From fa877c0400ebfbc37622928df4c31b1b573f51d4 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 16 Aug 2022 09:34:42 +0800
Subject: [PATCH] 隐藏机构选择,添加功能:不能对超级管理员进行操作
---
src/views/system/user.vue | 101 ++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 89 insertions(+), 12 deletions(-)
diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index fd0bee0..b126312 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"
@@ -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>
@@ -214,6 +250,7 @@
roleBox: false,
excelBox: false,
platformBox: false,
+ dialogVisible:false,
initFlag: true,
selectionList: [],
query: {},
@@ -275,11 +312,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: "登录账号",
@@ -291,7 +333,8 @@
label: "所属租户",
prop: "tenantName",
slot: true,
- display: false
+ display: false,
+ hide:true
},
{
label: "用户姓名",
@@ -309,7 +352,8 @@
label: "所属部门",
prop: "deptName",
slot: true,
- display: false
+ display: false,
+ hide:true
},
// {
// label: "用户平台",
@@ -349,7 +393,6 @@
type: "tree",
value:"000000",
display:false,
- hide:true,
dicUrl: "/api/blade-system/tenant/select",
props: {
label: "tenantName",
@@ -396,7 +439,7 @@
label: '密码',
prop: 'password',
hide: true,
- editDisplay: false,
+ display: false,
viewDisplay: false,
rules: [{required: true, validator: validatePass, trigger: 'blur'}]
},
@@ -404,7 +447,7 @@
label: '确认密码',
prop: 'password2',
hide: true,
- editDisplay: false,
+ display: false,
viewDisplay: false,
rules: [{required: true, validator: validatePass2, trigger: 'blur'}]
},
@@ -594,6 +637,7 @@
label: "所属租户",
prop: "tenantName",
slot: true,
+ hide:true,
display: false
},
{
@@ -749,10 +793,7 @@
const column = this.findObject(this.option.group, "roleId");
column.dicData = res.data.data;
});
- const data = {
- deptId:this.userInfo.dept_id
- }
- getFarmList(data).then(res => {
+ getFarmList().then(res => {
const column = this.findObject(this.option.group, "farmId");
column.dicData = res.data.data;
});
@@ -810,6 +851,41 @@
}, error => {
window.console.log(error);
loading();
+ });
+ },
+ update(row){
+ 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(",")
+ }
+ this.dialogVisible = true
+ },
+ 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(",")
+ 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) {
@@ -959,6 +1035,7 @@
if(type == "add"&& column.dicData == ""){
this.initData(website.tenantId)
}
+ this.form = {}
if (["edit", "view"].includes(type)) {
getUser(this.form.id).then(res => {
this.form = res.data.data;
--
Gitblit v1.9.3