From 558e3288e9500ecd6f410912aef2d726fbd1abb2 Mon Sep 17 00:00:00 2001
From: zichen1019 <1510748736@qq.com>
Date: Tue, 24 Aug 2021 18:40:52 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E6=97=A0=E6=B3=95=E6=9B=B4=E6=96=B0=E7=9A=84bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/user/user.vue | 144 +++++++++++++++++++++-------------------
1 file changed, 77 insertions(+), 67 deletions(-)
diff --git a/src/views/user/user.vue b/src/views/user/user.vue
index 2ff476f..d7e0ae1 100644
--- a/src/views/user/user.vue
+++ b/src/views/user/user.vue
@@ -29,7 +29,7 @@
v-if="hasPerm('user:add')"
type="primary"
icon="el-icon-edit"
- @click="showCreate"
+ @click="crud.toAdd"
>
添加
@@ -61,8 +61,8 @@
-
-
+
+
@@ -70,70 +70,70 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -295,7 +295,12 @@ export default {
},
fileList: [],
depts: [],
- roleIds: []
+ roleIds: [],
+ permission: {
+ add: ['user:add'],
+ edit: ['user:update'],
+ del: ['user:delete']
+ }
}
},
computed: {
@@ -316,6 +321,14 @@ export default {
console.log(this.crud, this.query, '啊哈哈哈')
},
methods: {
+ // 编辑框打开后做的操作
+ [CRUD.HOOK.beforeToAdd]() {
+ this.showCreate()
+ },
+ // 编辑框打开后做的操作
+ [CRUD.HOOK.beforeToEdit](crud, form) {
+ this.showUpdate(form)
+ },
getAllRoles() {
this.api({
url: '/role/all',
@@ -401,23 +414,18 @@ export default {
// 显示新增对话框
this.tempUser = {}
this.dialogStatus = 'create'
- this.dialogFormVisible = true
this.roleIds.length = 0
+ this.dialogFormVisible = true
},
- showUpdate($index) {
- const user = this.list[$index]
+ showUpdate(user) {
this.tempUser = user
this.roleIds.length = 0
- if (user.roleIds !== null && user.roleIds !== undefined) {
- if (user.roleIds.indexOf(',') !== -1) {
- user.roleIds
- .split(',')
- .forEach((roleId) => this.roleIds.push(Number(roleId)))
- }
+ if (user.roleIds) {
+ user.roleIds.split(',').forEach((roleId) => this.roleIds.push(Number(roleId)))
}
- if (user.signImg !== null && user.signImg !== '') {
+ if (user.signImg) {
this.tempUser.signImg = user.signImg
- this.fileList = JSON.parse(user.signImg)
+ this.fileList = [{ name: this.tempUser.signImg }]
if (this.fileList.length > 0) {
this.fileList[0].url =
process.env.VUE_APP_IMG_URL + 'signImage/' + this.fileList[0].name
@@ -425,6 +433,7 @@ export default {
} else {
this.fileList = []
}
+ console.log(this.fileList[0])
this.dialogStatus = 'update'
this.dialogFormVisible = true
},
@@ -484,6 +493,7 @@ export default {
_vue.getList()
}
})
+ this.crud.cancelCU()
})
} else {
return false