@qqt-product/system 0.0.1
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.
- package/.eslintignore +4 -0
- package/.eslintrc.cjs +22 -0
- package/.prettierignore +4 -0
- package/.prettierrc.cjs +41 -0
- package/.vscode/extensions.json +3 -0
- package/README.md +16 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +14234 -0
- package/dist/index.umd.js +311 -0
- package/dist/lib/components/QAccountList/src/QAccountList.vue.d.ts +143 -0
- package/dist/lib/components/QAccountList/src/useConfigData.d.ts +37 -0
- package/dist/lib/components/QBackgroundFileTaskList/src/QBackgroundFileTaskList.vue.d.ts +66 -0
- package/dist/lib/components/QBackgroundFileTaskList/src/useConfigData.d.ts +14 -0
- package/dist/lib/components/QCompanyermissionList/src/form.vue.d.ts +80 -0
- package/dist/lib/components/QCompanyermissionList/src/types.d.ts +44 -0
- package/dist/lib/components/QElsEmailSendLogList/src/QElsEmailSendLogList.vue.d.ts +68 -0
- package/dist/lib/components/QElsEmailSendLogList/src/useConfigData.d.ts +13 -0
- package/dist/lib/components/QElsMsgRecordList/src/QElsMsgRecordList.vue.d.ts +72 -0
- package/dist/lib/components/QElsMsgRecordList/src/useConfigData.d.ts +16 -0
- package/dist/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsList.vue.d.ts +75 -0
- package/dist/lib/components/QI18nList/src/QI18nForm.vue.d.ts +47 -0
- package/dist/lib/components/QI18nList/src/QI18nList.vue.d.ts +136 -0
- package/dist/lib/components/QI18nList/src/useConfigData.d.ts +31 -0
- package/dist/lib/components/QImChatGroupList/src/QImChatGroupList.vue.d.ts +61 -0
- package/dist/lib/components/QImChatGroupList/src/useConfigData.d.ts +11 -0
- package/dist/lib/components/QMqRecordList/src/QMqRecordList.vue.d.ts +60 -0
- package/dist/lib/components/QMqRecordList/src/useConfigData.d.ts +12 -0
- package/dist/lib/components/QPasswordSecurityPolicy/src/QPasswordSecurityPolicy.vue.d.ts +49 -0
- package/dist/lib/components/QPermissionDataList/src/QPermissionDataAuth.vue.d.ts +3 -0
- package/dist/lib/components/QPermissionDataList/src/form.vue.d.ts +50 -0
- package/dist/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeList.vue.d.ts +86 -0
- package/dist/lib/components/QPurchaseNoticeList/src/useConfigData.d.ts +15 -0
- package/dist/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateList.vue.d.ts +47 -0
- package/dist/lib/components/QPurchaseNoticeTemplateList/src/useConfigData.d.ts +12 -0
- package/dist/lib/components/QQuartzJobList/src/QQuartzJobList.vue.d.ts +129 -0
- package/dist/lib/components/QQuartzJobList/src/components/JCron.vue.d.ts +23 -0
- package/dist/lib/components/QQuartzJobList/src/components/JCronModal.vue.d.ts +100 -0
- package/dist/lib/components/QQuartzJobList/src/components/QuartzJobModal.vue.d.ts +55 -0
- package/dist/lib/components/QQuartzJobList/src/useConfigData.d.ts +20 -0
- package/dist/lib/components/QRoleList/src/QRoleList.vue.d.ts +100 -0
- package/dist/lib/components/QRoleList/src/components/content-header/index.d.ts +23 -0
- package/dist/lib/components/QRoleList/src/components/userAuthorization/index.d.ts +79 -0
- package/dist/lib/components/QRoleList/src/useConfigData.d.ts +30 -0
- package/dist/lib/components/QSupplierAccountList/src/QSupplierAccountForm.vue.d.ts +55 -0
- package/dist/lib/components/QSupplierAccountList/src/QSupplierAccountList.vue.d.ts +104 -0
- package/dist/lib/components/QSupplierAccountList/src/useConfigData.d.ts +29 -0
- package/dist/lib/components/QUsageList/src/QUsageList.vue.d.ts +49 -0
- package/dist/lib/components/QUsageList/src/useConfigData.d.ts +14 -0
- package/dist/lib/components/QcustomConfigEdit/component/TempalePreviewModal.vue.d.ts +31 -0
- package/dist/lib/components/QcustomConfigEdit/component/dataFormatComponent.d.ts +46 -0
- package/dist/lib/components/QcustomConfigEdit/component/regexComponent.d.ts +41 -0
- package/dist/lib/components/QcustomConfigEdit/src/QcustomConfigRender.d.ts +12 -0
- package/dist/lib/components/QcustomConfigEdit/src/types.d.ts +61 -0
- package/dist/lib/components/QcustomConfigEdit/src/useConfigComputed.d.ts +7 -0
- package/dist/lib/components/QcustomConfigEdit/src/useConfigData.d.ts +85 -0
- package/dist/lib/components/QcustomConfigEdit/src/useConfigMethods.d.ts +16 -0
- package/dist/lib/components/QcustomConfigEdit/src/useConstant.d.ts +18 -0
- package/dist/lib/components/QcustomConfigList/component/ImportJsonCustomConfig.vue.d.ts +50 -0
- package/dist/lib/components/QcustomConfigList/src/QcustomConfigList.vue.d.ts +112 -0
- package/dist/lib/components/QcustomConfigList/src/useConfigData.d.ts +17 -0
- package/dist/lib/components/QcustomConfigList/src/useMethods.d.ts +15 -0
- package/dist/lib/components/QsysConfigList/src/QsysConfigList.vue.d.ts +66 -0
- package/dist/lib/components/QsysConfigList/src/useConfigData.d.ts +11 -0
- package/dist/lib/components/QsysConfigList/src/useMethods.d.ts +6 -0
- package/dist/lib/components/index.d.ts +39 -0
- package/dist/lib/components/integratedNodesList/src/index.vue.d.ts +107 -0
- package/dist/lib/components/integratedReportList/src/index.vue.d.ts +70 -0
- package/dist/lib/components/integratedReportSearchList/src/index.vue.d.ts +61 -0
- package/dist/lib/components/loginAbnormalLogList/src/index.vue.d.ts +46 -0
- package/dist/lib/components/loginLogList/src/index.vue.d.ts +45 -0
- package/dist/lib/components/loginSupplierLogList/src/index.vue.d.ts +45 -0
- package/dist/lib/components/operateLogList/src/index.vue.d.ts +53 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/utils/global.hook.d.ts +31 -0
- package/dist/lib/utils/global.types.d.ts +41 -0
- package/dist/lib/utils/regexp.d.ts +27 -0
- package/dist/style.css +1 -0
- package/dist/vite-env.d.ts +13 -0
- package/dist/vite.svg +1 -0
- package/index.html +13 -0
- package/package.json +65 -0
- package/public/vite.svg +1 -0
- package/src/App.vue +8 -0
- package/src/lib/components/QAccountList/index.ts +6 -0
- package/src/lib/components/QAccountList/src/QAccountDetail.vue +191 -0
- package/src/lib/components/QAccountList/src/QAccountEdit.vue +241 -0
- package/src/lib/components/QAccountList/src/QAccountList.vue +530 -0
- package/src/lib/components/QAccountList/src/useConfigData.ts +53 -0
- package/src/lib/components/QBackgroundFileTaskList/index.ts +6 -0
- package/src/lib/components/QBackgroundFileTaskList/src/QBackgroundFileTaskList.vue +137 -0
- package/src/lib/components/QBackgroundFileTaskList/src/useConfigData.ts +20 -0
- package/src/lib/components/QCompanyermissionList/src/editTree.vue +291 -0
- package/src/lib/components/QCompanyermissionList/src/form.vue +238 -0
- package/src/lib/components/QCompanyermissionList/src/index.vue +309 -0
- package/src/lib/components/QCompanyermissionList/src/types.ts +44 -0
- package/src/lib/components/QElsEmailSendLogList/index.ts +6 -0
- package/src/lib/components/QElsEmailSendLogList/src/QElsEmailSendLogList.vue +166 -0
- package/src/lib/components/QElsEmailSendLogList/src/useConfigData.ts +19 -0
- package/src/lib/components/QElsMsgRecordList/index.ts +6 -0
- package/src/lib/components/QElsMsgRecordList/src/QElsMsgRecordDetail.vue +148 -0
- package/src/lib/components/QElsMsgRecordList/src/QElsMsgRecordList.vue +124 -0
- package/src/lib/components/QElsMsgRecordList/src/useConfigData.ts +22 -0
- package/src/lib/components/QElsTenantPortalNewsList/index.ts +6 -0
- package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsDetail.vue +139 -0
- package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsEdit.vue +196 -0
- package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsList.vue +122 -0
- package/src/lib/components/QElsTenantPortalNewsList/src/useConfigData.ts +20 -0
- package/src/lib/components/QI18nList/index.ts +6 -0
- package/src/lib/components/QI18nList/src/QI18nForm.vue +141 -0
- package/src/lib/components/QI18nList/src/QI18nList.vue +361 -0
- package/src/lib/components/QI18nList/src/useConfigData.ts +37 -0
- package/src/lib/components/QImChatGroupList/index.ts +6 -0
- package/src/lib/components/QImChatGroupList/src/QImChatGroupList.vue +94 -0
- package/src/lib/components/QImChatGroupList/src/useConfigData.ts +17 -0
- package/src/lib/components/QMqRecordList/index.ts +6 -0
- package/src/lib/components/QMqRecordList/src/QMqRecordList.vue +105 -0
- package/src/lib/components/QMqRecordList/src/useConfigData.ts +18 -0
- package/src/lib/components/QPasswordSecurityPolicy/index.ts +6 -0
- package/src/lib/components/QPasswordSecurityPolicy/src/QPasswordSecurityPolicy.vue +266 -0
- package/src/lib/components/QPermissionDataList/index.ts +6 -0
- package/src/lib/components/QPermissionDataList/src/QPermissionDataAuth.vue +3 -0
- package/src/lib/components/QPermissionDataList/src/QPermissionDataEdit.vue +221 -0
- package/src/lib/components/QPermissionDataList/src/QPermissionDataList.vue +117 -0
- package/src/lib/components/QPermissionDataList/src/form.vue +109 -0
- package/src/lib/components/QPurchaseNoticeList/index.ts +6 -0
- package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeDetail.vue +147 -0
- package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeEdit.vue +244 -0
- package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeList.vue +163 -0
- package/src/lib/components/QPurchaseNoticeList/src/useConfigData.ts +22 -0
- package/src/lib/components/QPurchaseNoticeTemplateList/index.ts +6 -0
- package/src/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateList.vue +85 -0
- package/src/lib/components/QPurchaseNoticeTemplateList/src/useConfigData.ts +18 -0
- package/src/lib/components/QQuartzJobList/index.ts +6 -0
- package/src/lib/components/QQuartzJobList/src/QQuartzJobList.vue +263 -0
- package/src/lib/components/QQuartzJobList/src/components/JCron.vue +82 -0
- package/src/lib/components/QQuartzJobList/src/components/JCronModal.vue +985 -0
- package/src/lib/components/QQuartzJobList/src/components/QuartzJobModal.vue +176 -0
- package/src/lib/components/QQuartzJobList/src/useConfigData.ts +26 -0
- package/src/lib/components/QRoleList/index.ts +6 -0
- package/src/lib/components/QRoleList/src/QRoleList.vue +288 -0
- package/src/lib/components/QRoleList/src/components/content-header/contentHeader.less +31 -0
- package/src/lib/components/QRoleList/src/components/content-header/index.tsx +42 -0
- package/src/lib/components/QRoleList/src/components/userAuthorization/index.tsx +690 -0
- package/src/lib/components/QRoleList/src/components/userAuthorization/userAuthorization.less +97 -0
- package/src/lib/components/QRoleList/src/useConfigData.ts +33 -0
- package/src/lib/components/QSupplierAccountList/index.ts +6 -0
- package/src/lib/components/QSupplierAccountList/src/QSupplierAccountForm.vue +187 -0
- package/src/lib/components/QSupplierAccountList/src/QSupplierAccountList.vue +302 -0
- package/src/lib/components/QSupplierAccountList/src/useConfigData.ts +29 -0
- package/src/lib/components/QUsageList/index.ts +6 -0
- package/src/lib/components/QUsageList/src/QUsageList.vue +82 -0
- package/src/lib/components/QUsageList/src/useConfigData.ts +20 -0
- package/src/lib/components/QcustomConfigEdit/component/AddDictCodeModal.vue +140 -0
- package/src/lib/components/QcustomConfigEdit/component/TempalePreviewModal.vue +100 -0
- package/src/lib/components/QcustomConfigEdit/component/dataFormatComponent.tsx +100 -0
- package/src/lib/components/QcustomConfigEdit/component/regexComponent.tsx +71 -0
- package/src/lib/components/QcustomConfigEdit/index.ts +6 -0
- package/src/lib/components/QcustomConfigEdit/src/QcustomConfigEdit.vue +1807 -0
- package/src/lib/components/QcustomConfigEdit/src/QcustomConfigRender.tsx +242 -0
- package/src/lib/components/QcustomConfigEdit/src/types.ts +71 -0
- package/src/lib/components/QcustomConfigEdit/src/useConfigComputed.ts +75 -0
- package/src/lib/components/QcustomConfigEdit/src/useConfigData.ts +123 -0
- package/src/lib/components/QcustomConfigEdit/src/useConfigMethods.ts +117 -0
- package/src/lib/components/QcustomConfigEdit/src/useConstant.ts +301 -0
- package/src/lib/components/QcustomConfigEdit/style/index.less +41 -0
- package/src/lib/components/QcustomConfigList/component/ImportJsonCustomConfig.vue +135 -0
- package/src/lib/components/QcustomConfigList/index.ts +6 -0
- package/src/lib/components/QcustomConfigList/src/QcustomConfigList.vue +268 -0
- package/src/lib/components/QcustomConfigList/src/types.ts +1 -0
- package/src/lib/components/QcustomConfigList/src/useConfigData.ts +23 -0
- package/src/lib/components/QcustomConfigList/src/useMethods.ts +36 -0
- package/src/lib/components/QcustomConfigList/style/index.less +3 -0
- package/src/lib/components/QsysConfigList/index.ts +6 -0
- package/src/lib/components/QsysConfigList/src/QsysConfigList.vue +125 -0
- package/src/lib/components/QsysConfigList/src/types.ts +1 -0
- package/src/lib/components/QsysConfigList/src/useConfigData.ts +17 -0
- package/src/lib/components/QsysConfigList/src/useMethods.ts +11 -0
- package/src/lib/components/QsysConfigList/style/index.less +3 -0
- package/src/lib/components/index.ts +78 -0
- package/src/lib/components/integratedNodesList/src/QIntegratedNodesDetail.vue +49 -0
- package/src/lib/components/integratedNodesList/src/QIntegratedNodesEdit.vue +143 -0
- package/src/lib/components/integratedNodesList/src/index.vue +136 -0
- package/src/lib/components/integratedReportList/src/index.vue +86 -0
- package/src/lib/components/integratedReportSearchList/src/index.vue +66 -0
- package/src/lib/components/loginAbnormalLogList/src/index.vue +50 -0
- package/src/lib/components/loginLogList/src/index.vue +57 -0
- package/src/lib/components/loginSupplierLogList/src/index.vue +63 -0
- package/src/lib/components/operateLogList/src/index.vue +57 -0
- package/src/lib/index.ts +15 -0
- package/src/lib/utils/constant.ts +1 -0
- package/src/lib/utils/global.hook.ts +337 -0
- package/src/lib/utils/global.types.ts +49 -0
- package/src/lib/utils/regexp.ts +143 -0
- package/src/main.ts +11 -0
- package/src/vite-env.d.ts +13 -0
- package/tsconfig.json +24 -0
- package/tsconfig.node.json +9 -0
- package/vite.config.ts +61 -0
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
import { ref, defineComponent, PropType, ExtractPropTypes, computed, onMounted } from 'vue'
|
|
2
|
+
import type { Ref, ComputedRef } from 'vue'
|
|
3
|
+
import QContentHeader from '../content-header'
|
|
4
|
+
|
|
5
|
+
import { BUTTON_CUSTOM, BUTTON_CUSTOM_PRIMARY } from '@qqt-product/ui'
|
|
6
|
+
import type { GlobalPageLayoutTypes } from '@qqt-product/ui'
|
|
7
|
+
|
|
8
|
+
import { message as Message } from '@qqt-product/ui'
|
|
9
|
+
|
|
10
|
+
import qqtApi from '@qqt-product/api'
|
|
11
|
+
import type { Map } from '@qqt-product/api'
|
|
12
|
+
|
|
13
|
+
import qqtUtils from '@qqt-product/utils'
|
|
14
|
+
const { debounce, cloneDeep } = qqtUtils
|
|
15
|
+
|
|
16
|
+
import { QIcon } from '@qqt-product/icons'
|
|
17
|
+
import { UpOutlined, DownOutlined, CaretRightOutlined, CaretDownOutlined } from '@ant-design/icons-vue'
|
|
18
|
+
|
|
19
|
+
import './userAuthorization.less'
|
|
20
|
+
|
|
21
|
+
const authProps = {
|
|
22
|
+
rows: {
|
|
23
|
+
type: Array as PropType<GlobalPageLayoutTypes.RecordStringNumber[]>,
|
|
24
|
+
default() {
|
|
25
|
+
return []
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
|--------------------------------------------------
|
|
30
|
+
| 目前为止该授权组件主要应用于三个页面
|
|
31
|
+
| 租户管理 TenantList(默认)
|
|
32
|
+
| 角色管理 RoleList
|
|
33
|
+
| 供应商权限组 SupplierGroupList
|
|
34
|
+
| 其中 租户管理 列表页面有批量、单选功能需要区分
|
|
35
|
+
|--------------------------------------------------
|
|
36
|
+
*/
|
|
37
|
+
parentPath: {
|
|
38
|
+
type: String as PropType<'TenantList' | 'RoleList' | 'SupplierGroupList'>,
|
|
39
|
+
default: 'TenantList',
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type AuthProps = ExtractPropTypes<typeof authProps>
|
|
44
|
+
|
|
45
|
+
// 定义树节点类型
|
|
46
|
+
export interface TreeNode {
|
|
47
|
+
__show?: boolean
|
|
48
|
+
__checkall?: boolean
|
|
49
|
+
__indeterminate?: boolean
|
|
50
|
+
__checked?: boolean
|
|
51
|
+
__has_children?: boolean
|
|
52
|
+
__sibling_has_children?: boolean
|
|
53
|
+
level: number
|
|
54
|
+
isLeaf: boolean
|
|
55
|
+
key: string
|
|
56
|
+
menuType: number
|
|
57
|
+
parentId: string
|
|
58
|
+
slotTitle: string
|
|
59
|
+
value: string
|
|
60
|
+
children?: null | TreeNode[]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default defineComponent({
|
|
64
|
+
name: 'QUserAuthorization',
|
|
65
|
+
components: {
|
|
66
|
+
'q-content-header': QContentHeader,
|
|
67
|
+
'q-icon': QIcon,
|
|
68
|
+
'up-outlined': UpOutlined,
|
|
69
|
+
'down-outlined': DownOutlined,
|
|
70
|
+
'caret-right-outlined': CaretRightOutlined,
|
|
71
|
+
'caret-down-outlined': CaretDownOutlined,
|
|
72
|
+
},
|
|
73
|
+
props: authProps,
|
|
74
|
+
setup(props: AuthProps, ctx) {
|
|
75
|
+
const Request: qqtApi.Request = qqtApi.useHttp()
|
|
76
|
+
|
|
77
|
+
// 自定义属性常量设置
|
|
78
|
+
const SHOW = '__show'
|
|
79
|
+
const CHECKALL = '__checkall'
|
|
80
|
+
const INDETERMINATE = '__indeterminate'
|
|
81
|
+
const CHECKED = '__checked'
|
|
82
|
+
const HAS_CHILDREN = '__has_children' // 有子级
|
|
83
|
+
const SIBLING_HAS_CHILDREN = '__sibling_has_children' // 同级别有子级
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @description:
|
|
87
|
+
* 递归操作
|
|
88
|
+
* 根据给定值 value 和节点 property 递归查找树的所有层级关系结果
|
|
89
|
+
*
|
|
90
|
+
* @param {*} array
|
|
91
|
+
* @param {*} property
|
|
92
|
+
* @param {*} value
|
|
93
|
+
* @param {*} childrenName
|
|
94
|
+
* @param {*} fn
|
|
95
|
+
* @return {*}
|
|
96
|
+
*/
|
|
97
|
+
const getNestedParentRelationItems = (array: TreeNode[], property = 'key', value = '', childrenName = 'children') => {
|
|
98
|
+
/**
|
|
99
|
+
* @description 递归查找所有符合条件依赖
|
|
100
|
+
*
|
|
101
|
+
* @param {*} arr
|
|
102
|
+
* @returns
|
|
103
|
+
*/
|
|
104
|
+
console.time('getRelation')
|
|
105
|
+
function recursion(arr: TreeNode[]) {
|
|
106
|
+
let result: TreeNode[] = []
|
|
107
|
+
for (const v of arr) {
|
|
108
|
+
const val: string = v[property]
|
|
109
|
+
if (val === value) {
|
|
110
|
+
result.push(v)
|
|
111
|
+
break
|
|
112
|
+
} else {
|
|
113
|
+
const child = v[childrenName]
|
|
114
|
+
if (child && child.length) {
|
|
115
|
+
const sub = recursion(child)
|
|
116
|
+
if (sub && sub.length) {
|
|
117
|
+
result = [v].concat(sub)
|
|
118
|
+
// 自定义格式化处理数据
|
|
119
|
+
formatItem(v)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (result.length) {
|
|
125
|
+
return result
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
console.timeEnd('getRelation')
|
|
130
|
+
return recursion(array)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @description: 赋值全选或半勾选操作
|
|
135
|
+
*
|
|
136
|
+
* @param {*} item
|
|
137
|
+
* @return {*}
|
|
138
|
+
*/
|
|
139
|
+
function formatItem(item) {
|
|
140
|
+
// if (item.key === '1394598965592260610') {
|
|
141
|
+
// console.log('item :>> ', item)
|
|
142
|
+
// }
|
|
143
|
+
const children = item.children || []
|
|
144
|
+
const checkAll = children.every((n) => n[CHECKED] || n[CHECKALL])
|
|
145
|
+
const indeterminate = children.some((n) => {
|
|
146
|
+
return n[CHECKED] || n[CHECKALL] || n[INDETERMINATE]
|
|
147
|
+
})
|
|
148
|
+
if (children && children.length) {
|
|
149
|
+
if (item[CHECKALL] !== checkAll) {
|
|
150
|
+
item[CHECKALL] = checkAll
|
|
151
|
+
}
|
|
152
|
+
const flag = !checkAll && indeterminate
|
|
153
|
+
if (item[INDETERMINATE] !== flag) {
|
|
154
|
+
item[INDETERMINATE] = flag
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @description:
|
|
161
|
+
* 递归操作
|
|
162
|
+
* 设置子级绑定值
|
|
163
|
+
* @param {*} array
|
|
164
|
+
* @param {*} bool
|
|
165
|
+
* @param {*} childrenName
|
|
166
|
+
* @return {*}
|
|
167
|
+
*/
|
|
168
|
+
const arrayTreeSetBool = (array: TreeNode[], bool = false, childrenName = 'children') => {
|
|
169
|
+
const recursion = (arr: TreeNode[]) => {
|
|
170
|
+
arr.forEach((v) => {
|
|
171
|
+
if (v[HAS_CHILDREN]) {
|
|
172
|
+
if (v[CHECKALL] !== bool) {
|
|
173
|
+
v[CHECKALL] = bool
|
|
174
|
+
}
|
|
175
|
+
if (v[INDETERMINATE]) {
|
|
176
|
+
v[INDETERMINATE] = false
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
if (v[CHECKED] !== bool) {
|
|
180
|
+
v[CHECKED] = bool
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const child = v[childrenName]
|
|
185
|
+
if (child && child.length) recursion(child)
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
recursion(array)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @description:
|
|
193
|
+
* 递归操作
|
|
194
|
+
* 树级列表各层级统一添加相同自定义属性值
|
|
195
|
+
* @param {*} array
|
|
196
|
+
* @param {*} levelName
|
|
197
|
+
* @param {*} childrenName
|
|
198
|
+
* @return {*}
|
|
199
|
+
*/
|
|
200
|
+
const arrayTreeAddPropertys = (array: TreeNode[], levelName = 'level', childrenName = 'children') => {
|
|
201
|
+
if (!Array.isArray(array)) return []
|
|
202
|
+
const recursion = (array: TreeNode[], level = 0) => {
|
|
203
|
+
level++
|
|
204
|
+
const siblingHasChildren = array.some((v) => v.children)
|
|
205
|
+
return array.map((v) => {
|
|
206
|
+
v[levelName] = level
|
|
207
|
+
const child = v[childrenName] as TreeNode[]
|
|
208
|
+
const hasChildren = !!(child && child.length)
|
|
209
|
+
// 展开/收起过滤切换绑定值
|
|
210
|
+
v[SHOW] = false
|
|
211
|
+
// checkbox 绑定值
|
|
212
|
+
v[CHECKED] = false
|
|
213
|
+
|
|
214
|
+
v[CHECKALL] = false
|
|
215
|
+
v[INDETERMINATE] = false
|
|
216
|
+
// 标识有没有子级
|
|
217
|
+
v[HAS_CHILDREN] = hasChildren
|
|
218
|
+
// 标识同级别其他 item 有没有子级, 用于布局排列控制
|
|
219
|
+
v[SIBLING_HAS_CHILDREN] = siblingHasChildren
|
|
220
|
+
if (hasChildren) recursion(child, level)
|
|
221
|
+
return v
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
return recursion(array)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @description:
|
|
229
|
+
* 递归操作
|
|
230
|
+
* 格式化处理树级列表各层级半勾选绑定值
|
|
231
|
+
* @param {*} array
|
|
232
|
+
* @param {*} childrenName
|
|
233
|
+
* @return {*}
|
|
234
|
+
*/
|
|
235
|
+
const arrayTreeFormatItem = (array: TreeNode[], permissionIds: string[], property = 'key', childrenName = 'children') => {
|
|
236
|
+
if (!Array.isArray(array)) return []
|
|
237
|
+
let num = 0
|
|
238
|
+
|
|
239
|
+
const recursion = (arr: TreeNode[]) => {
|
|
240
|
+
arr.forEach((v) => {
|
|
241
|
+
if (permissionIds.includes(v[property])) {
|
|
242
|
+
// 有子级,绑定在 __checkAll 属性上面
|
|
243
|
+
if (v[HAS_CHILDREN]) {
|
|
244
|
+
v[CHECKALL] = true
|
|
245
|
+
} else {
|
|
246
|
+
v[CHECKED] = true
|
|
247
|
+
}
|
|
248
|
+
num++
|
|
249
|
+
}
|
|
250
|
+
const child = v[childrenName] as TreeNode[]
|
|
251
|
+
if (child && child.length) recursion(child)
|
|
252
|
+
|
|
253
|
+
// 格式化处理每一层级半勾选绑定值
|
|
254
|
+
// 注,此处后序遍历处理才能确保把父级绑定半勾选状态值
|
|
255
|
+
formatItem(v)
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
recursion(array)
|
|
259
|
+
console.log('num :>> ', num)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* 计算属性
|
|
264
|
+
*/
|
|
265
|
+
// 是否单个权限配置
|
|
266
|
+
const isSingle: ComputedRef<boolean> = computed(() => props.rows.length === 1)
|
|
267
|
+
|
|
268
|
+
// 租户管理
|
|
269
|
+
const isTenantList: ComputedRef<boolean> = computed(() => props.parentPath === 'TenantList')
|
|
270
|
+
|
|
271
|
+
// 角色管理
|
|
272
|
+
const isRoleList: ComputedRef<boolean> = computed(() => props.parentPath === 'RoleList')
|
|
273
|
+
|
|
274
|
+
// 供应商权限组
|
|
275
|
+
const isSupplierGroupList: ComputedRef<boolean> = computed(() => props.parentPath === 'SupplierGroupList')
|
|
276
|
+
|
|
277
|
+
// 标题
|
|
278
|
+
const title: ComputedRef<string> = computed(() => {
|
|
279
|
+
return isTenantList.value ? '租户' : isRoleList.value ? '角色' : '供应商权限组'
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
// 副标题
|
|
283
|
+
const computedSubTit: ComputedRef<string> = computed(() => {
|
|
284
|
+
const names = props.rows.map((n) => {
|
|
285
|
+
if (isTenantList.value) {
|
|
286
|
+
return n.elsAccount ? `${n.elsAccount}_${n.companyName}` : ''
|
|
287
|
+
} else {
|
|
288
|
+
return n.roleCode ? `${n.roleCode}_${n.roleName}` : ''
|
|
289
|
+
}
|
|
290
|
+
})
|
|
291
|
+
return names.join(',')
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 属性定义
|
|
296
|
+
*/
|
|
297
|
+
// loading
|
|
298
|
+
const spinning: Ref<boolean> = ref(false)
|
|
299
|
+
const treeList: Ref<TreeNode[]> = ref([])
|
|
300
|
+
// const ids: Ref<string[]> = ref([])
|
|
301
|
+
const permissionIds: Ref<string[]> = ref([])
|
|
302
|
+
const lastpermissionIds: Ref<string[]> = ref([])
|
|
303
|
+
|
|
304
|
+
const toggleShow = debounce(function checkAllChange(event: Event, item: TreeNode) {
|
|
305
|
+
console.log('item :>> ', item)
|
|
306
|
+
item[SHOW] = !item[SHOW]
|
|
307
|
+
}, 150)
|
|
308
|
+
|
|
309
|
+
// 全选操作
|
|
310
|
+
const handleCheckAllChange = debounce(function checkAllChange(event: Event, item: TreeNode) {
|
|
311
|
+
console.log('item :>> ', item)
|
|
312
|
+
if (!item.children) {
|
|
313
|
+
return
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
item[CHECKALL] = !item[CHECKALL]
|
|
317
|
+
item[INDETERMINATE] = false
|
|
318
|
+
arrayTreeSetBool(item.children, item[CHECKALL])
|
|
319
|
+
|
|
320
|
+
// 层级一后面子级勾选全部时,需要设置其父级半勾选状态
|
|
321
|
+
if (item.level > 1) {
|
|
322
|
+
getNestedParentRelationItems(treeList.value, 'key', item.key)
|
|
323
|
+
}
|
|
324
|
+
}, 150)
|
|
325
|
+
|
|
326
|
+
// 最底层 checkbox 勾选
|
|
327
|
+
// 需要递归查找其所有关联的父级checkbox 并设置半勾选状态
|
|
328
|
+
const handleLastLevelCheckBoxChange = debounce(function lastLevelCheckBoxChange(event: Event, item: TreeNode) {
|
|
329
|
+
console.log('item :>> ', item)
|
|
330
|
+
item[CHECKED] = !item[CHECKED]
|
|
331
|
+
|
|
332
|
+
if (item.level === 1) {
|
|
333
|
+
return
|
|
334
|
+
}
|
|
335
|
+
getNestedParentRelationItems(treeList.value, 'key', item.key)
|
|
336
|
+
}, 150)
|
|
337
|
+
|
|
338
|
+
// 获取所有树级节点的key值
|
|
339
|
+
const handleGetPermissionIds = (array: TreeNode[], property = 'key', childrenName = 'children') => {
|
|
340
|
+
if (!Array.isArray(array)) return []
|
|
341
|
+
const result: string[] = []
|
|
342
|
+
const recursion = (arr: TreeNode[]) => {
|
|
343
|
+
arr.forEach((v) => {
|
|
344
|
+
// if (v.key === '1394598965592260610') {
|
|
345
|
+
// console.log('v :>> ', v)
|
|
346
|
+
// }
|
|
347
|
+
const val = v[property]
|
|
348
|
+
if (v[HAS_CHILDREN]) {
|
|
349
|
+
if (v[CHECKALL] || v[INDETERMINATE]) {
|
|
350
|
+
result.push(val)
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
if (v[CHECKED]) {
|
|
354
|
+
result.push(val)
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const child = v[childrenName]
|
|
359
|
+
if (child && child.length) recursion(child)
|
|
360
|
+
})
|
|
361
|
+
}
|
|
362
|
+
recursion(array)
|
|
363
|
+
|
|
364
|
+
return result
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const handleAuthSave = () => {
|
|
368
|
+
const permissionIds = handleGetPermissionIds(treeList.value)
|
|
369
|
+
console.log('permissionIds.length :>> ', permissionIds.length)
|
|
370
|
+
spinning.value = true
|
|
371
|
+
let params = {}
|
|
372
|
+
let request: Promise<void | Map> = Promise.resolve()
|
|
373
|
+
|
|
374
|
+
// 租户管理
|
|
375
|
+
if (isTenantList.value) {
|
|
376
|
+
// 单个租户
|
|
377
|
+
if (isSingle.value) {
|
|
378
|
+
const { elsAccount = '' } = props.rows[0] || {}
|
|
379
|
+
params = {
|
|
380
|
+
elsAccount,
|
|
381
|
+
permissionIds: permissionIds.join(','),
|
|
382
|
+
lastpermissionIds: lastpermissionIds.value.join(','),
|
|
383
|
+
}
|
|
384
|
+
request = Request.post({ url: '/account/permission/saveCompanyPermission', data: params })
|
|
385
|
+
} else {
|
|
386
|
+
// 多个租户
|
|
387
|
+
const elsAccount = props.rows.map((n) => n.elsAccount as string)
|
|
388
|
+
params = {
|
|
389
|
+
elsAccountList: elsAccount,
|
|
390
|
+
permissionIds: permissionIds.join(','),
|
|
391
|
+
lastpermissionIds: '',
|
|
392
|
+
}
|
|
393
|
+
request = Request.post({ url: '/account/permission/saveCompanyPermissionList', data: params })
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// 角色管理
|
|
398
|
+
if (isRoleList.value) {
|
|
399
|
+
const { id = '' } = props.rows[0] || {}
|
|
400
|
+
params = {
|
|
401
|
+
roleId: id,
|
|
402
|
+
permissionIds: permissionIds.join(','),
|
|
403
|
+
lastpermissionIds: lastpermissionIds.value.join(','),
|
|
404
|
+
}
|
|
405
|
+
request = Request.post({ url: '/account/permission/saveRolePermission', data: params })
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// 供应商权限组
|
|
409
|
+
if (isSupplierGroupList.value) {
|
|
410
|
+
const { id = '' } = props.rows[0] || {}
|
|
411
|
+
params = {
|
|
412
|
+
groupId: id,
|
|
413
|
+
permissionIds: permissionIds.join(','),
|
|
414
|
+
lastpermissionIds: lastpermissionIds.value.join(','),
|
|
415
|
+
}
|
|
416
|
+
request = Request.post({ url: '/account/supplierGroup/saveGroupPermission', data: params })
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
request
|
|
420
|
+
.then((res) => {
|
|
421
|
+
const response = res as GlobalPageLayoutTypes.ResponseType
|
|
422
|
+
|
|
423
|
+
const type = response.success ? 'success' : 'error'
|
|
424
|
+
Message[type](response.message)
|
|
425
|
+
if (response.success) {
|
|
426
|
+
ctx.emit('authCancel')
|
|
427
|
+
}
|
|
428
|
+
})
|
|
429
|
+
.finally(() => {
|
|
430
|
+
spinning.value = false
|
|
431
|
+
})
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// 获取树级节点数据
|
|
435
|
+
const getTreeData = () => {
|
|
436
|
+
const Map = {
|
|
437
|
+
// 租户管理
|
|
438
|
+
TenantList: {
|
|
439
|
+
treeListApi: '/account/role/queryTreeList',
|
|
440
|
+
permissionApi: '/account/permission/queryCompanyPermission',
|
|
441
|
+
params: {},
|
|
442
|
+
},
|
|
443
|
+
// 角色管理
|
|
444
|
+
RoleList: {
|
|
445
|
+
treeListApi: '/account/role/queryTreeList',
|
|
446
|
+
permissionApi: '/account/permission/queryRolePermission',
|
|
447
|
+
params: {},
|
|
448
|
+
},
|
|
449
|
+
// 供应商权限组
|
|
450
|
+
SupplierGroupList: {
|
|
451
|
+
treeListApi: '/account/supplierGroup/queryTreeList',
|
|
452
|
+
permissionApi: '/account/supplierGroup/queryGroupPermission',
|
|
453
|
+
params: {},
|
|
454
|
+
},
|
|
455
|
+
}
|
|
456
|
+
const { treeListApi, permissionApi } = Map[props.parentPath]
|
|
457
|
+
let { params } = Map[props.parentPath]
|
|
458
|
+
spinning.value = true
|
|
459
|
+
Request.get({ url: treeListApi })
|
|
460
|
+
.then((res) => {
|
|
461
|
+
if (!res.success) {
|
|
462
|
+
return
|
|
463
|
+
}
|
|
464
|
+
const response = res.result
|
|
465
|
+
|
|
466
|
+
// 树级数据添加自定义属性
|
|
467
|
+
treeList.value = arrayTreeAddPropertys(response.treeList)
|
|
468
|
+
console.log('treeList.value :>> ', treeList.value)
|
|
469
|
+
|
|
470
|
+
// ids.value = ids
|
|
471
|
+
|
|
472
|
+
// 查询单个租户 或 单个角色 或 单个供应商 权限数据
|
|
473
|
+
if (isSingle.value) {
|
|
474
|
+
// 单个租户
|
|
475
|
+
if (isTenantList.value) {
|
|
476
|
+
const { elsAccount = '' } = props.rows[0] || {}
|
|
477
|
+
params = { elsAccount }
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// 单个角色
|
|
481
|
+
if (isRoleList.value) {
|
|
482
|
+
const { id = '' } = props.rows[0] || {}
|
|
483
|
+
params = { roleId: id }
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// 单个供应商
|
|
487
|
+
if (isSupplierGroupList.value) {
|
|
488
|
+
const { elsAccount = '', groupId = '' } = props.rows[0] || {}
|
|
489
|
+
params = { elsAccount, groupId }
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
spinning.value = true
|
|
493
|
+
Request.get({ url: permissionApi, params }).then((res) => {
|
|
494
|
+
if (!res.success) {
|
|
495
|
+
return
|
|
496
|
+
}
|
|
497
|
+
const result = res.result || []
|
|
498
|
+
permissionIds.value = result
|
|
499
|
+
lastpermissionIds.value = cloneDeep(result)
|
|
500
|
+
console.time('time')
|
|
501
|
+
arrayTreeFormatItem(treeList.value, permissionIds.value)
|
|
502
|
+
console.timeEnd('time')
|
|
503
|
+
})
|
|
504
|
+
}
|
|
505
|
+
})
|
|
506
|
+
.finally(() => {
|
|
507
|
+
spinning.value = false
|
|
508
|
+
})
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// 菜单图标
|
|
512
|
+
// menuType, (0: 一级菜单,1: 子菜单, 2: 按钮)
|
|
513
|
+
const renderIcon = (item: TreeNode) => {
|
|
514
|
+
return item.menuType === 0 ? (
|
|
515
|
+
<q-icon class="icon" type="icon-first-level-menu" size="16" color="#5570f1" style={{ marginRight: '4px' }} />
|
|
516
|
+
) : item.menuType === 1 ? (
|
|
517
|
+
<q-icon class="icon" type="icon-secondary-menu" size="16" color="#454F59" style={{ marginRight: '4px' }} />
|
|
518
|
+
) : null
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
const renderMenuItem = (item: TreeNode) => {
|
|
522
|
+
return (
|
|
523
|
+
<a-col lg={8} xl={6} xxl={4}>
|
|
524
|
+
<a-checkbox checked={item[CHECKED]} onChange={(e: Event) => handleLastLevelCheckBoxChange(e, item)}>
|
|
525
|
+
{renderIcon(item)}
|
|
526
|
+
{item.slotTitle}
|
|
527
|
+
</a-checkbox>
|
|
528
|
+
</a-col>
|
|
529
|
+
)
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
const renderSubMenu = (item: TreeNode) => {
|
|
533
|
+
// 根据层级分别渲染不同的结构布局
|
|
534
|
+
const hasChildren = !!item[HAS_CHILDREN]
|
|
535
|
+
|
|
536
|
+
let subArr
|
|
537
|
+
if (hasChildren) {
|
|
538
|
+
if (item.children) {
|
|
539
|
+
subArr = item.children.map((sub) => renderItem(sub)) as JSX.Element[]
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// 根据子级的子级添加class类名
|
|
544
|
+
const hasGrandchildren = item.children && item.children.some((sub) => sub.children)
|
|
545
|
+
|
|
546
|
+
const subArrElem = hasGrandchildren ? <div class="children">{subArr}</div> : <a-row class="children">{subArr}</a-row>
|
|
547
|
+
|
|
548
|
+
// 渲染层级一
|
|
549
|
+
if (item.level === 1) {
|
|
550
|
+
const toggleBtn = !hasChildren ? null : (
|
|
551
|
+
<a-button type="link" onClick={(e) => toggleShow(e, item)}>
|
|
552
|
+
<span>{item[SHOW] ? '收起' : '展开'}</span>
|
|
553
|
+
{item[SHOW] ? <up-outlined /> : <down-outlined />}
|
|
554
|
+
</a-button>
|
|
555
|
+
)
|
|
556
|
+
|
|
557
|
+
const childrenEl = !hasChildren ? null : (
|
|
558
|
+
<q-collapse-transition>
|
|
559
|
+
{!item[SHOW] ? null : <div class={['collapse', hasGrandchildren ? '' : 'noneGrandchildren']}>{hasGrandchildren ? subArr : <a-row class="children">{subArr}</a-row>}</div>}
|
|
560
|
+
</q-collapse-transition>
|
|
561
|
+
)
|
|
562
|
+
|
|
563
|
+
return (
|
|
564
|
+
<div class="item">
|
|
565
|
+
<div class={['level', `level_${item.level}`, item[SHOW] ? '' : 'border']}>
|
|
566
|
+
<div class="info">
|
|
567
|
+
{!hasChildren ? (
|
|
568
|
+
<a-checkbox checked={item[CHECKED]} onChange={(e: Event) => handleLastLevelCheckBoxChange(e, item)}>
|
|
569
|
+
{renderIcon(item)}
|
|
570
|
+
<strong>{item.slotTitle}</strong>
|
|
571
|
+
</a-checkbox>
|
|
572
|
+
) : (
|
|
573
|
+
<a-checkbox indeterminate={item[INDETERMINATE]} checked={item[CHECKALL]} onChange={(e: Event) => handleCheckAllChange(e, item)}>
|
|
574
|
+
{renderIcon(item)}
|
|
575
|
+
<strong>{item.slotTitle}</strong>
|
|
576
|
+
</a-checkbox>
|
|
577
|
+
)}
|
|
578
|
+
<span class="tip">
|
|
579
|
+
{'请耐心地完成您的'}
|
|
580
|
+
{`${item.slotTitle}`}
|
|
581
|
+
{'权限配置设置'}
|
|
582
|
+
</span>
|
|
583
|
+
</div>
|
|
584
|
+
<div class="extra">{toggleBtn}</div>
|
|
585
|
+
</div>
|
|
586
|
+
{childrenEl}
|
|
587
|
+
</div>
|
|
588
|
+
)
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// 渲染层级二
|
|
592
|
+
if (item.level === 2) {
|
|
593
|
+
return (
|
|
594
|
+
<div class={['level', `level_${item.level}`]}>
|
|
595
|
+
<div class="info">
|
|
596
|
+
{!hasChildren ? (
|
|
597
|
+
<a-checkbox checked={item[CHECKED]} onChange={(e: Event) => handleLastLevelCheckBoxChange(e, item)}>
|
|
598
|
+
{renderIcon(item)}
|
|
599
|
+
{item.slotTitle}
|
|
600
|
+
</a-checkbox>
|
|
601
|
+
) : (
|
|
602
|
+
<a-checkbox indeterminate={item[INDETERMINATE]} checked={item[CHECKALL]} onChange={(e: Event) => handleCheckAllChange(e, item)}>
|
|
603
|
+
{renderIcon(item)}
|
|
604
|
+
<strong>{item.slotTitle}</strong>
|
|
605
|
+
</a-checkbox>
|
|
606
|
+
)}
|
|
607
|
+
</div>
|
|
608
|
+
{subArrElem}
|
|
609
|
+
</div>
|
|
610
|
+
)
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// 递归渲染缄层级三及后面层级
|
|
614
|
+
return (
|
|
615
|
+
<div class={['level', `level_${item.level}`]}>
|
|
616
|
+
{!hasChildren ? null : (
|
|
617
|
+
<span class={['triangle', item[SHOW] ? 'rotate90' : '']} onClick={(e: Event) => toggleShow(e, item)}>
|
|
618
|
+
<caret-right-outlined style={item[SHOW] ? { color: '#5570f1', fontSize: '16px' } : { color: 'rgba(0, 0, 0, 0.45)', fontSize: '16px' }} />
|
|
619
|
+
</span>
|
|
620
|
+
)}
|
|
621
|
+
{!hasChildren ? (
|
|
622
|
+
<a-checkbox checked={item[CHECKED]} onChange={(e: Event) => handleLastLevelCheckBoxChange(e, item)}>
|
|
623
|
+
{renderIcon(item)}
|
|
624
|
+
{item.slotTitle}
|
|
625
|
+
</a-checkbox>
|
|
626
|
+
) : (
|
|
627
|
+
<a-checkbox indeterminate={item[INDETERMINATE]} checked={item[CHECKALL]} onChange={(e: Event) => handleCheckAllChange(e, item)}>
|
|
628
|
+
{renderIcon(item)}
|
|
629
|
+
{item.slotTitle}
|
|
630
|
+
</a-checkbox>
|
|
631
|
+
)}
|
|
632
|
+
{!hasChildren ? null : <q-collapse-transition>{!item[SHOW] ? null : subArrElem}</q-collapse-transition>}
|
|
633
|
+
</div>
|
|
634
|
+
)
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// 渲染结构
|
|
638
|
+
const renderItem = (item: TreeNode) => {
|
|
639
|
+
// 某部分三级菜单有多个相邻同级别菜单
|
|
640
|
+
// 可能出现某几个没有子级,而其他有子级的情况
|
|
641
|
+
// 如供应商管理--准入管理简化模式
|
|
642
|
+
// 此处条件判断,如果相同层级某一个有子级就全部渲染成单行
|
|
643
|
+
return item.level === 1 || item[HAS_CHILDREN] || item[SIBLING_HAS_CHILDREN] ? renderSubMenu(item) : renderMenuItem(item)
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// init 初始化
|
|
647
|
+
onMounted(() => getTreeData())
|
|
648
|
+
|
|
649
|
+
const buttons: GlobalPageLayoutTypes.PageButton[] = [
|
|
650
|
+
{
|
|
651
|
+
...BUTTON_CUSTOM_PRIMARY,
|
|
652
|
+
title: '保存',
|
|
653
|
+
emit: true,
|
|
654
|
+
emitKey: 'authSave',
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
...BUTTON_CUSTOM,
|
|
658
|
+
title: '取消',
|
|
659
|
+
emit: true,
|
|
660
|
+
emitKey: 'authCancel',
|
|
661
|
+
},
|
|
662
|
+
]
|
|
663
|
+
|
|
664
|
+
const headerProps = {
|
|
665
|
+
buttons,
|
|
666
|
+
onAuthSave: () => handleAuthSave(),
|
|
667
|
+
...ctx.attrs,
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
return () => {
|
|
671
|
+
return (
|
|
672
|
+
<div class="UserAuthorization">
|
|
673
|
+
<a-spin spinning={spinning.value}>
|
|
674
|
+
<q-content-header {...headerProps}></q-content-header>
|
|
675
|
+
<div class="container">
|
|
676
|
+
<div class="pageBox">
|
|
677
|
+
<div class="title">
|
|
678
|
+
<strong>{title.value}</strong>
|
|
679
|
+
<strong>{props.rows.length > 1 ? '批量权限配置' : '权限配置'}</strong>
|
|
680
|
+
<span>{computedSubTit.value}</span>
|
|
681
|
+
</div>
|
|
682
|
+
{treeList.value.map((n) => renderItem(n))}
|
|
683
|
+
</div>
|
|
684
|
+
</div>
|
|
685
|
+
</a-spin>
|
|
686
|
+
</div>
|
|
687
|
+
)
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
})
|