cloud-web-corejs 1.0.54-dev.802 → 1.0.54-dev.804

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.
@@ -96,11 +96,11 @@
96
96
  </tr>
97
97
  <tr>
98
98
  <th>{{ $t1("创建人") }}</th>
99
- <td>{{ role.createBy }}</td>
99
+ <td>{{ role._createBy }}</td>
100
100
  <th>{{ $t1("创建时间") }}</th>
101
101
  <td>{{ role.createDate }}</td>
102
102
  <th>{{ $t1("更新人") }}</th>
103
- <td>{{ role.modifyBy }}</td>
103
+ <td>{{ role._modifyBy }}</td>
104
104
  <th>{{ $t1("更新时间") }}</th>
105
105
  <td>{{ role.modifyDate }}</td>
106
106
  </tr>
@@ -117,7 +117,11 @@
117
117
  <i
118
118
  class="fr"
119
119
  @click="$set(item, 'visibleRole', !item.visibleRole)"
120
- :class="!item.visibleRole ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
120
+ :class="
121
+ !item.visibleRole
122
+ ? 'el-icon-arrow-up'
123
+ : 'el-icon-arrow-down'
124
+ "
121
125
  ></i>
122
126
  </div>
123
127
  <div class="c" :class="{ hide: item.visibleRole }">
@@ -170,7 +174,9 @@
170
174
  <i
171
175
  class="fr"
172
176
  @click="visibleHome = !visibleHome"
173
- :class="!visibleHome ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
177
+ :class="
178
+ !visibleHome ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
179
+ "
174
180
  ></i>
175
181
  </div>
176
182
  <div class="c" :class="{ hide: visibleHome }">
@@ -195,13 +201,21 @@
195
201
  <baseTabPane :label="$t1('移动端菜单信息')">
196
202
  <template #default>
197
203
  <div class="role-box">
198
- <div class="item" v-for="(item, index) in allMobileMenus" :key="index">
204
+ <div
205
+ class="item"
206
+ v-for="(item, index) in allMobileMenus"
207
+ :key="index"
208
+ >
199
209
  <div class="t">
200
210
  {{ item.menuName }}
201
211
  <i
202
212
  class="fr"
203
213
  @click="$set(item, 'visibleRole', !item.visibleRole)"
204
- :class="!item.visibleRole ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
214
+ :class="
215
+ !item.visibleRole
216
+ ? 'el-icon-arrow-up'
217
+ : 'el-icon-arrow-down'
218
+ "
205
219
  ></i>
206
220
  </div>
207
221
  <div class="c" :class="{ hide: item.visibleRole }">
@@ -329,7 +343,8 @@ export default {
329
343
  this.$refs.editForm.$baseValidate((valid) => {
330
344
  if (valid) {
331
345
  this.$baseConfirm(this.$t1("您确定要保存吗?")).then(() => {
332
- var url = USER_PREFIX + (this.isEdit ? `/role/update` : `/role/save`);
346
+ var url =
347
+ USER_PREFIX + (this.isEdit ? `/role/update` : `/role/save`);
333
348
  let formData = this.role;
334
349
  formData.menuIds = this.getMenuFormData();
335
350
  formData.mobileMenuIds = this.getMobileMenuFormData();
@@ -501,10 +516,18 @@ export default {
501
516
  that.handlePermission(item, menuRolePermDTOs, menuRolePermOrgDTOs);
502
517
  if (item.children) {
503
518
  item.children.forEach(function (subItem) {
504
- that.handlePermission(subItem, menuRolePermDTOs, menuRolePermOrgDTOs);
519
+ that.handlePermission(
520
+ subItem,
521
+ menuRolePermDTOs,
522
+ menuRolePermOrgDTOs
523
+ );
505
524
  if (subItem.children) {
506
525
  subItem.children.forEach(function (thrItem) {
507
- that.handlePermission(thrItem, menuRolePermDTOs, menuRolePermOrgDTOs);
526
+ that.handlePermission(
527
+ thrItem,
528
+ menuRolePermDTOs,
529
+ menuRolePermOrgDTOs
530
+ );
508
531
  });
509
532
  }
510
533
  });
@@ -2,36 +2,80 @@
2
2
  <div id="containt">
3
3
  <el-tabs v-model="activeName" class="tab-box">
4
4
  <el-tab-pane :label="$t1('常规')" name="first">
5
- <editView v-if="showEdit" visible-key="showEdit" :_dataId.sync="dataId" :parent-target="_self"
6
- @reload="$reloadHandle"></editView>
5
+ <editView
6
+ v-if="showEdit"
7
+ visible-key="showEdit"
8
+ :_dataId.sync="dataId"
9
+ :parent-target="_self"
10
+ @reload="$reloadHandle"
11
+ ></editView>
12
+ <vocEditView
13
+ v-if="showVocEdit"
14
+ visible-key="showVocEdit"
15
+ :_dataId.sync="dataId"
16
+ :parent-target="_self"
17
+ @reload="$reloadHandle"
18
+ ></vocEditView>
7
19
  </el-tab-pane>
8
20
  <el-tab-pane :label="$t1('列表')" name="second">
9
21
  <div class="grid-height">
10
- <vxe-grid ref="table-m1" v-bind="vxeOption" @resizable-change="$vxeTableUtil.onColumnWitchChange"
11
- @custom="$vxeTableUtil.customHandle">
22
+ <vxe-grid
23
+ ref="table-m1"
24
+ v-bind="vxeOption"
25
+ @resizable-change="$vxeTableUtil.onColumnWitchChange"
26
+ @custom="$vxeTableUtil.customHandle"
27
+ >
12
28
  <template #form>
13
29
  <div class="clearfix screen-btns">
14
30
  <div class="fl">
15
- <vxe-button status="primary" class="button-sty" icon="el-icon-plus" @click="openEditDialog">
16
- {{ $t1('新增') }}
31
+ <vxe-button
32
+ status="primary"
33
+ class="button-sty"
34
+ icon="el-icon-plus"
35
+ @click="openEditDialog"
36
+ >
37
+ {{ $t1("新增") }}
17
38
  </vxe-button>
18
- <base-table-export :option="{ title: $t1('用户角色导出'), targetRef: 'table-m1'}"
19
- :parent-target="_self"/>
39
+ <base-table-export
40
+ :option="{
41
+ title: $t1('用户角色导出'),
42
+ targetRef: 'table-m1',
43
+ }"
44
+ :parent-target="_self"
45
+ />
20
46
  </div>
21
47
  <div class="fr">
22
- <vxe-button icon="el-icon-brush" class="button-sty" @click="resetEvent" type="text" status="primary"
23
- plain>{{ $t1('刷新') }}
48
+ <vxe-button
49
+ icon="el-icon-brush"
50
+ class="button-sty"
51
+ @click="resetEvent"
52
+ type="text"
53
+ status="primary"
54
+ plain
55
+ >{{ $t1("刷新") }}
24
56
  </vxe-button>
25
- <vxe-button status="warning" icon="el-icon-search" class="button-sty" @click="searchEvent">
26
- {{ $t1('搜索') }}
57
+ <vxe-button
58
+ status="warning"
59
+ icon="el-icon-search"
60
+ class="button-sty"
61
+ @click="searchEvent"
62
+ >
63
+ {{ $t1("搜索") }}
27
64
  </vxe-button>
28
65
  </div>
29
66
  </div>
30
- <vxe-form ref="form" class="screen-box" title-width="92px" title-align="right" :data="formData"
31
- @submit="searchEvent" @reset="searchEvent">
32
- <vxe-form-item :title="$t1('用户角色')+':'" field="name">
67
+ <vxe-form
68
+ ref="form"
69
+ class="screen-box"
70
+ title-width="92px"
71
+ title-align="right"
72
+ :data="formData"
73
+ @submit="searchEvent"
74
+ @reset="searchEvent"
75
+ >
76
+ <vxe-form-item :title="$t1('用户角色') + ':'" field="name">
33
77
  <template v-slot>
34
- <el-input v-model="formData.name" size="small" clearable/>
78
+ <el-input v-model="formData.name" size="small" clearable />
35
79
  </template>
36
80
  </vxe-form-item>
37
81
  <!-- <vxe-form-item :title="$t1('角色编码')+':'" field="code">
@@ -49,62 +93,82 @@
49
93
  </template>
50
94
 
51
95
  <script>
52
- import editView from './edit.vue';
96
+ import editView from "./edit.vue";
97
+ import vocEditView from "./voc_edit.vue";
53
98
 
54
99
  export default {
55
- name: 'role:list',
100
+ name: "role:list",
56
101
  components: {
57
- editView
58
- },
59
- created() {
102
+ editView,
103
+ vocEditView,
60
104
  },
105
+ created() {},
61
106
  mounted() {
62
- this.initTableList();
107
+ this.$getBaseDicts({
108
+ code: "sysType",
109
+ success: ({ dicts }) => {
110
+ let vocItem = (dicts || []).find((item) => item.sn === "voc");
111
+ this.showVocMenuBtn = !!vocItem;
112
+ this.vocMenuLabel = (vocItem && vocItem.value) || "";
113
+ },
114
+ }).finally(() => {
115
+ this.initTableList();
116
+ });
63
117
  },
64
118
  data() {
65
119
  return {
66
- activeName: 'second',
120
+ activeName: "second",
67
121
  dataId: 0,
68
122
  showEdit: false,
123
+ showVocEdit: false,
124
+ showVocMenuBtn: false,
125
+ vocMenuLabel: "",
69
126
  vxeOption: {},
70
- formData: {}
127
+ formData: {},
71
128
  };
72
129
  },
73
130
  methods: {
74
131
  searchEvent() {
75
- this.$refs['table-m1'].commitProxy('reload');
132
+ this.$refs["table-m1"].commitProxy("reload");
76
133
  },
77
134
  resetEvent() {
78
135
  this.formData = {};
79
- this.$refs['table-m1'].commitProxy('reload');
136
+ this.$refs["table-m1"].commitProxy("reload");
80
137
  },
81
138
  openEditDialog(id) {
82
- this.dataId = !id || typeof id == 'object' ? '' : id;
83
- this.activeName = 'first';
84
- this.$openEditView('showEdit');
139
+ this.dataId = !id || typeof id == "object" ? "" : id;
140
+ this.activeName = "first";
141
+ this.showVocEdit = false;
142
+ this.$openEditView("showEdit");
143
+ },
144
+ openVocEditDialog(id) {
145
+ this.dataId = !id || typeof id == "object" ? "" : id;
146
+ this.activeName = "first";
147
+ this.showEdit = false;
148
+ this.$openEditView("showVocEdit");
85
149
  },
86
150
  initTableList() {
87
151
  let tableOption = {
88
152
  vue: this,
89
- tableRef: 'table-m1',
90
- tableName: 'basic_role_list-m1',
91
- path: USER_PREFIX + '/role/listCurrentPage',
153
+ tableRef: "table-m1",
154
+ tableName: "basic_role_list-m1",
155
+ path: USER_PREFIX + "/role/listCurrentPage",
92
156
  param: () => {
93
157
  return this.formData;
94
158
  },
95
159
  columns: [
96
160
  {
97
- type: 'checkbox',
98
- fixed: 'left',
161
+ type: "checkbox",
162
+ fixed: "left",
99
163
  width: 48,
100
- resizable: false
164
+ resizable: false,
101
165
  },
102
166
  {
103
- title: this.$t1('用户角色'),
104
- field: 'name',
167
+ title: this.$t1("用户角色"),
168
+ field: "name",
105
169
  width: 150,
106
170
  sortable: true,
107
- fixed: 'left'
171
+ fixed: "left",
108
172
  },
109
173
  /* {
110
174
  title: this.$t1('角色编码'),
@@ -112,37 +176,36 @@ export default {
112
176
  width: 150
113
177
  }, */
114
178
  {
115
- title: this.$t1('角色描述'),
116
- field: 'description',
117
-
179
+ title: this.$t1("角色描述"),
180
+ field: "description",
118
181
  },
119
182
  {
120
- title: this.$t1('是否内置'),
121
- field: 'systems',
183
+ title: this.$t1("是否内置"),
184
+ field: "systems",
122
185
  width: 150,
123
186
  slots: {
124
- default: ({row}) => {
187
+ default: ({ row }) => {
125
188
  if (row.systems) {
126
- return this.$t1('');
189
+ return this.$t1("");
127
190
  } else {
128
- return this.$t1('');
191
+ return this.$t1("");
129
192
  }
130
- }
131
- }
193
+ },
194
+ },
132
195
  },
133
- {title: this.$t1('所属组织'), field: 'companyName', width: 150},
196
+ { title: this.$t1("所属组织"), field: "companyName", width: 150 },
134
197
  {
135
- field: 'createDate',
136
- title: this.$t1('创建时间'),
137
- width: 150
198
+ field: "createDate",
199
+ title: this.$t1("创建时间"),
200
+ width: 150,
138
201
  },
139
202
  {
140
- width: 47,
141
- fixed: 'right',
142
- title: '',
203
+ width: 150,
204
+ fixed: "right",
205
+ title: "",
143
206
  sortable: false,
144
207
  slots: {
145
- default: ({row}) => {
208
+ default: ({ row }) => {
146
209
  return [
147
210
  <a
148
211
  href="javascript:void(0);"
@@ -151,22 +214,37 @@ export default {
151
214
  this.openEditDialog(row.id);
152
215
  }}
153
216
  >
154
- <el-tooltip enterable={false} effect="dark" content={this.$t1('查看')} placement="top"
155
- popper-class="tooltip-skin">
156
- <i class="el-icon-edit"/>
217
+ <el-tooltip
218
+ enterable={false}
219
+ effect="dark"
220
+ content={this.$t1("查看")}
221
+ placement="top"
222
+ popper-class="tooltip-skin"
223
+ >
224
+ <i class="el-icon-edit" />
157
225
  </el-tooltip>
158
- </a>
226
+ </a>,
227
+ <a
228
+ href="javascript:void(0);"
229
+ class="a-link"
230
+ onclick={() => {
231
+ this.openVocEditDialog(row.id);
232
+ }}
233
+ v-show={this.showVocMenuBtn}
234
+ >
235
+ {this.vocMenuLabel}
236
+ </a>,
159
237
  ];
160
- }
161
- }
162
- }
163
- ]
238
+ },
239
+ },
240
+ },
241
+ ],
164
242
  };
165
- this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
243
+ this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
166
244
  this.vxeOption = opts;
167
245
  });
168
- }
169
- }
246
+ },
247
+ },
170
248
  };
171
249
  </script>
172
250
 
@@ -0,0 +1,293 @@
1
+ <template>
2
+ <div class="detail-wrap">
3
+ <el-form ref="editForm" :model="role">
4
+ <div class="d-header clearfix">
5
+ <div class="fl">
6
+ <i class="el-icon-info" />
7
+ {{ vocMenuLabel }}{{ role.name ? " - " + role.name : "" }}
8
+ </div>
9
+ <div class="fr">
10
+ <el-button
11
+ type="primary"
12
+ plain
13
+ class="button-sty"
14
+ @click="$baseReload()"
15
+ icon="el-icon-refresh-right"
16
+ >
17
+ {{ $t1("重置") }}
18
+ </el-button>
19
+ <el-button
20
+ type="primary"
21
+ class="button-sty"
22
+ icon="el-icon-check"
23
+ @click="saveData"
24
+ >{{ $t1("保存") }}
25
+ </el-button>
26
+ </div>
27
+ </div>
28
+ <baseTabs>
29
+ <baseTabPane :label="$t1('基本信息')">
30
+ <template #default>
31
+ <table class="table-detail">
32
+ <tbody>
33
+ <tr>
34
+ <th>{{ $t1("用户角色") }}</th>
35
+ <td>{{ role.name }}</td>
36
+ <th>{{ $t1("角色编码") }}</th>
37
+ <td>{{ role.code }}</td>
38
+ <th>{{ $t1("是否内置") }}</th>
39
+ <td>
40
+ <template v-if="role.systems">
41
+ {{ $t1("是") }}
42
+ </template>
43
+ <template v-else>
44
+ {{ $t1("否") }}
45
+ </template>
46
+ </td>
47
+ <th></th>
48
+ <td></td>
49
+ </tr>
50
+ <tr>
51
+ <th>{{ $t1("角色描述") }}</th>
52
+ <td colspan="7">{{ role.description }}</td>
53
+ </tr>
54
+ <tr>
55
+ <th>{{ $t1("创建人") }}</th>
56
+ <td>{{ role._createBy }}</td>
57
+ <th>{{ $t1("创建时间") }}</th>
58
+ <td>{{ role.createDate }}</td>
59
+ <th>{{ $t1("更新人") }}</th>
60
+ <td>{{ role._modifyBy }}</td>
61
+ <th>{{ $t1("更新时间") }}</th>
62
+ <td>{{ role.modifyDate }}</td>
63
+ </tr>
64
+ </tbody>
65
+ </table>
66
+ </template>
67
+ </baseTabPane>
68
+ <baseTabPane :label="vocMenuLabel">
69
+ <template #default>
70
+ <div class="role-box">
71
+ <div class="item" v-for="item in allMenus" :key="item.id">
72
+ <div class="t">
73
+ {{ item.menuName }}
74
+ <i
75
+ class="fr"
76
+ @click="$set(item, 'visibleRole', !item.visibleRole)"
77
+ :class="
78
+ !item.visibleRole
79
+ ? 'el-icon-arrow-up'
80
+ : 'el-icon-arrow-down'
81
+ "
82
+ ></i>
83
+ </div>
84
+ <div class="c" :class="{ hide: item.visibleRole }">
85
+ <div v-for="subItem in item.children" :key="subItem.id">
86
+ <div class="c-2nd">
87
+ <el-checkbox
88
+ :label="subItem.menuName"
89
+ v-model="subItem.hasAuth"
90
+ @change="selectAll(subItem)"
91
+ ></el-checkbox>
92
+ </div>
93
+ <div class="c-3rd">
94
+ <div
95
+ class="c-item"
96
+ v-for="(thrItem, index3) in subItem.children"
97
+ :key="thrItem.id"
98
+ >
99
+ <div class="name">
100
+ <el-checkbox
101
+ :label="thrItem.menuName"
102
+ v-model="thrItem.hasAuth"
103
+ @change="cancelSelect(subItem, index3)"
104
+ ></el-checkbox>
105
+ </div>
106
+ <div class="c-4th">
107
+ <el-checkbox
108
+ v-for="(fourthItem, index4) in thrItem.children"
109
+ :key="fourthItem.id"
110
+ :label="fourthItem.menuName"
111
+ v-model="fourthItem.hasAuth"
112
+ @change="changeBtnSelect(subItem, index3, index4)"
113
+ ></el-checkbox>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ </template>
122
+ </baseTabPane>
123
+ </baseTabs>
124
+ </el-form>
125
+ </div>
126
+ </template>
127
+
128
+ <script>
129
+ export default {
130
+ name: "roleVocEdit",
131
+ props: ["_dataId"],
132
+ data() {
133
+ return {
134
+ dataId: "",
135
+ sysType: "voc",
136
+ vocMenuLabel: "",
137
+ role: {},
138
+ allMenus: [],
139
+ };
140
+ },
141
+ created() {
142
+ if (this._dataId) this.dataId = this._dataId;
143
+ this.loadVocMenuLabel();
144
+ },
145
+ mounted() {
146
+ this.getData();
147
+ },
148
+ methods: {
149
+ loadVocMenuLabel() {
150
+ this.$getBaseDicts({
151
+ code: "sysType",
152
+ success: ({ dicts }) => {
153
+ let vocItem = (dicts || []).find((item) => item.sn === this.sysType);
154
+ if (vocItem) this.vocMenuLabel = vocItem.value || "";
155
+ },
156
+ });
157
+ },
158
+ getData() {
159
+ if (!this.dataId) {
160
+ this.initMenuData();
161
+ return;
162
+ }
163
+ this.$commonHttp({
164
+ url: USER_PREFIX + `/role/get`,
165
+ method: `post`,
166
+ data: {
167
+ id: this.dataId,
168
+ },
169
+ isLoading: true,
170
+ modalStrictly: true,
171
+ success: (res) => {
172
+ this.role = res.objx || {};
173
+ this.initMenuData();
174
+ },
175
+ });
176
+ },
177
+ initMenuData() {
178
+ this.$http({
179
+ url: USER_PREFIX + "/third_party_menu/getAll",
180
+ method: "POST",
181
+ data: {
182
+ stringOne: this.sysType,
183
+ },
184
+ isLoading: true,
185
+ modalStrictly: true,
186
+ success: (res) => {
187
+ let menus = res.objx || [];
188
+ this.handleRoles(menus, this.role.thirdPartyMenuIds || []);
189
+ this.allMenus = menus;
190
+ },
191
+ });
192
+ },
193
+ saveData() {
194
+ if (!this.dataId) {
195
+ this.$message.warning(this.$t1("请先选择角色"));
196
+ return;
197
+ }
198
+ this.$baseConfirm(this.$t1("您确定要保存吗?")).then(() => {
199
+ this.$http({
200
+ url: USER_PREFIX + `/role/saveThirdPartyMenus`,
201
+ method: `post`,
202
+ data: {
203
+ id: this.dataId,
204
+ sysType: this.sysType,
205
+ thirdPartyMenuIds: this.getSelectedMenuIds(),
206
+ },
207
+ isLoading: true,
208
+ success: (res) => {
209
+ this.$message({
210
+ message: res.content,
211
+ type: "success",
212
+ duration: 500,
213
+ onClose: () => {
214
+ this.$baseReload();
215
+ },
216
+ });
217
+ },
218
+ });
219
+ });
220
+ },
221
+ getSelectedMenuIds() {
222
+ let ids = [];
223
+ let walk = (nodes) => {
224
+ let hasSelected = false;
225
+ (nodes || []).forEach((node) => {
226
+ let childSelected = walk(node.children);
227
+ if (node.hasAuth || childSelected) {
228
+ ids.push(node.id);
229
+ hasSelected = true;
230
+ }
231
+ });
232
+ return hasSelected;
233
+ };
234
+ walk(this.allMenus);
235
+ return ids;
236
+ },
237
+ selectAll(subItem) {
238
+ let res = subItem.hasAuth;
239
+ if (subItem.children) {
240
+ subItem.children.forEach(function (thrItem) {
241
+ thrItem.hasAuth = res;
242
+ if (thrItem.children) {
243
+ thrItem.children.forEach(function (fourthItem) {
244
+ fourthItem.hasAuth = res;
245
+ });
246
+ }
247
+ });
248
+ }
249
+ this.$forceUpdate();
250
+ },
251
+ cancelSelect(subItem, index3) {
252
+ let citem = subItem.children[index3];
253
+ let res = citem.hasAuth;
254
+ let isCheckSubItem = false;
255
+ subItem.children.forEach(function (thrItem) {
256
+ if (thrItem.hasAuth) {
257
+ isCheckSubItem = true;
258
+ }
259
+ });
260
+ if (citem.type !== 1) {
261
+ subItem.hasAuth = isCheckSubItem;
262
+ } else {
263
+ if (isCheckSubItem) subItem.hasAuth = true;
264
+ }
265
+ if (citem.children) {
266
+ citem.children.forEach(function (fourthItem) {
267
+ fourthItem.hasAuth = res;
268
+ });
269
+ }
270
+ this.$forceUpdate();
271
+ },
272
+ changeBtnSelect(subItem, index3) {
273
+ let isCheckSubItem = false;
274
+ subItem.children.forEach(function (thrItem) {
275
+ if (thrItem.hasAuth) {
276
+ isCheckSubItem = true;
277
+ }
278
+ });
279
+ subItem.hasAuth = isCheckSubItem;
280
+ this.$forceUpdate();
281
+ },
282
+ handleRoles(rows, menuIds) {
283
+ let idSet = new Set((menuIds || []).map((id) => String(id)));
284
+ (rows || []).forEach((row) => {
285
+ row.hasAuth = idSet.has(String(row.id));
286
+ if (row.children) {
287
+ this.handleRoles(row.children, menuIds);
288
+ }
289
+ });
290
+ },
291
+ },
292
+ };
293
+ </script>