@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.
Files changed (198) hide show
  1. package/.eslintignore +4 -0
  2. package/.eslintrc.cjs +22 -0
  3. package/.prettierignore +4 -0
  4. package/.prettierrc.cjs +41 -0
  5. package/.vscode/extensions.json +3 -0
  6. package/README.md +16 -0
  7. package/dist/index.es.d.ts +1 -0
  8. package/dist/index.es.js +14234 -0
  9. package/dist/index.umd.js +311 -0
  10. package/dist/lib/components/QAccountList/src/QAccountList.vue.d.ts +143 -0
  11. package/dist/lib/components/QAccountList/src/useConfigData.d.ts +37 -0
  12. package/dist/lib/components/QBackgroundFileTaskList/src/QBackgroundFileTaskList.vue.d.ts +66 -0
  13. package/dist/lib/components/QBackgroundFileTaskList/src/useConfigData.d.ts +14 -0
  14. package/dist/lib/components/QCompanyermissionList/src/form.vue.d.ts +80 -0
  15. package/dist/lib/components/QCompanyermissionList/src/types.d.ts +44 -0
  16. package/dist/lib/components/QElsEmailSendLogList/src/QElsEmailSendLogList.vue.d.ts +68 -0
  17. package/dist/lib/components/QElsEmailSendLogList/src/useConfigData.d.ts +13 -0
  18. package/dist/lib/components/QElsMsgRecordList/src/QElsMsgRecordList.vue.d.ts +72 -0
  19. package/dist/lib/components/QElsMsgRecordList/src/useConfigData.d.ts +16 -0
  20. package/dist/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsList.vue.d.ts +75 -0
  21. package/dist/lib/components/QI18nList/src/QI18nForm.vue.d.ts +47 -0
  22. package/dist/lib/components/QI18nList/src/QI18nList.vue.d.ts +136 -0
  23. package/dist/lib/components/QI18nList/src/useConfigData.d.ts +31 -0
  24. package/dist/lib/components/QImChatGroupList/src/QImChatGroupList.vue.d.ts +61 -0
  25. package/dist/lib/components/QImChatGroupList/src/useConfigData.d.ts +11 -0
  26. package/dist/lib/components/QMqRecordList/src/QMqRecordList.vue.d.ts +60 -0
  27. package/dist/lib/components/QMqRecordList/src/useConfigData.d.ts +12 -0
  28. package/dist/lib/components/QPasswordSecurityPolicy/src/QPasswordSecurityPolicy.vue.d.ts +49 -0
  29. package/dist/lib/components/QPermissionDataList/src/QPermissionDataAuth.vue.d.ts +3 -0
  30. package/dist/lib/components/QPermissionDataList/src/form.vue.d.ts +50 -0
  31. package/dist/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeList.vue.d.ts +86 -0
  32. package/dist/lib/components/QPurchaseNoticeList/src/useConfigData.d.ts +15 -0
  33. package/dist/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateList.vue.d.ts +47 -0
  34. package/dist/lib/components/QPurchaseNoticeTemplateList/src/useConfigData.d.ts +12 -0
  35. package/dist/lib/components/QQuartzJobList/src/QQuartzJobList.vue.d.ts +129 -0
  36. package/dist/lib/components/QQuartzJobList/src/components/JCron.vue.d.ts +23 -0
  37. package/dist/lib/components/QQuartzJobList/src/components/JCronModal.vue.d.ts +100 -0
  38. package/dist/lib/components/QQuartzJobList/src/components/QuartzJobModal.vue.d.ts +55 -0
  39. package/dist/lib/components/QQuartzJobList/src/useConfigData.d.ts +20 -0
  40. package/dist/lib/components/QRoleList/src/QRoleList.vue.d.ts +100 -0
  41. package/dist/lib/components/QRoleList/src/components/content-header/index.d.ts +23 -0
  42. package/dist/lib/components/QRoleList/src/components/userAuthorization/index.d.ts +79 -0
  43. package/dist/lib/components/QRoleList/src/useConfigData.d.ts +30 -0
  44. package/dist/lib/components/QSupplierAccountList/src/QSupplierAccountForm.vue.d.ts +55 -0
  45. package/dist/lib/components/QSupplierAccountList/src/QSupplierAccountList.vue.d.ts +104 -0
  46. package/dist/lib/components/QSupplierAccountList/src/useConfigData.d.ts +29 -0
  47. package/dist/lib/components/QUsageList/src/QUsageList.vue.d.ts +49 -0
  48. package/dist/lib/components/QUsageList/src/useConfigData.d.ts +14 -0
  49. package/dist/lib/components/QcustomConfigEdit/component/TempalePreviewModal.vue.d.ts +31 -0
  50. package/dist/lib/components/QcustomConfigEdit/component/dataFormatComponent.d.ts +46 -0
  51. package/dist/lib/components/QcustomConfigEdit/component/regexComponent.d.ts +41 -0
  52. package/dist/lib/components/QcustomConfigEdit/src/QcustomConfigRender.d.ts +12 -0
  53. package/dist/lib/components/QcustomConfigEdit/src/types.d.ts +61 -0
  54. package/dist/lib/components/QcustomConfigEdit/src/useConfigComputed.d.ts +7 -0
  55. package/dist/lib/components/QcustomConfigEdit/src/useConfigData.d.ts +85 -0
  56. package/dist/lib/components/QcustomConfigEdit/src/useConfigMethods.d.ts +16 -0
  57. package/dist/lib/components/QcustomConfigEdit/src/useConstant.d.ts +18 -0
  58. package/dist/lib/components/QcustomConfigList/component/ImportJsonCustomConfig.vue.d.ts +50 -0
  59. package/dist/lib/components/QcustomConfigList/src/QcustomConfigList.vue.d.ts +112 -0
  60. package/dist/lib/components/QcustomConfigList/src/useConfigData.d.ts +17 -0
  61. package/dist/lib/components/QcustomConfigList/src/useMethods.d.ts +15 -0
  62. package/dist/lib/components/QsysConfigList/src/QsysConfigList.vue.d.ts +66 -0
  63. package/dist/lib/components/QsysConfigList/src/useConfigData.d.ts +11 -0
  64. package/dist/lib/components/QsysConfigList/src/useMethods.d.ts +6 -0
  65. package/dist/lib/components/index.d.ts +39 -0
  66. package/dist/lib/components/integratedNodesList/src/index.vue.d.ts +107 -0
  67. package/dist/lib/components/integratedReportList/src/index.vue.d.ts +70 -0
  68. package/dist/lib/components/integratedReportSearchList/src/index.vue.d.ts +61 -0
  69. package/dist/lib/components/loginAbnormalLogList/src/index.vue.d.ts +46 -0
  70. package/dist/lib/components/loginLogList/src/index.vue.d.ts +45 -0
  71. package/dist/lib/components/loginSupplierLogList/src/index.vue.d.ts +45 -0
  72. package/dist/lib/components/operateLogList/src/index.vue.d.ts +53 -0
  73. package/dist/lib/index.d.ts +6 -0
  74. package/dist/lib/utils/global.hook.d.ts +31 -0
  75. package/dist/lib/utils/global.types.d.ts +41 -0
  76. package/dist/lib/utils/regexp.d.ts +27 -0
  77. package/dist/style.css +1 -0
  78. package/dist/vite-env.d.ts +13 -0
  79. package/dist/vite.svg +1 -0
  80. package/index.html +13 -0
  81. package/package.json +65 -0
  82. package/public/vite.svg +1 -0
  83. package/src/App.vue +8 -0
  84. package/src/lib/components/QAccountList/index.ts +6 -0
  85. package/src/lib/components/QAccountList/src/QAccountDetail.vue +191 -0
  86. package/src/lib/components/QAccountList/src/QAccountEdit.vue +241 -0
  87. package/src/lib/components/QAccountList/src/QAccountList.vue +530 -0
  88. package/src/lib/components/QAccountList/src/useConfigData.ts +53 -0
  89. package/src/lib/components/QBackgroundFileTaskList/index.ts +6 -0
  90. package/src/lib/components/QBackgroundFileTaskList/src/QBackgroundFileTaskList.vue +137 -0
  91. package/src/lib/components/QBackgroundFileTaskList/src/useConfigData.ts +20 -0
  92. package/src/lib/components/QCompanyermissionList/src/editTree.vue +291 -0
  93. package/src/lib/components/QCompanyermissionList/src/form.vue +238 -0
  94. package/src/lib/components/QCompanyermissionList/src/index.vue +309 -0
  95. package/src/lib/components/QCompanyermissionList/src/types.ts +44 -0
  96. package/src/lib/components/QElsEmailSendLogList/index.ts +6 -0
  97. package/src/lib/components/QElsEmailSendLogList/src/QElsEmailSendLogList.vue +166 -0
  98. package/src/lib/components/QElsEmailSendLogList/src/useConfigData.ts +19 -0
  99. package/src/lib/components/QElsMsgRecordList/index.ts +6 -0
  100. package/src/lib/components/QElsMsgRecordList/src/QElsMsgRecordDetail.vue +148 -0
  101. package/src/lib/components/QElsMsgRecordList/src/QElsMsgRecordList.vue +124 -0
  102. package/src/lib/components/QElsMsgRecordList/src/useConfigData.ts +22 -0
  103. package/src/lib/components/QElsTenantPortalNewsList/index.ts +6 -0
  104. package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsDetail.vue +139 -0
  105. package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsEdit.vue +196 -0
  106. package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsList.vue +122 -0
  107. package/src/lib/components/QElsTenantPortalNewsList/src/useConfigData.ts +20 -0
  108. package/src/lib/components/QI18nList/index.ts +6 -0
  109. package/src/lib/components/QI18nList/src/QI18nForm.vue +141 -0
  110. package/src/lib/components/QI18nList/src/QI18nList.vue +361 -0
  111. package/src/lib/components/QI18nList/src/useConfigData.ts +37 -0
  112. package/src/lib/components/QImChatGroupList/index.ts +6 -0
  113. package/src/lib/components/QImChatGroupList/src/QImChatGroupList.vue +94 -0
  114. package/src/lib/components/QImChatGroupList/src/useConfigData.ts +17 -0
  115. package/src/lib/components/QMqRecordList/index.ts +6 -0
  116. package/src/lib/components/QMqRecordList/src/QMqRecordList.vue +105 -0
  117. package/src/lib/components/QMqRecordList/src/useConfigData.ts +18 -0
  118. package/src/lib/components/QPasswordSecurityPolicy/index.ts +6 -0
  119. package/src/lib/components/QPasswordSecurityPolicy/src/QPasswordSecurityPolicy.vue +266 -0
  120. package/src/lib/components/QPermissionDataList/index.ts +6 -0
  121. package/src/lib/components/QPermissionDataList/src/QPermissionDataAuth.vue +3 -0
  122. package/src/lib/components/QPermissionDataList/src/QPermissionDataEdit.vue +221 -0
  123. package/src/lib/components/QPermissionDataList/src/QPermissionDataList.vue +117 -0
  124. package/src/lib/components/QPermissionDataList/src/form.vue +109 -0
  125. package/src/lib/components/QPurchaseNoticeList/index.ts +6 -0
  126. package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeDetail.vue +147 -0
  127. package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeEdit.vue +244 -0
  128. package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeList.vue +163 -0
  129. package/src/lib/components/QPurchaseNoticeList/src/useConfigData.ts +22 -0
  130. package/src/lib/components/QPurchaseNoticeTemplateList/index.ts +6 -0
  131. package/src/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateList.vue +85 -0
  132. package/src/lib/components/QPurchaseNoticeTemplateList/src/useConfigData.ts +18 -0
  133. package/src/lib/components/QQuartzJobList/index.ts +6 -0
  134. package/src/lib/components/QQuartzJobList/src/QQuartzJobList.vue +263 -0
  135. package/src/lib/components/QQuartzJobList/src/components/JCron.vue +82 -0
  136. package/src/lib/components/QQuartzJobList/src/components/JCronModal.vue +985 -0
  137. package/src/lib/components/QQuartzJobList/src/components/QuartzJobModal.vue +176 -0
  138. package/src/lib/components/QQuartzJobList/src/useConfigData.ts +26 -0
  139. package/src/lib/components/QRoleList/index.ts +6 -0
  140. package/src/lib/components/QRoleList/src/QRoleList.vue +288 -0
  141. package/src/lib/components/QRoleList/src/components/content-header/contentHeader.less +31 -0
  142. package/src/lib/components/QRoleList/src/components/content-header/index.tsx +42 -0
  143. package/src/lib/components/QRoleList/src/components/userAuthorization/index.tsx +690 -0
  144. package/src/lib/components/QRoleList/src/components/userAuthorization/userAuthorization.less +97 -0
  145. package/src/lib/components/QRoleList/src/useConfigData.ts +33 -0
  146. package/src/lib/components/QSupplierAccountList/index.ts +6 -0
  147. package/src/lib/components/QSupplierAccountList/src/QSupplierAccountForm.vue +187 -0
  148. package/src/lib/components/QSupplierAccountList/src/QSupplierAccountList.vue +302 -0
  149. package/src/lib/components/QSupplierAccountList/src/useConfigData.ts +29 -0
  150. package/src/lib/components/QUsageList/index.ts +6 -0
  151. package/src/lib/components/QUsageList/src/QUsageList.vue +82 -0
  152. package/src/lib/components/QUsageList/src/useConfigData.ts +20 -0
  153. package/src/lib/components/QcustomConfigEdit/component/AddDictCodeModal.vue +140 -0
  154. package/src/lib/components/QcustomConfigEdit/component/TempalePreviewModal.vue +100 -0
  155. package/src/lib/components/QcustomConfigEdit/component/dataFormatComponent.tsx +100 -0
  156. package/src/lib/components/QcustomConfigEdit/component/regexComponent.tsx +71 -0
  157. package/src/lib/components/QcustomConfigEdit/index.ts +6 -0
  158. package/src/lib/components/QcustomConfigEdit/src/QcustomConfigEdit.vue +1807 -0
  159. package/src/lib/components/QcustomConfigEdit/src/QcustomConfigRender.tsx +242 -0
  160. package/src/lib/components/QcustomConfigEdit/src/types.ts +71 -0
  161. package/src/lib/components/QcustomConfigEdit/src/useConfigComputed.ts +75 -0
  162. package/src/lib/components/QcustomConfigEdit/src/useConfigData.ts +123 -0
  163. package/src/lib/components/QcustomConfigEdit/src/useConfigMethods.ts +117 -0
  164. package/src/lib/components/QcustomConfigEdit/src/useConstant.ts +301 -0
  165. package/src/lib/components/QcustomConfigEdit/style/index.less +41 -0
  166. package/src/lib/components/QcustomConfigList/component/ImportJsonCustomConfig.vue +135 -0
  167. package/src/lib/components/QcustomConfigList/index.ts +6 -0
  168. package/src/lib/components/QcustomConfigList/src/QcustomConfigList.vue +268 -0
  169. package/src/lib/components/QcustomConfigList/src/types.ts +1 -0
  170. package/src/lib/components/QcustomConfigList/src/useConfigData.ts +23 -0
  171. package/src/lib/components/QcustomConfigList/src/useMethods.ts +36 -0
  172. package/src/lib/components/QcustomConfigList/style/index.less +3 -0
  173. package/src/lib/components/QsysConfigList/index.ts +6 -0
  174. package/src/lib/components/QsysConfigList/src/QsysConfigList.vue +125 -0
  175. package/src/lib/components/QsysConfigList/src/types.ts +1 -0
  176. package/src/lib/components/QsysConfigList/src/useConfigData.ts +17 -0
  177. package/src/lib/components/QsysConfigList/src/useMethods.ts +11 -0
  178. package/src/lib/components/QsysConfigList/style/index.less +3 -0
  179. package/src/lib/components/index.ts +78 -0
  180. package/src/lib/components/integratedNodesList/src/QIntegratedNodesDetail.vue +49 -0
  181. package/src/lib/components/integratedNodesList/src/QIntegratedNodesEdit.vue +143 -0
  182. package/src/lib/components/integratedNodesList/src/index.vue +136 -0
  183. package/src/lib/components/integratedReportList/src/index.vue +86 -0
  184. package/src/lib/components/integratedReportSearchList/src/index.vue +66 -0
  185. package/src/lib/components/loginAbnormalLogList/src/index.vue +50 -0
  186. package/src/lib/components/loginLogList/src/index.vue +57 -0
  187. package/src/lib/components/loginSupplierLogList/src/index.vue +63 -0
  188. package/src/lib/components/operateLogList/src/index.vue +57 -0
  189. package/src/lib/index.ts +15 -0
  190. package/src/lib/utils/constant.ts +1 -0
  191. package/src/lib/utils/global.hook.ts +337 -0
  192. package/src/lib/utils/global.types.ts +49 -0
  193. package/src/lib/utils/regexp.ts +143 -0
  194. package/src/main.ts +11 -0
  195. package/src/vite-env.d.ts +13 -0
  196. package/tsconfig.json +24 -0
  197. package/tsconfig.node.json +9 -0
  198. package/vite.config.ts +61 -0
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <div style="height: 100%">
3
+ <q-list-layout ref="listLayoutRef" v-if="!showEditPage" :pageData="pageData" :apiUrls="apiUrls" />
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ //JS
9
+ import { defineComponent, reactive, inject } from 'vue'
10
+ //hook
11
+ import { useConfigData } from './useConfigData'
12
+ import { INJECT_HTTP, HttpClient, MapObjectNoneType } from '../../../utils/global.types'
13
+ import { message, Modal } from '@qqt-product/ui'
14
+ import { useConigApiMethods } from '../../../utils/global.hook'
15
+ export default defineComponent({
16
+ name: 'QBackgroundFileTaskList',
17
+ props: {
18
+ userInfo: {
19
+ type: Object,
20
+ defalut: () => {
21
+ return {}
22
+ },
23
+ },
24
+ },
25
+ setup() {
26
+ //data-hook
27
+ const { showEditPage, apiUrls, listLayoutRef } = useConfigData()
28
+ const qHttp = inject(INJECT_HTTP) as HttpClient
29
+ const { handleExport } = useConigApiMethods(qHttp)
30
+ // const { userIpnfo } = toRefs(props)
31
+ // console.log('userInfos', userInfo)
32
+
33
+ //data
34
+ const pageData = reactive({
35
+ statusConfig: {
36
+ show: false,
37
+ },
38
+ optColumn: {
39
+ attrs: {},
40
+ extend: {},
41
+ optColumnList: [
42
+ { authorityCode: 'backgroundFileTask#BackgroundFileTask:runTask', type: 'run', title: '执行任务', click: handleRun, disabled: allowRun },
43
+ {
44
+ authorityCode: 'backgroundFileTask#BackgroundFileTask:downTaskFile',
45
+ type: 'down',
46
+ title: '下载文件',
47
+ click: handleCustomDown,
48
+ disabled: allowDown,
49
+ },
50
+ {
51
+ authorityCode: 'backgroundFileTask#BackgroundFileTask:delete',
52
+ type: 'delete',
53
+ title: '删除',
54
+ args: {
55
+ url: apiUrls.value.delete,
56
+ },
57
+ },
58
+ ],
59
+ },
60
+ buttonConfig: {
61
+ attrs: {},
62
+ extend: {},
63
+ buttons: [
64
+ // {label: srmI18n(`${getLangAccount()}#i18n_title_listCustom`, '列自定义'), icon: 'setting', clickFn: this.settingColumns},
65
+ // {label: srmI18n(`${getLangAccount()}#i18n_title_helpText`, '帮助说明'), icon: 'file-text', folded: true, isDocument: true, clickFn: this.showHelpText},
66
+ // {label: srmI18n(`${getLangAccount()}#i18n_title_attachment`, '说明附件'), icon: 'file-pdf', folded: true, isDocument: true, clickFn: this.showHelpPDF}
67
+ ],
68
+ },
69
+ queryConfig: {
70
+ attrs: {},
71
+ extend: {},
72
+ form: [],
73
+ formState: {},
74
+ },
75
+ pagerConfig: {},
76
+ })
77
+ //methods
78
+
79
+ function allowRun({ row = {} as MapObjectNoneType }) {
80
+ return '0' !== row.taskStatus
81
+ }
82
+
83
+ function handleRun({ row = {} as MapObjectNoneType }) {
84
+ if ('0' !== row.taskStatus) {
85
+ message.warning('当前状态不允许执行文件任务')
86
+ return
87
+ }
88
+ Modal.confirm({
89
+ title: '执行文件任务',
90
+ content: '是否执行文件任务?',
91
+ onOk() {
92
+ listLayoutRef.value.loading = true
93
+ qHttp
94
+ .post({
95
+ url: apiUrls.value.runTask + '/' + row.id,
96
+ })
97
+ .then((res) => {
98
+ if (res.success) {
99
+ listLayoutRef.value.fetchListData()
100
+ message.success(res.message)
101
+ } else {
102
+ message.warning(res.message)
103
+ }
104
+ })
105
+ .finally(() => {
106
+ listLayoutRef.value.loading = true
107
+ })
108
+ },
109
+ })
110
+ }
111
+
112
+ function allowDown({ row = {} as MapObjectNoneType }) {
113
+ return '1' !== row.taskStatus
114
+ }
115
+ function handleCustomDown({ row = {} as MapObjectNoneType }) {
116
+ handleExport({
117
+ exportXlsUrl: apiUrls.value.downTaskFile + '/' + row.id,
118
+ type: 'xls',
119
+ fileName: row.taskName,
120
+ actionType: 'get',
121
+ setPostParms: () => {
122
+ return {}
123
+ },
124
+ berforCallback: () => {
125
+ listLayoutRef.value.loading = true
126
+ },
127
+ afterCallback: () => {
128
+ listLayoutRef.value.loading = false
129
+ },
130
+ })
131
+ }
132
+
133
+ return { listLayoutRef, showEditPage, apiUrls, pageData }
134
+ },
135
+ })
136
+ </script>
137
+ <style scoped></style>
@@ -0,0 +1,20 @@
1
+ import { shallowRef, ref } from 'vue'
2
+ // import type { MapObjectNoneType } from './types'
3
+ // import { VxeTableInstance } from 'vxe-table'
4
+ // import type {}
5
+ export function useConfigData() {
6
+ //响应
7
+
8
+ const apiUrls = shallowRef({
9
+ list: '/base/fileTask/list',
10
+ delete: '/base/fileTask/delete',
11
+ runTask: '/base/fileTask/runTask',
12
+ downTaskFile: '/base/fileTask/downTaskFile',
13
+ columnsCode: 'BackgroundFileTaskList',
14
+ })
15
+ const uploadShow = shallowRef<boolean>(false)
16
+ const showEditPage = shallowRef<boolean>(false)
17
+ const currentEditRow = ref({})
18
+ const listLayoutRef = ref()
19
+ return { apiUrls, showEditPage, currentEditRow, listLayoutRef, uploadShow }
20
+ }
@@ -0,0 +1,291 @@
1
+ <template>
2
+ <vxe-grid ref="xGrid" v-bind="gridOptions">
3
+ <template #toolbar_buttons>
4
+ <div class="toolbar-button-wrap">
5
+ <vxe-button status="primary" @click="add">新增</vxe-button>
6
+ </div>
7
+ </template>
8
+ <template #dragBtn>
9
+ <span class="drag-btn">
10
+ <i class="vxe-icon-sort"></i>
11
+ </span>
12
+ </template>
13
+ <!-- <template #dragTip>
14
+ <vxe-tooltip :content="dragTipContent" enterable>
15
+ <i class="vxe-icon-question-circle-fill"></i>
16
+ </vxe-tooltip>
17
+ </template> -->
18
+ <template #hiddenCol="{ row }">
19
+ <span>{{ row.hidden ? '是' : '否' }}</span>
20
+ </template>
21
+ <template #menuTypeCol="{ row }">
22
+ <span>
23
+ {{ getMenuTypeLabel(row.menuType) }}
24
+ </span>
25
+ </template>
26
+ <template #menuAttributeCol="{ row }">
27
+ <span>
28
+ {{ getMenuAttributeTypesLabel(row.menuAttribute) }}
29
+ </span>
30
+ </template>
31
+ <template #optsCol="{ row }">
32
+ <vxe-button type="text" status="primary" @click="edit(row, 'top')">编辑</vxe-button>
33
+ <!-- <vxe-button type="text" status="primary" @click="addSubMenu(row)">新增</vxe-button>
34
+ <vxe-button type="text" status="danger" @click="removeRow(row)">删除</vxe-button> -->
35
+ <vxe-button type="text" status="success" v-if="showHelpBtn(row)" @click="toHelpCenter(row)">说明</vxe-button>
36
+ </template>
37
+ </vxe-grid>
38
+ <PermissionForm
39
+ v-if="showPermissionForm"
40
+ :title="permissionFormTitle"
41
+ :treeData="gridOptions.data"
42
+ :show="showPermissionForm"
43
+ :currentRow="permissioncurrentRow"
44
+ :menuTypes="menuTypes"
45
+ :menuAttributeTypes="menuAttributeTypes"
46
+ @hide="showPermissionForm = false"
47
+ @afterHandleSaveSuccess="afterHandleSavePermissionSuccess"
48
+ ></PermissionForm>
49
+ </template>
50
+ <script lang="ts">
51
+ import { defineComponent, reactive, ref, unref, onMounted, inject } from 'vue'
52
+ import { VXETable, VxeGridInstance, VxeGridProps } from 'vxe-table'
53
+ import { INJECT_HTTP, HttpClient } from '../../../../../src/lib/utils/global.types'
54
+ import { PermissionDataType } from './types'
55
+ import PermissionForm from './form.vue'
56
+
57
+ export default defineComponent({
58
+ props: {
59
+ gridConfig: {
60
+ type: Object,
61
+ required: true,
62
+ },
63
+ },
64
+ components: {
65
+ PermissionForm,
66
+ },
67
+ setup(props) {
68
+ const router = inject('Q_APPLICATION_ROUTER', { push: (obj: { path: string; query: object }) => console.log('router path: ' + obj.path) })
69
+ // 菜单类型
70
+ const menuTypes = unref([
71
+ {
72
+ key: 0,
73
+ value: 0,
74
+ label: '一级菜单',
75
+ },
76
+ {
77
+ key: 1,
78
+ value: 1,
79
+ label: '子菜单',
80
+ },
81
+ {
82
+ key: 2,
83
+ value: 2,
84
+ label: '按钮/权限',
85
+ },
86
+ ])
87
+ // 菜单属性类型
88
+ const menuAttributeTypes = ref([
89
+ {
90
+ key: '1',
91
+ value: '1',
92
+ label: '采购',
93
+ },
94
+ {
95
+ key: '2',
96
+ value: '2',
97
+ label: '销售',
98
+ },
99
+ {
100
+ key: '3',
101
+ value: '3',
102
+ label: '公共',
103
+ },
104
+ {
105
+ key: '4',
106
+ value: '4',
107
+ label: '平台',
108
+ },
109
+ ])
110
+ const getMenuTypeLabel = (value: string | number) => {
111
+ let obj = menuTypes.find((item) => item.value === value)
112
+ return obj?.label
113
+ }
114
+ const getMenuAttributeTypesLabel = (value: string | number) => {
115
+ let obj = menuAttributeTypes.value.find((item) => item.value === value)
116
+ return obj?.label
117
+ }
118
+ // 是否显示说明
119
+ const showHelpBtn = (currentRow: PermissionDataType) => {
120
+ const types = [0, 1]
121
+ if (!types.includes(currentRow.menuType as number)) {
122
+ return false
123
+ }
124
+ if (currentRow.menuType !== 1 && currentRow.children && currentRow.children.length) {
125
+ return false
126
+ }
127
+ return true
128
+ }
129
+ const permissionFormTitle = ref('')
130
+ const qHttp = inject(INJECT_HTTP) as HttpClient
131
+ const showPermissionForm = ref(false)
132
+ const permissioncurrentRow = ref<PermissionDataType>()
133
+ const xGrid = ref({} as VxeGridInstance)
134
+ const gridOptions = reactive({
135
+ ...props.gridConfig,
136
+ class: 'sortable-tree-demo',
137
+ rowConfig: {
138
+ useKey: true,
139
+ },
140
+ scrollY: {
141
+ enabled: false,
142
+ },
143
+ treeConfig: {
144
+ children: 'children',
145
+ },
146
+ columns: [
147
+ // { width: 60, fixed: 'left', slots: { default: 'dragBtn', header: 'dragTip' } },
148
+ { field: 'name', width: 200, title: '菜单名称', treeNode: true, fixed: 'left' },
149
+ { field: 'nameI18nKey', width: 180, title: '菜单名称国际化' },
150
+ { field: 'icon', width: 80, title: '图标' },
151
+ { field: 'hidden', width: 80, title: '是否隐藏', slots: { default: 'hiddenCol' } },
152
+ { field: 'menuType', width: 120, title: '菜单类型', slots: { default: 'menuTypeCol' } },
153
+ { field: 'menuAttribute', width: 120, title: '菜单属性', slots: { default: 'menuAttributeCol' } },
154
+ { field: 'component', width: 140, title: '前端组件路径' },
155
+ { field: 'url', width: 160, title: '访问路由地址', titlePrefix: { content: "以'/'开头为嵌套路由的根路径,需要填写全路径,否则为嵌套的相对路径" } },
156
+ { field: 'perms', width: 260, title: '授权标识' },
157
+ { width: 300, title: '操作', fixed: 'right', slots: { default: 'optsCol' } },
158
+ ],
159
+ data: [],
160
+ } as VxeGridProps)
161
+ // 新增
162
+ const add = () => {
163
+ permissionFormTitle.value = '新增'
164
+ permissioncurrentRow.value = {
165
+ id: '',
166
+ menuType: 0,
167
+ name: '',
168
+ nameI18nKey: '',
169
+ url: '',
170
+ menuAttribute: '',
171
+ component: '',
172
+ redirect: '',
173
+ perms: '',
174
+ icon: '',
175
+ sortNo: null,
176
+ hidden: false,
177
+ keepAlive: true,
178
+ mobile: true,
179
+ }
180
+ showPermissionForm.value = true
181
+ }
182
+ // 新增子菜单
183
+ const addSubMenu = (currentRow?: PermissionDataType) => {
184
+ permissionFormTitle.value = '添加子菜单'
185
+ permissioncurrentRow.value = Object.assign({}, { parentId: currentRow?.id, menuType: 1, perms: currentRow?.perms })
186
+ showPermissionForm.value = true
187
+ }
188
+ // 编辑
189
+ const edit = (currentRow: PermissionDataType, locat: string) => {
190
+ permissionFormTitle.value = '编辑'
191
+ permissioncurrentRow.value = currentRow
192
+ showPermissionForm.value = true
193
+ console.log(currentRow, locat)
194
+ }
195
+ // 获取权限菜单
196
+ const getPermissionList = () => {
197
+ qHttp.registerModuleAction('PermissionModule/getCompanyPermissionList').then((res) => {
198
+ if (res && res.success) {
199
+ gridOptions.data = res.result
200
+ }
201
+ })
202
+ }
203
+ // 保存成功后
204
+ const afterHandleSavePermissionSuccess = () => {
205
+ VXETable.modal.message({ content: '保存成功,重新登录后生效', status: 'success' })
206
+ //getPermissionList()
207
+ }
208
+ // 插入
209
+ const insertRow = async (currentRow: PermissionDataType, locat: string) => {
210
+ const $table = xGrid.value
211
+ if ($table) {
212
+ const waitInsertData = {
213
+ id: Date.now(),
214
+ parentId: locat === 'current' ? currentRow.parentId : currentRow.id,
215
+ name: currentRow.name + '子菜单',
216
+ }
217
+ if (locat === 'current') {
218
+ const { row: newRow } = await $table.insertAt(waitInsertData, currentRow)
219
+ await $table.setEditRow(newRow)
220
+ } else if (locat === 'top') {
221
+ const { row: newRow } = await $table.insert(waitInsertData)
222
+ await $table.setTreeExpand(currentRow, true) // 将父节点展开
223
+ await $table.setEditRow(newRow)
224
+ } else if (locat === 'bottom') {
225
+ const { row: newRow } = await $table.insertAt(waitInsertData, -1)
226
+ await $table.setTreeExpand(currentRow, true) // 将父节点展开
227
+ await $table.setEditRow(newRow)
228
+ }
229
+ }
230
+ }
231
+ // 删除
232
+ const removeRow = async (currentRow: PermissionDataType) => {
233
+ const type = await VXETable.modal.confirm('是否确认删除', '提示')
234
+ if (type === 'confirm') {
235
+ if (xGrid.value) {
236
+ qHttp.registerModuleAction('PermissionModule/deletePermissionSingle', { id: currentRow.id }).then((res) => {
237
+ if (res && res.success) {
238
+ VXETable.modal.message({ content: '删除成功,重新登录后生效', status: 'success' })
239
+ getPermissionList()
240
+ } else {
241
+ VXETable.modal.message({ content: res.message, status: 'error' })
242
+ }
243
+ })
244
+ }
245
+ }
246
+ }
247
+ const toHelpCenter = (currentRow: PermissionDataType) => {
248
+ router.push({ path: '/platform/menu/PermissionList/HelpCenter', query: { id: currentRow.id, title: currentRow.title, isCompany: false } })
249
+ }
250
+ onMounted(() => {
251
+ getPermissionList()
252
+ })
253
+
254
+ return {
255
+ permissionFormTitle,
256
+ showPermissionForm,
257
+ permissioncurrentRow,
258
+ add,
259
+ addSubMenu,
260
+ edit,
261
+ getPermissionList,
262
+ afterHandleSavePermissionSuccess,
263
+ xGrid,
264
+ // dragTipContent,
265
+ gridOptions,
266
+ // treeDrop,
267
+ insertRow,
268
+ removeRow,
269
+ menuTypes,
270
+ menuAttributeTypes,
271
+ getMenuTypeLabel,
272
+ getMenuAttributeTypesLabel,
273
+ showHelpBtn,
274
+ toHelpCenter,
275
+ }
276
+ },
277
+ })
278
+ </script>
279
+ <style scoped lang="scss">
280
+ .sortable-tree-demo .drag-btn {
281
+ cursor: move;
282
+ font-size: 12px;
283
+ }
284
+ .sortable-tree-demo .vxe-body--row.sortable-ghost,
285
+ .sortable-tree-demo .vxe-body--row.sortable-chosen {
286
+ background-color: #dfecfb;
287
+ }
288
+ .toolbar-button-wrap {
289
+ padding: 0 10px;
290
+ }
291
+ </style>
@@ -0,0 +1,238 @@
1
+ <template>
2
+ <vxe-modal :width="1100" :title="modalTitle" v-model="showModal" :hide="hideModal">
3
+ <template #default>
4
+ <vxe-form title-colon ref="xForm" title-align="right" title-width="160" :data="permission.formData" :rules="permission.formRules" :loading="permission.loading" @submit="submitEvent">
5
+ <vxe-form-item align="center" span="24">
6
+ <template #default="{ data }">
7
+ <vxe-radio-group v-model="data.menuType">
8
+ <vxe-radio v-for="menu in menuTypesOpts" :disabled="true" :key="menu.key" :label="menu.value" :content="menu.label"></vxe-radio>
9
+ </vxe-radio-group>
10
+ </template>
11
+ </vxe-form-item>
12
+ <vxe-form-gather span="12">
13
+ <vxe-form-item :visible-method="previousMenusVisible" title="上级菜单" field="parentId" span="24" :item-render="{}" title-overflow="ellipsis">
14
+ <template #default="{ data }">
15
+ <a-tree-select
16
+ v-model:value="data.parentId"
17
+ style="width: 100%"
18
+ :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
19
+ placeholder="请选择上级菜单"
20
+ allow-clear
21
+ tree-default-expand-all
22
+ :tree-data="previousMenus"
23
+ >
24
+ </a-tree-select>
25
+ </template>
26
+ </vxe-form-item>
27
+ <vxe-form-item title="菜单名称" field="name" span="24">
28
+ <template #default="{ data }">
29
+ <vxe-input v-model="data.name" type="text" placeholder="请输入菜单名称" clearable></vxe-input>
30
+ </template>
31
+ </vxe-form-item>
32
+ <vxe-form-item title="菜单名称国际化key" field="nameI18nKey" span="24">
33
+ <template #default="{ data }">
34
+ <vxe-input v-model="data.nameI18nKey" type="text" placeholder="请输入菜单名称国际化key" clearable></vxe-input>
35
+ </template>
36
+ </vxe-form-item>
37
+ <vxe-form-item title="菜单属性" field="menuAttribute" span="24" :item-render="{}" title-overflow="ellipsis">
38
+ <template #default="{ data }">
39
+ <vxe-select :disabled="true" v-model="data.menuAttribute" placeholder="请选择菜单属性" clearable>
40
+ <vxe-option v-for="menuAttr in menuAttributeTypesOpts" :key="menuAttr.key" :value="menuAttr.value" :label="menuAttr.label"></vxe-option>
41
+ </vxe-select>
42
+ </template>
43
+ </vxe-form-item>
44
+ <vxe-form-item title="访问路由地址" field="url" span="24" :item-render="{}" title-overflow="title">
45
+ <template #default="{ data }">
46
+ <vxe-input :disabled="true" v-model="data.url" type="text" placeholder="请输入访问路由地址" clearable></vxe-input>
47
+ </template>
48
+ </vxe-form-item>
49
+ <vxe-form-item title="前端组件路径" field="component" span="24" :item-render="{}" title-overflow="title">
50
+ <template #default="{ data }">
51
+ <vxe-input :disabled="true" v-model="data.component" type="text" placeholder="请输入前端组件路径" clearable></vxe-input>
52
+ </template>
53
+ </vxe-form-item>
54
+ <vxe-form-item title="默认跳转地址" field="redirect" span="24" :item-render="{}" title-overflow="title">
55
+ <template #default="{ data }">
56
+ <vxe-input v-model="data.redirect" type="text" placeholder="请输入路由参数redirect" clearable></vxe-input>
57
+ </template>
58
+ </vxe-form-item>
59
+ <vxe-form-item title="授权标识" field="perms" span="24" :item-render="{}" title-overflow="title">
60
+ <template #default="{ data }">
61
+ <vxe-input v-model="data.perms" type="text" placeholder="请输入授权标识,多个用分号隔开,如 user:list;user:edit" clearable></vxe-input>
62
+ </template>
63
+ </vxe-form-item>
64
+ </vxe-form-gather>
65
+ <vxe-form-gather span="12">
66
+ <vxe-form-item title="排序" field="sortNo" span="24" :item-render="{}" title-overflow="title">
67
+ <template #default="{ data }">
68
+ <vxe-input v-model="data.sortNo" type="integer" placeholder="请输入顺序" clearable></vxe-input>
69
+ </template>
70
+ </vxe-form-item>
71
+ <vxe-form-item title="图标" field="icon" span="24" :item-render="{}" title-overflow="title">
72
+ <template #default="{ data }">
73
+ <vxe-input v-model="data.icon" type="text" placeholder="请选择图标" clearable></vxe-input>
74
+ </template>
75
+ </vxe-form-item>
76
+ <vxe-form-item title="是否隐藏菜单" field="hidden" span="24" :item-render="{}" title-overflow="title">
77
+ <template #default="{ data }">
78
+ <vxe-switch v-model="data.hidden" open-label="是" close-label="否"></vxe-switch>
79
+ </template>
80
+ </vxe-form-item>
81
+ <vxe-form-item title="是否缓存路由" field="hidden" span="24" :item-render="{}" title-overflow="title">
82
+ <template #default="{ data }">
83
+ <vxe-switch v-model="data.keepAlive" open-label="是" close-label="否"></vxe-switch>
84
+ </template>
85
+ </vxe-form-item>
86
+ <vxe-form-item title="是否移动端菜单" field="mobile" span="24" :item-render="{}" title-overflow="title">
87
+ <template #default="{ data }">
88
+ <vxe-switch :disabled="true" v-model="data.mobile" open-label="是" close-label="否"></vxe-switch>
89
+ </template>
90
+ </vxe-form-item>
91
+ </vxe-form-gather>
92
+ <vxe-form-item align="center" span="24">
93
+ <template #default>
94
+ <vxe-button content="取消" @click="hideModal"></vxe-button>
95
+ <vxe-button type="submit" status="primary" content="确定"></vxe-button>
96
+ </template>
97
+ </vxe-form-item>
98
+ </vxe-form>
99
+ </template>
100
+ </vxe-modal>
101
+ </template>
102
+ <script lang="ts">
103
+ import { defineComponent, reactive, ref, onMounted, inject } from 'vue'
104
+ import { VXETable, VxeFormEvents, VxeFormPropTypes } from 'vxe-table'
105
+ import { INJECT_HTTP, HttpClient } from '../../../../../src/lib/utils/global.types'
106
+ export default defineComponent({
107
+ name: 'PermissionForm',
108
+ props: {
109
+ title: {
110
+ type: String,
111
+ default: '',
112
+ },
113
+ show: {
114
+ type: Boolean,
115
+ default: false,
116
+ },
117
+ treeData: {
118
+ type: Object,
119
+ },
120
+ currentRow: {
121
+ type: Object,
122
+ },
123
+ menuTypes: {
124
+ type: Object,
125
+ },
126
+ menuAttributeTypes: {
127
+ type: Object,
128
+ },
129
+ },
130
+ setup(props, { emit }) {
131
+ const qHttp = inject(INJECT_HTTP) as HttpClient
132
+ const modalTitle = ref(props.title)
133
+ const showModal = ref(props.show)
134
+ const previousMenus = ref([])
135
+ const menuTypesOpts = ref(props.menuTypes)
136
+ const menuAttributeTypesOpts = ref(props.menuAttributeTypes)
137
+ const hideModal = () => {
138
+ emit('hide', false)
139
+ }
140
+ const permission = reactive({
141
+ loading: false,
142
+ formData: {
143
+ id: null,
144
+ parentId: null,
145
+ menuType: null,
146
+ name: null,
147
+ nameI18nKey: null,
148
+ url: null,
149
+ menuAttribute: null,
150
+ component: null,
151
+ redirect: null,
152
+ perms: null,
153
+ keepAlive: null,
154
+ icon: null,
155
+ sortNo: null,
156
+ hidden: null,
157
+ mobile: null,
158
+ },
159
+ formRules: {
160
+ name: [{ required: true, message: '请输入名称' }],
161
+ url: [{ required: true, message: '请输入菜单路径' }],
162
+ menuAttribute: [{ required: true, message: '请输入菜单属性' }],
163
+ component: [{ required: true, message: '请输入前端组件路径' }],
164
+ parentId: [
165
+ { required: true, message: '请选择上级菜单' },
166
+ {
167
+ validator(valid) {
168
+ if (!valid.itemValue) {
169
+ return new Error('请选择上级菜单')
170
+ }
171
+ },
172
+ },
173
+ ],
174
+ } as VxeFormPropTypes.Rules,
175
+ })
176
+ permission.formData = Object.assign({}, permission.formData, props.currentRow)
177
+ // 是否显示上级菜单
178
+ const previousMenusVisible = () => {
179
+ if (permission.formData.menuType) {
180
+ if (permission.formData.menuType === 0) {
181
+ return false
182
+ } else {
183
+ return true
184
+ }
185
+ } else {
186
+ return false
187
+ }
188
+ }
189
+ // 保存
190
+ const save = async () => {
191
+ permission.loading = true
192
+ const res = permission.formData.id
193
+ ? await qHttp.registerModuleAction('PermissionModule/editPermission', permission.formData)
194
+ : await qHttp.registerModuleAction('PermissionModule/addPermission', permission.formData)
195
+ if (res && res.success) {
196
+ hideModal()
197
+ emit('afterHandleSaveSuccess')
198
+ } else {
199
+ VXETable.modal.message({ content: res.message, status: 'error' })
200
+ }
201
+ permission.loading = false
202
+ }
203
+ const submitEvent: VxeFormEvents.Submit = () => {
204
+ save()
205
+ }
206
+ onMounted(() => {
207
+ qHttp.registerModuleAction('PermissionModule/queryTreeList').then((res) => {
208
+ if (res && res.success) {
209
+ if (res.result && res.result.treeList) {
210
+ previousMenus.value = res.result.treeList
211
+ }
212
+ }
213
+ })
214
+ })
215
+
216
+ return {
217
+ modalTitle,
218
+ previousMenus,
219
+ previousMenusVisible,
220
+ showModal,
221
+ hideModal,
222
+ menuTypesOpts,
223
+ menuAttributeTypesOpts,
224
+ permission,
225
+ save,
226
+ submitEvent,
227
+ }
228
+ },
229
+ })
230
+ </script>
231
+ <style lang="scss" scoped>
232
+ :deep(.vxe-form--gather) {
233
+ padding: 20px 0px;
234
+ }
235
+ :deep(.vxe-form--gather:first-child) {
236
+ border-right: solid 1px #ddd;
237
+ }
238
+ </style>