From fec7909e8552e98c60f3e14efc7d208e109dc4f8 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 26 Aug 2022 11:07:41 +0800
Subject: [PATCH] 增加秧苗
---
src/views/system/user.vue | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 106 insertions(+), 12 deletions(-)
diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index f056093..9dfd586 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: "用户平台",
@@ -347,6 +391,8 @@
label: "所属租户",
prop: "tenantId",
type: "tree",
+ value:"000000",
+ display:false,
dicUrl: "/api/blade-system/tenant/select",
props: {
label: "tenantName",
@@ -393,7 +439,7 @@
label: '密码',
prop: 'password',
hide: true,
- editDisplay: false,
+ display: false,
viewDisplay: false,
rules: [{required: true, validator: validatePass, trigger: 'blur'}]
},
@@ -401,7 +447,7 @@
label: '确认密码',
prop: 'password2',
hide: true,
- editDisplay: false,
+ display: false,
viewDisplay: false,
rules: [{required: true, validator: validatePass2, trigger: 'blur'}]
},
@@ -513,7 +559,7 @@
prop: "farmId",
labelWidth:110,
type: "tree",
- // multiple: true,
+ multiple: true,
dicData: [],
props: {
label: "farmName",
@@ -591,6 +637,7 @@
label: "所属租户",
prop: "tenantName",
slot: true,
+ hide:true,
display: false
},
{
@@ -746,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;
});
@@ -807,6 +851,45 @@
}, 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(",")
+ }
+ var passwordColumn = this.findObject(this.option.group,"password");
+ var password2Column = this.findObject(this.option.group,"password2")
+ passwordColumn.display = false;
+ password2Column.display = false;
+ 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) {
@@ -952,7 +1035,18 @@
})
},
beforeOpen(done, type) {
+ 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 = {}
+ 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")){
--
Gitblit v1.9.3