bdde9e93 by 任超
2 parents 019ca4a5 692e8fc1
...@@ -16,7 +16,7 @@ export const getRolesById = categoryId => { ...@@ -16,7 +16,7 @@ export const getRolesById = categoryId => {
16 conditions: [ 16 conditions: [
17 { 17 {
18 property: 'category', 18 property: 'category',
19 value:categoryId, 19 value: categoryId,
20 operator: 'EQ' 20 operator: 'EQ'
21 } 21 }
22 ], 22 ],
...@@ -81,3 +81,43 @@ export const getParentMenuListAction = (id) => { ...@@ -81,3 +81,43 @@ export const getParentMenuListAction = (id) => {
81 const params = getParams(conditionGroup) 81 const params = getParams(conditionGroup)
82 return getAction(api.menus, params) 82 return getAction(api.menus, params)
83 } 83 }
84 // 获取权限列表
85 export const getAuthorityListAction = (productId, subsystemCode) => {
86 const conditionGroup = {
87 conditions: [
88 {
89 property: 'productId',
90 value: productId,
91 operator: 'EQ'
92 },
93 {
94 property: 'code',
95 value: subsystemCode + '_MENU',
96 operator: 'EQ'
97 }
98 ],
99 queryRelation: 'AND'
100 }
101 const params = getParams(conditionGroup)
102 return getAction(api.resourceCategory, params)
103 }
104 /**
105 * 获取角色的权限 id operationCodes resourceCategoryCode
106 * id 授权id
107 * operationCodes 操作符集合
108 * resourceCategoryCode 菜单默认MENU
109 */
110 export const getRoleAuthorityList = (
111 id,
112 operationCodes,
113 resourceCategoryCode
114 ) => {
115 return getAction(`${api.rolePermissions}/${id}`, {
116 operationCodes: operationCodes,
117 resourceCategoryCode: resourceCategoryCode
118 })
119 }
120 // 角色授权
121 export const roleAuthority = (id, permissionDtos) => {
122 return putAction(`${api.rolePermissions}/${id}`, permissionDtos)
123 }
......
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
64 }) 64 })
65 }, 65 },
66 beforeDestroy () { 66 beforeDestroy () {
67 this.chart.dispose(); 67 // this.chart.dispose();
68 this.chart = null; 68 this.chart = null;
69 }, 69 },
70 methods: { 70 methods: {
......
1 import Vue from 'vue' 1 import Vue from 'vue'
2 2
3 // 下载,导出 3 // 下载,导出
4 Vue.prototype.$download = function(name, href) { 4 Vue.prototype.$download = function (name, href) {
5 var a = document.createElement('a') // 创建a标签 5 var a = document.createElement('a') // 创建a标签
6 var e = document.createEvent('MouseEvents') // 创建鼠标事件对象 6 var e = document.createEvent('MouseEvents') // 创建鼠标事件对象
7 e.initEvent('click', false, false) // 初始化事件对象 7 e.initEvent('click', false, false) // 初始化事件对象
...@@ -10,7 +10,7 @@ Vue.prototype.$download = function(name, href) { ...@@ -10,7 +10,7 @@ Vue.prototype.$download = function(name, href) {
10 a.dispatchEvent(e) // 给指定的元素,执行事件click事件 10 a.dispatchEvent(e) // 给指定的元素,执行事件click事件
11 } 11 }
12 // 导出json文件 12 // 导出json文件
13 Vue.prototype.$downloadJson = function(data, name) { 13 Vue.prototype.$downloadJson = function (data, name) {
14 // 1 生成文件的 blob 对象 14 // 1 生成文件的 blob 对象
15 const blobData = new Blob([JSON.stringify(data)], { 15 const blobData = new Blob([JSON.stringify(data)], {
16 type: 'application/octet-stream' 16 type: 'application/octet-stream'
...@@ -84,7 +84,7 @@ const checkCode = (rule, value, callback) => { ...@@ -84,7 +84,7 @@ const checkCode = (rule, value, callback) => {
84 // } 84 // }
85 // } 85 // }
86 // 日期格式转换 "yyyy-MM-dd HH:mm:ss" 86 // 日期格式转换 "yyyy-MM-dd HH:mm:ss"
87 Vue.prototype.$formdate = function(date) { 87 Vue.prototype.$formdate = function (date) {
88 if (!date) { 88 if (!date) {
89 return "" 89 return ""
90 } 90 }
...@@ -95,22 +95,22 @@ Vue.prototype.$formdate = function(date) { ...@@ -95,22 +95,22 @@ Vue.prototype.$formdate = function(date) {
95 var hh = (d.getHours() < 10 ? '0' + d.getHours() : d.getHours()) + ':'; 95 var hh = (d.getHours() < 10 ? '0' + d.getHours() : d.getHours()) + ':';
96 var mm = (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes()) + ':'; 96 var mm = (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes()) + ':';
97 var ss = (d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds()); 97 var ss = (d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds());
98 return YY + MM + DD +" "+hh + mm + ss 98 return YY + MM + DD + " " + hh + mm + ss
99 } 99 }
100 // 时间格式过滤 100 // 时间格式过滤
101 Vue.filter('timeFilter', function(timeStr) { 101 Vue.filter('timeFilter', function (timeStr) {
102 if (timeStr) { 102 if (timeStr) {
103 return timeStr.substring(0, 10) 103 return timeStr.substring(0, 10)
104 } 104 }
105 }) 105 })
106 export function getType(o) { 106 export function getType (o) {
107 return Object.prototype.toString.call(o).slice(8, -1) 107 return Object.prototype.toString.call(o).slice(8, -1)
108 } 108 }
109 export function isKeyType(o, type) { 109 export function isKeyType (o, type) {
110 return getType(o).toLowerCase() === type.toLowerCase() 110 return getType(o).toLowerCase() === type.toLowerCase()
111 } 111 }
112 // 深拷贝全局挂载 112 // 深拷贝全局挂载
113 Vue.prototype.$deepCopy = function(sth) { 113 Vue.prototype.$deepCopy = function (sth) {
114 // 深度复制数组 114 // 深度复制数组
115 // if (Object.prototype.toString.call(obj) === "[object Array]") { 115 // if (Object.prototype.toString.call(obj) === "[object Array]") {
116 // const object = []; 116 // const object = [];
...@@ -196,7 +196,7 @@ Vue.prototype.$dealArrNotDisabled = arr => { ...@@ -196,7 +196,7 @@ Vue.prototype.$dealArrNotDisabled = arr => {
196 } 196 }
197 } 197 }
198 } 198 }
199 function nodeDeal(arr) { 199 function nodeDeal (arr) {
200 arr.forEach(item => { 200 arr.forEach(item => {
201 delete item.disabled 201 delete item.disabled
202 if (item.children) { 202 if (item.children) {
...@@ -222,7 +222,7 @@ Vue.prototype.$dealArrDisabled = (arr, id) => { ...@@ -222,7 +222,7 @@ Vue.prototype.$dealArrDisabled = (arr, id) => {
222 } 222 }
223 } 223 }
224 } 224 }
225 function nodeDeal(arr) { 225 function nodeDeal (arr) {
226 arr.forEach(item => { 226 arr.forEach(item => {
227 item['disabled'] = true 227 item['disabled'] = true
228 if (item.children) { 228 if (item.children) {
...@@ -249,10 +249,9 @@ Vue.prototype.$getNodeRoute = (val, id) => { ...@@ -249,10 +249,9 @@ Vue.prototype.$getNodeRoute = (val, id) => {
249 } 249 }
250 } 250 }
251 }) 251 })
252 function nodefun(newVal, newId, newCid_list) { 252 function nodefun (newVal, newId, newCid_list) {
253 let flag = false 253 let flag = false
254 newVal.forEach(j => { 254 newVal.forEach(j => {
255 // console.log(j)
256 if (j.id === newId) { 255 if (j.id === newId) {
257 newCid_list.push(j.id) 256 newCid_list.push(j.id)
258 flag = true 257 flag = true
...@@ -272,7 +271,7 @@ Vue.prototype.$getNodeRoute = (val, id) => { ...@@ -272,7 +271,7 @@ Vue.prototype.$getNodeRoute = (val, id) => {
272 return newCid_list 271 return newCid_list
273 } 272 }
274 } 273 }
275 function result(cid_list) { 274 function result (cid_list) {
276 const arr = cid_list.concat() 275 const arr = cid_list.concat()
277 arr.pop() 276 arr.pop()
278 return arr 277 return arr
...@@ -325,7 +324,7 @@ Vue.prototype.$findParent = (list, id) => { ...@@ -325,7 +324,7 @@ Vue.prototype.$findParent = (list, id) => {
325 Vue.prototype.$findChildren = (list, nodeId) => { 324 Vue.prototype.$findChildren = (list, nodeId) => {
326 let newArray = [] 325 let newArray = []
327 let flag = false 326 let flag = false
328 function dealList(list, nodeId) { 327 function dealList (list, nodeId) {
329 if (list.length !== 0) { 328 if (list.length !== 0) {
330 list.forEach(item => { 329 list.forEach(item => {
331 if (!flag) { 330 if (!flag) {
......
1 <template>
2 <Dialog :title="title" class="tableClass" :show.sync="visible" :width="'715px'" @close="close()">
3 <template slot="content">
4 <lb-table ref="multipleTable"
5 :pagination="false"
6 :column="tableData.column"
7 :data="tableData.data"
8 @selection-change="handleSelectionChange">
9 </lb-table>
10 </template>
11 <template slot="footer">
12 <el-button type="primary" class="save" @click="handleSaveMember()"
13 >保存</el-button
14 >
15 <el-button class="cancel-button" @click="close()">取消</el-button>
16 </template>
17 </Dialog>
18 </template>
19
20 <script>
21 import Dialog from "@/components/Dialog/";
22 export default {
23 name: "",
24 components: { Dialog },
25 props: {},
26 data() {
27 return {
28 title: "人员配置",
29 visible: false,
30 tableData: {
31 column: [
32 {
33 type: 'selection'
34 },
35 {
36 prop: 'name',
37 label: '角色名称'
38 },
39 {
40 prop: 'type',
41 label: '角色类型'
42 },
43 {
44 prop: 'departmentName',
45 label: '角色描述'
46 },
47 ],
48 data: [
49 {
50 id: "3127e455-43ba-45ff-9326-0e02ef89485e",
51 createdAt: null,
52 updatedAt: "2022-08-04T03:38:27.626+0000",
53 createdBy: null,
54 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
55 sort: 1,
56 name: "超级管理员",
57 loginName: "admin",
58 password: "05eb15777e8fd1d61c840472e7267f61d432f63340d86b59",
59 passwordSalt: "5178114777136485",
60 email: null,
61 lastLoginTime: null,
62 mobilePhone: "18291003568",
63 status: "ACTIVE",
64 passwordChangeTime: "2021-12-10T08:01:01.569+0000",
65 idCard: "612725202111021521",
66 departmentId: "2eae5304-544f-4f5b-b354-8f5d47433c9b",
67 organizationId: "0bca67ae-1d9e-4b41-b057-f165586d24aa",
68 sex: "0",
69 isDuty: true,
70 type:"",
71 code: "123324",
72 jobLevel: null,
73 telephone: "028-87720898",
74 address: "办公地点修改测试",
75 isLocked: false,
76 departmentName: "研发部",
77 _X_ROW_KEY: "row_276",
78 },
79 {
80 name: '数据管理员',
81 type:"1",
82 },
83 {
84 name: '数据管理员2',
85 type:"d",
86 }
87 ]
88 },
89 multipleSelection: []
90
91 }
92 },
93 computed: {},
94 watch: {},
95 created() {},
96 mounted() {},
97 methods: {
98 authorization() {
99 this.visible = true;
100 },
101 close() {
102 // this.resetForm()
103 this.visible = false;
104 },
105 // 保存事件
106 handleSaveMember() {
107 // if (this.memberList.length === 0) {
108 // this.$message.warning("请添加待选人员");
109 // return false;
110 // }
111 // const idList = this.memberList.map(item => item.id)
112 // updateUser(this.roleId, idList).then(res => {
113 // if (res.status === 1) {
114 // this.$message.success({ message: '保存成功', showClose: true })
115 // this.showMemberConfigDialog = false
116 // this.$emit('setUsers', this.roleId)
117 // this.resetMemberConfig()
118 // } else this.$message.error({ message: res.message, showClose: true })
119 // })
120 },
121 handleSelectionChange (val) {
122 this.multipleSelection = val
123 }
124 }
125 };
126 </script>
127 <style scoped lang="scss">
128 /deep/.el-dialog__header{
129 text-align: center;
130 margin-bottom: 10px;
131 .el-dialog__title{
132 color: white;
133 }
134 }
135 </style>
...@@ -166,6 +166,7 @@ export default { ...@@ -166,6 +166,7 @@ export default {
166 methods: { 166 methods: {
167 // 获取父级菜单 167 // 获取父级菜单
168 getParentMenuList(id) { 168 getParentMenuList(id) {
169
169 getParentMenuListAction(id).then((res) => { 170 getParentMenuListAction(id).then((res) => {
170 if (res.status === 1) { 171 if (res.status === 1) {
171 const list = this.$dealArrChildren(res.content) 172 const list = this.$dealArrChildren(res.content)
...@@ -195,7 +196,7 @@ export default { ...@@ -195,7 +196,7 @@ export default {
195 }, 196 },
196 // 新增菜单 197 // 新增菜单
197 add() { 198 add() {
198 this.getParentMenuList(this.productId) 199 this.getParentMenuList("2925fdeb-ddeb-4c15-8ee0-7bc3aa75ec2b")
199 this.visible = true 200 this.visible = true
200 this.type = 0 201 this.type = 0
201 this.form.jumpMode = 1 202 this.form.jumpMode = 1
......
...@@ -19,178 +19,176 @@ ...@@ -19,178 +19,176 @@
19 :data="tablelistData" 19 :data="tablelistData"
20 row-key="id" 20 row-key="id"
21 default-expand-all 21 default-expand-all
22 :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" 22 :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
23 >
24 </lb-table> 23 </lb-table>
25 </div> 24 </div>
26 <edit-dialog ref="dialogForm" 25 <edit-dialog ref="dialogForm"
27 :product-id="productId" 26 :product-id="productId"
28 :resource-category-id="resourceCategoryId" 27 :resource-category-id="resourceCategoryId"
29 @ok="reloadTableData"/> 28 @ok="reloadTableData" />
30 <!-- <authorizationdiglog ref="rolesForm" /> --> 29 <!-- <authorizationdiglog ref="rolesForm" /> -->
31 </div> 30 </div>
32 </template> 31 </template>
33 <script> 32 <script>
34 // 定时任务 33 // 定时任务
35 import data from "./data"; 34 import data from "./data";
36 import { deleteAction, getAction, api } from "@/api/manageApi"; 35 import { deleteAction, getAction, api } from "@/api/manageApi";
37 import EditDialog from "./edit-dialog.vue"; 36 import EditDialog from "./edit-dialog.vue";
38 // import authorizationdiglog from "./authorizationdiglog.vue"; 37 // import authorizationdiglog from "./authorizationdiglog.vue";
39 export default { 38 export default {
40 name: "menus", 39 name: "menus",
41 components: { 40 components: {
42 EditDialog, 41 EditDialog,
43 // authorizationdiglog, 42 // authorizationdiglog,
44 }, 43 },
45 data() { 44 data () {
46 return { 45 return {
47 tablelistData: [], 46 tablelistData: [],
48 resourceCategoryId:"", 47 resourceCategoryId: "",
49 taskData: null, 48 taskData: null,
50 form: { 49 form: {
51 job_name: "", 50 job_name: "",
52 currentPage: 1, 51 currentPage: 1,
53 }, 52 },
54 title: "", 53 title: "",
55 queryParam: {}, 54 queryParam: {},
56 selectType: "0", 55 selectType: "0",
57 queryName: "", 56 queryName: "",
58 organizationId: "", // 组织机构ID 57 organizationId: "", // 组织机构ID
59 departmentId: "", // 部门ID 58 departmentId: "", // 部门ID
60 departmentList: [], // 部门列表 59 departmentList: [], // 部门列表
61 levelList: [], // 职务级别 60 levelList: [], // 职务级别
62 sexList: [], 61 sexList: [],
63
64 selectionList: [],
65 tableData: {
66 columns: [].concat(data.columns()).concat([
67 {
68 label: "操作",
69 width: 380,
70 render: (h, scope) => {
71 return (
72 <div>
73 <el-button
74 type="text"
75 size="mini"
76 icon="el-icon-edit"
77 onClick={() => {
78 this.handleEdit(scope.row);
79 }}
80 >
81 修改
82 </el-button>
83
84 <el-button
85 type="text"
86 size="mini"
87 icon="el-icon-delete"
88 style="color:#F56C6C"
89 onClick={() => {
90 this.handleDelete(scope.row.id, scope.row.name);
91 }}
92 >
93 删除
94 </el-button>
95 </div>
96 );
97 },
98 },
99 ]),
100 data: [],
101 },
102 pageData: {
103 total: 5,
104 pageSize: 15,
105 current: 1,
106 },
107 tableUrl: api.menus, // 菜单接口地址
108 meumurlid: api.subsystem,// 项目id接口地址
109 productId:""//项目id
110 };
111 },
112 created() {
113 this.getTableList();
114 },
115 methods: {
116 // 加载表格数据
117 getTableList() {
118 62
119 const queryOptionsid = { 63 selectionList: [],
120 conditionGroup: { 64 tableData: {
121 queryRelation: "AND", 65 columns: [].concat(data.columns()).concat([
122 conditions: [
123 { 66 {
124 property: "code", 67 label: "操作",
125 value: "BDCJGPT", 68 width: 380,
126 operator: "EQ", 69 render: (h, scope) => {
70 return (
71 <div>
72 <el-button
73 type="text"
74 size="mini"
75 icon="el-icon-edit"
76 onClick={() => {
77 this.handleEdit(scope.row);
78 }}
79 >
80 修改
81 </el-button>
82
83 <el-button
84 type="text"
85 size="mini"
86 icon="el-icon-delete"
87 style="color:#F56C6C"
88 onClick={() => {
89 this.handleDelete(scope.row.id, scope.row.name);
90 }}
91 >
92 删除
93 </el-button>
94 </div>
95 );
96 },
127 }, 97 },
128 ], 98 ]),
99 data: [],
129 }, 100 },
101 pageData: {
102 total: 5,
103 pageSize: 15,
104 current: 1,
105 },
106 tableUrl: api.menus, // 菜单接口地址
107 meumurlid: api.subsystem,// 项目id接口地址
108 productId: ""//项目id
130 }; 109 };
131 const params = {
132 queryOptions: queryOptionsid,
133 };
134 // 获取系统id
135 getAction(this.meumurlid, params)
136 .then((res) => {
137 this.productId=res.content[0].id;
138 let queryOptions = {
139 conditionGroup: {
140 conditions: [
141 {
142 property: "productId",
143 value: this.productId,
144 operator: "EQ",
145 },
146 ],
147 queryRelation: "AND",
148 },
149 orderBys: [{ property: "sort", direction: "desc" }],
150 };
151 if (!this.tableUrl) {
152 console.log("请设置tableUrl属性为接口地址!");
153 return;
154 }
155 if (this.queryOptions !== "") {
156 this.queryParam.queryOptions = JSON.stringify(queryOptions);
157 }
158 // 查询系统菜单
159 getAction(this.tableUrl, this.queryParam)
160 .then((res) => {
161 if (res.status === 1) {
162 this.loading = false;
163 this.tablelistData = res.content;
164 console.log("this.tablelistData", this.tablelistData);
165 } else {
166 this.$message.error({ message: res.message, showClose: true });
167 this.loading = false;
168 }
169 })
170 .catch((error) => {
171 console.log("errrrrrorrrrr", error);
172 this.loading = false;
173 });
174 })
175 .catch((error) => {
176 console.log("errrrrrorrrrr", error);
177 });
178 }, 110 },
179 // 新增菜单 111 created () {
180 handleAdd() { 112 this.getTableList();
181 this.$refs.dialogForm.add();
182 this.$refs.dialogForm.title = "添加";
183 }, 113 },
114 methods: {
115 // 加载表格数据
116 getTableList () {
184 117
185 // 修改 118 const queryOptionsid = {
186 handleEdit(record) { 119 conditionGroup: {
187 this.$refs.dialogForm.edit(record); 120 queryRelation: "AND",
188 this.$refs.dialogForm.title = "修改"; 121 conditions: [
189 }, 122 {
190 // 删除 123 property: "code",
191 handleDelete(id,content) { 124 value: "BDCJGPT",
192 this.$confirm( 125 operator: "EQ",
193 `<div class="customer-message-wrapper"> 126 },
127 ],
128 },
129 };
130 const params = {
131 queryOptions: queryOptionsid,
132 };
133 // 获取系统id
134 getAction(this.meumurlid, params)
135 .then((res) => {
136 this.productId = res.content[0].id;
137 let queryOptions = {
138 conditionGroup: {
139 conditions: [
140 {
141 property: "productId",
142 value: this.productId,
143 operator: "EQ",
144 },
145 ],
146 queryRelation: "AND",
147 },
148 orderBys: [{ property: "sort", direction: "desc" }],
149 };
150 if (!this.tableUrl) {
151 console.log("请设置tableUrl属性为接口地址!");
152 return;
153 }
154 if (this.queryOptions !== "") {
155 this.queryParam.queryOptions = JSON.stringify(queryOptions);
156 }
157 // 查询系统菜单
158 getAction(this.tableUrl, this.queryParam)
159 .then((res) => {
160 if (res.status === 1) {
161 this.loading = false;
162 this.tablelistData = res.content;
163 } else {
164 this.$message.error({ message: res.message, showClose: true });
165 this.loading = false;
166 }
167 })
168 .catch((error) => {
169 console.log("er", error);
170 this.loading = false;
171 });
172 })
173 .catch((error) => {
174 console.log("er", error);
175 });
176 },
177 // 新增菜单
178 handleAdd () {
179 this.$refs.dialogForm.add();
180 this.$refs.dialogForm.title = "添加";
181 },
182
183 // 修改
184 handleEdit (record) {
185 this.$refs.dialogForm.edit(record);
186 this.$refs.dialogForm.title = "修改";
187 },
188 // 删除
189 handleDelete (id, content) {
190 this.$confirm(
191 `<div class="customer-message-wrapper">
194 <h5 class="title">您确认要执行该操作用于以下信息:</h5> 192 <h5 class="title">您确认要执行该操作用于以下信息:</h5>
195 <p class="content" aria-controls="${content}">${content} 193 <p class="content" aria-controls="${content}">${content}
196 </p> 194 </p>
...@@ -198,49 +196,49 @@ export default { ...@@ -198,49 +196,49 @@ export default {
198 <span >无法恢复</span> 196 <span >无法恢复</span>
199 </p> 197 </p>
200 </div>`, 198 </div>`,
201 '执行确认', 199 '执行确认',
202 { 200 {
203 dangerouslyUseHTMLString: true, 201 dangerouslyUseHTMLString: true,
204 customClass: 'customer-delete', 202 customClass: 'customer-delete',
205 confirmButtonText: '确定', 203 confirmButtonText: '确定',
206 cancelButtonText: '取消', 204 cancelButtonText: '取消',
207 type: 'warning' 205 type: 'warning'
208 }
209 )
210 .then(() => {
211 if (!this.tableUrl) {
212 this.$message.error({
213 message: '请设置tableUrl属性为接口地址!',
214 showClose: true
215 })
216 return
217 } 206 }
218 const url = this.tableUrl + '/' + id 207 )
219 deleteAction(url).then(res => { 208 .then(() => {
220 if (res.status === 1) { 209 if (!this.tableUrl) {
221 this.$message.success({ message: res.message, showClose: true }) 210 this.$message.error({
222 this.reloadTableData() 211 message: '请设置tableUrl属性为接口地址!',
223 } else { 212 showClose: true
224 this.$message.error({ message: res.message, showClose: true }) 213 })
214 return
225 } 215 }
216 const url = this.tableUrl + '/' + id
217 deleteAction(url).then(res => {
218 if (res.status === 1) {
219 this.$message.success({ message: res.message, showClose: true })
220 this.reloadTableData()
221 } else {
222 this.$message.error({ message: res.message, showClose: true })
223 }
224 })
226 }) 225 })
227 }) 226 .catch(() => { })
228 .catch(() => {}) 227 },
229 }, 228 // 新增、编辑回显
230 // 新增、编辑回显 229 reloadTableData () {
231 reloadTableData() { 230 this.getTableList()
232 this.getTableList() 231 },
233 }, 232 },
234 }, 233 };
235 };
236 </script> 234 </script>
237 <style scoped lang="scss"> 235 <style scoped lang="scss">
238 @import "~@/styles/mixin.scss"; 236 @import "~@/styles/mixin.scss";
239 @import "~@/styles/public.scss"; 237 @import "~@/styles/public.scss";
240 .btnColRight { 238 .btnColRight {
241 margin-top: 20px; 239 margin-top: 20px;
242 } 240 }
243 /deep/.el-table__expand-icon { 241 /deep/.el-table__expand-icon {
244 color: #fff; 242 color: #fff;
245 } 243 }
246 </style> 244 </style>
......
...@@ -22,8 +22,7 @@ ...@@ -22,8 +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="id">
26 >
27 </lb-table> 26 </lb-table>
28 </div> 27 </div>
29 <EditDialog ref="addEditDialog" @ok="reloadTableData" /> 28 <EditDialog ref="addEditDialog" @ok="reloadTableData" />
...@@ -31,281 +30,400 @@ ...@@ -31,281 +30,400 @@
31 </div> 30 </div>
32 </template> 31 </template>
33 <script> 32 <script>
34 import { 33 import {
35 getUuid, 34 getUuid,
36 judgeSort, 35 judgeSort,
37 realMove, 36 realMove,
38 findParents, 37 findParents,
39 removeTreeListItem, 38 removeTreeListItem,
40 } from "@/utils/operation"; 39 } from "@/utils/operation";
41 import { getRolesById, getUserRoles } from "@/api/quanxianmanagement"; 40 import { getRolesById, getUserRoles, getAuthorityListAction } from "@/api/quanxianmanagement";
42 import data from "./data"; 41 import data from "./data";
43 import sjsbTask from "@/api/sjsbTask.js"; 42 // import {
44 import { api, getAction,deleteAction } from "@/api/manageApi"; 43 // getOrganizationAuthorityList,
45 import tableMixin from "@/mixins/tableMixin.js"; 44 // getDepartmentAuthorityList,
46 import EditDialog from "./edit-dialog.vue"; 45 // getRoleAuthorityList,
47 import Roleslistdiglog from "./roleslistdiglog.vue"; 46 // getUserAuthorityList,
48 export default { 47 // getAuthorityListAction
49 name: "menus", 48 // } from '@/api/authorityManage'
50 mixins: [tableMixin], 49 import sjsbTask from "@/api/sjsbTask.js";
51 components: { 50 import { api, getAction, deleteAction } from "@/api/manageApi";
52 EditDialog, 51 import tableMixin from "@/mixins/tableMixin.js";
53 Roleslistdiglog, 52 import EditDialog from "./edit-dialog.vue";
54 }, 53 import Roleslistdiglog from "./roleslistdiglog.vue";
55 data() { 54 export default {
56 return { 55 name: "menus",
57 personlist: null, 56 mixins: [tableMixin],
58 waitMemberList: [], 57 components: {
59 keyList: [], 58 EditDialog,
60 listdata: [], 59 Roleslistdiglog,
61 tableUrl: api.roles, 60 },
62 form: { 61 data () {
63 job_name: "", 62 return {
64 currentPage: 1, 63 personlist: null,
65 }, 64 waitMemberList: [],
66 // 当前所选角色id 65 keyList: [],
67 roleId: "", 66 listdata: [],
68 title: "", 67 tableUrl: api.roles,
69 queryParam: {}, 68 form: {
70 selectType: "0", 69 job_name: "",
71 queryName: "", 70 currentPage: 1,
72 organizationId: "", // 组织机构ID
73 departmentId: "", // 部门ID
74 departmentList: [], // 部门列表
75 levelList: [], // 职务级别
76 sexList: [],
77 typeOptions: [
78 {
79 value: "0",
80 label: "姓名",
81 },
82 {
83 value: "1",
84 label: "工号",
85 },
86 {
87 value: "2",
88 label: "部门",
89 },
90 {
91 value: "3",
92 label: "机构",
93 }, 71 },
94 ], 72 // 当前所选角色id
95 73 roleId: "",
96 selectionList: [], 74 title: "",
97 tableData: { 75 queryParam: {},
98 columns: [ 76 multipleSelection: [],
77 // 菜单列表
78 menutablelistData: [],
79 tableUrl: api.menus, // 菜单接口地址
80 meumurlid: api.subsystem, // 项目id接口地址
81 selectType: "0",
82 queryName: "",
83 organizationId: "", // 组织机构ID
84 departmentId: "", // 部门ID
85 departmentList: [], // 部门列表
86 levelList: [], // 职务级别
87 sexList: [],
88 operationCodes: null, // 操作符对象
89 operationList: [], // 获取授权列表需要提交的操作符数组
90 typeOptions: [
91 {
92 value: "0",
93 label: "姓名",
94 },
95 {
96 value: "1",
97 label: "工号",
98 },
99 { 99 {
100 label: "序号", 100 value: "2",
101 type: "index", 101 label: "部门",
102 width: "50",
103 index: this.indexMethod,
104 }, 102 },
105 ] 103 {
106 .concat(data.columns()) 104 value: "3",
107 .concat([ 105 label: "机构",
106 },
107 ],
108
109 selectionList: [],
110 tableData: {
111 columns: [
108 { 112 {
109 label: "排序", 113 label: "序号",
110 width: 380, 114 type: "index",
111 render: (h, scope) => { 115 width: "50",
112 return ( 116 index: this.indexMethod,
113 <div>
114 <el-button
115 type="text"
116 disabled={scope.row.isTop}
117 onClick={() => {
118 this.moveUpward(scope.$index, scope.row);
119 }}
120 >
121 上移
122 </el-button>
123 <el-button
124 type="text"
125 disabled={scope.row.isBottom}
126 onClick={() => {
127 this.moveDown(scope.$index, scope.row);
128 }}
129 >
130 下移
131 </el-button>
132 </div>
133 );
134 },
135 }, 117 },
136 ]) 118 ]
137 .concat([ 119 .concat(data.columns())
138 { 120 .concat([
139 label: "操作", 121 {
140 width: 380, 122 label: "排序",
141 render: (h, scope) => { 123 width: 380,
142 return ( 124 render: (h, scope) => {
143 <div> 125 return (
144 <el-tooltip class="item" effect="dark" disabled={scope.row.type !== 'Everyone'} content="没有点击的权限" placement="top"> 126 <div>
145 <span> 127 <el-button
146 <el-button 128 type="text"
147 disabled={scope.row.type === 'Everyone'} 129 disabled={scope.row.isTop}
148 type="text" 130 onClick={() => {
149 size="mini" 131 this.moveUpward(scope.$index, scope.row);
150 icon="el-icon-video-pause" 132 }}
151 onClick={() => { 133 >
152 this.getUserList(scope.row); 134 上移
153 }} 135 </el-button>
154 > 136 <el-button
155 配置 137 type="text"
156 </el-button> 138 disabled={scope.row.isBottom}
157 </span> 139 onClick={() => {
158 </el-tooltip> 140 this.moveDown(scope.$index, scope.row);
159 <el-tooltip class="item" effect="dark" disabled={scope.row.category !== 1} content="系统内置角色 不允许修改" placement="top"> 141 }}
160 <span> 142 >
161 <el-button 143 下移
162 disabled={scope.row.category === 1} 144 </el-button>
163 type="text" 145 </div>
164 size="mini" 146 );
165 icon="el-icon-edit" 147 },
166 onClick={() => {
167 this.handleAddEdit(scope.row);
168 }}
169 >
170 修改
171 </el-button>
172 </span>
173 </el-tooltip>
174 <el-tooltip class="item" effect="dark" disabled={scope.row.category !== 1} content="系统内置角色 不允许删除" placement="top">
175 <span>
176 <el-button
177 type="text"
178 disabled={scope.row.category === 1}
179 size="mini"
180 icon="el-icon-delete"
181 // style="color:#F56C6C"
182 onClick={() => {
183 this.handleDelete(scope.row.id, scope.row.name);
184 }}
185 >
186 删除
187 </el-button>
188 </span>
189 </el-tooltip>
190 </div>
191 );
192 }, 148 },
193 }, 149 ])
194 ]), 150 .concat([
195 data: [], 151 {
196 }, 152 label: "操作",
197 pageData: { 153 width: 380,
198 total: 5, 154 render: (h, scope) => {
199 pageSize: 15, 155 return (
200 current: 1, 156 <div>
201 }, 157 <el-tooltip
202 }; 158 class="item"
203 }, 159 effect="dark"
204 created() { 160 disabled={scope.row.type !== "Everyone"}
205 this.getTableData(); 161 content="没有点击的权限"
206 }, 162 placement="top"
207 mounted() {}, 163 >
208 methods: { 164 <span>
209 // 获取角色列表 165 <el-button
210 getTableData() { 166 disabled={scope.row.type === "Everyone"}
211 let Builtinrole=[] 167 type="text"
212 let Publicrole=[] 168 size="mini"
213 169 icon="el-icon-video-pause"
214 getRolesById(1) 170 onClick={() => {
215 .then((res) => { 171 this.getUserList(scope.row);
216 Builtinrole = res.content; 172 }}
217 getRolesById(2) 173 >
218 .then((res) => { 174 配置
219 Publicrole = res.content; 175 </el-button>
176 </span>
177 </el-tooltip>
178 <el-tooltip
179 class="item"
180 effect="dark"
181 disabled={scope.row.category !== 1}
182 content="系统内置角色 不允许修改"
183 placement="top"
184 >
185 <span>
186 <el-button
187 disabled={scope.row.category === 1}
188 type="text"
189 size="mini"
190 icon="el-icon-edit"
191 onClick={() => {
192 this.handleAddEdit(scope.row);
193 }}
194 >
195 修改
196 </el-button>
197 </span>
198 </el-tooltip>
199 <el-tooltip
200 class="item"
201 effect="dark"
202 disabled={scope.row.category !== 1}
203 content="系统内置角色 不允许删除"
204 placement="top"
205 >
206 <span>
207 <el-button
208 type="text"
209 disabled={scope.row.category === 1}
210 size="mini"
211 icon="el-icon-delete"
212 // style="color:#F56C6C"
213 onClick={() => {
214 this.handleDelete(scope.row.id, scope.row.name);
215 }}
216 >
217 删除
218 </el-button>
219 </span>
220 </el-tooltip>
221 </div>
222 );
223 },
224 },
225 ]),
226 data: [],
227 },
228 pageData: {
229 total: 5,
230 pageSize: 15,
231 current: 1,
232 },
233 };
234 },
235 created () {
236 this.getTableData();
237 this.getTableList()
238 },
239 mounted () { },
240 methods: {
241 // 获取角色列表
242 getTableData () {
243 let Builtinrole = [];
244 let Publicrole = [];
220 245
221 this.listdata = Builtinrole.concat(Publicrole); 246 getRolesById(1)
247 .then((res) => {
248 Builtinrole = res.content;
249 getRolesById(2)
250 .then((res) => {
251 Publicrole = res.content;
222 252
223 this.listdata = judgeSort(this.listdata); 253 this.listdata = Builtinrole.concat(Publicrole);
224 })
225 .catch((e) => console.error(e));
226 })
227 .catch((e) => console.error(e));
228 254
255 this.listdata = judgeSort(this.listdata);
256 })
257 .catch((e) => console.error(e));
258 })
259 .catch((e) => console.error(e));
260 },
229 261
230 }, 262 // 获取菜单列表
231 // 人员配置 263 getTableList () {
232 getUserList(row) { 264 const queryOptionsid = {
233 const params = {}; 265 conditionGroup: {
234 const queryOptions = { 266 queryRelation: "AND",
235 conditionGroup: { 267 conditions: [
236 conditions: [ 268 {
237 { 269 property: "code",
238 property: "organizationId", 270 value: "BDCJGPT",
239 value: row.organizationId, 271 operator: "EQ",
240 operator: "EQ", 272 },
241 }, 273 ],
242 { 274 },
243 property: "departmentId", 275 };
244 value: row.departmentId, 276 const params = {
245 operator: "EQ", 277 queryOptions: queryOptionsid,
246 }, 278 };
247 ], 279 // 获取系统id
248 queryRelation: "AND", 280 getAction(this.meumurlid, params)
249 }, 281 .then((res) => {
250 orderBys: [{ property: "sort", direction: "desc" }], 282 this.productId = res.content[0].id;
251 }; 283 this.getAuthorityList(res.content[0].id, res.content[0].code)
252 params.queryOptions = JSON.stringify(queryOptions); 284 this.selectedSubsystemCode = res.content[0].code
253 getUserRoles(row.id).then((res) => { 285 let queryOptions = {
254 if (res.status === 1) { 286 conditionGroup: {
255 this.personlist = res.content; 287 conditions: [
256 getAction(api.users, params).then((res) => { 288 {
289 property: "productId",
290 value: this.productId,
291 operator: "EQ",
292 },
293 ],
294 queryRelation: "AND",
295 },
296 orderBys: [{ property: "sort", direction: "desc" }],
297 };
298 if (!this.tableUrl) {
299 console.log("请设置tableUrl属性为接口地址!");
300 return;
301 }
302 if (this.queryOptions !== "") {
303 this.queryParam.queryOptions = JSON.stringify(queryOptions);
304 }
305 // 查询系统菜单
306 getAction(this.tableUrl, this.queryParam)
307 .then((res) => {
308 if (res.status === 1) {
309 this.loading = false;
310 this.menutablelistData = res.content;
311 } else {
312 this.$message.error({ message: res.message, showClose: true });
313 this.loading = false;
314 }
315 })
316 .catch((error) => {
317 console.log("er", error);
318 this.loading = false;
319 });
320 })
321 .catch((error) => {
322 console.log("er", error);
323 });
324 },
325 // 获取权限列表
326 getAuthorityList (productId, code) {
327 getAuthorityListAction(productId, code).then(
328 res => {
257 if (res.status === 1) { 329 if (res.status === 1) {
258 this.waitMemberList = res.content; 330 if (res.content.length !== 0) {
259 if (this.personlist) { 331 this.operationCodes = res.content[0].operations
260 this.waitMemberList.forEach((item, i) => { 332 this.operationList = []
261 this.personlist.forEach((val) => { 333 for (var k in this.operationCodes) {
262 if (item.id === val.id) { 334 this.operationList.push(k)
263 this.waitMemberList[i].selectStatus = 0; 335 }
264 }
265 });
266 });
267 } 336 }
268
269 this.$refs.rolesForm.adds(this.waitMemberList, row.id);
270 } else { 337 } else {
271 this.$message.error({ message: res.message, showClose: true }); 338 this.$message.error({ message: res.message, showClose: true })
272 } 339 }
273 }); 340 }
274 this.$refs.rolesForm.title = "人员配置"; 341 )
275 } else this.$message.error({ message: res.message, showClose: true }); 342 },
276 });
277 },
278 // 新增、修改角色
279 handleAddEdit(value) {
280 this.$refs.addEditDialog.menuType = this.menuType;
281 this.$refs.addEditDialog.roleId = value.id;
282 this.roleSort = value.sort ? value.sort : 0;
283 if (value.id) {
284 this.$refs.addEditDialog.dialogForm.roleName = value.name;
285 this.$refs.addEditDialog.dialogForm.roleType = value.type;
286 this.$refs.addEditDialog.dialogForm.roleTextArea = value.description;
287 }
288 this.$refs.addEditDialog.showAddEditDialog = true;
289 this.$refs.addEditDialog.dialogTitle = value.id ? "修改" : "新增";
290 },
291 // 上移下移
292 moveUpward(index, row) {
293 realMove(row.id, "UP", this.listdata);
294 this.key++;
295 let id = findParents(this.listdata, row.id);
296 this.keyList = id;
297 },
298 moveDown(index, row) {
299 realMove(row.id, "DOWN", this.listdata);
300 this.key++;
301 let id = findParents(this.listdata, row.id);
302 this.keyList = id;
303 },
304 343
305 // 删除 344 // 配置
306 handleDelete: function(id, content = '') { 345 getUserList (row) {
307 this.$confirm( 346 this.getTableList()
308 `<div class="customer-message-wrapper"> 347 const params = {};
348 const queryOptions = {
349 conditionGroup: {
350 conditions: [
351 {
352 property: "organizationId",
353 value: row.organizationId,
354 operator: "EQ",
355 },
356 {
357 property: "departmentId",
358 value: row.departmentId,
359 operator: "EQ",
360 },
361 ],
362 queryRelation: "AND",
363 },
364 orderBys: [{ property: "sort", direction: "desc" }],
365 };
366 params.queryOptions = JSON.stringify(queryOptions);
367
368 getUserRoles(row.id).then((res) => {
369 if (res.status === 1) {
370 this.personlist = res.content;
371 getAction(api.users, params).then((res) => {
372 if (res.status === 1) {
373 this.waitMemberList = res.content;
374 if (this.personlist) {
375 this.waitMemberList.forEach((item, i) => {
376 this.personlist.forEach((val) => {
377 if (item.id === val.id) {
378 this.waitMemberList[i].selectStatus = 0;
379 }
380 });
381 });
382 }
383
384 this.$refs.rolesForm.personlist(this.waitMemberList, row.id);
385 // this.$refs.rolesForm.getMenuData();
386
387 this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes);
388 } else {
389 this.$message.error({ message: res.message, showClose: true });
390 }
391 });
392 this.$refs.rolesForm.title = "人员配置";
393 } else this.$message.error({ message: res.message, showClose: true });
394 });
395 },
396 // 新增、修改角色
397 handleAddEdit (value) {
398 this.$refs.addEditDialog.menuType = this.menuType;
399 this.$refs.addEditDialog.roleId = value.id;
400 this.roleSort = value.sort ? value.sort : 0;
401 if (value.id) {
402 this.$refs.addEditDialog.dialogForm.roleName = value.name;
403 this.$refs.addEditDialog.dialogForm.roleType = value.type;
404 this.$refs.addEditDialog.dialogForm.roleTextArea = value.description;
405 }
406 this.$refs.addEditDialog.showAddEditDialog = true;
407 this.$refs.addEditDialog.dialogTitle = value.id ? "修改" : "新增";
408 },
409 // 上移下移
410 moveUpward (index, row) {
411 realMove(row.id, "UP", this.listdata);
412 this.key++;
413 let id = findParents(this.listdata, row.id);
414 this.keyList = id;
415 },
416 moveDown (index, row) {
417 realMove(row.id, "DOWN", this.listdata);
418 this.key++;
419 let id = findParents(this.listdata, row.id);
420 this.keyList = id;
421 },
422
423 // 删除
424 handleDelete: function (id, content = "") {
425 this.$confirm(
426 `<div class="customer-message-wrapper">
309 <h5 class="title">您确认要执行该操作用于以下信息:</h5> 427 <h5 class="title">您确认要执行该操作用于以下信息:</h5>
310 <p class="content" aria-controls="${content}">${content} 428 <p class="content" aria-controls="${content}">${content}
311 </p> 429 </p>
...@@ -313,47 +431,47 @@ export default { ...@@ -313,47 +431,47 @@ export default {
313 <span >无法恢复</span> 431 <span >无法恢复</span>
314 </p> 432 </p>
315 </div>`, 433 </div>`,
316 '执行确认', 434 "执行确认",
317 { 435 {
318 dangerouslyUseHTMLString: true, 436 dangerouslyUseHTMLString: true,
319 customClass: 'customer-delete', 437 customClass: "customer-delete",
320 confirmButtonText: '确定', 438 confirmButtonText: "确定",
321 cancelButtonText: '取消', 439 cancelButtonText: "取消",
322 type: 'warning' 440 type: "warning",
323 }
324 )
325 .then(() => {
326 if (!this.tableUrl) {
327 this.$message.error({
328 message: '请设置tableUrl属性为接口地址!',
329 showClose: true
330 })
331 return
332 } 441 }
333 const url = this.tableUrl + '/' + id 442 )
334 deleteAction(url).then(res => { 443 .then(() => {
335 if (res.status === 1) { 444 if (!this.tableUrl) {
336 this.$message.success({ message: res.message, showClose: true }) 445 this.$message.error({
337 this.getTableData() 446 message: "请设置tableUrl属性为接口地址!",
338 } else { 447 showClose: true,
339 this.$message.error({ message: res.message, showClose: true }) 448 });
449 return;
340 } 450 }
451 const url = this.tableUrl + "/" + id;
452 deleteAction(url).then((res) => {
453 if (res.status === 1) {
454 this.$message.success({ message: res.message, showClose: true });
455 this.getTableData();
456 } else {
457 this.$message.error({ message: res.message, showClose: true });
458 }
459 });
341 }) 460 })
342 }) 461 .catch(() => { });
343 .catch(() => {}) 462 },
344 },
345 // 新增回显 463 // 新增回显
346 reloadTableData() { 464 reloadTableData () {
347 this.getTableData() 465 this.getTableData();
466 },
348 }, 467 },
349 }, 468 };
350 };
351 </script> 469 </script>
352 <style scoped lang="scss"> 470 <style scoped lang="scss">
353 @import "~@/styles/mixin.scss"; 471 @import "~@/styles/mixin.scss";
354 @import "~@/styles/public.scss"; 472 @import "~@/styles/public.scss";
355 .btnColRight { 473 .btnColRight {
356 margin-left: -30px; 474 margin-left: -30px;
357 margin-top: 20px; 475 margin-top: 20px;
358 } 476 }
359 </style> 477 </style>
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
5 @click="close()" 5 @click="close()"
6 custom-class="dialogBox editDialogBox mainCenter" 6 custom-class="dialogBox editDialogBox mainCenter"
7 :visible.sync="visible" 7 :visible.sync="visible"
8 width="85%" 8 width="85%">
9 >
10 <div slot="title" class="dialog_title" ref="dialogTitle"> 9 <div slot="title" class="dialog_title" ref="dialogTitle">
11 {{ title || "标题" }} 10 {{ title || "标题" }}
12 </div> 11 </div>
...@@ -15,424 +14,595 @@ ...@@ -15,424 +14,595 @@
15 <el-tab-pane label="人员配置" name="first"></el-tab-pane> 14 <el-tab-pane label="人员配置" name="first"></el-tab-pane>
16 <el-tab-pane label="菜单配置" name="second"></el-tab-pane> 15 <el-tab-pane label="菜单配置" name="second"></el-tab-pane>
17 </el-tabs> 16 </el-tabs>
18 <!-- <div class="editDialogBox-box" v-if="activeName == 'first'"> -->
19 <lb-table 17 <lb-table
20 v-if="activeName == 'first'" 18 v-show="activeName == 'first'"
21 ref="multipleTable" 19 ref="multipleTable"
22 :pagination="false" 20 :pagination="false"
23 :column="usertableData.column" 21 :column="usertableData.column"
24 :data="usertableData.data" 22 :data="usertableData.data"
25 @selection-change="handleSelectionChange" 23 @selection-change="handleSelectionChange"
26 @row-click="handleClickTableRow" 24 @row-click="handleClickTableRow">
27 >
28 > 25 >
29 </lb-table> 26 </lb-table>
30 <!-- </div> --> 27 <lb-table
31 <!-- <div class="editDialogBox-box" v-else="activeName !== 'first'"> --> 28 :key="menukey"
32 <lb-table 29 v-show="activeName == 'second'"
33 v-else="activeName !== 'first'" 30 ref="multipleTable1"
34 :pagination="false" 31 :pagination="false"
35 :column="menutableData.columns" 32 :column="menutableData.column"
36 :data="menutableData" 33 :data="lastMenuList"
37 row-key="id" 34 row-key="id"
38 default-expand-all 35 default-expand-all
39 @selection-change="handleSelectionChanges" 36 :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
40 @row-click="handleClickTableRows"
41 :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
42 >
43 </lb-table> 37 </lb-table>
44 <!-- </div> -->
45 </div> 38 </div>
46 <template slot="footer"> 39 <template slot="footer">
47 <el-button type="primary" class="save" @click="handleSaveMember()" 40 <el-button type="primary" class="save" @click="handleSaveMember()">保存</el-button>
48 >保存</el-button
49 >
50 <el-button class="cancel-button" @click="close()">取消</el-button> 41 <el-button class="cancel-button" @click="close()">取消</el-button>
51 </template> 42 </template>
52 </el-dialog> 43 </el-dialog>
53 </template> 44 </template>
54 45
55 <script> 46 <script>
56 import { updateUser } from "@/api/quanxianmanagement"; 47 import { api } from "@/api/manageApi";
57 export default { 48 import { updateUser, getRoleAuthorityList, roleAuthority } from "@/api/quanxianmanagement";
58 name: "", 49 export default {
59 data() { 50 name: "",
60 return { 51 data () {
61 title: "人员配置", 52 return {
62 visible: false, 53 title: "人员配置",
63 menutableData: { 54 visible: false,
64 column: [ 55 menutableData: {
65 { 56 column: [
66 type: "selection", 57 {
67 }, 58 label: "序号",
68 { 59 type: "index",
69 prop: "name", 60 width: "50",
70 label: "菜单名称", 61 // index: this.indexMethod,
71 }, 62 },
72 ], 63 {
73 }, 64 prop: "name",
74 usertableData: { 65 width: 330,
75 column: [ 66 label: "菜单名称",
76 { 67 }
77 type: "selection", 68 ].concat([
78 }, 69 {
79 { 70 label: "权限",
80 prop: "name", 71 render: (h, scope) => {
81 label: "姓名", 72 return (
82 }, 73 <div>
83 { 74 <el-checkbox v-model={scope.row.checkArr[0].value}
84 prop: "loginName", 75 disabled={scope.row.checkArr[0].disabled}
85 label: "用户名", 76 label={scope.row.checkArr[0].name} onChange={(checked) => {
86 }, 77 this.changeCheck(checked, scope.row.checkArr[0].id, scope);
87 ], 78 }} />
88 }, 79 <el-checkbox v-model={scope.row.checkArr[1].value}
89 // 角色id 80 disabled={scope.row.checkArr[0].disabled}
90 roleId: "", 81 label={scope.row.checkArr[1].name}
91 activeName: "first", 82 onChange={(checked) => {
92 multipleSelection: [], 83 this.changeCheck(checked, scope.row.checkArr[1].id, scope);
93 }; 84 }} />
94 }, 85 </div>
95 computed: {}, 86 );
96 87 },
97 created() {}, 88 },
98 mounted() {}, 89 ]),
99 methods: { 90 },
100 91 usertableData: {
101 // 人员配置点击行勾选数据 92 column: [
102 handleClickTableRow(row, event) { 93 {
103 this.checkNum = 0; 94 type: "selection",
104 this.isCheck = false; 95 width: 330,
105 if (event.label == "操作") { 96 },
106 return; 97 {
107 } else { 98 prop: "name",
108 if (row.status == "0") { 99 width: 330,
100 label: "姓名",
101 },
102 {
103 prop: "loginName",
104 label: "用户名",
105 },
106 ],
107 data: []
108 },
109 // 角色id
110 roleId: "",
111 menuList: [], // 菜单列表
112 queryParam: {},
113 menukey: 0,
114 activeName: "first",
115 lastMenuList: [], // 重构完成的菜单表格数据
116 usermultipleSelection: [],
117 // 选中菜单列表
118 menumultipleSelection: [],
119 tableUrl: api.menus, // 菜单接口地址
120 meumurlid: api.subsystem,// 项目id接口地址
121 checkArr: [], // 重构操作符列表
122 authorityList: [], // 授权回显数组
123 checklistbor: [],
124 // 授权对象数据
125 menuprams: {},
126 // 系统code
127 selectedSubsystemCode: ""
128 };
129 },
130 computed: {},
131
132 created () {
133 },
134 mounted () {
135 },
136 methods: {
137
138 // 人员配置点击行勾选数据
139 handleClickTableRow (row, event) {
140 this.checkNum1 = 0;
141 this.isCheck1 = false;
142 if (event.label == "操作") {
109 return; 143 return;
110 } else { 144 } else {
111 if (this.multipleSelection.length > 0) { 145 if (row.status == "0") {
112 if ( 146 return;
113 JSON.stringify(this.multipleSelection).indexOf( 147 } else {
114 JSON.stringify(row) 148 if (this.usermultipleSelection.length > 0) {
115 ) == -1 149 if (
116 ) { 150 JSON.stringify(this.usermultipleSelection).indexOf(
117 this.multipleSelection.push(row); 151 JSON.stringify(row)
118 this.$refs.multipleTable.toggleRowSelection(row, true); 152 ) == -1
153 ) {
154 this.usermultipleSelection.push(row);
155 this.$refs.multipleTable.toggleRowSelection(row, true);
156 } else {
157 this.usermultipleSelection.map((item, index) => {
158 if (item.id == row.id) {
159 this.usermultipleSelection.splice(index, 1);
160 this.$refs.multipleTable.toggleRowSelection(row, false);
161 }
162 });
163 }
119 } else { 164 } else {
120 this.multipleSelection.map((item, index) => { 165 this.usermultipleSelection.push(row);
121 if (item.id == row.id) { 166 this.$refs.multipleTable.toggleRowSelection(row, true);
122 this.multipleSelection.splice(index, 1);
123 this.$refs.multipleTable.toggleRowSelection(row, false);
124 }
125 });
126 } 167 }
168 }
169 }
170 if (this.usermultipleSelection.length > 0) {
171 this.checkNum1 = this.usermultipleSelection.length;
172 this.isCheck1 = true;
173 } else {
174 this.isCheck1 = false;
175 }
176 },
177 // 获取授权主体的菜单权限
178 // getMenuAuthorityList
179 menulist (operationList, id, Code, menutablelistData, operationCodes) {
180 this.selectedSubsystemCode = Code
181 this.menuList = menutablelistData;
182 getRoleAuthorityList(
183 id,
184 operationList.toString(),
185 Code + '_MENU'
186 ).then(res => {
187 if (res.status === 1) {
188 this.authorityList = res.content
189 this.getRecursionTreeData(this.menuList, this.authorityList, operationCodes)
190 this.getAuthorizedInfo()
191 // this.setCheckAllArr()
192 // this.getAuthorizedInfo()
127 } else { 193 } else {
128 this.multipleSelection.push(row); 194 this.$message.error({ message: res.message, showClose: true })
129 this.$refs.multipleTable.toggleRowSelection(row, true);
130 } 195 }
196 })
197
198
199 },
200 /**
201 * 递归渲染列表数据
202 * list:原始数组
203 * authorityList:已授权数组
204 */
205 getRecursionTreeData (list, authorityList, operationCodes) {
206 ++this.menukey
207 this.checkArr = []
208 for (const k in operationCodes) {
209 const obj = {}
210 obj.name = operationCodes[k]
211 obj.id = k
212 obj.value = false
213 obj.disabled = false
214 // obj.isAll = false;
215 this.checkArr.push(obj)
131 } 216 }
132 } 217 for (const [index, item] of Object.entries(list)) {
133 if (this.multipleSelection.length > 0) { 218 this.setAuthorizedConditions(
134 this.checkNum = this.multipleSelection.length; 219 authorityList,
135 this.isCheck = true; 220 this.$deepCopy(this.checkArr),
136 } else { 221 item
137 this.isCheck = false; 222 )
138 } 223 if (
139 }, 224 item.children &&
140 // 菜单配置点击行勾选数据 225 item.children !== null &&
141 handleClickTableRow(row, event) { 226 item.children.length !== 0
142 this.checkNum = 0; 227 ) {
143 this.isCheck = false; 228 item.children.forEach((child, j) => {
144 if (event.label == "操作") { 229 this.setAuthorizedConditions(
145 return; 230 authorityList,
146 } else { 231 this.$deepCopy(this.checkArr),
147 if (row.status == "0") { 232 child
148 return; 233 )
234 })
235 this.getRecursionTreeData(item.children, authorityList, operationCodes)
236 }
237 }
238 this.lastMenuList = list
239 // this.setCheckAllArr(list)
240 },
241 // 授权条件
242 setAuthorizedConditions (authorityList, checkArr, item) {
243 if (this.roleId === '') {
244 checkArr.forEach(ele => {
245 ele.disabled = true
246 ele.value = false
247 })
149 } else { 248 } else {
150 if (this.multipleSelection.length > 0) { 249 if (authorityList.length !== 0) {
151 if ( 250 if (authorityList[0].superPermission === true) {
152 JSON.stringify(this.multipleSelection).indexOf( 251 checkArr.forEach(ele => {
153 JSON.stringify(row) 252 ele.value = true
154 ) == -1 253 ele.disabled = true
155 ) { 254 })
156 this.multipleSelection.push(row);
157 this.$refs.multipleTable.toggleRowSelection(row, true);
158 } else { 255 } else {
159 this.multipleSelection.map((item, index) => { 256 const repeatArr = authorityList.filter(authorityItem => {
160 if (item.id == row.id) { 257 return authorityItem.resourceUri === item.id
161 this.multipleSelection.splice(index, 1); 258 })
162 this.$refs.multipleTable.toggleRowSelection(row, false); 259 repeatArr.forEach(element => {
163 } 260 checkArr.forEach(ele => {
164 }); 261 if (element.operationCode === ele.id) {
262 ele.value = true
263 if (this.roleId !== element.subjectId) {
264 ele.disabled = true
265 }
266 }
267 })
268 })
165 } 269 }
166 } else {
167 this.multipleSelection.push(row);
168 this.$refs.multipleTable.toggleRowSelection(row, true);
169 } 270 }
170 } 271 }
171 } 272 this.$set(item, 'checkArr', this.$deepCopy(checkArr))
172 if (this.multipleSelection.length > 0) { 273 },
173 this.checkNum = this.multipleSelection.length; 274 // 获取拼接授权信息
174 this.isCheck = true; 275 getAuthorizedInfo () {
175 } else { 276 const lastArr = []
176 this.isCheck = false; 277 const authorizedList = []
177 } 278 const wholeArr = this.$deepCopy(this.lastMenuList)
178 }, 279 const arr = this.$treeConvertToArr(wholeArr)
179 // 获取人员列表做筛选 280 arr.forEach(ele => {
180 adds(a, rid) { 281 ele.checkArr.forEach(val => {
181 this.roleId = rid; 282 if (val.value === true && val.disabled === false) {
182 this.visible = true; 283 const obj = {
183 this.usertableData.data = a; 284 operationCode: val.id,
184 this.usertableData.data.forEach((item, index) => { 285 name: ele.name,
185 if (item.selectStatus === 0) { 286 id: ele.id
186 this.$nextTick(() => { 287 }
187 this.$refs.multipleTable.toggleRowSelection( 288 lastArr.push(obj)
188 this.usertableData.data[index], 289 }
189 true 290 })
190 ); 291 })
191 }); 292 lastArr.forEach(element => {
293 authorizedList.push({
294 operationCode: element.operationCode, // 标识符
295 productCode: this.selectedSubsystemCode, // 子系统code
296 resourceCategoryCode: this.selectedSubsystemCode + '_MENU', // 资源类别code默认为MENU
297 resourceName: element.name,
298 resourceUri: element.id, // 授权菜单id
299 subjectId: this.roleId, // 授权对象id
300 subjectType: 'ROLE' // 授权对象类别
301 })
302 })
303 this.menuprams = {
304 subjectId: this.roleId,
305 authorizedList: authorizedList
192 } 306 }
193 }); 307 },
194 }, 308 // 获取人员列表做筛选
195 // 关闭事件 309 personlist (a, rid) {
196 close() { 310 this.roleId = rid;
197 this.visible = false; 311 this.visible = true;
198 }, 312
199 // 保存事件 313 this.usertableData.data = a;
200 handleSaveMember() { 314 this.usertableData.data.forEach((item, index) => {
201 const idList = this.multipleSelection.map((item) => { 315 if (item.selectStatus === 0) {
202 return item.id; 316 this.$nextTick(() => {
203 }); 317 this.$refs.multipleTable.toggleRowSelection(
204 updateUser(this.roleId, idList).then((res) => { 318 this.usertableData.data[index],
205 if (res.status === 1) { 319 true
206 this.$message.success({ message: "保存成功", showClose: true }); 320 );
207 this.visible = false; 321 });
208 // this.$emit("setUsers", this.roleId); 322 }
209 // this.resetMemberConfig(); 323 });
210 } else this.$message.error({ message: res.message, showClose: true }); 324
211 }); 325 },
212 }, 326 // 关闭事件
213 // 勾选人员事件 327 close () {
214 handleSelectionChange(val) { 328 this.visible = false;
215 this.multipleSelection = val; 329 },
216 }, 330 // 保存事件
217 // 勾选菜单事件 331 handleSaveMember () {
218 handleSelectionChanges(val) { 332 // 人员授权
219 this.multipleSelection = val; 333 const idList = this.usermultipleSelection.map((item) => {
334 return item.id;
335 })
336 updateUser(this.roleId, idList).then((res) => {
337 if (res.status === 1) {
338 this.$message.success({ message: "保存成功", showClose: true });
339 this.visible = false;
340 } else this.$message.error({ message: res.message, showClose: true });
341 });
342 // 菜单授权
343 roleAuthority(
344 this.menuprams.subjectId,
345 this.menuprams.authorizedList
346 ).then((res) => {
347 if (res.status === 1) {
348 this.$message.success({
349 message: res.message,
350 })
351 // this.authorizedContChange()
352 } else {
353 this.$message.error({ message: res.message, showClose: true })
354 }
355 })
356 },
357 // 勾选人员事件
358 handleSelectionChange (val) {
359 this.usermultipleSelection = val;
360 },
361 // 数据筛选
362 setarrdata (scope, arr) {
363
364 arr.forEach((item, index, arr) => {
365 if (item.id == scope.row.id) {
366 this.checklistbor = [...arr]
367 } else if (item.id !== scope.row.id && item.children) {
368 this.setarrdata(scope, item.children)
369 }
370
371 })
372
373 },
374 // 勾选菜单事件
375 changeCheck (flag, checkId, scope) {
376 this.checklistbor = []
377 this.setarrdata(scope, this.lastMenuList)
378 const parents = this.$findParent(this.lastMenuList, scope.row.parentId)
379 const childs = this.$findChildren(this.lastMenuList, scope.row.id)
380 this.$setChildArr(
381 this.lastMenuList,
382 scope.row.id,
383 checkId,
384 flag,
385 this.checklistbor,
386 parents,
387 childs
388 )
389 this.getAuthorizedInfo()
390 },
220 }, 391 },
221 }, 392 };
222 };
223 </script> 393 </script>
224 <style scoped lang="scss"> 394 <style scoped lang="scss">
225 @import "~@/styles/mixin.scss"; 395 @import "~@/styles/mixin.scss";
226 @import "~@/styles/dialogBox.scss"; 396 @import "~@/styles/dialogBox.scss";
227 397
228 .editForm { 398 .editForm {
229 /deep/.el-textarea__inner { 399 /deep/.el-textarea__inner {
230 border: 1px solid #224c7c !important; 400 border: 1px solid #224c7c !important;
231 margin: 0 0 10px 0 !important; 401 margin: 0 0 10px 0 !important;
232 width: 100% !important; 402 width: 100% !important;
233 color: #dadde3 !important; 403 color: #dadde3 !important;
234 background: transparent !important; 404 background: transparent !important;
405 }
406
407 /deep/.el-input__inner {
408 border: 1px solid #224c7c !important;
409 margin: 0 !important;
410 width: 100% !important;
411 color: #dadde3 !important;
412 background: transparent !important;
413 }
235 } 414 }
236 415
237 /deep/.el-input__inner { 416 /deep/.el-dialog__body {
238 border: 1px solid #224c7c !important; 417 display: flex;
239 margin: 0 !important; 418 flex-direction: column;
240 width: 100% !important;
241 color: #dadde3 !important;
242 background: transparent !important;
243 } 419 }
244 }
245 420
246 /deep/.el-dialog__body { 421 /deep/ .el-tabs {
247 display: flex; 422 color: #cef8ff;
248 flex-direction: column; 423 }
249 }
250 424
251 /deep/ .el-tabs { 425 .sjmx {
252 color: #cef8ff; 426 /deep/.el-tabs__item {
253 } 427 height: 50px;
428 padding-top: 6px;
429 }
430 }
254 431
255 .sjmx {
256 /deep/.el-tabs__item { 432 /deep/.el-tabs__item {
257 height: 50px; 433 color: #cef8ff !important;
258 padding-top: 6px; 434
435 display: flex;
436 flex-direction: row;
437 justify-content: center;
438 background: url("~@/image/tabitem.png") no-repeat;
439 background-size: 100% 100%;
440 border: none !important;
259 } 441 }
260 } 442
261 443 .obligee-item-name {
262 /deep/.el-tabs__item { 444 background: #05275b;
263 color: #cef8ff !important; 445 color: #ffffff;
264 446 background: url("~@/image/itembg.png") no-repeat;
265 display: flex; 447 background-size: 100% 100%;
266 flex-direction: row;
267 justify-content: center;
268 background: url("~@/image/tabitem.png") no-repeat;
269 background-size: 100% 100%;
270 border: none !important;
271 }
272
273 .obligee-item-name {
274 background: #05275b;
275 color: #ffffff;
276 background: url("~@/image/itembg.png") no-repeat;
277 background-size: 100% 100%;
278 }
279
280 /deep/.el-tabs__nav-scroll {
281 background: none;
282 }
283
284 /deep/.el-tabs__nav {
285 display: flex;
286 border: none !important;
287 }
288
289 /deep/.el-tabs__item.is-top {
290 border: 1px solid #dfe4ed;
291 border-top: 1px solid #dfe4ed;
292 border-bottom: 1px solid transparent;
293 }
294
295 /deep/.el-tabs__header {
296 border: none;
297 margin-bottom: 0;
298 }
299
300 /deep/.el-tabs__item.is-top:not(:last-child) {
301 margin-right: 5px;
302 }
303
304 /deep/.el-tabs__item.is-top {
305 background-color: none !important;
306 }
307
308 /deep/.el-tabs__item.is-active {
309 background: url("~@/image/tabitemse.png") no-repeat;
310 background-size: 100% 100%;
311 }
312
313 .success-images {
314 width: 30px;
315 height: 30px;
316 position: relative;
317 top: 10px;
318 right: 3px;
319 }
320
321 .tab-pane-item {
322 line-height: 20px;
323 color: #02d9fd;
324
325 p {
326 text-align: center;
327 } 448 }
328 } 449
329 450 /deep/.el-tabs__nav-scroll {
330 .edit-content { 451 background: none;
331 height: 450px; 452 }
332 overflow-y: auto; 453
333 overflow-x: hidden; 454 /deep/.el-tabs__nav {
334 padding-right: 1px; 455 display: flex;
335 margin-bottom: 10px; 456 border: none !important;
336 border-top: none; 457 }
337 } 458
338 459 /deep/.el-tabs__item.is-top {
339 /deep/.editDialogBox { 460 border: 1px solid #dfe4ed;
340 border-radius: 8px; 461 border-top: 1px solid #dfe4ed;
341 overflow: hidden; 462 border-bottom: 1px solid transparent;
342 min-width: 1228px; 463 }
343 height: 825px !important; 464
344 465 /deep/.el-tabs__header {
345 .dialog-from { 466 border: none;
346 padding: 13px; 467 margin-bottom: 0;
347 border-radius: 2px; 468 }
348 box-sizing: border-box; 469
349 470 /deep/.el-tabs__item.is-top:not(:last-child) {
350 .el-row { 471 margin-right: 5px;
351 display: flex; 472 }
352 flex-wrap: nowrap; 473
474 /deep/.el-tabs__item.is-top {
475 background-color: none !important;
476 }
477
478 /deep/.el-tabs__item.is-active {
479 background: url("~@/image/tabitemse.png") no-repeat;
480 background-size: 100% 100%;
481 }
482
483 .success-images {
484 width: 30px;
485 height: 30px;
486 position: relative;
487 top: 10px;
488 right: 3px;
489 }
490
491 .tab-pane-item {
492 line-height: 20px;
493 color: #02d9fd;
494
495 p {
496 text-align: center;
353 } 497 }
498 }
354 499
355 .el-col { 500 .edit-content {
356 line-height: 18px; 501 height: 450px;
357 display: flex; 502 overflow-y: auto;
358 align-items: center; 503 overflow-x: hidden;
359 margin-bottom: 3px; 504 padding-right: 1px;
360 color: #b5d6dc; 505 margin-bottom: 10px;
506 border-top: none;
507 }
508
509 /deep/.editDialogBox {
510 border-radius: 8px;
511 overflow: hidden;
512 min-width: 1228px;
513 height: 825px !important;
514
515 .dialog-from {
516 padding: 13px;
361 border-radius: 2px; 517 border-radius: 2px;
362 border: 1px solid #224c7c; 518 box-sizing: border-box;
363 margin: 5px; 519
364 520 .el-row {
365 span { 521 display: flex;
366 display: inline-block; 522 flex-wrap: nowrap;
367 padding: 3px;
368 border-radius: 3px;
369 overflow: hidden;
370 white-space: nowrap;
371 text-align: left;
372 color: #02d9fd;
373 } 523 }
374 524
375 p { 525 .el-col {
376 flex: 1; 526 line-height: 18px;
377 width: 100%; 527 display: flex;
378 padding-left: 5px; 528 align-items: center;
379 line-height: 20px; 529 margin-bottom: 3px;
380 color: #c0c4cc; 530 color: #b5d6dc;
381 cursor: not-allowed; 531 border-radius: 2px;
382 white-space: nowrap; 532 border: 1px solid #224c7c;
383 margin-right: 5px; 533 margin: 5px;
384 text-align: right; 534
535 span {
536 display: inline-block;
537 padding: 3px;
538 border-radius: 3px;
539 overflow: hidden;
540 white-space: nowrap;
541 text-align: left;
542 color: #02d9fd;
543 }
544
545 p {
546 flex: 1;
547 width: 100%;
548 padding-left: 5px;
549 line-height: 20px;
550 color: #c0c4cc;
551 cursor: not-allowed;
552 white-space: nowrap;
553 margin-right: 5px;
554 text-align: right;
555 }
385 } 556 }
386 } 557 }
387 }
388 558
389 .dialog_title { 559 .dialog_title {
390 display: flex; 560 display: flex;
391 position: relative; 561 position: relative;
392 font-size: 24px; 562 font-size: 24px;
393 top: -11px; 563 top: -11px;
394 width: 38%; 564 width: 38%;
395 height: 40px; 565 height: 40px;
396 margin-left: 28px; 566 margin-left: 28px;
397 justify-content: center; 567 justify-content: center;
398 } 568 }
399 569
400 .el-dialog__header { 570 .el-dialog__header {
401 display: flex; 571 display: flex;
402 margin-bottom: 15px; 572 margin-bottom: 15px;
403 } 573 }
404 574
405 .dialog_footer { 575 .dialog_footer {
406 flex-direction: column; 576 flex-direction: column;
407 577
408 .dialog_button { 578 .dialog_button {
409 margin-top: 8px; 579 margin-top: 8px;
580 }
410 } 581 }
411 }
412 582
413 .divider { 583 .divider {
414 width: 100%; 584 width: 100%;
415 border-bottom: 1px solid #ccc; 585 border-bottom: 1px solid #ccc;
586 }
416 } 587 }
417 } 588
418 589 .el-dialog__wrapper {
419 .el-dialog__wrapper { 590 overflow: hidden;
420 overflow: hidden;
421 }
422 /deep/.el-table {
423 background: none;
424 th.el-table__cell {
425 background-color: #073781;
426 color: #02d9fd;
427 } 591 }
428 tr { 592 /deep/.el-table {
429 background: none; 593 background: none;
594 th.el-table__cell {
595 background-color: #073781;
596 color: #02d9fd;
597 }
598 tr {
599 background: none;
430 600
431 td { 601 td {
432 color: white; 602 color: white;
603 }
433 } 604 }
434 } 605 }
435 }
436 606
437 // #08346F !important; 607 // #08346F !important;
438 </style> 608 </style>
......