yh-pub 1.0.0

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.
Files changed (56) hide show
  1. package/README.MD +19 -0
  2. package/layout/admin/adminIndex.vue +104 -0
  3. package/layout/admin/api/loginApi.js +24 -0
  4. package/layout/admin/api/routers.js +93 -0
  5. package/layout/admin/api/tenantApi.js +123 -0
  6. package/layout/admin/home/homeIndex.vue +25 -0
  7. package/layout/admin/login/login.vue +161 -0
  8. package/layout/admin/menu/MenuIndex.vue +648 -0
  9. package/layout/admin/menu/icon.vue +108 -0
  10. package/layout/admin/menu/iconList.js +934 -0
  11. package/layout/admin/saTenant/saTenant.js +0 -0
  12. package/layout/admin/saTenant/saTenant.vue +173 -0
  13. package/layout/admin/saTenant/saTenantForm.js +80 -0
  14. package/layout/admin/saTenant/saTenantForm.vue +61 -0
  15. package/layout/admin/saTenant/saTenantRoleManage.js +417 -0
  16. package/layout/admin/saTenant/saTenantRoleManage.vue +99 -0
  17. package/layout/admin/user/saUser.less +6 -0
  18. package/layout/admin/user/saUser.vue +72 -0
  19. package/layout/main/components/console/console.vue +205 -0
  20. package/layout/main/components/error-store/error-store.vue +72 -0
  21. package/layout/main/components/error-store/index.js +2 -0
  22. package/layout/main/components/fullscreen/fullscreen.vue +57 -0
  23. package/layout/main/components/fullscreen/index.js +2 -0
  24. package/layout/main/components/language/language.vue +71 -0
  25. package/layout/main/components/side-menu/side-menu.less +74 -0
  26. package/layout/main/components/side-menu/side-menu.vue +75 -0
  27. package/layout/main/components/tags-nav/tags-nav.less +45 -0
  28. package/layout/main/components/tags-nav/tags-nav.vue +144 -0
  29. package/layout/main/components/user/user.less +12 -0
  30. package/layout/main/components/user/user.vue +185 -0
  31. package/layout/main/home/home.vue +480 -0
  32. package/layout/main/home/index.js +2 -0
  33. package/layout/main/home/toDoList.vue +32 -0
  34. package/layout/main/login/login.less +93 -0
  35. package/layout/main/login/login.vue +151 -0
  36. package/layout/main/main.less +81 -0
  37. package/layout/main/main.vue +202 -0
  38. package/layout/main/system/dict.vue +64 -0
  39. package/layout/main/system/orgManage.vue +473 -0
  40. package/layout/main/system/roleManage.js +755 -0
  41. package/layout/main/system/roleManage.vue +399 -0
  42. package/package.json +12 -0
  43. package/view/basic/error-logger.vue +74 -0
  44. package/view/basic/error-page/401.vue +22 -0
  45. package/view/basic/error-page/404.vue +22 -0
  46. package/view/basic/error-page/500.vue +22 -0
  47. package/view/basic/error-page/back-btn-group.vue +48 -0
  48. package/view/basic/error-page/error-content.vue +28 -0
  49. package/view/basic/error-page/error.less +46 -0
  50. package/view/config/component/confFormItem.vue +49 -0
  51. package/view/config/config.scss +45 -0
  52. package/view/config/configIndex.vue +150 -0
  53. package/view/config/subPage/router-config.vue +5 -0
  54. package/view/config/subPage/sys-config.vue +249 -0
  55. package/view/window/IframeFReportView.vue +28 -0
  56. package/view/window/windowIndex.vue +22 -0
@@ -0,0 +1,417 @@
1
+ import {
2
+ saTenantGetById,
3
+ saTenantGetMenuList,
4
+ saTenantGetMenuWindowButton,
5
+ saTenantGetRoleMenus,
6
+ saTenantGetRoleWindowButton,
7
+ saTenantSetMenus,
8
+ } from "../api/tenantApi";
9
+ import { deepClone } from "@/libs/util";
10
+
11
+ export default {
12
+ props: {
13
+ actionData: {
14
+ type: Object,
15
+ },
16
+ },
17
+ watch: {
18
+ actionData: {
19
+ async handler(val) {
20
+ this.id = val.id;
21
+ let dataTemp = await this.getById(val.id);
22
+ this.tenantInfo = dataTemp;
23
+ this.getRoleWindowButton(dataTemp.adRoleId);
24
+ let roleMenuData = await this.getRoleMenus(dataTemp.adRoleId);
25
+ this.initMenu(roleMenuData);
26
+ this.visible = true;
27
+ },
28
+ deep: true,
29
+ },
30
+ },
31
+ data() {
32
+ return {
33
+ tenantInfo: {},
34
+ submitPermLoading: false,
35
+ saveWinBtnList: [],
36
+ unCheckedMenuTreeData: {},
37
+ roleMenuData: {},
38
+ curWindowBtnList: [],
39
+ curSelectedMenuId: "", // 当前选中目录ID
40
+ roleSavedBtnPermMap: {}, // 角色已授予的按钮权限
41
+ checkedMenuKeys: [],
42
+ expandedMenuKeys: [],
43
+ replaceFields: {
44
+ children: "children",
45
+ title: "title",
46
+ },
47
+ permData: [],
48
+ treeLoading: true,
49
+ type: "",
50
+ id: "",
51
+ visible: false,
52
+ };
53
+ },
54
+ computed: {},
55
+ methods: {
56
+ resetBtnPerData() {
57
+ this.roleSavedBtnPermMap = {};
58
+ this.unCheckedMenuTreeData = {};
59
+ this.roleMenuData = {};
60
+ this.curWindowBtnList = [];
61
+ this.saveWinBtnList = [];
62
+ },
63
+ async submitPermEdit() {
64
+ let curVm = this;
65
+ this.submitPermLoading = true;
66
+ let permMenuIds = this.checkedMenuKeys.join(",");
67
+ // // 所有菜单窗口按钮
68
+ let permMenuBtnIds = {};
69
+ Object.keys(this.roleSavedBtnPermMap).forEach(function (key) {
70
+ permMenuBtnIds["W_" + key] = curVm.roleSavedBtnPermMap[key];
71
+ });
72
+ saTenantSetMenus({
73
+ roleId: this.tenantInfo.adRoleId,
74
+ ids: permMenuIds,
75
+ btns: JSON.stringify(permMenuBtnIds),
76
+ adClientId: this.tenantInfo.adClientId,
77
+ adOrgId: this.tenantInfo.adOrgId,
78
+ }).then((res) => {
79
+ this.submitPermLoading = false;
80
+ if (res.data.result) {
81
+ this.$message.success("操作成功");
82
+ this.permModalVisible = false;
83
+ this.cancel();
84
+ } else {
85
+ this.$message.error(res.data.msg);
86
+ }
87
+ });
88
+ },
89
+ getRoleWindowButton(roleId) {
90
+ saTenantGetRoleWindowButton({ adRoleId: roleId }).then((res) => {
91
+ if (res.data.data) {
92
+ let data = res.data.data;
93
+ let roleBtnPermMap = {};
94
+ data.forEach(function (e) {
95
+ if (!roleBtnPermMap[e.sysWindowId]) {
96
+ roleBtnPermMap[e.sysWindowId] = [];
97
+ }
98
+ roleBtnPermMap[e.sysWindowId].push(e.sysWindowButtonId);
99
+ });
100
+ this.roleSavedBtnPermMap = roleBtnPermMap;
101
+ }
102
+ });
103
+ },
104
+ cancel() {
105
+ this.resetBtnPerData();
106
+ this.visible = false;
107
+ this.$emit("getinfo");
108
+ },
109
+ getById: async function (id) {
110
+ let param = {
111
+ adClientId: id,
112
+ };
113
+ let data;
114
+ await saTenantGetById(param).then((res) => {
115
+ if (res.data.data) {
116
+ data = res.data.data;
117
+ }
118
+ });
119
+ return data;
120
+ },
121
+ getRoleMenus: async function (roleId) {
122
+ // 请求角色菜单数据
123
+ let roleMenuData = [];
124
+ let that = this;
125
+ this.expandedMenuKeys.clear();
126
+ this.checkedMenuKeys.clear();
127
+
128
+ await saTenantGetRoleMenus({ adRoleId: roleId }).then((res) => {
129
+ if (res.data.result) {
130
+ res.data.data.forEach(function (e) {
131
+ if (e.MENU_TYPE !== "GROUP") {
132
+ roleMenuData[e.AD_MENU_ID] = e;
133
+ that.checkedMenuKeys.push(e.AD_MENU_ID);
134
+ } else {
135
+ that.expandedMenuKeys.push(e.AD_MENU_ID);
136
+ }
137
+ });
138
+ }
139
+ });
140
+ return roleMenuData;
141
+ },
142
+ initMenu(roleMenuData) {
143
+ let curVm = this;
144
+ saTenantGetMenuList().then((res) => {
145
+ if (res.data.data) {
146
+ let newTreeData = [];
147
+ let data = res.data.data;
148
+ data.forEach(function (e) {
149
+ newTreeData.push(curVm.parseTreeData(e, 0));
150
+ });
151
+ this.calNewTreeData(newTreeData, roleMenuData);
152
+
153
+ curVm.permData = newTreeData;
154
+ curVm.treeLoading = false;
155
+ }
156
+ });
157
+ },
158
+ // 递归标记是否选中
159
+ calNewTreeData(newTreeData, roleMenuData) {
160
+ let curVm = this;
161
+ newTreeData.forEach(function (e) {
162
+ let checkedCount = 0;
163
+ e.expand = true;
164
+
165
+ // 判断是否选中
166
+ if (roleMenuData[e.adMenuId]) {
167
+ e.checked = true;
168
+ checkedCount++;
169
+ }
170
+
171
+ if (e.children && e.children.length > 0) {
172
+ let sonCheckedCount = curVm.calNewTreeData(e.children, roleMenuData);
173
+ // 判断父节点是否选中
174
+ if (sonCheckedCount === e.children.length) {
175
+ e.checked = true;
176
+ e.selectable = true;
177
+ e.indeterminate = false;
178
+ } else if (sonCheckedCount > 0 && sonCheckedCount < e.children.length) {
179
+ e.indeterminate = true;
180
+ e.checked = false;
181
+ e.selectable = true;
182
+ } else {
183
+ e.checked = false;
184
+ e.indeterminate = false;
185
+ }
186
+ }
187
+ return checkedCount;
188
+ });
189
+ },
190
+ selectTree(v, cv) {
191
+ // 菜单选择框不变
192
+ cv.checked = cv.selected;
193
+ if (v.length > 0) {
194
+ this.curSelectedMenuId = cv.selectedNodes[0].data.props.data.sysWindowId;
195
+ if (!this.curSelectedMenuId) {
196
+ this.curWindowBtnList = [];
197
+ // 加载角色已授权的按钮
198
+ this.saveWinBtnList = this.roleSavedBtnPermMap[this.curSelectedMenuId];
199
+ return;
200
+ }
201
+
202
+ // 加载目录树
203
+ saTenantGetMenuWindowButton({ sysWindowId: this.curSelectedMenuId }).then((res) => {
204
+ let { result, data } = res.data;
205
+ if (result && data) {
206
+ let roleBtnData = [];
207
+ let tempQyBtnData = [];
208
+ data.forEach((tData) => {
209
+ if (tData.TYPE === "QY") {
210
+ roleBtnData.push(tData);
211
+ tempQyBtnData[tData.ID] = [];
212
+ } else {
213
+ if (tempQyBtnData[tData.PARENT_ID]) {
214
+ tempQyBtnData[tData.PARENT_ID].push(tData);
215
+ }
216
+ }
217
+ });
218
+ roleBtnData.forEach((item) => {
219
+ item["childs"] = tempQyBtnData[item.ID];
220
+ // e['checkAll'] = false
221
+ let checkChilds = this.roleSavedBtnPermMap[this.curSelectedMenuId];
222
+ let tcount = 0;
223
+ tempQyBtnData[item.ID].forEach((es) => {
224
+ if (checkChilds.includes(es.ID)) {
225
+ tcount++;
226
+ }
227
+ });
228
+ if (tcount === tempQyBtnData[item.ID].length) {
229
+ item["checkAll"] = true;
230
+ item["indeterminate"] = false;
231
+ } else if (tcount > 0) {
232
+ item["checkAll"] = false;
233
+ item["indeterminate"] = true;
234
+ } else {
235
+ item["checkAll"] = false;
236
+ item["indeterminate"] = false;
237
+ }
238
+ item["checkChilds"] = checkChilds;
239
+ });
240
+ this.curWindowBtnList = roleBtnData;
241
+ // 加载角色已授权的按钮
242
+ this.saveWinBtnList = this.roleSavedBtnPermMap[this.curSelectedMenuId];
243
+ }
244
+ });
245
+ }
246
+ },
247
+ checkedMenuTree(v, cv) {
248
+ if (cv.menuType !== "GROUP") {
249
+ if (!cv.checked) {
250
+ if (!this.unCheckedMenuTreeData[cv.adMenuId]) {
251
+ this.unCheckedMenuTreeData[cv.adMenuId] = "1";
252
+ }
253
+ } else {
254
+ delete this.unCheckedMenuTreeData[cv.adMenuId];
255
+ }
256
+ } else {
257
+ this.getTreeCheckedDataLoop(cv, !cv.checked);
258
+ }
259
+ },
260
+ getTreeCheckedDataLoop(cv, delFlag) {
261
+ let curVm = this;
262
+ if (delFlag) {
263
+ if (!this.unCheckedMenuTreeData[cv.adMenuId]) {
264
+ this.unCheckedMenuTreeData[cv.adMenuId] = "1";
265
+ }
266
+ if (cv.children && cv.children.length > 0) {
267
+ cv.children.forEach(function (ss) {
268
+ curVm.getTreeCheckedDataLoop(ss, delFlag);
269
+ });
270
+ }
271
+ } else {
272
+ delete this.unCheckedMenuTreeData[cv.adMenuId];
273
+ }
274
+ },
275
+ renderContent(h, { root, node, data }) {
276
+ let icon = "";
277
+ if (data.level === 0) {
278
+ icon = "ios-navigate";
279
+ } else if (data.level === 1) {
280
+ icon = "md-list-box";
281
+ } else if (data.level === 2) {
282
+ icon = "md-list";
283
+ } else if (data.level === 3) {
284
+ icon = "md-radio-button-on";
285
+ } else {
286
+ icon = "md-radio-button-off";
287
+ }
288
+ return h(
289
+ "span",
290
+ {
291
+ style: {
292
+ display: "inline-block",
293
+ cursor: "pointer",
294
+ },
295
+ on: {
296
+ click: () => {
297
+ data.checked = data.selected;
298
+ },
299
+ },
300
+ },
301
+ [
302
+ h("span", [
303
+ h("Icon", {
304
+ props: {
305
+ type: icon,
306
+ size: "16",
307
+ },
308
+ style: {
309
+ "margin-right": "8px",
310
+ "margin-bottom": "3px",
311
+ },
312
+ }),
313
+ h("span", data.title),
314
+ ]),
315
+ ]
316
+ );
317
+ },
318
+ handleCheckAll(event, item, key) {
319
+ let checkChilds = [];
320
+ if (item.checkAll && (!item.indeterminate || item.indeterminate)) {
321
+ // 已经全选取消全选状态
322
+ item.checkAll = false;
323
+ item.indeterminate = false;
324
+ item.checkChilds = checkChilds;
325
+ } else {
326
+ // 不是全选状态,获取所有ids,并设定全选状态相关参数
327
+ checkChilds = item.childs.map((item) => item.ID);
328
+ item.checkAll = true;
329
+ item.indeterminate = false;
330
+ item.checkChilds = checkChilds;
331
+ }
332
+
333
+ // 状态设置完成,将数据赋值到 响应对象上去
334
+ this.$set(this.roleSavedBtnPermMap, this.curSelectedMenuId, checkChilds);
335
+ this.$set(this.curWindowBtnList, key, item);
336
+ },
337
+ checkAllGroupChange(event, key) {
338
+ let list = deepClone({}, this.curWindowBtnList);
339
+ let currentItem = list[key];
340
+ if (event.length > 0) {
341
+ // 判断是否存在值
342
+ let containFlag = 0; // 0 不包含 1 部分包括 2 全包括
343
+ let okCount = 0; // 统计包括次数
344
+ for (let i = 0; i < currentItem.childs.length; i++) {
345
+ if (event.includes(currentItem.childs[i].ID)) {
346
+ okCount++;
347
+ }
348
+ }
349
+ if (okCount === currentItem.childs.length) {
350
+ containFlag = 2;
351
+ } else {
352
+ containFlag = 1;
353
+ }
354
+ // 判断是否选中
355
+ if (containFlag === 1) {
356
+ currentItem.checkAll = false;
357
+ if (okCount === 0) {
358
+ currentItem.indeterminate = false;
359
+ } else {
360
+ currentItem.indeterminate = true;
361
+ }
362
+ } else if (containFlag === 2) {
363
+ currentItem.checkAll = true;
364
+ currentItem.indeterminate = false;
365
+ }
366
+ } else {
367
+ currentItem.checkAll = false;
368
+ currentItem.indeterminate = false;
369
+ }
370
+ currentItem.checkChilds = event;
371
+ this.$set(this.curWindowBtnList, key, currentItem);
372
+ this.roleSavedBtnPermMap[this.curSelectedMenuId] = event;
373
+ },
374
+ doWinBtnData(doType, btnId) {
375
+ if (!this.saveWinBtnList) {
376
+ this.saveWinBtnList = [];
377
+ }
378
+ if (doType === "add") {
379
+ if (this.saveWinBtnList.length !== 0) {
380
+ for (let i = 0; i < this.saveWinBtnList.length; i++) {
381
+ if (this.saveWinBtnList[i] === btnId) {
382
+ return;
383
+ }
384
+ }
385
+ }
386
+ this.saveWinBtnList.push(btnId);
387
+ } else {
388
+ for (let i = 0; i < this.saveWinBtnList.length; i++) {
389
+ if (this.saveWinBtnList[i] === btnId) {
390
+ this.saveWinBtnList.splice(i, 1);
391
+ return;
392
+ }
393
+ }
394
+ }
395
+ },
396
+ parseTreeData(curLevelData, curLevel) {
397
+ let curVm = this;
398
+ let newLevelData = { data: curLevelData };
399
+ newLevelData["key"] = curLevelData.adMenuId;
400
+ newLevelData["title"] = curLevelData.name;
401
+
402
+ if (curLevelData._childs && curLevelData._childs.length > 0) {
403
+ curLevelData._childs.forEach(function (sonTreeData) {
404
+ if (!newLevelData.children) {
405
+ newLevelData.children = [];
406
+ }
407
+ newLevelData.children.push(curVm.parseTreeData(sonTreeData, curLevel + 1));
408
+ });
409
+ newLevelData["isLeaf"] = false;
410
+ } else {
411
+ newLevelData["isLeaf"] = true;
412
+ }
413
+ delete curLevelData._childs;
414
+ return newLevelData;
415
+ },
416
+ },
417
+ };
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <a-drawer
3
+ title="分配权限"
4
+ :closable="false"
5
+ :visible="visible"
6
+ :width="800"
7
+ @close="cancel"
8
+ draggable>
9
+ <a-row>
10
+ <a-col span="12">
11
+ <a-card title="菜单权限">
12
+ <div class="drawer-content">
13
+ <a-tree
14
+ ref="tree"
15
+ :tree-data="permData"
16
+ checkable
17
+ @select="selectTree"
18
+ @check="checkedMenuTree"
19
+ default-expand-parent
20
+ v-model="checkedMenuKeys"
21
+ :render="renderContent"></a-tree>
22
+ <a-spin
23
+ size="large"
24
+ fix
25
+ v-if="treeLoading"></a-spin>
26
+ </div>
27
+ </a-card>
28
+ </a-col>
29
+ <a-col span="12">
30
+ <a-card title="按钮权限">
31
+ <div
32
+ class="drawer-content"
33
+ style="margin-bottom: 40px; height: calc(100vh - 51px - 32px - 32px - 51px - 42px)">
34
+ <a-card
35
+ v-for="(item, key) in curWindowBtnList"
36
+ :key="key"
37
+ style="margin-top: 5px">
38
+ <p
39
+ slot="title"
40
+ style="margin-left: 10px">
41
+ {{ item.NAME }}
42
+ <a-checkbox
43
+ :indeterminate="item.indeterminate"
44
+ :checked="item.checkAll"
45
+ :key="item.ID"
46
+ @change="handleCheckAll($event, item, key)">
47
+ 全选
48
+ </a-checkbox>
49
+ </p>
50
+ <a-checkbox-group
51
+ :value="item.checkChilds"
52
+ :options="
53
+ item.childs.map((item) => {
54
+ return { value: item.ID, label: item.NAME };
55
+ })
56
+ "
57
+ @change="checkAllGroupChange($event, key)"></a-checkbox-group>
58
+ </a-card>
59
+ <a-empty
60
+ description="暂无权限按钮"
61
+ v-if="curWindowBtnList.length === 0"></a-empty>
62
+ <div class="drawer-footer br">
63
+ <el-button
64
+ type="primary"
65
+ :loading="submitPermLoading"
66
+ @click="submitPermEdit">
67
+ 提交
68
+ </el-button>
69
+ <el-button
70
+ text
71
+ @click="cancel">
72
+ 取消
73
+ </el-button>
74
+ </div>
75
+ </div>
76
+ </a-card>
77
+ </a-col>
78
+ </a-row>
79
+ </a-drawer>
80
+ </template>
81
+ <script src="./saTenantRoleManage.js"></script>
82
+ <style>
83
+ .drawer-footer {
84
+ z-index: 10;
85
+ width: 100%;
86
+ position: absolute;
87
+ bottom: 0;
88
+ left: 0;
89
+ border-top: 1px solid #e8e8e8;
90
+ padding: 10px 16px;
91
+ text-align: left;
92
+ background: #fff;
93
+ }
94
+
95
+ .drawer-content {
96
+ height: calc(100vh - 51px - 32px - 32px - 51px - 2px);
97
+ overflow: auto;
98
+ }
99
+ </style>
@@ -0,0 +1,6 @@
1
+ .sa-user-avatar-dropdown {
2
+ .el-dropdown,
3
+ .el-badge {
4
+ height: 100%;
5
+ }
6
+ }
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <el-dropdown
3
+ split-button
4
+ class="sa-user-avatar-dropdown"
5
+ @command="handleClick">
6
+ <el-badge>欢迎你,{{ userName }}</el-badge>
7
+ <template #dropdown>
8
+ <el-dropdown-menu>
9
+ <el-dropdown-item command="logout">退出登录</el-dropdown-item>
10
+ </el-dropdown-menu>
11
+ </template>
12
+ </el-dropdown>
13
+ </template>
14
+
15
+ <script setup>
16
+ import "./saUser.less";
17
+ import axios from "@/libs/api.request";
18
+ import { clearStorage } from "@/libs/util";
19
+ import { useRouter } from "vue-router";
20
+
21
+ const router = useRouter();
22
+
23
+ const props = defineProps({
24
+ userName: {
25
+ type: String,
26
+ default: "",
27
+ },
28
+ });
29
+
30
+ function logout() {
31
+ return axios
32
+ .request({
33
+ url: "admin/loginOut",
34
+ method: "post",
35
+ })
36
+ .then(() => {
37
+ clearStorage();
38
+ router.push({
39
+ path: "/admin/login",
40
+ });
41
+ })
42
+ .catch((error) => {
43
+ console.error(error);
44
+ });
45
+ }
46
+ function handleClick(e) {
47
+ switch (e) {
48
+ case "logout":
49
+ logout();
50
+ break;
51
+ }
52
+ }
53
+ </script>
54
+
55
+ <style lang="scss">
56
+ .sa-user-avatar-dropdown {
57
+ margin-right: 12px;
58
+ .el-button {
59
+ --el-button-text-color: var(--el-color-white);
60
+ --el-button-active-text-color: var(--el-color-white);
61
+ --el-button-hover-text-color: var(--el-color-white);
62
+ --el-button-bg-color: transparent;
63
+ --el-button-active-bg-color: transparent;
64
+ --el-button-hover-bg-color: transparent;
65
+ --el-button-outline-color: transparent;
66
+ --el-button-active-border-color: var(--el-color-white);
67
+ --el-button-hover-border-color: var(--el-color-white);
68
+ --el-button-border-color: var(--el-color-white);
69
+ }
70
+ }
71
+ </style>
72
+ @/libs/api.request@/libs/util