a25db879 by 任超

style:code配置化的完成

1 parent c7c6dddb
1 { 1 {
2 "TITLE": "汉中市数据上报系统", 2 "TITLE": "汉中市数据上报系统",
3 "THEME": "sb", 3 "THEME": "sb",
4 "CODE": "BDCSBPT",
4 "SERVERAPI": "/bdcsjsb", 5 "SERVERAPI": "/bdcsjsb",
5 "MANAGEMENTAPI": "http://192.168.2.38:8090/management" 6 "MANAGEMENTAPI": "http://192.168.2.38:8090/management"
6 } 7 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-23 16:37:20 4 * @LastEditTime: 2023-03-24 16:59:29
5 */ 5 */
6 import Vue from 'vue' 6 import Vue from 'vue'
7 import router from "./router"; 7 import router from "./router";
...@@ -25,7 +25,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -25,7 +25,7 @@ router.beforeEach(async (to, from, next) => {
25 localStorage.removeItem("token"); 25 localStorage.removeItem("token");
26 next(); 26 next();
27 } else { 27 } else {
28 let code = Vue.prototype.BASE_API.THEME == "sb" ? "BDCSBPT" : "BDCJGPT" 28 let code = Vue.prototype.BASE_API.CODE
29 //判断token是否存在 29 //判断token是否存在
30 const hasToken = localStorage.getItem("token"); 30 const hasToken = localStorage.getItem("token");
31 if (hasToken) { 31 if (hasToken) {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
22 </div> 22 </div>
23 </template> 23 </template>
24 <script> 24 <script>
25 import { getMenuInfo } from "@/api/user";
26 import { loginIn } from "@/api/login.js"; 25 import { loginIn } from "@/api/login.js";
27 export default { 26 export default {
28 name: "jgLogin", 27 name: "jgLogin",
......
...@@ -108,7 +108,7 @@ export default { ...@@ -108,7 +108,7 @@ export default {
108 if (valid) { 108 if (valid) {
109 let res = await loginIn(self.user.account, self.user.password) 109 let res = await loginIn(self.user.account, self.user.password)
110 if (res.status == 1) { 110 if (res.status == 1) {
111 let code = this.BASE_API.THEME == "sb" ? "BDCSBPT" : "BDCJGPT" 111 let code = this.BASE_API.CODE;
112 localStorage.setItem("token", `Bearer ${res.content}`); 112 localStorage.setItem("token", `Bearer ${res.content}`);
113 const { result: getMenuData } = (await getMenuInfo(code)) || []; 113 const { result: getMenuData } = (await getMenuInfo(code)) || [];
114 let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path 114 let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path
......
...@@ -29,181 +29,181 @@ ...@@ -29,181 +29,181 @@
29 </div> 29 </div>
30 </template> 30 </template>
31 <script> 31 <script>
32 // 定时任务 32 // 定时任务
33 import data from "./data"; 33 import data from "./data";
34 import { deleteAction, getAction, api } from "@/api/manageApi"; 34 import { deleteAction, getAction, api } from "@/api/manageApi";
35 import EditDialog from "./edit-dialog.vue"; 35 import EditDialog from "./edit-dialog.vue";
36 import { mapGetters } from "vuex"; 36 import { mapGetters } from "vuex";
37 import { getMenuInfo } from "@/api/user"; 37 import { getMenuInfo } from "@/api/user";
38 import { 38 import {
39 getUuid, 39 getUuid,
40 judgeSort, 40 judgeSort,
41 realMove, 41 realMove,
42 findParents, 42 findParents,
43 removeTreeListItem, 43 removeTreeListItem,
44 } from "@/utils/operation"; 44 } from "@/utils/operation";
45 export default { 45 export default {
46 name: "menus", 46 name: "menus",
47 components: { 47 components: {
48 EditDialog, 48 EditDialog,
49 }, 49 },
50 data () { 50 data () {
51 return { 51 return {
52 isDialog: false, 52 isDialog: false,
53 tablelistData: [], 53 tablelistData: [],
54 listData: [], 54 listData: [],
55 resourceCategoryId: "", 55 resourceCategoryId: "",
56 taskData: null, 56 taskData: null,
57 form: { 57 form: {
58 menuName: "", 58 menuName: "",
59 }, 59 },
60 title: "", 60 title: "",
61 queryParam: {}, 61 queryParam: {},
62 selectType: "0", 62 selectType: "0",
63 queryName: "", 63 queryName: "",
64 organizationId: "", // 组织机构ID 64 organizationId: "", // 组织机构ID
65 departmentId: "", // 部门ID 65 departmentId: "", // 部门ID
66 departmentList: [], // 部门列表 66 departmentList: [], // 部门列表
67 levelList: [], // 职务级别 67 levelList: [], // 职务级别
68 sexList: [], 68 sexList: [],
69 69
70 selectionList: [], 70 selectionList: [],
71 tableData: { 71 tableData: {
72 columns: [].concat(data.columns()).concat([ 72 columns: [].concat(data.columns()).concat([
73 { 73 {
74 label: "操作", 74 label: "操作",
75 width: 380, 75 width: 380,
76 render: (h, scope) => { 76 render: (h, scope) => {
77 return ( 77 return (
78 <div> 78 <div>
79 <el-button 79 <el-button
80 type="text" 80 type="text"
81 class='successColor' 81 class='successColor'
82 onClick={() => { 82 onClick={() => {
83 this.handleEdit(scope.row); 83 this.handleEdit(scope.row);
84 }} 84 }}
85 > 85 >
86 修改 86 修改
87 </el-button> 87 </el-button>
88 88
89 <el-button 89 <el-button
90 type="text" 90 type="text"
91 class='delColor' 91 class='delColor'
92 onClick={() => { 92 onClick={() => {
93 this.handleDelete(scope.row.id, scope.row.name); 93 this.handleDelete(scope.row.id, scope.row.name);
94 }} 94 }}
95 > 95 >
96 删除 96 删除
97 </el-button> 97 </el-button>
98 </div> 98 </div>
99 ); 99 );
100 },
101 }, 100 },
102 ]), 101 },
103 data: [], 102 ]),
104 }, 103 data: [],
105 tableUrl: api.menus, // 菜单接口地址
106 meumurlid: api.subsystem,// 项目id接口地址
107 productId: ""//项目id
108 };
109 },
110 created () {
111 this.getTableList();
112 },
113 computed: {
114 ...mapGetters(["products"])
115 },
116 methods: {
117 //查询
118 searchQuery () {
119 if (this.form.menuName) {
120 this.tablelistData = this.childrenFn(this.listData, this.form.menuName);
121 } else {
122 this.getTableList()
123 }
124 }, 104 },
125 childrenFn (arr, key) { 105 tableUrl: api.menus, // 菜单接口地址
126 const that = this; 106 meumurlid: api.subsystem,// 项目id接口地址
127 let searchTree = []; 107 productId: ""//项目id
128 arr.forEach((item, index) => { 108 };
129 if (item.children != undefined && item.children.length != 0) { 109 },
130 let leaf = that.childrenFn(item.children, key); 110 created () {
131 if (leaf != undefined) { 111 this.getTableList();
132 let { name, code, resourceCategoryId, id, iproductId, operations, metadata } = item; 112 },
133 let parentObj = { 113 computed: {
134 code, name, resourceCategoryId, id, iproductId, operations, metadata, children: leaf 114 ...mapGetters(["products"])
135 }; 115 },
136 searchTree.push(parentObj); 116 methods: {
137 } else { 117 //查询
138 if (item.name.indexOf(key) != -1) { 118 searchQuery () {
139 searchTree.push(item); 119 if (this.form.menuName) {
140 } 120 this.tablelistData = this.childrenFn(this.listData, this.form.menuName);
141 } 121 } else {
122 this.getTableList()
123 }
124 },
125 childrenFn (arr, key) {
126 const that = this;
127 let searchTree = [];
128 arr.forEach((item, index) => {
129 if (item.children != undefined && item.children.length != 0) {
130 let leaf = that.childrenFn(item.children, key);
131 if (leaf != undefined) {
132 let { name, code, resourceCategoryId, id, iproductId, operations, metadata } = item;
133 let parentObj = {
134 code, name, resourceCategoryId, id, iproductId, operations, metadata, children: leaf
135 };
136 searchTree.push(parentObj);
142 } else { 137 } else {
143 if (item.name.indexOf(key) != -1) { 138 if (item.name.indexOf(key) != -1) {
144
145 searchTree.push(item); 139 searchTree.push(item);
146 } 140 }
147 } 141 }
148 }); 142 } else {
149 if (searchTree != undefined && searchTree.length != 0) { 143 if (item.name.indexOf(key) != -1) {
150 return searchTree; 144
151 } 145 searchTree.push(item);
152 },
153 // 加载表格数据
154 getTableList () {
155 getMenuInfo(sessionStorage.getItem("products")).then((res) => {
156 if (res.code === 200) {
157 this.tablelistData = judgeSort(res.result)
158 this.listData = this.tablelistData
159 } else {
160 this.$message.error({ message: res.message, showClose: true })
161 } 146 }
162 }) 147 }
163 const queryOptionsid = { 148 });
164 conditionGroup: { 149 if (searchTree != undefined && searchTree.length != 0) {
165 queryRelation: "AND", 150 return searchTree;
166 conditions: [ 151 }
167 { 152 },
168 property: "code", 153 // 加载表格数据
169 value: sessionStorage.getItem("products"), 154 getTableList () {
170 operator: "EQ", 155 getMenuInfo(this.BASE_API.CODE).then((res) => {
171 }, 156 if (res.code === 200) {
172 ], 157 this.tablelistData = judgeSort(res.result)
173 }, 158 this.listData = this.tablelistData
174 }; 159 } else {
175 const params = { 160 this.$message.error({ message: res.message, showClose: true })
176 queryOptions: queryOptionsid, 161 }
177 }; 162 })
178 // 获取系统id 163 const queryOptionsid = {
179 getAction(this.meumurlid, params) 164 conditionGroup: {
180 .then((res) => { 165 queryRelation: "AND",
181 this.productId = res.content[0].id; 166 conditions: [
182 this.getAuthorityList(res.content[0].id, res.content[0].code) 167 {
183 this.selectedSubsystemCode = res.content[0].code 168 property: "code",
169 value: sessionStorage.getItem("products"),
170 operator: "EQ",
171 },
172 ],
173 },
174 };
175 const params = {
176 queryOptions: queryOptionsid,
177 };
178 // 获取系统id
179 getAction(this.meumurlid, params)
180 .then((res) => {
181 this.productId = res.content[0].id;
182 this.getAuthorityList(res.content[0].id, res.content[0].code)
183 this.selectedSubsystemCode = res.content[0].code
184 184
185 }) 185 })
186 .catch((error) => { 186 .catch((error) => {
187 console.log("er", error); 187 console.log("er", error);
188 }) 188 })
189 }, 189 },
190 // 新增菜单 190 // 新增菜单
191 handleAdd () { 191 handleAdd () {
192 this.isDialog = true 192 this.isDialog = true
193 this.$refs.dialogForm.add(); 193 this.$refs.dialogForm.add();
194 this.$refs.dialogForm.title = "新增"; 194 this.$refs.dialogForm.title = "新增";
195 }, 195 },
196 196
197 // 修改 197 // 修改
198 handleEdit (record) { 198 handleEdit (record) {
199 this.isDialog = true 199 this.isDialog = true
200 this.$refs.dialogForm.edit(record); 200 this.$refs.dialogForm.edit(record);
201 this.$refs.dialogForm.title = "修改"; 201 this.$refs.dialogForm.title = "修改";
202 }, 202 },
203 // 删除 203 // 删除
204 handleDelete (id, content) { 204 handleDelete (id, content) {
205 this.$confirm( 205 this.$confirm(
206 `<div class="customer-message-wrapper"> 206 `<div class="customer-message-wrapper">
207 <h5 class="title">您确认要执行该操作用于以下信息:</h5> 207 <h5 class="title">您确认要执行该操作用于以下信息:</h5>
208 <p class="content" aria-controls="${content}">${content} 208 <p class="content" aria-controls="${content}">${content}
209 </p> 209 </p>
...@@ -211,48 +211,48 @@ ...@@ -211,48 +211,48 @@
211 <span >无法恢复</span> 211 <span >无法恢复</span>
212 </p> 212 </p>
213 </div>`, 213 </div>`,
214 '执行确认', 214 '执行确认',
215 { 215 {
216 dangerouslyUseHTMLString: true, 216 dangerouslyUseHTMLString: true,
217 customClass: 'customer-delete', 217 customClass: 'customer-delete',
218 confirmButtonText: '确定', 218 confirmButtonText: '确定',
219 cancelButtonText: '取消', 219 cancelButtonText: '取消',
220 type: 'warning' 220 type: 'warning'
221 }
222 )
223 .then(() => {
224 if (!this.tableUrl) {
225 this.$message.error({
226 message: '请设置tableUrl属性为接口地址!',
227 showClose: true
228 })
229 return
221 } 230 }
222 ) 231 const url = this.tableUrl + '/' + id
223 .then(() => { 232 deleteAction(url).then(res => {
224 if (!this.tableUrl) { 233 if (res.status === 1) {
225 this.$message.error({ 234 this.$message.success({ message: res.message, showClose: true })
226 message: '请设置tableUrl属性为接口地址!', 235 this.reloadTableData()
227 showClose: true 236 } else {
228 }) 237 this.$message.error({ message: res.message, showClose: true })
229 return
230 } 238 }
231 const url = this.tableUrl + '/' + id
232 deleteAction(url).then(res => {
233 if (res.status === 1) {
234 this.$message.success({ message: res.message, showClose: true })
235 this.reloadTableData()
236 } else {
237 this.$message.error({ message: res.message, showClose: true })
238 }
239 })
240 }) 239 })
241 .catch(() => { }) 240 })
242 }, 241 .catch(() => { })
243 // 新增、编辑回显 242 },
244 reloadTableData () { 243 // 新增、编辑回显
245 this.getTableList() 244 reloadTableData () {
246 }, 245 this.getTableList()
247 }, 246 },
248 }; 247 },
248 };
249 </script> 249 </script>
250 <style scoped lang="scss"> 250 <style scoped lang="scss">
251 @import "~@/styles/mixin.scss"; 251 @import "~@/styles/mixin.scss";
252 252
253 // @import "~@/styles/public.scss"; 253 // @import "~@/styles/public.scss";
254 254
255 /deep/.el-table__expand-icon { 255 /deep/.el-table__expand-icon {
256 color: #fff; 256 color: #fff;
257 } 257 }
258 </style> 258 </style>
......
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
19 </el-form> 19 </el-form>
20 </div> 20 </div>
21 <div class="from-clues-content"> 21 <div class="from-clues-content">
22 <lb-table :pagination="false" @size-change="handleSizeChange" :calcHeight="200" @p-current-change="handleCurrentChange" 22 <lb-table :pagination="false" @size-change="handleSizeChange" :calcHeight="200"
23 :column="tableData.columns" :data="listdata" :expand-row-keys="keyList" row-key="dictid"> 23 @p-current-change="handleCurrentChange" :column="tableData.columns" :data="listdata" :expand-row-keys="keyList"
24 row-key="dictid">
24 </lb-table> 25 </lb-table>
25 </div> 26 </div>
26 <EditDialog ref="addEditDialog" v-model="isDialog" @ok="reloadTableData" /> 27 <EditDialog ref="addEditDialog" v-model="isDialog" @ok="reloadTableData" />
...@@ -28,439 +29,439 @@ ...@@ -28,439 +29,439 @@
28 </div> 29 </div>
29 </template> 30 </template>
30 <script> 31 <script>
31 import { 32 import {
32 getUuid, 33 getUuid,
33 judgeSort, 34 judgeSort,
34 realMove, 35 realMove,
35 findParents, 36 findParents,
36 removeTreeListItem, 37 removeTreeListItem,
37 } from "@/utils/operation"; 38 } from "@/utils/operation";
38 import { getRolesById, getAuthorityListAction } from "@/api/authorityManage"; 39 import { getRolesById, getAuthorityListAction } from "@/api/authorityManage";
39 import { getUserRoles } from "@/api/personnelManage"; 40 import { getUserRoles } from "@/api/personnelManage";
40 import data from "./data"; 41 import data from "./data";
41 import { getMenuInfo } from "@/api/user"; 42 import { getMenuInfo } from "@/api/user";
42 import { api, getAction, deleteAction } from "@/api/manageApi"; 43 import { api, getAction, deleteAction } from "@/api/manageApi";
43 import tableMixin from "@/mixins/tableMixin.js"; 44 import tableMixin from "@/mixins/tableMixin.js";
44 import EditDialog from "./edit-dialog.vue"; 45 import EditDialog from "./edit-dialog.vue";
45 import Roleslistdiglog from "./roleslistdiglog.vue"; 46 import Roleslistdiglog from "./roleslistdiglog.vue";
46 import { mapGetters } from "vuex"; 47 import { mapGetters } from "vuex";
47 import { updateOrder } from "@/api/orders" 48 import { updateOrder } from "@/api/orders"
48 export default { 49 export default {
49 name: "menus", 50 name: "menus",
50 mixins: [tableMixin], 51 mixins: [tableMixin],
51 components: { 52 components: {
52 EditDialog, 53 EditDialog,
53 Roleslistdiglog, 54 Roleslistdiglog,
54 }, 55 },
55 data () { 56 data () {
56 return { 57 return {
57 isDialog: false, 58 isDialog: false,
58 personlist: null, 59 personlist: null,
59 waitMemberList: [], 60 waitMemberList: [],
60 keyList: [], 61 keyList: [],
61 listdata: [], 62 listdata: [],
62 setlistdata: [], 63 setlistdata: [],
63 tableUrlroles: api.roles, 64 tableUrlroles: api.roles,
64 form: { 65 form: {
65 rolesName: "", 66 rolesName: "",
67 },
68 // 当前所选角色id
69 roleId: "",
70 title: "",
71 queryParam: {},
72 multipleSelection: [],
73 // 菜单列表
74 menutablelistData: [],
75 tableUrl: api.menus, // 菜单接口地址
76 meumurlid: api.subsystem, // 项目id接口地址
77 selectType: "0",
78 queryName: "",
79 organizationId: "", // 组织机构ID
80 departmentId: "", // 部门ID
81 departmentList: [], // 部门列表
82 levelList: [], // 职务级别
83 sexList: [],
84 operationCodes: null, // 操作符对象
85 operationList: [], // 获取授权列表需要提交的操作符数组
86 typeOptions: [
87 {
88 value: "0",
89 label: "姓名",
66 }, 90 },
67 // 当前所选角色id 91 {
68 roleId: "", 92 value: "1",
69 title: "", 93 label: "工号",
70 queryParam: {}, 94 },
71 multipleSelection: [], 95 {
72 // 菜单列表 96 value: "2",
73 menutablelistData: [], 97 label: "部门",
74 tableUrl: api.menus, // 菜单接口地址 98 },
75 meumurlid: api.subsystem, // 项目id接口地址 99 {
76 selectType: "0", 100 value: "3",
77 queryName: "", 101 label: "机构",
78 organizationId: "", // 组织机构ID 102 },
79 departmentId: "", // 部门ID 103 ],
80 departmentList: [], // 部门列表 104
81 levelList: [], // 职务级别 105 selectionList: [],
82 sexList: [], 106 tableData: {
83 operationCodes: null, // 操作符对象 107 columns: [
84 operationList: [], // 获取授权列表需要提交的操作符数组
85 typeOptions: [
86 {
87 value: "0",
88 label: "姓名",
89 },
90 {
91 value: "1",
92 label: "工号",
93 },
94 {
95 value: "2",
96 label: "部门",
97 },
98 { 108 {
99 value: "3", 109 label: "序号",
100 label: "机构", 110 type: "index",
111 width: "50",
112 index: this.indexMethod,
101 }, 113 },
102 ], 114 ]
103 115 .concat(data.columns())
104 selectionList: [], 116 .concat([
105 tableData: {
106 columns: [
107 { 117 {
108 label: "序号", 118 label: "排序",
109 type: "index", 119 width: 300,
110 width: "50", 120 render: (h, scope) => {
111 index: this.indexMethod, 121 return (
122 <div>
123 <el-button
124 type="text"
125 class='movebtnColor'
126 disabled={scope.row.isTop}
127 onClick={() => {
128 this.updateOrder(scope.row, 'TOP');
129 }}
130 >
131 置顶
132 </el-button>
133 <el-button
134 type="text"
135 class='movebtnColor'
136 disabled={scope.row.isTop}
137 onClick={() => {
138 this.updateOrder(scope.row, 'UP');
139 }}
140 >
141 上移
142 </el-button>
143 <el-button
144 type="text"
145 class='movebtnColor'
146 disabled={scope.row.isBottom}
147 onClick={() => {
148 this.updateOrder(scope.row, 'DOWN');
149 }}
150 >
151 下移
152 </el-button>
153 <el-button
154 type="text"
155 class='movebtnColor'
156 disabled={scope.row.isBottom}
157 onClick={() => {
158 this.updateOrder(scope.row, 'BOTTOM');
159 }}
160 >
161 置底
162 </el-button>
163 </div>
164 );
165 },
112 }, 166 },
113 ] 167 ])
114 .concat(data.columns()) 168 .concat([
115 .concat([ 169 {
116 { 170 label: "操作",
117 label: "排序", 171 width: 280,
118 width: 300, 172 render: (h, scope) => {
119 render: (h, scope) => { 173 return (
120 return ( 174 <div>
121 <div> 175 <el-tooltip
122 <el-button 176 class="item"
123 type="text" 177 effect="dark"
124 class='movebtnColor' 178 disabled={scope.row.type !== "Everyone"}
125 disabled={scope.row.isTop} 179 content="没有点击的权限"
126 onClick={() => { 180 placement="top"
127 this.updateOrder(scope.row, 'TOP'); 181 >
128 }} 182 <span>
129 > 183 <el-button
130 置顶 184 disabled={scope.row.type === "Everyone"}
131 </el-button> 185 type="text"
132 <el-button 186 size="mini"
133 type="text" 187 class="configurationbtnColor"
134 class='movebtnColor' 188 onClick={() => {
135 disabled={scope.row.isTop} 189 this.getList(scope.row);
136 onClick={() => { 190 }}
137 this.updateOrder(scope.row, 'UP'); 191 >
138 }} 192 配置
139 > 193 </el-button>
140 上移 194 </span>
141 </el-button> 195 </el-tooltip>
142 <el-button 196 <el-tooltip
143 type="text" 197 class="item"
144 class='movebtnColor' 198 effect="dark"
145 disabled={scope.row.isBottom} 199 disabled={scope.row.category !== 1}
146 onClick={() => { 200 content="系统内置角色 不允许修改"
147 this.updateOrder(scope.row, 'DOWN'); 201 placement="top"
148 }} 202 >
149 > 203 <span>
150 下移 204 <el-button
151 </el-button> 205 disabled={scope.row.category === 1}
152 <el-button 206 type="text"
153 type="text" 207 size="mini"
154 class='movebtnColor' 208 class='successColor'
155 disabled={scope.row.isBottom} 209 onClick={() => {
156 onClick={() => { 210 this.handleAddEdit(scope.row);
157 this.updateOrder(scope.row, 'BOTTOM'); 211 }}
158 }} 212 >
159 > 213 修改
160 置底 214 </el-button>
161 </el-button> 215 </span>
162 </div> 216 </el-tooltip>
163 ); 217 <el-tooltip
164 }, 218 class="item"
219 effect="dark"
220 disabled={scope.row.category !== 1}
221 content="系统内置角色 不允许删除"
222 placement="top"
223 >
224 <span>
225 <el-button
226 type="text"
227 disabled={scope.row.category === 1}
228 size="mini"
229 class='delColor'
230 // style="color:#F56C6C"
231 onClick={() => {
232 this.handleDelete(scope.row.id, scope.row.name);
233 }}
234 >
235 删除
236 </el-button>
237 </span>
238 </el-tooltip>
239 </div>
240 );
165 }, 241 },
166 ])
167 .concat([
168 {
169 label: "操作",
170 width: 280,
171 render: (h, scope) => {
172 return (
173 <div>
174 <el-tooltip
175 class="item"
176 effect="dark"
177 disabled={scope.row.type !== "Everyone"}
178 content="没有点击的权限"
179 placement="top"
180 >
181 <span>
182 <el-button
183 disabled={scope.row.type === "Everyone"}
184 type="text"
185 size="mini"
186 class="configurationbtnColor"
187 onClick={() => {
188 this.getList(scope.row);
189 }}
190 >
191 配置
192 </el-button>
193 </span>
194 </el-tooltip>
195 <el-tooltip
196 class="item"
197 effect="dark"
198 disabled={scope.row.category !== 1}
199 content="系统内置角色 不允许修改"
200 placement="top"
201 >
202 <span>
203 <el-button
204 disabled={scope.row.category === 1}
205 type="text"
206 size="mini"
207 class='successColor'
208 onClick={() => {
209 this.handleAddEdit(scope.row);
210 }}
211 >
212 修改
213 </el-button>
214 </span>
215 </el-tooltip>
216 <el-tooltip
217 class="item"
218 effect="dark"
219 disabled={scope.row.category !== 1}
220 content="系统内置角色 不允许删除"
221 placement="top"
222 >
223 <span>
224 <el-button
225 type="text"
226 disabled={scope.row.category === 1}
227 size="mini"
228 class='delColor'
229 // style="color:#F56C6C"
230 onClick={() => {
231 this.handleDelete(scope.row.id, scope.row.name);
232 }}
233 >
234 删除
235 </el-button>
236 </span>
237 </el-tooltip>
238 </div>
239 );
240 },
241 242
242 }]), 243 }]),
243 }, 244 },
244 data: [], 245 data: [],
246 }
247 },
248 created () {
249 this.getTableData();
250 this.getTableList()
251 },
252 computed: {
253 ...mapGetters(["products"])
254 },
255 mounted () { },
256 methods: {
257 //查询
258 searchQuery () {
259 if (this.form.rolesName) {
260 this.listdata = this.childrenFn(this.setlistdata, this.form.rolesName);
261 } else {
262 this.getTableData()
245 } 263 }
246 }, 264 },
247 created () { 265 childrenFn (arr, key) {
248 this.getTableData(); 266 let searchTree = [];
249 this.getTableList() 267 arr.forEach((item, index) => {
268 if (item.name.indexOf(key) != -1) {
269
270 searchTree.push(item);
271 }
272 });
273 if (searchTree != undefined && searchTree.length != 0) {
274 return judgeSort(searchTree);
275 }
250 }, 276 },
251 computed: { 277 // 获取角色列表
252 ...mapGetters(["products"]) 278 getTableData () {
279 getRolesById([1, 2])
280 .then((res) => {
281 this.listdata = res.content;
282 this.listdata = judgeSort(this.listdata);
283 this.setlistdata = res.content;
284 })
285 .catch((e) => console.error(e));
253 }, 286 },
254 mounted () { },
255 methods: {
256 //查询
257 searchQuery () {
258 if (this.form.rolesName) {
259 this.listdata = this.childrenFn(this.setlistdata, this.form.rolesName);
260 } else {
261 this.getTableData()
262 }
263 },
264 childrenFn (arr, key) {
265 let searchTree = [];
266 arr.forEach((item, index) => {
267 if (item.name.indexOf(key) != -1) {
268 287
269 searchTree.push(item); 288 // 获取菜单列表
270 } 289 getTableList () {
271 }); 290 getMenuInfo(this.BASE_API.CODE).then((res) => {
272 if (searchTree != undefined && searchTree.length != 0) { 291 if (res.code === 200) {
273 return judgeSort(searchTree); 292 this.menutablelistData = judgeSort(res.result)
293 } else {
294 this.$message.error({ message: res.message, showClose: true })
274 } 295 }
275 }, 296 })
276 // 获取角色列表 297 const queryOptionsid = {
277 getTableData () { 298 conditionGroup: {
278 getRolesById([1, 2]) 299 queryRelation: "AND",
279 .then((res) => { 300 conditions: [
280 this.listdata = res.content; 301 {
281 this.listdata = judgeSort(this.listdata); 302 property: "code",
282 this.setlistdata = res.content; 303 value: this.products,
283 }) 304 operator: "EQ",
284 .catch((e) => console.error(e)); 305 },
285 }, 306 ],
286 307 },
287 // 获取菜单列表 308 };
288 getTableList () { 309 const params = {
289 getMenuInfo(sessionStorage.getItem("products")).then((res) => { 310 queryOptions: queryOptionsid,
290 if (res.code === 200) { 311 };
291 this.menutablelistData = judgeSort(res.result) 312 // 获取系统id
292 } else { 313 getAction(this.meumurlid, params)
293 this.$message.error({ message: res.message, showClose: true }) 314 .then((res) => {
294 } 315 this.productId = res.content[0].id;
316 this.getAuthorityList(res.content[0].id, res.content[0].code)
317 this.selectedSubsystemCode = res.content[0].code
318 // let queryOptions = {
319 // conditionGroup: {
320 // conditions: [
321 // {
322 // property: "productId",
323 // value: this.productId,
324 // operator: "EQ",
325 // },
326 // ],
327 // queryRelation: "AND",
328 // },
329 // orderBys: [{ property: "sort", direction: "desc" }],
330 // };
331 // if (!this.tableUrl) {
332 // console.log("请设置tableUrl属性为接口地址!");
333 // return;
334 // }
335 // if (this.queryOptions !== "") {
336 // this.queryParam.queryOptions = JSON.stringify(queryOptions);
337 // }
338 // 查询系统菜单
339 // getAction(this.tableUrl, this.queryParam)
340 // .then((res) => {
341 // if (res.status === 1) {
342 // this.loading = false;
343 // // this.menutablelistData = res.content;
344 // console.log("res.content菜单", res.content);
345 // } else {
346 // this.$message.error({ message: res.message, showClose: true });
347 // this.loading = false;
348 // }
349 // })
350 // .catch((error) => {
351 // console.log("er", error);
352 // this.loading = false;
353 // });
295 }) 354 })
296 const queryOptionsid = { 355 .catch((error) => {
297 conditionGroup: { 356 console.log("er", error);
298 queryRelation: "AND", 357 });
299 conditions: [ 358 },
300 { 359 // 获取权限列表
301 property: "code", 360 getAuthorityList (productId, code) {
302 value: this.products, 361 getAuthorityListAction(productId, code).then(
303 operator: "EQ", 362 res => {
304 }, 363 if (res.status === 1) {
305 ], 364 if (res.content.length !== 0) {
306 }, 365 this.operationCodes = res.content[0].operations
307 }; 366 this.operationList = []
308 const params = { 367 for (var k in this.operationCodes) {
309 queryOptions: queryOptionsid, 368 this.operationList.push(k)
310 };
311 // 获取系统id
312 getAction(this.meumurlid, params)
313 .then((res) => {
314 this.productId = res.content[0].id;
315 this.getAuthorityList(res.content[0].id, res.content[0].code)
316 this.selectedSubsystemCode = res.content[0].code
317 // let queryOptions = {
318 // conditionGroup: {
319 // conditions: [
320 // {
321 // property: "productId",
322 // value: this.productId,
323 // operator: "EQ",
324 // },
325 // ],
326 // queryRelation: "AND",
327 // },
328 // orderBys: [{ property: "sort", direction: "desc" }],
329 // };
330 // if (!this.tableUrl) {
331 // console.log("请设置tableUrl属性为接口地址!");
332 // return;
333 // }
334 // if (this.queryOptions !== "") {
335 // this.queryParam.queryOptions = JSON.stringify(queryOptions);
336 // }
337 // 查询系统菜单
338 // getAction(this.tableUrl, this.queryParam)
339 // .then((res) => {
340 // if (res.status === 1) {
341 // this.loading = false;
342 // // this.menutablelistData = res.content;
343 // console.log("res.content菜单", res.content);
344 // } else {
345 // this.$message.error({ message: res.message, showClose: true });
346 // this.loading = false;
347 // }
348 // })
349 // .catch((error) => {
350 // console.log("er", error);
351 // this.loading = false;
352 // });
353 })
354 .catch((error) => {
355 console.log("er", error);
356 });
357 },
358 // 获取权限列表
359 getAuthorityList (productId, code) {
360 getAuthorityListAction(productId, code).then(
361 res => {
362 if (res.status === 1) {
363 if (res.content.length !== 0) {
364 this.operationCodes = res.content[0].operations
365 this.operationList = []
366 for (var k in this.operationCodes) {
367 this.operationList.push(k)
368 }
369 } 369 }
370 } else {
371 this.$message.error({ message: res.message, showClose: true })
372 } 370 }
371 } else {
372 this.$message.error({ message: res.message, showClose: true })
373 } 373 }
374 ) 374 }
375 }, 375 )
376 },
376 377
377 // 配置 378 // 配置
378 getList (row) { 379 getList (row) {
379 this.getTableList() 380 this.getTableList()
380 const params = {}; 381 const params = {};
381 const queryOptions = { 382 const queryOptions = {
382 conditionGroup: { 383 conditionGroup: {
383 conditions: [ 384 conditions: [
384 { 385 {
385 property: "organizationId", 386 property: "organizationId",
386 value: row.organizationId, 387 value: row.organizationId,
387 operator: "EQ", 388 operator: "EQ",
388 }, 389 },
389 { 390 {
390 property: "departmentId", 391 property: "departmentId",
391 value: row.departmentId, 392 value: row.departmentId,
392 operator: "EQ", 393 operator: "EQ",
393 }, 394 },
394 ], 395 ],
395 queryRelation: "AND", 396 queryRelation: "AND",
396 }, 397 },
397 orderBys: [{ property: "sort", direction: "desc" }], 398 orderBys: [{ property: "sort", direction: "desc" }],
398 }; 399 };
399 params.queryOptions = JSON.stringify(queryOptions); 400 params.queryOptions = JSON.stringify(queryOptions);
400 401
401 getUserRoles(row.id).then((res) => { 402 getUserRoles(row.id).then((res) => {
402 if (res.status === 1) { 403 if (res.status === 1) {
403 this.personlist = res.content; 404 this.personlist = res.content;
404 getAction(api.users, params).then((res) => { 405 getAction(api.users, params).then((res) => {
405 if (res.status === 1) { 406 if (res.status === 1) {
406 this.waitMemberList = res.content; 407 this.waitMemberList = res.content;
407 if (this.personlist) { 408 if (this.personlist) {
408 this.waitMemberList.forEach((item, i) => { 409 this.waitMemberList.forEach((item, i) => {
409 this.personlist.forEach((val) => { 410 this.personlist.forEach((val) => {
410 if (item.id === val.id) { 411 if (item.id === val.id) {
411 this.waitMemberList[i].selectStatus = 0; 412 this.waitMemberList[i].selectStatus = 0;
412 } 413 }
413 });
414 }); 414 });
415 } 415 });
416
417 this.$refs.rolesForm.personlist(this.waitMemberList, row.id);
418 this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes);
419 } else {
420 this.$message.error({ message: res.message, showClose: true });
421 } 416 }
422 });
423 this.$refs.rolesForm.title = "人员配置";
424 } else this.$message.error({ message: res.message, showClose: true });
425 });
426 },
427 // 新增、修改角色
428 handleAddEdit (value) {
429 this.isDialog = true
430 this.$refs.addEditDialog.menuType = this.menuType;
431 this.$refs.addEditDialog.roleId = value.id;
432 this.roleSort = value.sort ? value.sort : 0;
433 this.$refs.addEditDialog.dialogForm.roleType = sessionStorage.getItem("products");
434 if (value.id) {
435 this.$refs.addEditDialog.dialogForm.roleName = value.name;
436 417
437 this.$refs.addEditDialog.dialogForm.roleTextArea = value.description; 418 this.$refs.rolesForm.personlist(this.waitMemberList, row.id);
438 } 419 this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes);
439 this.$refs.addEditDialog.showAddEditDialog = true; 420 } else {
440 this.$refs.addEditDialog.title = value.id ? "修改" : "新增"; 421 this.$message.error({ message: res.message, showClose: true });
441 }, 422 }
442 //排序 423 });
443 updateOrder (record, operate) { 424 this.$refs.rolesForm.title = "人员配置";
444 const findIndex = this.listdata.findIndex(item => item.id === record.id) 425 } else this.$message.error({ message: res.message, showClose: true });
445 let swapId = '' 426 });
446 if (operate === 'UP') { 427 },
447 swapId = this.listdata[findIndex - 1].id 428 // 新增、修改角色
448 } else if (operate === 'DOWN') { 429 handleAddEdit (value) {
449 swapId = this.listdata[findIndex + 1].id 430 this.isDialog = true
431 this.$refs.addEditDialog.menuType = this.menuType;
432 this.$refs.addEditDialog.roleId = value.id;
433 this.roleSort = value.sort ? value.sort : 0;
434 this.$refs.addEditDialog.dialogForm.roleType = sessionStorage.getItem("products");
435 if (value.id) {
436 this.$refs.addEditDialog.dialogForm.roleName = value.name;
437
438 this.$refs.addEditDialog.dialogForm.roleTextArea = value.description;
439 }
440 this.$refs.addEditDialog.showAddEditDialog = true;
441 this.$refs.addEditDialog.title = value.id ? "修改" : "新增";
442 },
443 //排序
444 updateOrder (record, operate) {
445 const findIndex = this.listdata.findIndex(item => item.id === record.id)
446 let swapId = ''
447 if (operate === 'UP') {
448 swapId = this.listdata[findIndex - 1].id
449 } else if (operate === 'DOWN') {
450 swapId = this.listdata[findIndex + 1].id
451 }
452 updateOrder('/rest/roles', record, operate, swapId).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 })
450 } 458 }
451 updateOrder('/rest/roles', record, operate, swapId).then(res => { 459 })
452 if (res.status === 1) { 460 },
453 this.$message.success({ message: res.message, showClose: true }) 461 // 删除
454 this.getTableData(); 462 handleDelete: function (id, content = "") {
455 } else { 463 this.$confirm(
456 this.$message.error({ message: res.message, showClose: true }) 464 `<div class="customer-message-wrapper">
457 }
458 })
459 },
460 // 删除
461 handleDelete: function (id, content = "") {
462 this.$confirm(
463 `<div class="customer-message-wrapper">
464 <h5 class="title">您确认要执行该操作用于以下信息:</h5> 465 <h5 class="title">您确认要执行该操作用于以下信息:</h5>
465 <p class="content" aria-controls="${content}">${content} 466 <p class="content" aria-controls="${content}">${content}
466 </p> 467 </p>
...@@ -468,50 +469,50 @@ ...@@ -468,50 +469,50 @@
468 <span >无法恢复</span> 469 <span >无法恢复</span>
469 </p> 470 </p>
470 </div>`, 471 </div>`,
471 "执行确认", 472 "执行确认",
472 { 473 {
473 dangerouslyUseHTMLString: true, 474 dangerouslyUseHTMLString: true,
474 customClass: "customer-delete", 475 customClass: "customer-delete",
475 confirmButtonText: "确定", 476 confirmButtonText: "确定",
476 cancelButtonText: "取消", 477 cancelButtonText: "取消",
477 type: "warning", 478 type: "warning",
479 }
480 )
481 .then(() => {
482 if (!this.tableUrlroles) {
483 this.$message.error({
484 message: "请设置tableUrl属性为接口地址!",
485 showClose: true,
486 });
487 return;
478 } 488 }
479 ) 489 const url = this.tableUrlroles + "/" + id;
480 .then(() => { 490 deleteAction(url).then((res) => {
481 if (!this.tableUrlroles) { 491 if (res.status === 1) {
482 this.$message.error({ 492 this.$message.success({ message: res.message, showClose: true });
483 message: "请设置tableUrl属性为接口地址!", 493 this.getTableData();
484 showClose: true, 494 } else {
485 }); 495 this.$message.error({ message: res.message, showClose: true });
486 return;
487 } 496 }
488 const url = this.tableUrlroles + "/" + id; 497 });
489 deleteAction(url).then((res) => { 498 })
490 if (res.status === 1) { 499 .catch(() => { });
491 this.$message.success({ message: res.message, showClose: true }); 500 },
492 this.getTableData(); 501 // 新增回显
493 } else { 502 reloadTableData () {
494 this.$message.error({ message: res.message, showClose: true }); 503 this.getTableData();
495 }
496 });
497 })
498 .catch(() => { });
499 },
500 // 新增回显
501 reloadTableData () {
502 this.getTableData();
503 },
504 }, 504 },
505 }; 505 },
506 };
506 </script> 507 </script>
507 <style scoped lang="scss"> 508 <style scoped lang="scss">
508 @import "~@/styles/mixin.scss"; 509 @import "~@/styles/mixin.scss";
509 // @import "~@/styles/public.scss"; 510 // @import "~@/styles/public.scss";
510 511
511 /deep/.el-button.is-disabled.el-button--text { 512 /deep/.el-button.is-disabled.el-button--text {
512 width: 64px; 513 width: 64px;
513 height: 28px; 514 height: 28px;
514 background: rgba(255, 255, 255, 0.1); 515 background: rgba(255, 255, 255, 0.1);
515 border-radius: 16px; 516 border-radius: 16px;
516 } 517 }
517 </style> 518 </style>
......