角色管理人员勾选回显问腿处理
Showing
7 changed files
with
165 additions
and
167 deletions
... | @@ -142,8 +142,8 @@ | ... | @@ -142,8 +142,8 @@ |
142 | padding: 24px 120px 0px; | 142 | padding: 24px 120px 0px; |
143 | .el-form-item { | 143 | .el-form-item { |
144 | margin-bottom: 24px; | 144 | margin-bottom: 24px; |
145 | .el-form-item__label { | 145 | /deep/.el-form-item__label { |
146 | color: #747e8c; | 146 | color: #ffffff; |
147 | } | 147 | } |
148 | ::v-deep .el-input .el-input__inner { | 148 | ::v-deep .el-input .el-input__inner { |
149 | padding: 0 8px; | 149 | padding: 0 8px; | ... | ... |
... | @@ -110,10 +110,10 @@ | ... | @@ -110,10 +110,10 @@ |
110 | overflow-y: auto; | 110 | overflow-y: auto; |
111 | .form-wrapper { | 111 | .form-wrapper { |
112 | padding: 24px 120px 0px; | 112 | padding: 24px 120px 0px; |
113 | .el-form-item { | 113 | /deep/.el-form-item { |
114 | margin-bottom: 24px; | 114 | margin-bottom: 24px; |
115 | .el-form-item__label { | 115 | .el-form-item__label { |
116 | color: #747e8c; | 116 | color: #ffffff; |
117 | } | 117 | } |
118 | ::v-deep .el-input .el-input__inner { | 118 | ::v-deep .el-input .el-input__inner { |
119 | padding: 0 8px; | 119 | padding: 0 8px; | ... | ... |
... | @@ -30,8 +30,8 @@ | ... | @@ -30,8 +30,8 @@ |
30 | 30 | ||
31 | </el-row> | 31 | </el-row> |
32 | <el-row :gutter="24"> | 32 | <el-row :gutter="24"> |
33 | <el-col :span="12"> | 33 | <el-col :span="24"> |
34 | <el-form-item label="代码:" prop="code" label-width="54px"> | 34 | <el-form-item label="代码:" prop="code" label-width="124px"> |
35 | <el-input | 35 | <el-input |
36 | v-model="codeComputed" | 36 | v-model="codeComputed" |
37 | placeholder="请输入菜单代码" | 37 | placeholder="请输入菜单代码" | ... | ... |
src/views/system/roles/data/roles.js
deleted
100644 → 0
1 | import filter from '@/utils/filter.js' | ||
2 | class data extends filter { | ||
3 | constructor() { | ||
4 | super() | ||
5 | } | ||
6 | columns () { | ||
7 | return [ | ||
8 | { | ||
9 | prop: "name", | ||
10 | label: "角色名称", | ||
11 | width: 330 | ||
12 | }, | ||
13 | { | ||
14 | prop: "type", | ||
15 | label: "类别", | ||
16 | width: 400 | ||
17 | }, | ||
18 | { | ||
19 | prop: "address", | ||
20 | label: "备注" | ||
21 | } | ||
22 | ] | ||
23 | } | ||
24 | } | ||
25 | export default new data() |
... | @@ -4,8 +4,7 @@ | ... | @@ -4,8 +4,7 @@ |
4 | :title="dialogTitle" | 4 | :title="dialogTitle" |
5 | :show.sync="showAddEditDialog" | 5 | :show.sync="showAddEditDialog" |
6 | :width="'767px'" | 6 | :width="'767px'" |
7 | @close="handleCloseDialog()" | 7 | @close="handleCloseDialog()"> |
8 | > | ||
9 | <template slot="content"> | 8 | <template slot="content"> |
10 | <el-form ref="form" :model="dialogForm" :rules="rules" label-width="82px"> | 9 | <el-form ref="form" :model="dialogForm" :rules="rules" label-width="82px"> |
11 | <el-row :gutter="24"> | 10 | <el-row :gutter="24"> |
... | @@ -14,8 +13,7 @@ | ... | @@ -14,8 +13,7 @@ |
14 | <el-input | 13 | <el-input |
15 | v-model="dialogForm.roleName" | 14 | v-model="dialogForm.roleName" |
16 | clearable | 15 | clearable |
17 | placeholder="角色名称" | 16 | placeholder="角色名称" /> |
18 | /> | ||
19 | </el-form-item> | 17 | </el-form-item> |
20 | </el-col> | 18 | </el-col> |
21 | <el-col :span="12"> | 19 | <el-col :span="12"> |
... | @@ -23,8 +21,7 @@ | ... | @@ -23,8 +21,7 @@ |
23 | <el-input | 21 | <el-input |
24 | v-model="dialogForm.roleType" | 22 | v-model="dialogForm.roleType" |
25 | clearable | 23 | clearable |
26 | placeholder="角色类型" | 24 | placeholder="角色类型" /> |
27 | /> | ||
28 | </el-form-item> | 25 | </el-form-item> |
29 | </el-col> | 26 | </el-col> |
30 | </el-row> | 27 | </el-row> |
... | @@ -35,8 +32,7 @@ | ... | @@ -35,8 +32,7 @@ |
35 | <el-input | 32 | <el-input |
36 | v-model="dialogForm.roleTextArea" | 33 | v-model="dialogForm.roleTextArea" |
37 | type="textarea" | 34 | type="textarea" |
38 | placeholder="备注" | 35 | placeholder="备注" /> |
39 | /> | ||
40 | </el-form-item> | 36 | </el-form-item> |
41 | </el-col> | 37 | </el-col> |
42 | </el-row> | 38 | </el-row> |
... | @@ -45,72 +41,89 @@ | ... | @@ -45,72 +41,89 @@ |
45 | <template slot="footer"> | 41 | <template slot="footer"> |
46 | <el-button | 42 | <el-button |
47 | class="cancel-button" | 43 | class="cancel-button" |
48 | @click="handleCloseDialog" | 44 | @click="handleCloseDialog">取消</el-button> |
49 | >取消</el-button> | ||
50 | 45 | ||
51 | <el-button | 46 | <el-button |
52 | type="primary" | 47 | type="primary" |
53 | @click="handleSaveRole()" | 48 | @click="handleSaveRole()">保存</el-button> |
54 | >保存</el-button> | ||
55 | </template> | 49 | </template> |
56 | </Dialog> | 50 | </Dialog> |
57 | </template> | 51 | </template> |
58 | 52 | ||
59 | <script> | 53 | <script> |
60 | import Dialog from "@/components/Dialog/"; | 54 | import Dialog from "@/components/Dialog/"; |
61 | import { api, httpAction } from '@/api/manageApi' | 55 | import { api, httpAction } from '@/api/manageApi' |
62 | export default { | 56 | export default { |
63 | components: { | 57 | components: { |
64 | Dialog | 58 | Dialog |
65 | }, | 59 | }, |
66 | data() { | 60 | data () { |
67 | return { | 61 | return { |
68 | dialogTitle: '', | 62 | dialogTitle: '', |
69 | showAddEditDialog: false, | 63 | showAddEditDialog: false, |
70 | menuType: '', | 64 | menuType: '', |
71 | roleId: '', | 65 | roleId: '', |
72 | sort: 0, | 66 | sort: 0, |
73 | dialogForm: { | 67 | dialogForm: { |
74 | roleName: '', | 68 | roleName: '', |
75 | roleType: '', | 69 | roleType: '', |
76 | roleTextArea: '' | 70 | roleTextArea: '' |
77 | }, | 71 | }, |
78 | rules: { | 72 | rules: { |
79 | roleName: [ | 73 | roleName: [ |
80 | { required: true, message: '请输入角色名称', trigger: 'blur' } | 74 | { required: true, message: '请输入角色名称', trigger: 'blur' } |
81 | ], | 75 | ], |
82 | roleType: [ | 76 | roleType: [ |
83 | { required: true, message: '请输入角色类型', trigger: 'blur' } | 77 | { required: true, message: '请输入角色类型', trigger: 'blur' } |
78 | ] | ||
79 | }, | ||
80 | roleTypeOptions: [ | ||
81 | { name: '定制', value: '定制' }, | ||
82 | { name: '其他', value: '其他' } | ||
84 | ] | 83 | ] |
85 | }, | 84 | } |
86 | roleTypeOptions: [ | 85 | }, |
87 | { name: '定制', value: '定制' }, | 86 | methods: { |
88 | { name: '其他', value: '其他' } | 87 | // 保存新增或关闭事件 |
89 | ] | 88 | handleSaveRole (val) { |
90 | } | 89 | this.$refs.form.validate((valid) => { |
91 | }, | 90 | if (valid) { |
92 | methods: { | 91 | try { |
93 | // 保存新增或关闭事件 | 92 | const params = { |
94 | handleSaveRole(val) { | 93 | category: 2, |
95 | this.$refs.form.validate((valid) => { | 94 | description: this.dialogForm.roleTextArea, |
96 | if (valid) { | 95 | name: this.dialogForm.roleName, |
97 | try { | 96 | sort: this.sort, |
98 | const params = { | 97 | type: this.dialogForm.roleType |
99 | category: 2, | 98 | } |
100 | description: this.dialogForm.roleTextArea, | 99 | if (this.roleId) { |
101 | name: this.dialogForm.roleName, | 100 | params.id = this.roleId |
102 | sort: this.sort, | 101 | httpAction(`${api.roles}/${params.id}`, params, 'post').then( |
103 | type: this.dialogForm.roleType | 102 | (res) => { |
104 | } | 103 | if (res.status === 1) { |
105 | console.log("this.roleId",this.roleId); | 104 | this.$message.success({ |
106 | if (this.roleId) { | 105 | message: '修改成功', |
107 | params.id = this.roleId | 106 | showClose: true |
108 | console.log("修改",params.id,params); | 107 | }) |
109 | httpAction(`${api.roles}/${params.id}`, params, 'post').then( | 108 | this.dialogForm = { |
110 | (res) => { | 109 | roleName: '', |
110 | roleType: '' | ||
111 | } | ||
112 | this.showAddEditDialog = val | ||
113 | this.$emit('ok', this.menuType) | ||
114 | } else { | ||
115 | this.$message.error({ | ||
116 | message: res.message, | ||
117 | showClose: true | ||
118 | }) | ||
119 | } | ||
120 | } | ||
121 | ) | ||
122 | } else { | ||
123 | httpAction(api.roles, params, 'post').then((res) => { | ||
111 | if (res.status === 1) { | 124 | if (res.status === 1) { |
112 | this.$message.success({ | 125 | this.$message.success({ |
113 | message: '修改成功', | 126 | message: '新增成功', |
114 | showClose: true | 127 | showClose: true |
115 | }) | 128 | }) |
116 | this.dialogForm = { | 129 | this.dialogForm = { |
... | @@ -125,58 +138,42 @@ export default { | ... | @@ -125,58 +138,42 @@ export default { |
125 | showClose: true | 138 | showClose: true |
126 | }) | 139 | }) |
127 | } | 140 | } |
128 | } | 141 | }) |
129 | ) | 142 | } |
130 | } else { | 143 | } catch (e) { |
131 | httpAction(api.roles, params, 'post').then((res) => { | 144 | console.error(e) |
132 | if (res.status === 1) { | ||
133 | this.$message.success({ | ||
134 | message: '新增成功', | ||
135 | showClose: true | ||
136 | }) | ||
137 | this.dialogForm = { | ||
138 | roleName: '', | ||
139 | roleType: '' | ||
140 | } | ||
141 | this.showAddEditDialog = val | ||
142 | this.$emit('ok', this.menuType) | ||
143 | } else { | ||
144 | this.$message.error({ | ||
145 | message: res.message, | ||
146 | showClose: true | ||
147 | }) | ||
148 | } | ||
149 | }) | ||
150 | } | 145 | } |
151 | } catch (e) { | ||
152 | console.error(e) | ||
153 | } | 146 | } |
147 | }) | ||
148 | }, | ||
149 | // 取消事件 | ||
150 | handleCloseDialog () { | ||
151 | this.$refs.form.resetFields() | ||
152 | this.dialogForm = { | ||
153 | roleName: '', | ||
154 | roleType: '' | ||
154 | } | 155 | } |
155 | }) | 156 | this.showAddEditDialog = false |
156 | }, | ||
157 | // 取消事件 | ||
158 | handleCloseDialog() { | ||
159 | this.$refs.form.resetFields() | ||
160 | this.dialogForm = { | ||
161 | roleName: '', | ||
162 | roleType: '' | ||
163 | } | 157 | } |
164 | this.showAddEditDialog = false | ||
165 | } | 158 | } |
166 | } | 159 | } |
167 | } | ||
168 | </script> | 160 | </script> |
169 | <style scoped lang="scss"> | 161 | <style scoped lang="scss"> |
170 | /deep/.el-input__inner { | 162 | /deep/.el-input__inner { |
171 | background: #07388B; | 163 | background: #07388b; |
172 | border-radius: 2px; | 164 | border-radius: 2px; |
173 | border: 1px solid #6BC1FC; | 165 | border: 1px solid #6bc1fc; |
174 | } | 166 | } |
175 | /deep/.el-textarea__inner{ | 167 | /deep/.el-textarea__inner { |
176 | background: #07388B; | 168 | background: #07388b; |
177 | color: #fff; | 169 | color: #fff; |
178 | } | 170 | } |
179 | /deep/.el-form-item__label{ | 171 | /deep/.el-form-item__label { |
180 | color:#fff; | 172 | color: #fff; |
181 | } | 173 | } |
174 | /deep/.el-dialog__headerbtn { | ||
175 | position: absolute; | ||
176 | top: 15px; | ||
177 | right: 30px; | ||
178 | } | ||
182 | </style> | 179 | </style> | ... | ... |
... | @@ -22,7 +22,7 @@ | ... | @@ -22,7 +22,7 @@ |
22 | :column="tableData.columns" | 22 | :column="tableData.columns" |
23 | :data="listdata" | 23 | :data="listdata" |
24 | :expand-row-keys="keyList" | 24 | :expand-row-keys="keyList" |
25 | row-key="id"> | 25 | row-key="dictid"> |
26 | </lb-table> | 26 | </lb-table> |
27 | </div> | 27 | </div> |
28 | <EditDialog ref="addEditDialog" @ok="reloadTableData" /> | 28 | <EditDialog ref="addEditDialog" @ok="reloadTableData" /> |
... | @@ -376,8 +376,6 @@ | ... | @@ -376,8 +376,6 @@ |
376 | } | 376 | } |
377 | 377 | ||
378 | this.$refs.rolesForm.personlist(this.waitMemberList, row.id); | 378 | this.$refs.rolesForm.personlist(this.waitMemberList, row.id); |
379 | // this.$refs.rolesForm.getMenuData(); | ||
380 | |||
381 | this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes); | 379 | this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes); |
382 | } else { | 380 | } else { |
383 | this.$message.error({ message: res.message, showClose: true }); | 381 | this.$message.error({ message: res.message, showClose: true }); |
... | @@ -402,15 +400,15 @@ | ... | @@ -402,15 +400,15 @@ |
402 | }, | 400 | }, |
403 | // 上移下移 | 401 | // 上移下移 |
404 | moveUpward (index, row) { | 402 | moveUpward (index, row) { |
405 | realMove(row.id, "UP", this.listdata); | 403 | realMove(row.dictid, "UP", this.listdata); |
406 | this.key++; | 404 | this.key++; |
407 | let id = findParents(this.listdata, row.id); | 405 | let id = findParents(this.listdata, row.dictid); |
408 | this.keyList = id; | 406 | this.keyList = id; |
409 | }, | 407 | }, |
410 | moveDown (index, row) { | 408 | moveDown (index, row) { |
411 | realMove(row.id, "DOWN", this.listdata); | 409 | realMove(row.dictid, "DOWN", this.listdata); |
412 | this.key++; | 410 | this.key++; |
413 | let id = findParents(this.listdata, row.id); | 411 | let id = findParents(this.listdata, row.dictid); |
414 | this.keyList = id; | 412 | this.keyList = id; |
415 | }, | 413 | }, |
416 | 414 | ... | ... |
... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
10 | {{ title || "标题" }} | 10 | {{ title || "标题" }} |
11 | </div> | 11 | </div> |
12 | <div class="editDialogBox-box"> | 12 | <div class="editDialogBox-box"> |
13 | <el-tabs v-model="activeName" type="card"> | 13 | <el-tabs v-model="activeName" type="card" @tab-click="handleClick"> |
14 | <el-tab-pane label="人员配置" name="first"></el-tab-pane> | 14 | <el-tab-pane label="人员配置" name="first"></el-tab-pane> |
15 | <el-tab-pane label="菜单配置" name="second"></el-tab-pane> | 15 | <el-tab-pane label="菜单配置" name="second"></el-tab-pane> |
16 | </el-tabs> | 16 | </el-tabs> |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | ref="multipleTable" | 19 | ref="multipleTable" |
20 | :pagination="false" | 20 | :pagination="false" |
21 | :column="usertableData.column" | 21 | :column="usertableData.column" |
22 | :data="usertableData.data" | 22 | :data="lastuserList" |
23 | @selection-change="handleSelectionChange" | 23 | @selection-change="handleSelectionChange" |
24 | @row-click="handleClickTableRow"> | 24 | @row-click="handleClickTableRow"> |
25 | > | 25 | > |
... | @@ -27,7 +27,6 @@ | ... | @@ -27,7 +27,6 @@ |
27 | <lb-table | 27 | <lb-table |
28 | :key="menukey" | 28 | :key="menukey" |
29 | v-if="activeName == 'second'" | 29 | v-if="activeName == 'second'" |
30 | ref="multipleTable1" | ||
31 | :pagination="false" | 30 | :pagination="false" |
32 | :column="menutableData.column" | 31 | :column="menutableData.column" |
33 | :data="lastMenuList" | 32 | :data="lastMenuList" |
... | @@ -99,7 +98,6 @@ | ... | @@ -99,7 +98,6 @@ |
99 | label: "用户名", | 98 | label: "用户名", |
100 | }, | 99 | }, |
101 | ], | 100 | ], |
102 | data: [] | ||
103 | }, | 101 | }, |
104 | // 角色id | 102 | // 角色id |
105 | roleId: "", | 103 | roleId: "", |
... | @@ -107,6 +105,7 @@ | ... | @@ -107,6 +105,7 @@ |
107 | queryParam: {}, | 105 | queryParam: {}, |
108 | menukey: 0, | 106 | menukey: 0, |
109 | activeName: "first", | 107 | activeName: "first", |
108 | lastuserList: [], // 人员表格数据 | ||
110 | lastMenuList: [], // 重构完成的菜单表格数据 | 109 | lastMenuList: [], // 重构完成的菜单表格数据 |
111 | usermultipleSelection: [], | 110 | usermultipleSelection: [], |
112 | // 选中菜单列表 | 111 | // 选中菜单列表 |
... | @@ -132,8 +131,8 @@ | ... | @@ -132,8 +131,8 @@ |
132 | 131 | ||
133 | // 人员配置点击行勾选数据 | 132 | // 人员配置点击行勾选数据 |
134 | handleClickTableRow (row, event) { | 133 | handleClickTableRow (row, event) { |
135 | this.checkNum1 = 0; | 134 | this.checkNum = 0; |
136 | this.isCheck1 = false; | 135 | this.isCheck = false; |
137 | if (event.label == "操作") { | 136 | if (event.label == "操作") { |
138 | return; | 137 | return; |
139 | } else { | 138 | } else { |
... | @@ -163,10 +162,10 @@ | ... | @@ -163,10 +162,10 @@ |
163 | } | 162 | } |
164 | } | 163 | } |
165 | if (this.usermultipleSelection.length > 0) { | 164 | if (this.usermultipleSelection.length > 0) { |
166 | this.checkNum1 = this.usermultipleSelection.length; | 165 | this.checkNum = this.usermultipleSelection.length; |
167 | this.isCheck1 = true; | 166 | this.isCheck = true; |
168 | } else { | 167 | } else { |
169 | this.isCheck1 = false; | 168 | this.isCheck = false; |
170 | } | 169 | } |
171 | }, | 170 | }, |
172 | // 获取授权主体的菜单权限 | 171 | // 获取授权主体的菜单权限 |
... | @@ -304,19 +303,21 @@ | ... | @@ -304,19 +303,21 @@ |
304 | personlist (a, rid) { | 303 | personlist (a, rid) { |
305 | this.roleId = rid; | 304 | this.roleId = rid; |
306 | this.visible = true; | 305 | this.visible = true; |
307 | 306 | this.lastuserList = a; | |
308 | this.usertableData.data = a; | 307 | this.lastuserList.forEach((item, index) => { |
309 | this.usertableData.data.forEach((item, index) => { | ||
310 | if (item.selectStatus === 0) { | 308 | if (item.selectStatus === 0) { |
311 | this.$nextTick(() => { | 309 | this.$nextTick(async () => { |
312 | this.$refs.multipleTable.toggleRowSelection( | 310 | await this.$refs.multipleTable |
313 | this.usertableData.data[index], | 311 | if (this.$refs.multipleTable) { |
314 | true | 312 | this.$refs.multipleTable.toggleRowSelection( |
315 | ); | 313 | this.lastuserList[index], |
314 | true | ||
315 | ); | ||
316 | } | ||
317 | |||
316 | }); | 318 | }); |
317 | } | 319 | } |
318 | }); | 320 | }); |
319 | |||
320 | }, | 321 | }, |
321 | // 关闭事件 | 322 | // 关闭事件 |
322 | close () { | 323 | close () { |
... | @@ -351,7 +352,17 @@ | ... | @@ -351,7 +352,17 @@ |
351 | }, | 352 | }, |
352 | // 勾选人员事件 | 353 | // 勾选人员事件 |
353 | handleSelectionChange (val) { | 354 | handleSelectionChange (val) { |
355 | this.lastuserList.forEach((element, index) => { | ||
356 | delete this.lastuserList[index].selectStatus | ||
357 | }); | ||
354 | this.usermultipleSelection = val; | 358 | this.usermultipleSelection = val; |
359 | this.lastuserList.forEach((element, index) => { | ||
360 | this.usermultipleSelection.forEach(element1 => { | ||
361 | if (element.id == element1.id) { | ||
362 | this.lastuserList[index].selectStatus = 0 | ||
363 | } | ||
364 | }); | ||
365 | }); | ||
355 | }, | 366 | }, |
356 | // 数据筛选 | 367 | // 数据筛选 |
357 | setarrdata (scope, arr) { | 368 | setarrdata (scope, arr) { |
... | @@ -383,6 +394,23 @@ | ... | @@ -383,6 +394,23 @@ |
383 | ) | 394 | ) |
384 | this.getAuthorizedInfo() | 395 | this.getAuthorizedInfo() |
385 | }, | 396 | }, |
397 | handleClick (tab, event) { | ||
398 | this.lastuserList.forEach((item, index) => { | ||
399 | if (item.selectStatus === 0) { | ||
400 | this.$nextTick(async () => { | ||
401 | await this.$refs.multipleTable | ||
402 | if (this.$refs.multipleTable) { | ||
403 | this.$refs.multipleTable.toggleRowSelection( | ||
404 | this.lastuserList[index], | ||
405 | true | ||
406 | ); | ||
407 | } | ||
408 | |||
409 | }); | ||
410 | } | ||
411 | }); | ||
412 | } | ||
413 | |||
386 | }, | 414 | }, |
387 | }; | 415 | }; |
388 | </script> | 416 | </script> | ... | ... |
-
Please register or sign in to post a comment