yh-pub 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <iframe
3
3
  class="admin-home-index"
4
- src="http://docs.js.sforcecon.com:5900/view/591"
4
+ src="http://docs.js.sforcecon.com:5900/view/589"
5
5
  frameborder="0"></iframe>
6
6
  </template>
7
7
  <script>
@@ -17,8 +17,8 @@ export default {
17
17
 
18
18
  <style>
19
19
  .main-container .admin-home-index {
20
- margin: 0 -16px -20px -16px;
21
- width: calc(100% + 32px);
20
+ margin: 0 0 -20px 0;
21
+ width: 100%;
22
22
  height: calc(100% + 10px);
23
23
  overflow: hidden;
24
24
  }
@@ -1,5 +1,5 @@
1
1
  <style lang="less">
2
- @import "./login.less";
2
+ @import './login.less';
3
3
  </style>
4
4
 
5
5
  <template>
@@ -12,8 +12,8 @@
12
12
  </div>
13
13
  <div class="login-con">
14
14
  <div class="login-title">
15
- <div class="login-title-cn">中控系统</div>
16
- <div class="login-title-en">Central Control System</div>
15
+ <div class="login-title-cn">力控元海</div>
16
+ <div class="login-title-en">Li Kong Yuan Hai</div>
17
17
  </div>
18
18
  <div class="form-con">
19
19
  <el-form
@@ -91,21 +91,21 @@
91
91
  </template>
92
92
 
93
93
  <script>
94
- import { useUserStore } from "@/store/user";
95
- import { defineComponent } from "vue";
94
+ import {useUserStore} from '@/store/user';
95
+ import {defineComponent} from 'vue';
96
96
 
97
97
  export default defineComponent({
98
98
  data() {
99
99
  return {
100
- errorMsg: "",
100
+ errorMsg: '',
101
101
  form: {
102
- username: "",
103
- password: "",
102
+ username: '',
103
+ password: '',
104
104
  },
105
105
  loading: false,
106
106
  rules: {
107
- username: [{ required: true, message: "账号不能为空", trigger: "blur" }],
108
- password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
107
+ username: [{required: true, message: '账号不能为空', trigger: 'blur'}],
108
+ password: [{required: true, message: '密码不能为空', trigger: 'blur'}],
109
109
  },
110
110
  };
111
111
  },
@@ -124,7 +124,7 @@ export default defineComponent({
124
124
  .then(async (res) => {
125
125
  this.loading = false;
126
126
  if (res.data.result) {
127
- this.$message.success("登录成功");
127
+ this.$message.success('登录成功');
128
128
  userStore.getUserInfo().then(() => {
129
129
  this.$router
130
130
  .replace({
@@ -1,4 +1,4 @@
1
- import dict from "yh-pub/layout/main/system/dict.vue";
1
+ import dict from "./dict.vue";
2
2
  import { deepClone } from "@/libs/util";
3
3
 
4
4
  export default {
@@ -6,11 +6,12 @@ export default {
6
6
  components: {
7
7
  dict,
8
8
  },
9
- data() {
9
+ data () {
10
10
  return {
11
11
  maxHeight: 510,
12
12
  openTip: false,
13
13
  loading: true,
14
+ userLoading: false,
14
15
  treeLoading: true,
15
16
  submitPermLoading: false,
16
17
  submitDepLoading: false,
@@ -31,48 +32,23 @@ export default {
31
32
  key: "",
32
33
  },
33
34
  roleForm: {
34
- ad_org_id: "",
35
+ adOrgId: "",
35
36
  name: "",
36
- isAdmin: "",
37
+ isAdmin: "N",
37
38
  description: "",
38
- ad_role_id: "",
39
+ adRoleId: "",
39
40
  },
40
41
  roleFormValidate: {
41
- ad_org_id: [{ required: true, message: "组织机构不能为空", trigger: "change" }],
42
+ adOrgId: [{ required: true, message: "组织机构不能为空", trigger: "change" }],
42
43
  name: [{ required: true, message: "角色名称不能为空", trigger: "change" }],
43
44
  },
44
45
  submitLoading: false,
45
46
  selectList: [],
46
- columns: [
47
- {
48
- title: "所属机构",
49
- dataIndex: "org_name",
50
- width: 150,
51
- sortable: true,
52
- },
53
- {
54
- title: "角色名称",
55
- dataIndex: "name",
56
- width: 300,
57
- sortable: true,
58
- },
59
- {
60
- title: "备注",
61
- dataIndex: "description",
62
- minWidth: 200,
63
- sortable: true,
64
- },
65
- {
66
- title: "操作",
67
- dataIndex: "action",
68
- fixed: "right",
69
- width: 280,
70
- scopedSlots: { customRender: "action", title: "操作" },
71
- },
72
- ],
73
47
  data: [],
48
+ userData: [],
49
+ paginationUser: { currentPage: 1, pageSize: 10, total: 0 },
74
50
  listLoading: false,
75
- pagination: { currentPage: 1, pageSize: 15, total: 0 },
51
+ pagination: { currentPage: 1, pageSize: 10, total: 0 },
76
52
  permData: [],
77
53
  editRolePermId: "",
78
54
  selectAllFlag: false,
@@ -89,13 +65,19 @@ export default {
89
65
  halfSelectedNodes: [],
90
66
  deptCheckedKeys: [],
91
67
  timer: null,
68
+ queryOrgId: "",
69
+ queryRoteId: "",
70
+ queryUserList: [],
71
+ currentRow: null,
72
+ userIds: [],
73
+ userListVisible: false,
92
74
  };
93
75
  },
94
76
  methods: {
95
- init() {
77
+ init () {
96
78
  this.getDataList();
97
79
  },
98
- parseOrgTreeData(curLevelData, curLevel, roleOrgData) {
80
+ parseOrgTreeData (curLevelData, curLevel, roleOrgData) {
99
81
  let curVm = this;
100
82
  let newLevelData = curLevelData;
101
83
  newLevelData.key = curLevelData.adOrgId;
@@ -116,7 +98,7 @@ export default {
116
98
  }
117
99
  return newLevelData;
118
100
  },
119
- async loadRoleOrg() {
101
+ async loadRoleOrg () {
120
102
  let roleOrgData = {};
121
103
  // 请求系统数据
122
104
  this.axios
@@ -124,7 +106,7 @@ export default {
124
106
  "/roleController/getRoleOrgAccess",
125
107
  this.$qs.stringify({
126
108
  roleId: this.editRolePermId,
127
- })
109
+ }),
128
110
  )
129
111
  .then((response) => {
130
112
  if (response.data.result) {
@@ -137,17 +119,17 @@ export default {
137
119
  });
138
120
  return roleOrgData;
139
121
  },
140
- async editOrg(v) {
141
- this.editRolePermId = v.ad_role_id;
122
+ async editOrg (v) {
123
+ this.editRolePermId = v.adRoleId;
142
124
  this.modalTitle = "分配 " + v.name + " 的组织机构权限";
143
125
  let roleOrgData = await this.loadRoleOrg();
144
126
  this.roleOrgData = roleOrgData;
145
127
  // 请求系统数据
146
- this.axios.post("/orgController/getOrgData", this.$qs.stringify({})).then((response) => {
128
+ this.axios.post("/orgController/getUserOrgTree", {}).then((response) => {
147
129
  if (response.data.result) {
148
130
  let newTreeData = [];
149
131
  this.deptCheckedKeys = [];
150
- response.data.orgList.forEach((e) => {
132
+ response.data.list.forEach((e) => {
151
133
  newTreeData.push(this.parseOrgTreeData(e, 0, roleOrgData));
152
134
  });
153
135
  this.orgData = newTreeData;
@@ -158,7 +140,7 @@ export default {
158
140
  });
159
141
  this.orgModalVisible = true;
160
142
  },
161
- checkOrgTree() {
143
+ checkOrgTree () {
162
144
  if (this.timer) {
163
145
  clearTimeout(this.timer);
164
146
  }
@@ -166,7 +148,7 @@ export default {
166
148
  this.deptCheckedKeys = this.$refs.depTree.getCheckedKeys();
167
149
  }, 300);
168
150
  },
169
- submitRoleOrg() {
151
+ submitRoleOrg () {
170
152
  let selectedNodes = this.$refs.depTree.getCheckedKeys() || [];
171
153
  let curVm = this;
172
154
  let subRoleOrgData = [];
@@ -180,7 +162,7 @@ export default {
180
162
  this.$qs.stringify({
181
163
  roleId: curVm.editRolePermId,
182
164
  subJsonData: JSON.stringify(subRoleOrgData),
183
- })
165
+ }),
184
166
  )
185
167
  .then((response) => {
186
168
  if (response.data.result) {
@@ -191,7 +173,7 @@ export default {
191
173
  });
192
174
  this.orgModalVisible = false;
193
175
  },
194
- renderContent(h, { root, node, data }) {
176
+ renderContent (h, { root, node, data }) {
195
177
  let icon = "";
196
178
  if (data.level === 0) {
197
179
  icon = "ios-navigate";
@@ -231,10 +213,10 @@ export default {
231
213
  }),
232
214
  h("span", data.title),
233
215
  ]),
234
- ]
216
+ ],
235
217
  );
236
218
  },
237
- checkedMenuTree() {
219
+ checkedMenuTree () {
238
220
  if (this.timer) {
239
221
  clearTimeout(this.timer);
240
222
  }
@@ -243,7 +225,7 @@ export default {
243
225
  this.halfSelectedNodes = this.$refs.tree.getHalfCheckedKeys(true);
244
226
  }, 300);
245
227
  },
246
- selectTree(data, node) {
228
+ selectTree (data, node) {
247
229
  if (data) {
248
230
  this.curSelectedMenuId = data.sysWindowId;
249
231
  // 加载目录树
@@ -267,10 +249,12 @@ export default {
267
249
  roleBtnData.forEach((item) => {
268
250
  item["childs"] = tempQyBtnData[item.ID];
269
251
  // e['checkAll'] = false
270
- let checkChilds = this.roleSavedBtnPermMap[this.curSelectedMenuId] || [];
252
+ let roleSavedBtns = this.roleSavedBtnPermMap[this.curSelectedMenuId] || [];
253
+ let checkChilds = [];
271
254
  let tcount = 0;
272
255
  tempQyBtnData[item.ID].forEach((es) => {
273
- if (checkChilds.includes(es.ID)) {
256
+ if (roleSavedBtns.includes(es.ID)) {
257
+ checkChilds.push(es.ID);
274
258
  tcount++;
275
259
  }
276
260
  });
@@ -293,12 +277,12 @@ export default {
293
277
  });
294
278
  }
295
279
  },
296
- resetBtnPerData() {
280
+ resetBtnPerData () {
297
281
  this.roleSavedBtnPermMap = {};
298
282
  this.curWindowBtnList = [];
299
283
  this.saveWinBtnList = [];
300
284
  },
301
- doWinBtnData(doType, btnId) {
285
+ doWinBtnData (doType, btnId) {
302
286
  if (!this.saveWinBtnList) {
303
287
  this.saveWinBtnList = [];
304
288
  }
@@ -320,7 +304,7 @@ export default {
320
304
  }
321
305
  }
322
306
  },
323
- handleCheckAll(item, key) {
307
+ handleCheckAll (item, key) {
324
308
  let checkChilds = [];
325
309
  if (!item.checkAll) {
326
310
  // 已经全选取消全选状态
@@ -339,7 +323,7 @@ export default {
339
323
  this.updateBtnsToList();
340
324
  this.curWindowBtnList[key] = item;
341
325
  },
342
- checkAllGroupChange(event, key) {
326
+ checkAllGroupChange (event, key) {
343
327
  let list = deepClone({}, this.curWindowBtnList);
344
328
  let currentItem = list[key];
345
329
  if (event.length > 0) {
@@ -376,7 +360,7 @@ export default {
376
360
  this.curWindowBtnList[key] = currentItem;
377
361
  this.updateBtnsToList();
378
362
  },
379
- updateBtnsToList() {
363
+ updateBtnsToList () {
380
364
  let btns = new Set();
381
365
  this.curWindowBtnList.forEach((item) => {
382
366
  item.checkChilds.forEach((checkId) => {
@@ -386,16 +370,16 @@ export default {
386
370
  btns = Array.from(btns);
387
371
  this.roleSavedBtnPermMap[this.curSelectedMenuId] = btns;
388
372
  },
389
- changePage(v) {
373
+ changePage (v) {
390
374
  this.searchForm.pageNumber = v;
391
375
  this.getDataList();
392
376
  this.clearSelectAll();
393
377
  },
394
- changePageSize(v) {
378
+ changePageSize (v) {
395
379
  this.searchForm.pageSize = v;
396
380
  this.getDataList();
397
381
  },
398
- changeSort(e) {
382
+ changeSort (e) {
399
383
  this.searchForm.sort = e.key;
400
384
  this.searchForm.order = e.order;
401
385
  if (e.order === "normal") {
@@ -403,26 +387,96 @@ export default {
403
387
  }
404
388
  this.getDataList();
405
389
  },
406
- getDataList() {
390
+ getDataList () {
407
391
  this.loading = true;
408
- this.axios
409
- .post(
410
- "/roleController/getRoleList",
392
+ this.axios.post("/roleController/getRoleList",
393
+ this.$qs.stringify({
394
+ name: this.searchForm.key,
395
+ pageSize: this.pagination.pageSize,
396
+ pageIndex: this.pagination.currentPage,
397
+ }),
398
+ ).then((response) => {
399
+ this.loading = false;
400
+ if (response.data.result) {
401
+ this.data = response.data.data.records;
402
+ this.pagination.total = response.data.data.total;
403
+ }
404
+ });
405
+ },
406
+ getUserDataList (val) {
407
+ if (val === undefined) {
408
+ this.userData = [];
409
+ return;
410
+ }
411
+ if (val != 1) {
412
+ this.currentRow = val;
413
+ }
414
+ this.userLoading = true;
415
+ this.userIds = [];
416
+ this.axios.post("/roteUser/getAdRoleUsers",
417
+ this.$qs.stringify({
418
+ roteId: this.currentRow.adRoleId,
419
+ orgId: this.currentRow.adOrgId,
420
+ pageSize: this.paginationUser.pageSize,
421
+ pageIndex: this.paginationUser.currentPage,
422
+ }),
423
+ ).then((response) => {
424
+ this.userLoading = false;
425
+ if (response.data.result) {
426
+ this.queryOrgId = this.currentRow.adOrgId;
427
+ this.queryRoteId = this.currentRow.adRoleId;
428
+ this.userData = response.data.data.records;
429
+ this.paginationUser.total = response.data.data.total;
430
+ this.userData.forEach(value => {
431
+ this.userIds.push(value.ad_user_id);
432
+ });
433
+ }
434
+ });
435
+ },
436
+ getUserList () {
437
+ this.userListVisible = true;
438
+ this.axios.post("/roteUser/getUserList",
439
+ this.$qs.stringify({
440
+ orgId: this.queryOrgId,
441
+ }),
442
+ ).then((response) => {
443
+ this.userLoading = false;
444
+ if (response.data.result) {
445
+ this.queryUserList = response.data.data;
446
+ }
447
+ });
448
+ },
449
+ addUserRote () {
450
+ this.axios.post("/roteUser/addUserRote",
451
+ this.$qs.stringify({
452
+ roteId: this.queryRoteId,
453
+ userIds: this.userIds.toString(),
454
+ }),
455
+ ).then((response) => {
456
+ this.userLoading = false;
457
+ this.userListVisible = false;
458
+ this.$message.success("操作成功");
459
+ this.getUserDataList(this.currentRow);
460
+ });
461
+ },
462
+ deleteUserRote (v) {
463
+ if (v && v.adRoleId && v.ad_user_id) {
464
+ this.axios.post("/roteUser/deleteUserRote",
411
465
  this.$qs.stringify({
412
- name: this.searchForm.key,
413
- pageSize: this.pagination.pageSize,
414
- pageIndex: this.pagination.current,
415
- })
416
- )
417
- .then((response) => {
418
- this.loading = false;
419
- if (response.data.result) {
420
- this.data = response.data.data.records;
421
- this.pagination.total = response.data.data.total;
422
- }
466
+ roteId: v.adRoleId,
467
+ userId: v.ad_user_id,
468
+ }),
469
+ ).then((response) => {
470
+ this.userLoading = false;
471
+ this.$message.success("操作成功");
472
+ this.getUserDataList(this.currentRow);
423
473
  });
474
+ }
475
+ },
476
+ onCanael () {
477
+ this.userListVisible = false;
424
478
  },
425
- parseTreeData(curLevelData, curLevel) {
479
+ parseTreeData (curLevelData, curLevel) {
426
480
  let newLevelData = curLevelData;
427
481
  newLevelData["id"] = curLevelData.adMenuId;
428
482
  newLevelData["key"] = curLevelData.adMenuId;
@@ -451,14 +505,13 @@ export default {
451
505
  roleMenuData[e.AD_MENU_ID] = e;
452
506
  });
453
507
  }
454
- })
455
- .catch((e) => {
508
+ }).catch((e) => {
456
509
  console.error(e);
457
510
  });
458
511
  return roleMenuData;
459
512
  },
460
513
  // 递归标记是否选中
461
- calNewTreeData(newTreeData, roleMenuData) {
514
+ calNewTreeData (newTreeData, roleMenuData) {
462
515
  let checkedCount = 0;
463
516
  newTreeData.forEach((e) => {
464
517
  if (e.level === 0 || e.level === 1) {
@@ -493,7 +546,6 @@ export default {
493
546
  }
494
547
  } else {
495
548
  if (e.checked) {
496
- // console.log('checked', e.adMenuId);
497
549
  this.selectedNodes.push(e.adMenuId);
498
550
  }
499
551
  }
@@ -521,7 +573,6 @@ export default {
521
573
 
522
574
  this.$nextTick(() => {
523
575
  let checked = this.selectedNodes.filter((item) => !this.halfSelectedNodes.includes(item));
524
- console.log(this.selectedNodes.length, checked.length);
525
576
  this.$refs.tree.setCheckedKeys(checked);
526
577
  });
527
578
  }
@@ -529,7 +580,7 @@ export default {
529
580
  });
530
581
  },
531
582
  // 递归标记禁用节点
532
- deleteDisableNode(permData) {
583
+ deleteDisableNode (permData) {
533
584
  let that = this;
534
585
  permData.forEach(function (e) {
535
586
  if (e.status === -1) {
@@ -541,14 +592,14 @@ export default {
541
592
  }
542
593
  });
543
594
  },
544
- cancelRole() {
595
+ cancelRole () {
545
596
  this.roleModalVisible = false;
546
597
  },
547
- submitRole() {
598
+ submitRole () {
548
599
  let that = this;
549
600
  let subForm = {
550
- orgId: this.roleForm.ad_org_id,
551
- adRoleId: this.roleForm.ad_role_id,
601
+ orgId: this.roleForm.adOrgId,
602
+ adRoleId: this.roleForm.adRoleId,
552
603
  name: this.roleForm.name,
553
604
  description: this.roleForm.description,
554
605
  isAdmin: this.roleForm.isAdmin,
@@ -556,6 +607,7 @@ export default {
556
607
  this.$refs.roleForm.validate((valid) => {
557
608
  if (valid) {
558
609
  this.submitLoading = true;
610
+ debugger;
559
611
  this.axios.post("/roleController/submitRole", this.$qs.stringify(subForm)).then((response) => {
560
612
  that.submitLoading = false;
561
613
  if (response.data.result) {
@@ -569,39 +621,39 @@ export default {
569
621
  }
570
622
  });
571
623
  },
572
- addRole() {
624
+ addRole () {
573
625
  // 处理状态
574
626
  this.modalType = 0;
575
627
  this.modalTitle = "添加角色";
576
628
  // 清理表单
577
- this.roleForm.ad_role_id = undefined;
629
+ this.roleForm.adRoleId = undefined;
578
630
  this.roleForm.name = "";
579
631
  this.roleForm.isAdmin = "N";
580
632
  this.roleForm.description = "";
581
- this.roleForm.ad_role_id = "";
633
+ this.roleForm.adRoleId = "";
582
634
  // 显示弹窗
583
635
  this.roleModalVisible = true;
584
636
  },
585
- edit(v) {
637
+ edit (v) {
586
638
  // 处理状态
587
639
  this.modalType = 1;
588
640
  this.modalTitle = "编辑角色";
589
641
  // 填充表单
590
- this.roleForm.ad_org_id = v.ad_org_id;
642
+ this.roleForm.adOrgId = v.adOrgId;
591
643
  this.roleForm.name = v.name;
592
- this.roleForm.isAdmin = v.is_admin == "Y";
644
+ this.roleForm.isAdmin = v.isAdmin;
593
645
  this.roleForm.description = v.description;
594
- this.roleForm.ad_role_id = v.ad_role_id;
646
+ this.roleForm.adRoleId = v.adRoleId;
595
647
  // 显示弹窗
596
648
  this.roleModalVisible = true;
597
649
  },
598
- deleteRole(delId) {
650
+ deleteRole (delId) {
599
651
  this.axios
600
652
  .post(
601
653
  "/roleController/delRoleByIds",
602
654
  this.$qs.stringify({
603
655
  ids: delId,
604
- })
656
+ }),
605
657
  )
606
658
  .then((response) => {
607
659
  if (response.data.result) {
@@ -613,18 +665,18 @@ export default {
613
665
  }
614
666
  });
615
667
  },
616
- remove(v) {
617
- if (v && v.ad_role_id) {
618
- this.deleteRole(v.ad_role_id);
668
+ remove (v) {
669
+ if (v && v.adRoleId) {
670
+ this.deleteRole(v.adRoleId);
619
671
  }
620
672
  },
621
- clearSelectAll() {
673
+ clearSelectAll () {
622
674
  this.selectList = [];
623
675
  },
624
- changeSelect(e) {
676
+ changeSelect (e) {
625
677
  this.selectList = e;
626
678
  },
627
- delAll() {
679
+ delAll () {
628
680
  if (this.selectList.length <= 0) {
629
681
  this.$message.warning("您还未选择要删除的数据");
630
682
  return;
@@ -633,8 +685,8 @@ export default {
633
685
  // 删除按钮代码
634
686
  this.deleteRole(ids);
635
687
  },
636
- editPerm(v) {
637
- this.editRolePermId = v.ad_role_id;
688
+ editPerm (v) {
689
+ this.editRolePermId = v.adRoleId;
638
690
  // 获取所有菜单权限树
639
691
  this.getPermList();
640
692
  this.modalTitle = "分配 " + v.name + " 的菜单权限";
@@ -658,7 +710,7 @@ export default {
658
710
  this.permModalVisible = true;
659
711
  },
660
712
  // 递归判断子节点
661
- checkPermTree(permData, rolePerms) {
713
+ checkPermTree (permData, rolePerms) {
662
714
  let that = this;
663
715
  permData.forEach(function (p) {
664
716
  if (that.hasPerm(p, rolePerms) && p.status !== -1) {
@@ -672,7 +724,7 @@ export default {
672
724
  });
673
725
  },
674
726
  // 判断角色拥有的权限节点勾选
675
- hasPerm(p, rolePerms) {
727
+ hasPerm (p, rolePerms) {
676
728
  let flag = false;
677
729
  for (let i = 0; i < rolePerms.length; i++) {
678
730
  if (p.id === rolePerms[i].permissionId) {
@@ -686,13 +738,13 @@ export default {
686
738
  return false;
687
739
  },
688
740
  // 全选反选
689
- selectTreeAll() {
741
+ selectTreeAll () {
690
742
  this.selectAllFlag = !this.selectAllFlag;
691
743
  let select = this.selectAllFlag;
692
744
  this.selectedTreeAll(this.permData, select);
693
745
  },
694
746
  // 递归全选节点
695
- selectedTreeAll(permData, select) {
747
+ selectedTreeAll (permData, select) {
696
748
  let that = this;
697
749
  permData.forEach(function (e) {
698
750
  e.checked = select;
@@ -704,7 +756,7 @@ export default {
704
756
  }
705
757
  });
706
758
  },
707
- async submitPermEdit() {
759
+ async submitPermEdit () {
708
760
  let curVm = this;
709
761
  this.submitPermLoading = true;
710
762
  let permMenuIds = "";
@@ -723,7 +775,7 @@ export default {
723
775
  roleId: this.editRolePermId,
724
776
  ids: permMenuIds,
725
777
  btns: JSON.stringify(permMenuBtnIds),
726
- })
778
+ }),
727
779
  )
728
780
  .then((response) => {
729
781
  this.submitPermLoading = false;
@@ -737,7 +789,7 @@ export default {
737
789
  }
738
790
  });
739
791
  },
740
- cancelPermEdit() {
792
+ cancelPermEdit () {
741
793
  this.selectedKeys = [];
742
794
  this.expandedKeys = [];
743
795
  this.selectedNodes = [];
@@ -748,7 +800,7 @@ export default {
748
800
  });
749
801
  },
750
802
  },
751
- mounted() {
803
+ mounted () {
752
804
  this.maxHeight = Number(document.documentElement.clientHeight - 121) + "px";
753
805
  this.init();
754
806
  },
@@ -1,339 +1,364 @@
1
1
  <template>
2
- <div class="search">
3
- <el-row class="operation">
4
- <div style="padding: 5px 15px 5px 2px; font-size: 13px">角色名称</div>
5
- <el-input
6
- v-model="searchForm.key"
7
- @search="getDataList"
8
- placeholder="输入关键词搜索"
9
- style="width: 300px; margin-left: 12px"
10
- clearable
11
- enter-button />
12
- </el-row>
13
- <el-row class="operation">
14
- <div style="padding: 5px 15px 5px 2px; font-size: 18px; font-weight: bold">角色管理</div>
15
- <el-button
16
- @click="addRole"
17
- type="primary">
18
- <i class="iconfont icon-plus"></i>
19
- 添加角色
20
- </el-button>
21
- <el-popconfirm
22
- title="确定要删除所选的角色吗?"
23
- ok-text="删除"
24
- cancel-text="取消"
25
- @confirm="delAll"
26
- style="margin-left: 12px">
27
- <el-button>
28
- <i class="iconfont icon-delete"></i>
29
- 批量删除
2
+ <div class="ver-container">
3
+ <div class="ver-col">
4
+ <div class="operation">
5
+ <div style="padding: 5px 15px 5px 2px; font-size: 13px">角色名称</div>
6
+ <el-input
7
+ v-model="searchForm.key"
8
+ @change="getDataList"
9
+ placeholder="输入关键词搜索"
10
+ style="width: 300px; margin-left: 12px"
11
+ clearable
12
+ enter-button />
13
+ </div>
14
+ <div class="operation">
15
+ <div style="padding: 5px 15px 5px 2px; font-size: 18px; font-weight: bold">角色管理</div>
16
+ <el-button
17
+ @click="addRole"
18
+ type="primary">
19
+ <i class="iconfont icon-plus"></i>
20
+ 添加角色
21
+ </el-button>
22
+ <el-popconfirm
23
+ title="确定要删除所选的角色吗?"
24
+ ok-text="删除"
25
+ cancel-text="取消"
26
+ @confirm="delAll"
27
+ style="margin-left: 12px">
28
+ <el-button>
29
+ <i class="iconfont icon-delete"></i>
30
+ 批量删除
31
+ </el-button>
32
+ </el-popconfirm>
33
+ <el-button
34
+ @click="getDataList"
35
+ style="margin-left: 12px">
36
+ <i class="iconfont icon-refresh"></i>
37
+ 刷新
30
38
  </el-button>
31
- </el-popconfirm>
32
- <el-button
33
- @click="init"
34
- style="margin-left: 12px">
35
- <i class="iconfont icon-refresh"></i>
36
- 查询
37
- </el-button>
38
- </el-row>
39
- <el-table
40
- v-loading="loading"
41
- row-key="ad_role_id"
42
- :data="data"
43
- ref="table"
44
- highlight-current-row
45
- :header-cell-style="{ background: '#f8f8f8', color: '#606266', fontSize: '13px' }"
46
- stripe>
47
- <el-table-column
48
- label="#"
49
- width="50">
50
- <template #default="scope">{{ scope.$index + 1 }}</template>
51
- </el-table-column>
52
- <el-table-column
53
- label="所属机构"
54
- min-width="150"
55
- prop="org_name"></el-table-column>
56
- <el-table-column
57
- label="角色名称"
58
- min-width="300"
59
- prop="name"></el-table-column>
60
- <el-table-column
61
- label="角色管理员"
62
- min-width="300"
63
- prop="is_admin"></el-table-column>
64
- <el-table-column
65
- label="备注"
66
- min-width="200"
67
- prop="description"></el-table-column>
68
- <el-table-column
69
- width="300"
70
- label="操作">
71
- <template #default="{ row }">
39
+ </div>
40
+ <el-table
41
+ v-loading="loading"
42
+ row-key="adRoleId"
43
+ :data="data"
44
+ ref="table"
45
+ highlight-current-row
46
+ :header-cell-style="{background: '#f8f8f8', color: '#606266', fontSize: '13px'}"
47
+ stripe>
48
+ <el-table-column
49
+ label="#"
50
+ width="50">
51
+ <template #default="scope">{{ scope.$index + 1 }}</template>
52
+ </el-table-column>
53
+ <el-table-column
54
+ label="所属机构"
55
+ min-width="150"
56
+ prop="orgName"></el-table-column>
57
+ <el-table-column
58
+ label="角色名称"
59
+ min-width="200"
60
+ prop="name"></el-table-column>
61
+ <el-table-column
62
+ label="角色管理员"
63
+ width="150"
64
+ align="center"
65
+ prop="isAdmin"></el-table-column>
66
+ <el-table-column
67
+ label="备注"
68
+ min-width="300"
69
+ prop="description"></el-table-column>
70
+ <el-table-column
71
+ width="320"
72
+ align="center"
73
+ label="操作">
74
+ <template #default="{row}">
75
+ <el-button
76
+ size="small"
77
+ type="primary"
78
+ @click="editPerm(row)">
79
+ 菜单权限
80
+ </el-button>
81
+ <el-button
82
+ size="small"
83
+ type="success"
84
+ @click="editOrg(row)">
85
+ 角色机构
86
+ </el-button>
87
+ <el-button
88
+ size="small"
89
+ type="info"
90
+ @click="edit(row)">
91
+ 编辑
92
+ </el-button>
93
+ <el-popconfirm
94
+ title="你确定要删除吗"
95
+ ok-text="确定"
96
+ cancel-text="取消"
97
+ @confirm="remove(row)">
98
+ <template #reference>
99
+ <el-button
100
+ title="删除"
101
+ size="small"
102
+ type="danger">
103
+ 删除
104
+ </el-button>
105
+ </template>
106
+ </el-popconfirm>
107
+ </template>
108
+ </el-table-column>
109
+ </el-table>
110
+ <el-pagination
111
+ v-model:current-page="pagination.currentPage"
112
+ v-model:page-size="pagination.pageSize"
113
+ :page-sizes="[10, 30, 50, 100]"
114
+ layout="prev, pager, next, sizes, total, jumper"
115
+ :total="pagination.total"
116
+ @size-change="getDataList"
117
+ @current-change="getDataList" />
118
+ <!-- 编辑 -->
119
+ <el-dialog
120
+ :title="modalTitle"
121
+ v-model="roleModalVisible"
122
+ :mask-closable="false"
123
+ @cancel="cancelRole"
124
+ :width="500">
125
+ <el-form
126
+ ref="roleForm"
127
+ :model="roleForm"
128
+ :label-width="100"
129
+ :rules="roleFormValidate">
130
+ <el-form-item
131
+ label="组织机构"
132
+ prop="ad_org_id">
133
+ <dict
134
+ dict="ad_org_id"
135
+ url="/orgController/getGroupOrgs"
136
+ v-model="roleForm.adOrgId"
137
+ placeholder="请选择或输入搜索"
138
+ filterable
139
+ clearable />
140
+ </el-form-item>
141
+ <el-form-item
142
+ label="角色名称"
143
+ prop="name">
144
+ <el-input
145
+ v-model="roleForm.name"
146
+ placeholder="请输入" />
147
+ </el-form-item>
148
+ <el-form-item label="角色管理员">
149
+ <el-switch
150
+ v-model="roleForm.isAdmin"
151
+ active-value="Y"
152
+ inactive-value="N"
153
+ size="large">
154
+ <span slot="Y">Y</span>
155
+ <span slot="N">N</span>
156
+ </el-switch>
157
+ </el-form-item>
158
+ <el-form-item
159
+ label="备注"
160
+ prop="description">
161
+ <el-input v-model="roleForm.description" />
162
+ </el-form-item>
163
+ </el-form>
164
+ <div
165
+ slot="footer"
166
+ style="padding-left: 150px">
167
+ <el-button
168
+ text
169
+ @click="cancelRole">
170
+ 取消
171
+ </el-button>
72
172
  <el-button
73
- size="small"
74
173
  type="primary"
75
- @click="editPerm(row)">
76
- 菜单权限
174
+ :loading="submitLoading"
175
+ @click="submitRole">
176
+ 提交
77
177
  </el-button>
178
+ </div>
179
+ </el-dialog>
180
+ <!-- 菜单权限 -->
181
+ <el-drawer
182
+ :title="modalTitle"
183
+ v-model="permModalVisible"
184
+ :mask-closable="false"
185
+ :width="800"
186
+ @close="cancelPermEdit">
187
+ <el-row>
188
+ <el-col
189
+ :span="12"
190
+ style="overflow: auto; height: 100%">
191
+ <el-tree
192
+ ref="tree"
193
+ v-loading="treeLoading"
194
+ :data="permData"
195
+ :props="{label: 'title'}"
196
+ show-checkbox
197
+ default-expand-all
198
+ node-key="adMenuId"
199
+ @current-change="selectTree"
200
+ @check-change="checkedMenuTree"></el-tree>
201
+ </el-col>
202
+ <el-col :span="12">
203
+ <div class="ivu-card-head"><p style="margin-bottom: 0px">按钮权限</p></div>
204
+ <div style="height: 100%; overflow-y: auto; padding: 0 10px">
205
+ <el-card
206
+ v-for="(item, key) in curWindowBtnList"
207
+ :key="key"
208
+ shadow="never"
209
+ style="margin-top: 5px">
210
+ <template #header>
211
+ {{ item.NAME }}
212
+ <el-checkbox
213
+ style="margin-left: 10px"
214
+ :indeterminate="item.indeterminate"
215
+ v-model="item.checkAll"
216
+ :key="item.ID"
217
+ @change="handleCheckAll(item, key)">
218
+ 全选
219
+ </el-checkbox>
220
+ </template>
221
+ <el-checkbox-group
222
+ v-model="item.checkChilds"
223
+ :options="
224
+ item.childs.map((item) => {
225
+ return {value: item.ID, label: item.NAME};
226
+ })
227
+ "
228
+ @change="checkAllGroupChange($event, key)">
229
+ <el-checkbox
230
+ v-for="child in item.childs"
231
+ :key="child.ID"
232
+ :label="child.ID">
233
+ {{ child.NAME }}
234
+ </el-checkbox>
235
+ </el-checkbox-group>
236
+ </el-card>
237
+ <el-empty
238
+ description="暂无按钮权限数据"
239
+ v-if="curWindowBtnList.length === 0"></el-empty>
240
+ </div>
241
+ </el-col>
242
+ </el-row>
243
+ <template #footer>
78
244
  <el-button
79
- size="small"
80
- type="success"
81
- @click="editOrg(row)">
82
- 角色机构
245
+ type="primary"
246
+ :loading="submitPermLoading"
247
+ @click="submitPermEdit">
248
+ 提交
83
249
  </el-button>
84
250
  <el-button
85
- size="small"
86
- type="info"
87
- @click="edit(row)">
88
- 编辑
251
+ text
252
+ @click="cancelPermEdit">
253
+ 取消
89
254
  </el-button>
90
- <el-popconfirm
91
- title="你确定要删除吗"
92
- ok-text="确定"
93
- cancel-text="取消"
94
- @confirm="remove(row)">
95
- <template #reference>
96
- <el-button
97
- title="删除"
98
- size="small"
99
- type="danger">
100
- 删除
101
- </el-button>
102
- </template>
103
- </el-popconfirm>
104
255
  </template>
105
- </el-table-column>
106
- </el-table>
107
- <el-pagination
108
- v-model:current-page="pagination.currentPage"
109
- v-model:page-size="pagination.pageSize"
110
- :page-sizes="[15, 30, 50, 100]"
111
- layout="prev, pager, next, sizes, total, jumper"
112
- :total="pagination.total"
113
- @size-change="getDataList"
114
- @current-change="getDataList" />
115
- <!-- 编辑 -->
116
- <el-dialog
117
- :title="modalTitle"
118
- v-model="roleModalVisible"
119
- :mask-closable="false"
120
- @cancel="cancelRole"
121
- :width="500">
122
- <el-form
123
- ref="roleForm"
124
- :model="roleForm"
125
- :label-width="100"
126
- :rules="roleFormValidate">
127
- <el-form-item
128
- label="组织机构"
129
- prop="ad_org_id">
130
- <dict
131
- dict="ad_org_id"
132
- url="/orgController/getGroupOrgs"
133
- _select_id="2E72E905E55540FA8D2C297A362A2677"
134
- _field_id="FBDE07DC546E453EABBBA45046FF335A"
135
- _region_id="0944A00F8A434099BA2D9B6FA46F35F9"
136
- v-model="roleForm.ad_org_id"
137
- placeholder="请选择或输入搜索"
138
- filterable
139
- clearable />
140
- </el-form-item>
141
- <el-form-item
142
- label="角色名称"
143
- prop="name">
144
- <el-input
145
- v-model="roleForm.name"
146
- placeholder="请输入" />
147
- </el-form-item>
148
- <el-form-item label="角色管理员">
149
- <el-switch
150
- v-model="roleForm.isAdmin"
151
- true-value="Y"
152
- false-value="N"
153
- size="large">
154
- <span slot="Y">Y</span>
155
- <span slot="N">N</span>
156
- </el-switch>
157
- </el-form-item>
158
- <el-form-item
159
- label="备注"
160
- prop="description">
161
- <el-input v-model="roleForm.description" />
162
- </el-form-item>
163
- </el-form>
164
- <div
165
- slot="footer"
166
- style="padding-left: 150px">
167
- <el-button
168
- text
169
- @click="cancelRole">
170
- 取消
171
- </el-button>
172
- <el-button
173
- type="primary"
174
- :loading="submitLoading"
175
- @click="submitRole">
176
- 提交
177
- </el-button>
178
- </div>
179
- </el-dialog>
180
- <!-- 菜单权限 -->
181
- <el-drawer
182
- :title="modalTitle"
183
- v-model="permModalVisible"
184
- :mask-closable="false"
185
- :width="800"
186
- @close="cancelPermEdit">
187
- <el-row>
188
- <el-col
189
- :span="12"
190
- style="overflow: auto; height: 100%">
191
- <el-tree
192
- ref="tree"
193
- v-loading="treeLoading"
194
- :data="permData"
195
- :props="{ label: 'title' }"
196
- show-checkbox
197
- default-expand-all
198
- node-key="adMenuId"
199
- @current-change="selectTree"
200
- @check-change="checkedMenuTree"></el-tree>
201
- </el-col>
202
- <el-col :span="12">
203
- <div class="ivu-card-head"><p style="margin-bottom: 0px">按钮权限</p></div>
204
- <div style="height: 100%; overflow-y: auto; padding: 0 10px">
205
- <el-card
206
- v-for="(item, key) in curWindowBtnList"
207
- :key="key"
208
- shadow="never"
209
- style="margin-top: 5px">
210
- <template #header>
211
- {{ item.NAME }}
212
- <el-checkbox
213
- style="margin-left: 10px"
214
- :indeterminate="item.indeterminate"
215
- v-model="item.checkAll"
216
- :key="item.ID"
217
- @change="handleCheckAll(item, key)">
218
- 全选
219
- </el-checkbox>
220
- </template>
221
- <el-checkbox-group
222
- v-model="item.checkChilds"
223
- :options="
224
- item.childs.map((item) => {
225
- return { value: item.ID, label: item.NAME };
226
- })
227
- "
228
- @change="checkAllGroupChange($event, key)">
229
- <el-checkbox
230
- v-for="child in item.childs"
231
- :key="child.ID"
232
- :label="child.ID">
233
- {{ child.NAME }}
234
- </el-checkbox>
235
- </el-checkbox-group>
236
- </el-card>
237
- <el-empty
238
- description="暂无按钮权限数据"
239
- v-if="curWindowBtnList.length === 0"></el-empty>
256
+ </el-drawer>
257
+ <!-- 角色机构所属 -->
258
+ <el-dialog
259
+ :title="modalTitle"
260
+ v-model="orgModalVisible"
261
+ :close-on-click-modal="false"
262
+ :width="400"
263
+ class="depModal yh-el-dialog">
264
+ <el-alert
265
+ show-icon
266
+ title="请勾选下方组织机构,选中复选框为角色管理员"></el-alert>
267
+ <div style="margin-top: 15px; min-height: 300px">
268
+ <div style="position: relative">
269
+ <el-tree
270
+ ref="depTree"
271
+ :data="orgData"
272
+ :props="{label: 'title'}"
273
+ show-checkbox
274
+ default-expand-all
275
+ node-key="adOrgId"
276
+ check-on-click-node
277
+ check-strictly
278
+ :selectedKeys.sync="selectedKeys"
279
+ v-model="deptCheckedKeys"
280
+ @check-change="checkOrgTree"></el-tree>
240
281
  </div>
241
- </el-col>
242
- </el-row>
243
- <template #footer>
244
- <el-button
245
- type="primary"
246
- :loading="submitPermLoading"
247
- @click="submitPermEdit">
248
- 提交
249
- </el-button>
250
- <el-button
251
- text
252
- @click="cancelPermEdit">
253
- 取消
254
- </el-button>
255
- </template>
256
- </el-drawer>
257
- <!-- 角色机构所属 -->
258
- <el-dialog
259
- :title="modalTitle"
260
- v-model="orgModalVisible"
261
- :close-on-click-modal="false"
262
- :width="500"
263
- class="depModal yh-el-dialog">
264
- <el-alert
265
- show-icon
266
- title="请勾选下方组织机构,选中复选框为角色管理员"></el-alert>
267
- <div style="margin-top: 15px">
268
- <div style="position: relative">
269
- <el-tree
270
- ref="depTree"
271
- :data="orgData"
272
- :props="{ label: 'title' }"
273
- show-checkbox
274
- default-expand-all
275
- node-key="adOrgId"
276
- check-on-click-node
277
- :selectedKeys.sync="selectedKeys"
278
- v-model="deptCheckedKeys"
279
- @check-change="checkOrgTree"></el-tree>
280
282
  </div>
281
- </div>
282
- <template #footer>
283
- <el-button
284
- type="primary"
285
- :loading="submitDepLoading"
286
- @click="submitRoleOrg">
287
- 提交
288
- </el-button>
289
- <el-button
290
- text
291
- @click="orgModalVisible = false">
292
- 取消
293
- </el-button>
294
- </template>
295
- </el-dialog>
283
+ <template #footer>
284
+ <el-button
285
+ type="primary"
286
+ :loading="submitDepLoading"
287
+ @click="submitRoleOrg">
288
+ 提交
289
+ </el-button>
290
+ <el-button
291
+ text
292
+ @click="orgModalVisible = false">
293
+ 取消
294
+ </el-button>
295
+ </template>
296
+ </el-dialog>
297
+ </div>
296
298
  </div>
297
299
  </template>
298
300
 
299
301
  <script src="./roleManage.js"></script>
300
302
  <style lang="scss">
301
- .search {
302
- padding: 10px 0;
303
- .operation {
304
- margin-bottom: 2vh;
305
- }
303
+ .main-container:has(.ver-container) {
304
+ overflow: hidden;
305
+ }
306
+ .ver-container {
307
+ display: flex;
308
+ flex-direction: column;
309
+ overflow: hidden;
310
+ height: 100%;
311
+ .ver-col {
312
+ flex: 1;
313
+ width: 100%;
314
+ overflow: hidden;
315
+ display: flex;
316
+ flex-direction: column;
317
+ .operation {
318
+ display: flex;
319
+ padding: 8px 16px;
320
+ }
321
+ .el-table {
322
+ flex: 1;
323
+ overflow: hidden;
324
+ }
306
325
 
307
- .select-count {
308
- font-weight: 600;
309
- color: #40a9ff;
310
- }
326
+ .select-count {
327
+ font-weight: 600;
328
+ color: #40a9ff;
329
+ }
311
330
 
312
- .select-clear {
313
- margin-left: 10px;
314
- }
331
+ .select-clear {
332
+ margin-left: 10px;
333
+ }
315
334
 
316
- .page {
317
- margin-top: 2vh;
318
- }
335
+ .page {
336
+ margin-top: 2vh;
337
+ }
319
338
 
320
- .drop-down {
321
- margin-left: 5px;
322
- }
323
- .el-pagination {
324
- padding: 10px 0;
325
- justify-content: flex-end;
326
- }
327
- .el-drawer__body {
328
- overflow: hidden;
329
- .el-row {
330
- height: 100%;
339
+ .drop-down {
340
+ margin-left: 5px;
341
+ }
342
+
343
+ .el-pagination {
344
+ padding: 10px 0;
345
+ justify-content: flex-end;
346
+ }
347
+
348
+ .el-drawer__body {
331
349
  overflow: hidden;
332
- .el-card__header {
333
- padding: 5px 10px;
334
- }
335
- .el-card__body {
336
- padding: 7px 10px;
350
+
351
+ .el-row {
352
+ height: 100%;
353
+ overflow: hidden;
354
+
355
+ .el-card__header {
356
+ padding: 5px 10px;
357
+ }
358
+
359
+ .el-card__body {
360
+ padding: 7px 10px;
361
+ }
337
362
  }
338
363
  }
339
364
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "yh-pub",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "公共代码",
5
5
  "scripts": {
6
- "pub:npm": "npm publish --registry https://registry.npmjs.org/ --no-git-checks"
6
+ "pub": "npm publish --registry https://registry.npmjs.org/ --no-git-checks && npm publish --registry https://packages.aliyun.com/60765e0161a945067837bb5f/npm/npm-registry/ --no-git-checks"
7
7
  },
8
8
  "peerDependencies": {
9
9
  "vue": "^3.0.0"
10
10
  },
11
11
  "author": "Liubin"
12
- }
12
+ }