From 082613d446e29e4ec1c16bfaa52345106a498b23 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 08 Nov 2022 09:03:49 +0800
Subject: [PATCH] 农事操作隐藏后四个,地图模式2d改为3d
---
src/views/system/user.vue | 431 +++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 313 insertions(+), 118 deletions(-)
diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index 831b2df..1563cdb 100644
--- a/src/views/system/user.vue
+++ b/src/views/system/user.vue
@@ -1,6 +1,6 @@
<template>
<el-row>
- <el-col :span="5">
+ <!-- <el-col :span="5">
<div class="box">
<el-scrollbar>
<basic-container>
@@ -8,8 +8,8 @@
</basic-container>
</el-scrollbar>
</div>
- </el-col>
- <el-col :span="19">
+ </el-col> -->
+ <el-col :span="24">
<basic-container>
<avue-crud :option="option"
:search.sync="search"
@@ -30,6 +30,20 @@
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad">
+ <template slot-scope="{type,row,size}" slot="menu">
+ <el-button
+ :type="type"
+ :size="size"
+ icon="el-icon-edit"
+ :disabled="row.roleId == '1123598816738675201' "
+ @click="update(row)">编辑</el-button>
+ <el-button
+ :type="type"
+ :size="size"
+ icon="el-icon-delete"
+ :disabled="row.roleId == '1123598816738675201' "
+ @click="rowDel(row)">删除</el-button>
+ </template>
<template slot="menuLeft">
<el-button type="danger"
size="small"
@@ -38,13 +52,13 @@
v-if="permission.user_delete"
@click="handleDelete">删 除
</el-button>
- <el-button type="info"
- size="small"
- plain
- v-if="permission.user_role"
- icon="el-icon-user"
- @click="handleGrant">角色配置
- </el-button>
+<!-- <el-button type="info"-->
+<!-- size="small"-->
+<!-- plain-->
+<!-- v-if="permission.user_role"-->
+<!-- icon="el-icon-user"-->
+<!-- @click="handleGrant">角色配置-->
+<!-- </el-button>-->
<el-button type="info"
size="small"
plain
@@ -52,13 +66,13 @@
icon="el-icon-refresh"
@click="handleReset">密码重置
</el-button>
- <el-button type="info"
- size="small"
- plain
- v-if="userInfo.role_name.includes('admin')"
- icon="el-icon-setting"
- @click="handlePlatform">平台配置
- </el-button>
+<!-- <el-button type="info"-->
+<!-- size="small"-->
+<!-- plain-->
+<!-- v-if="userInfo.role_name.includes('admin')"-->
+<!-- icon="el-icon-setting"-->
+<!-- @click="handlePlatform">平台配置-->
+<!-- </el-button>-->
<el-button type="info"
size="small"
plain
@@ -66,20 +80,20 @@
icon="el-icon-coordinate"
@click="handleLock">账号解封
</el-button>
- <el-button type="success"
- size="small"
- plain
- v-if="userInfo.role_name.includes('admin')"
- icon="el-icon-upload2"
- @click="handleImport">导入
- </el-button>
- <el-button type="warning"
- size="small"
- plain
- v-if="userInfo.role_name.includes('admin')"
- icon="el-icon-download"
- @click="handleExport">导出
- </el-button>
+<!-- <el-button type="success"-->
+<!-- size="small"-->
+<!-- plain-->
+<!-- v-if="userInfo.role_name.includes('admin')"-->
+<!-- icon="el-icon-upload2"-->
+<!-- @click="handleImport">导入-->
+<!-- </el-button>-->
+<!-- <el-button type="warning"-->
+<!-- size="small"-->
+<!-- plain-->
+<!-- v-if="userInfo.role_name.includes('admin')"-->
+<!-- icon="el-icon-download"-->
+<!-- @click="handleExport">导出-->
+<!-- </el-button>-->
</template>
<template slot-scope="{row}"
slot="tenantName">
@@ -160,6 +174,28 @@
</template>
</avue-crud>
</el-dialog>
+ <el-drawer
+ title="编辑"
+ size="60%"
+ :visible.sync="dialogVisible"
+ width="width"
+ :modal="true"
+ :modal-append-to-body="false"
+ :append-to-body="true"
+ :close-on-click-modal="false"
+ :close-on-press-escape="false"
+ >
+ <div>
+ <avue-form
+ ref="form"
+ :option="option"
+ v-model="form"
+ @reset-change="emptytChange"
+ @submit="submitUpdate"
+ >
+ </avue-form>
+ </div>
+ </el-drawer>
</basic-container>
</el-col>
</el-row>
@@ -179,6 +215,7 @@
} from "@/api/system/user";
import {exportBlob} from "@/api/common";
import {getDeptTree, getDeptLazyTree} from "@/api/system/dept";
+ import {getFarmList} from "@/api/farm/farm";
import {getRoleTree} from "@/api/system/role";
import {getPostList} from "@/api/system/post";
import {mapGetters} from "vuex";
@@ -188,7 +225,6 @@
import {dateNow} from "@/util/date";
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
-
export default {
data() {
const validatePass = (rule, value, callback) => {
@@ -207,12 +243,36 @@
callback();
}
};
+ const validatePhone = (rule, value, callback) => {
+ if (value){
+ if (!/^[1]([3-9])[0-9]{9}$/.test(value)) {
+ callback(new Error("请输入正确的手机号格式"));
+ } else {
+ callback();
+ }
+ }else {
+ callback();
+ }
+ };
+ const validateEmail = (rule, value, callback) => {
+ const mal = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
+ if (value){
+ if (!(mal.test(value))) {
+ callback(new Error('请输入正确邮箱'))
+ } else {
+ callback()
+ }
+ }else {
+ callback()
+ }
+ };
return {
form: {},
search:{},
roleBox: false,
excelBox: false,
platformBox: false,
+ dialogVisible:false,
initFlag: true,
selectionList: [],
query: {},
@@ -274,8 +334,16 @@
index: true,
selection: true,
viewBtn: true,
+ delBtn:false,
+ editBtn:false,
dialogType: 'drawer',
dialogClickModal: false,
+ refreshBtn:false,
+ columnBtn:false,
+ searchShowBtn:false,
+ selectable:(row,index)=>{
+ return row.roleId != "1123598816738675201";
+ },
column: [
{
label: "登录账号",
@@ -287,7 +355,8 @@
label: "所属租户",
prop: "tenantName",
slot: true,
- display: false
+ display: false,
+ hide:true
},
{
label: "用户姓名",
@@ -302,36 +371,50 @@
display: false
},
{
+ display: false,
+ label: "账号状态",
+ prop: "bannedState",
+ slot: true,
+ dicData: [{
+ label: '已封禁',
+ value: "1"
+ }, {
+ label: '正常',
+ value: "0"
+ }],
+ },
+ {
label: "所属部门",
prop: "deptName",
slot: true,
- display: false
- },
- {
- label: "用户平台",
- prop: "userTypeName",
- slot: true,
- display: false
- },
- {
- label: "用户平台",
- type: "select",
- dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- dataType: "number",
- search: true,
- hide: true,
display: false,
- prop: "userType",
- rules: [{
- required: true,
- message: "请选择用户平台",
- trigger: "blur"
- }]
+ hide:true
},
+ // {
+ // label: "用户平台",
+ // prop: "userTypeName",
+ // slot: true,
+ // display: false
+ // },
+ // {
+ // label: "用户平台",
+ // type: "select",
+ // dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
+ // props: {
+ // label: "dictValue",
+ // value: "dictKey"
+ // },
+ // dataType: "number",
+ // search: true,
+ // hide: true,
+ // display: false,
+ // prop: "userType",
+ // rules: [{
+ // required: true,
+ // message: "请选择用户平台",
+ // trigger: "blur"
+ // }]
+ // },
],
group: [
{
@@ -343,6 +426,8 @@
label: "所属租户",
prop: "tenantId",
type: "tree",
+ value:"000000",
+ display:false,
dicUrl: "/api/blade-system/tenant/select",
props: {
label: "tenantName",
@@ -366,38 +451,47 @@
required: true,
message: "请输入登录账号",
trigger: "blur"
+ },{
+ min: 2,
+ max: 40,
+ message: '账号长度在2到40个字符'
}],
},
- {
- label: "用户平台",
- type: "select",
- dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- dataType: "number",
- slot: true,
- prop: "userType",
- rules: [{
- required: true,
- message: "请选择用户平台",
- trigger: "blur"
- }]
- },
+ // {
+ // label: "用户平台",
+ // type: "select",
+ // dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
+ // props: {
+ // label: "dictValue",
+ // value: "dictKey"
+ // },
+ // dataType: "number",
+ // slot: true,
+ // prop: "userType",
+ // rules: [{
+ // required: true,
+ // message: "请选择用户平台",
+ // trigger: "blur"
+ // }]
+ // },
{
label: '密码',
prop: 'password',
hide: true,
- editDisplay: false,
+ display: false,
viewDisplay: false,
- rules: [{required: true, validator: validatePass, trigger: 'blur'}]
+ rules: [{required: true, validator: validatePass, trigger: 'blur'},
+ {
+ min: 2,
+ max: 40,
+ message: '密码长度在2到40个字符'
+ }]
},
{
label: '确认密码',
prop: 'password2',
hide: true,
- editDisplay: false,
+ display: false,
viewDisplay: false,
rules: [{required: true, validator: validatePass2, trigger: 'blur'}]
},
@@ -416,6 +510,10 @@
required: true,
message: "请输入用户昵称",
trigger: "blur"
+ },{
+ min: 2,
+ max: 10,
+ message: '昵称长度在2到10个字符'
}]
},
{
@@ -434,13 +532,15 @@
{
label: "手机号码",
prop: "phone",
- overHidden: true
+ overHidden: true,
+ rules: [{required: false, validator: validatePhone, trigger: 'blur'}]
},
{
label: "电子邮箱",
prop: "email",
hide: true,
- overHidden: true
+ overHidden: true,
+ rules: [{required: false, validator: validateEmail, trigger: 'blur'}]
},
{
label: "用户性别",
@@ -483,10 +583,10 @@
prop: 'dutyInfo',
icon: 'el-icon-s-custom',
column: [
- {
- label: "用户编号",
- prop: "code",
- },
+ // {
+ // label: "用户编号",
+ // prop: "code",
+ // },
{
label: "所属角色",
prop: "roleId",
@@ -505,38 +605,57 @@
}]
},
{
- label: "所属部门",
- prop: "deptId",
+ label: "负责的农场",
+ prop: "farmId",
+ labelWidth:110,
type: "tree",
multiple: true,
dicData: [],
props: {
- label: "title"
+ label: "farmName",
+ value:"id"
},
checkStrictly: true,
slot: true,
rules: [{
required: true,
- message: "请选择所属部门",
+ message: "请选择负责的农场",
trigger: "click"
}]
},
- {
- label: "所属岗位",
- prop: "postId",
- type: "tree",
- multiple: true,
- dicData: [],
- props: {
- label: "postName",
- value: "id"
- },
- rules: [{
- required: true,
- message: "请选择所属岗位",
- trigger: "click"
- }],
- },
+ // {
+ // label: "所属部门",
+ // prop: "deptId",
+ // type: "tree",
+ // multiple: true,
+ // dicData: [],
+ // props: {
+ // label: "title"
+ // },
+ // checkStrictly: true,
+ // slot: true,
+ // rules: [{
+ // required: true,
+ // message: "请选择所属部门",
+ // trigger: "click"
+ // }]
+ // },
+ // {
+ // label: "所属岗位",
+ // prop: "postId",
+ // type: "tree",
+ // multiple: true,
+ // dicData: [],
+ // props: {
+ // label: "postName",
+ // value: "id"
+ // },
+ // rules: [{
+ // required: true,
+ // message: "请选择所属岗位",
+ // trigger: "click"
+ // }],
+ // },
]
},
]
@@ -568,6 +687,7 @@
label: "所属租户",
prop: "tenantName",
slot: true,
+ hide:true,
display: false
},
{
@@ -723,14 +843,18 @@
const column = this.findObject(this.option.group, "roleId");
column.dicData = res.data.data;
});
- getDeptTree(tenantId).then(res => {
- const column = this.findObject(this.option.group, "deptId");
+ getFarmList().then(res => {
+ const column = this.findObject(this.option.group, "farmId");
column.dicData = res.data.data;
});
- getPostList(tenantId).then(res => {
- const column = this.findObject(this.option.group, "postId");
- column.dicData = res.data.data;
- });
+ // getDeptTree(tenantId).then(res => {
+ // const column = this.findObject(this.option.group, "deptId");
+ // column.dicData = res.data.data;
+ // });
+ // getPostList(tenantId).then(res => {
+ // const column = this.findObject(this.option.group, "postId");
+ // column.dicData = res.data.data;
+ // });
},
submitRole() {
const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
@@ -744,9 +868,13 @@
});
},
rowSave(row, done, loading) {
- row.deptId = row.deptId.join(",");
+ row['deptId'] = this.userInfo.dept_id;
row.roleId = row.roleId.join(",");
- row.postId = row.postId.join(",");
+ row.farmId = row.farmId.join(",");
+ row.id = null
+ if (!row.sex){
+ row.sex = 3
+ }
add(row).then(() => {
this.initFlag = false;
this.onLoad(this.page);
@@ -761,9 +889,10 @@
});
},
rowUpdate(row, index, done, loading) {
- row.deptId = row.deptId.join(",");
+ debugger;
+ row['deptId'] = this.userInfo.dept_id;
row.roleId = row.roleId.join(",");
- row.postId = row.postId.join(",");
+ row.farmId = row.farmId.join(",");
update(row).then(() => {
this.initFlag = false;
this.onLoad(this.page);
@@ -775,6 +904,51 @@
}, error => {
window.console.log(error);
loading();
+ });
+ },
+ update(row){
+ this.dialogVisible = true
+ this.$nextTick(()=>{
+ this.$refs.form.clearValidate()
+ })
+ this.form = {
+ id:row.id,
+ account:row.account,
+ name:row.name,
+ realName:row.realName,
+ phone:row.phone,
+ email:row.email,
+ sex:row.sex,
+ birthday:row.birthday,
+ roleId:row.roleId.split(','),
+ farmId : row.farmId.split(",")
+ }
+ var passwordColumn = this.findObject(this.option.group,"password");
+ var password2Column = this.findObject(this.option.group,"password2")
+ passwordColumn.display = false;
+ password2Column.display = false;
+ },
+ submitUpdate(row, done, loading){
+ this.form['deptId'] = this.userInfo.dept_id;
+ this.form.roleId = this.form.roleId.join(",")
+ this.form.farmId = this.form.farmId.join(",")
+ if (!row.sex){
+ row.sex = 3
+ }
+ update(this.form).then(() => {
+ this.initFlag = false;
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ this.dialogVisible = false
+ done();
+
+ }, error => {
+ window.console.log(error);
+ loading();
+ done();
});
},
rowDel(row) {
@@ -890,6 +1064,7 @@
type: "success",
message: "操作成功!"
});
+ this.onLoad(this.page)
});
},
handleImport() {
@@ -920,21 +1095,41 @@
})
},
beforeOpen(done, type) {
+ this.initFlag = true;
+ const column = this.findObject(this.option.group, "farmId");
+ var passwordColumn = this.findObject(this.option.group,"password");
+ var password2Column = this.findObject(this.option.group,"password2")
+ passwordColumn.display = true;
+ password2Column.display = true;
+ if(type == "add"&& column.dicData == ""){
+ this.form = {id:null}
+ this.initData(website.tenantId)
+ }
if (["edit", "view"].includes(type)) {
+ passwordColumn.display = false;
+ password2Column.display = false;
getUser(this.form.id).then(res => {
this.form = res.data.data;
if(this.form.hasOwnProperty("deptId")){
this.form.deptId = this.form.deptId.split(",");
}
+ if(this.form.hasOwnProperty("farmId")){
+ this.form.farmId = this.form.farmId.split(",");
+ }
if(this.form.hasOwnProperty("roleId")){
this.form.roleId = this.form.roleId.split(",");
}
- if(this.form.hasOwnProperty("postId")){
- this.form.postId = this.form.postId.split(",");
- }
+ // if(this.form.hasOwnProperty("postId")){
+ // this.form.postId = this.form.postId.split(",");
+ // }
});
}
- this.initFlag = true;
+ if (type == "add"){
+ if (this.$refs.form){
+ this.$refs.form.resetForm()
+ }
+ this.form = {id :null }
+ }
done();
},
currentChange(currentPage) {
--
Gitblit v1.9.3