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

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,79 @@
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
+ this.showVocMenuBtn = (dicts || []).some((item) => item.sn === "voc");
111
+ },
112
+ }).finally(() => {
113
+ this.initTableList();
114
+ });
63
115
  },
64
116
  data() {
65
117
  return {
66
- activeName: 'second',
118
+ activeName: "second",
67
119
  dataId: 0,
68
120
  showEdit: false,
121
+ showVocEdit: false,
122
+ showVocMenuBtn: false,
69
123
  vxeOption: {},
70
- formData: {}
124
+ formData: {},
71
125
  };
72
126
  },
73
127
  methods: {
74
128
  searchEvent() {
75
- this.$refs['table-m1'].commitProxy('reload');
129
+ this.$refs["table-m1"].commitProxy("reload");
76
130
  },
77
131
  resetEvent() {
78
132
  this.formData = {};
79
- this.$refs['table-m1'].commitProxy('reload');
133
+ this.$refs["table-m1"].commitProxy("reload");
80
134
  },
81
135
  openEditDialog(id) {
82
- this.dataId = !id || typeof id == 'object' ? '' : id;
83
- this.activeName = 'first';
84
- this.$openEditView('showEdit');
136
+ this.dataId = !id || typeof id == "object" ? "" : id;
137
+ this.activeName = "first";
138
+ this.showVocEdit = false;
139
+ this.$openEditView("showEdit");
140
+ },
141
+ openVocEditDialog(id) {
142
+ this.dataId = !id || typeof id == "object" ? "" : id;
143
+ this.activeName = "first";
144
+ this.showEdit = false;
145
+ this.$openEditView("showVocEdit");
85
146
  },
86
147
  initTableList() {
87
148
  let tableOption = {
88
149
  vue: this,
89
- tableRef: 'table-m1',
90
- tableName: 'basic_role_list-m1',
91
- path: USER_PREFIX + '/role/listCurrentPage',
150
+ tableRef: "table-m1",
151
+ tableName: "basic_role_list-m1",
152
+ path: USER_PREFIX + "/role/listCurrentPage",
92
153
  param: () => {
93
154
  return this.formData;
94
155
  },
95
156
  columns: [
96
157
  {
97
- type: 'checkbox',
98
- fixed: 'left',
158
+ type: "checkbox",
159
+ fixed: "left",
99
160
  width: 48,
100
- resizable: false
161
+ resizable: false,
101
162
  },
102
163
  {
103
- title: this.$t1('用户角色'),
104
- field: 'name',
164
+ title: this.$t1("用户角色"),
165
+ field: "name",
105
166
  width: 150,
106
167
  sortable: true,
107
- fixed: 'left'
168
+ fixed: "left",
108
169
  },
109
170
  /* {
110
171
  title: this.$t1('角色编码'),
@@ -112,37 +173,36 @@ export default {
112
173
  width: 150
113
174
  }, */
114
175
  {
115
- title: this.$t1('角色描述'),
116
- field: 'description',
117
-
176
+ title: this.$t1("角色描述"),
177
+ field: "description",
118
178
  },
119
179
  {
120
- title: this.$t1('是否内置'),
121
- field: 'systems',
180
+ title: this.$t1("是否内置"),
181
+ field: "systems",
122
182
  width: 150,
123
183
  slots: {
124
- default: ({row}) => {
184
+ default: ({ row }) => {
125
185
  if (row.systems) {
126
- return this.$t1('');
186
+ return this.$t1("");
127
187
  } else {
128
- return this.$t1('');
188
+ return this.$t1("");
129
189
  }
130
- }
131
- }
190
+ },
191
+ },
132
192
  },
133
- {title: this.$t1('所属组织'), field: 'companyName', width: 150},
193
+ { title: this.$t1("所属组织"), field: "companyName", width: 150 },
134
194
  {
135
- field: 'createDate',
136
- title: this.$t1('创建时间'),
137
- width: 150
195
+ field: "createDate",
196
+ title: this.$t1("创建时间"),
197
+ width: 150,
138
198
  },
139
199
  {
140
- width: 47,
141
- fixed: 'right',
142
- title: '',
200
+ width: 150,
201
+ fixed: "right",
202
+ title: "",
143
203
  sortable: false,
144
204
  slots: {
145
- default: ({row}) => {
205
+ default: ({ row }) => {
146
206
  return [
147
207
  <a
148
208
  href="javascript:void(0);"
@@ -151,22 +211,37 @@ export default {
151
211
  this.openEditDialog(row.id);
152
212
  }}
153
213
  >
154
- <el-tooltip enterable={false} effect="dark" content={this.$t1('查看')} placement="top"
155
- popper-class="tooltip-skin">
156
- <i class="el-icon-edit"/>
214
+ <el-tooltip
215
+ enterable={false}
216
+ effect="dark"
217
+ content={this.$t1("查看")}
218
+ placement="top"
219
+ popper-class="tooltip-skin"
220
+ >
221
+ <i class="el-icon-edit" />
157
222
  </el-tooltip>
158
- </a>
223
+ </a>,
224
+ <a
225
+ href="javascript:void(0);"
226
+ class="a-link"
227
+ onclick={() => {
228
+ this.openVocEditDialog(row.id);
229
+ }}
230
+ v-show={this.showVocMenuBtn}
231
+ >
232
+ {this.$t1("VOC菜单")}
233
+ </a>,
159
234
  ];
160
- }
161
- }
162
- }
163
- ]
235
+ },
236
+ },
237
+ },
238
+ ],
164
239
  };
165
- this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
240
+ this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
166
241
  this.vxeOption = opts;
167
242
  });
168
- }
169
- }
243
+ },
244
+ },
170
245
  };
171
246
  </script>
172
247
 
@@ -0,0 +1,282 @@
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
+ {{ $t1("VOC菜单") }}{{ 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="$t1('VOC菜单')">
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
+ role: {},
137
+ allMenus: [],
138
+ };
139
+ },
140
+ created() {
141
+ if (this._dataId) this.dataId = this._dataId;
142
+ },
143
+ mounted() {
144
+ this.getData();
145
+ },
146
+ methods: {
147
+ getData() {
148
+ if (!this.dataId) {
149
+ this.initMenuData();
150
+ return;
151
+ }
152
+ this.$commonHttp({
153
+ url: USER_PREFIX + `/role/get`,
154
+ method: `post`,
155
+ data: {
156
+ id: this.dataId,
157
+ },
158
+ isLoading: true,
159
+ modalStrictly: true,
160
+ success: (res) => {
161
+ this.role = res.objx || {};
162
+ this.initMenuData();
163
+ },
164
+ });
165
+ },
166
+ initMenuData() {
167
+ this.$http({
168
+ url: USER_PREFIX + "/third_party_menu/getAll",
169
+ method: "POST",
170
+ data: {
171
+ stringOne: this.sysType,
172
+ },
173
+ isLoading: true,
174
+ modalStrictly: true,
175
+ success: (res) => {
176
+ let menus = res.objx || [];
177
+ this.handleRoles(menus, this.role.thirdPartyMenuIds || []);
178
+ this.allMenus = menus;
179
+ },
180
+ });
181
+ },
182
+ saveData() {
183
+ if (!this.dataId) {
184
+ this.$message.warning(this.$t1("请先选择角色"));
185
+ return;
186
+ }
187
+ this.$baseConfirm(this.$t1("您确定要保存吗?")).then(() => {
188
+ this.$http({
189
+ url: USER_PREFIX + `/role/saveThirdPartyMenus`,
190
+ method: `post`,
191
+ data: {
192
+ id: this.dataId,
193
+ sysType: this.sysType,
194
+ thirdPartyMenuIds: this.getSelectedMenuIds(),
195
+ },
196
+ isLoading: true,
197
+ success: (res) => {
198
+ this.$message({
199
+ message: res.content,
200
+ type: "success",
201
+ duration: 500,
202
+ onClose: () => {
203
+ this.$baseReload();
204
+ },
205
+ });
206
+ },
207
+ });
208
+ });
209
+ },
210
+ getSelectedMenuIds() {
211
+ let ids = [];
212
+ let walk = (nodes) => {
213
+ let hasSelected = false;
214
+ (nodes || []).forEach((node) => {
215
+ let childSelected = walk(node.children);
216
+ if (node.hasAuth || childSelected) {
217
+ ids.push(node.id);
218
+ hasSelected = true;
219
+ }
220
+ });
221
+ return hasSelected;
222
+ };
223
+ walk(this.allMenus);
224
+ return ids;
225
+ },
226
+ selectAll(subItem) {
227
+ let res = subItem.hasAuth;
228
+ if (subItem.children) {
229
+ subItem.children.forEach(function (thrItem) {
230
+ thrItem.hasAuth = res;
231
+ if (thrItem.children) {
232
+ thrItem.children.forEach(function (fourthItem) {
233
+ fourthItem.hasAuth = res;
234
+ });
235
+ }
236
+ });
237
+ }
238
+ this.$forceUpdate();
239
+ },
240
+ cancelSelect(subItem, index3) {
241
+ let citem = subItem.children[index3];
242
+ let res = citem.hasAuth;
243
+ let isCheckSubItem = false;
244
+ subItem.children.forEach(function (thrItem) {
245
+ if (thrItem.hasAuth) {
246
+ isCheckSubItem = true;
247
+ }
248
+ });
249
+ if (citem.type !== 1) {
250
+ subItem.hasAuth = isCheckSubItem;
251
+ } else {
252
+ if (isCheckSubItem) subItem.hasAuth = true;
253
+ }
254
+ if (citem.children) {
255
+ citem.children.forEach(function (fourthItem) {
256
+ fourthItem.hasAuth = res;
257
+ });
258
+ }
259
+ this.$forceUpdate();
260
+ },
261
+ changeBtnSelect(subItem, index3) {
262
+ let isCheckSubItem = false;
263
+ subItem.children.forEach(function (thrItem) {
264
+ if (thrItem.hasAuth) {
265
+ isCheckSubItem = true;
266
+ }
267
+ });
268
+ subItem.hasAuth = isCheckSubItem;
269
+ this.$forceUpdate();
270
+ },
271
+ handleRoles(rows, menuIds) {
272
+ let idSet = new Set((menuIds || []).map((id) => String(id)));
273
+ (rows || []).forEach((row) => {
274
+ row.hasAuth = idSet.has(String(row.id));
275
+ if (row.children) {
276
+ this.handleRoles(row.children, menuIds);
277
+ }
278
+ });
279
+ },
280
+ },
281
+ };
282
+ </script>