@qqt-product/system 0.0.1 → 0.0.16

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 (105) hide show
  1. package/dist/index.es.js +53240 -10634
  2. package/dist/index.umd.js +94 -21
  3. package/dist/lib/components/QAccountList/src/QAccountCreate.vue.d.ts +2878 -0
  4. package/dist/lib/components/QAccountList/src/QAccountDetail.vue.d.ts +2871 -0
  5. package/dist/lib/components/QAccountList/src/QAccountEdit.vue.d.ts +2878 -0
  6. package/dist/lib/components/QAccountList/src/QAccountList.vue.d.ts +23 -4
  7. package/dist/lib/components/QBackgroundFileTaskList/src/QBackgroundFileTaskList.vue.d.ts +9 -4
  8. package/dist/lib/components/QElsEmailSendLogList/src/QElsEmailSendLogList.vue.d.ts +9 -4
  9. package/dist/lib/components/QElsMsgRecordList/src/QElsMsgRecordDetail.vue.d.ts +2864 -0
  10. package/dist/lib/components/QElsMsgRecordList/src/QElsMsgRecordList.vue.d.ts +2 -3
  11. package/dist/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsDetail.vue.d.ts +2864 -0
  12. package/dist/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsEdit.vue.d.ts +2876 -0
  13. package/dist/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsList.vue.d.ts +29 -14
  14. package/dist/lib/components/QI18nList/src/QI18nList.vue.d.ts +2 -6
  15. package/dist/lib/components/QImChatGroupList/src/QImChatGroupList.vue.d.ts +5 -8
  16. package/dist/lib/components/QMqRecordList/src/QMqRecordList.vue.d.ts +9 -4
  17. package/dist/lib/components/QPermissionDataList/src/QPermissionDataEdit.vue.d.ts +2872 -0
  18. package/dist/lib/components/QPermissionDataList/src/QPermissionDataList.vue.d.ts +126 -0
  19. package/dist/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeDetail.vue.d.ts +2864 -0
  20. package/dist/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeEdit.vue.d.ts +2887 -0
  21. package/dist/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeList.vue.d.ts +25 -5
  22. package/dist/lib/components/QPurchaseNoticeList/src/use-field-select-modal-hook.d.ts +7 -0
  23. package/dist/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateList.vue.d.ts +221 -28
  24. package/dist/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateModal.vue.d.ts +45 -0
  25. package/dist/lib/components/QQuartzJobList/src/QQuartzJobList.vue.d.ts +24 -5
  26. package/dist/lib/components/QRoleList/src/QRoleList.vue.d.ts +23 -7
  27. package/dist/lib/components/QRoleList/src/useConfigData.d.ts +1 -11
  28. package/dist/lib/components/QSupplierAccountList/src/QSupplierAccountList.vue.d.ts +7 -3
  29. package/dist/lib/components/QUsageList/src/QUsageList.vue.d.ts +15 -35
  30. package/dist/lib/components/QUsageList/src/useConfigData.d.ts +111 -10
  31. package/dist/lib/components/QcustomConfigEdit/component/AddDictCodeModal.vue.d.ts +25 -0
  32. package/dist/lib/components/QcustomConfigEdit/component/regexComponent.d.ts +9 -10
  33. package/dist/lib/components/QcustomConfigEdit/src/QcustomConfigEdit.vue.d.ts +1209 -0
  34. package/dist/lib/components/QcustomConfigEdit/src/useConfigData.d.ts +1 -1
  35. package/dist/lib/components/QcustomConfigList/src/QcustomConfigList.vue.d.ts +8 -7
  36. package/dist/lib/components/QsysConfigList/src/QsysConfigList.vue.d.ts +2 -3
  37. package/dist/lib/components/index.d.ts +2 -2
  38. package/dist/lib/components/integratedNodesList/src/QIntegratedNodesDetail.vue.d.ts +2863 -0
  39. package/dist/lib/components/integratedNodesList/src/QIntegratedNodesEdit.vue.d.ts +2872 -0
  40. package/dist/lib/components/integratedNodesList/src/index.vue.d.ts +8 -11
  41. package/dist/lib/components/integratedReportSearchList/src/index.vue.d.ts +16 -10
  42. package/dist/lib/components/loginAbnormalLogList/src/index.vue.d.ts +2 -9
  43. package/dist/lib/components/loginLogList/src/index.vue.d.ts +2 -8
  44. package/dist/lib/components/loginSupplierLogList/src/index.vue.d.ts +2 -12
  45. package/dist/lib/components/operateLogList/src/index.vue.d.ts +2 -13
  46. package/dist/style.css +1 -1
  47. package/dist/vite-env.d.ts +13 -13
  48. package/package.json +13 -11
  49. package/src/lib/components/QAccountList/src/QAccountCreate.vue +272 -0
  50. package/src/lib/components/QAccountList/src/QAccountDetail.vue +82 -14
  51. package/src/lib/components/QAccountList/src/QAccountEdit.vue +65 -33
  52. package/src/lib/components/QAccountList/src/QAccountList.vue +532 -530
  53. package/src/lib/components/QBackgroundFileTaskList/src/QBackgroundFileTaskList.vue +143 -137
  54. package/src/lib/components/QElsEmailSendLogList/src/QElsEmailSendLogList.vue +172 -166
  55. package/src/lib/components/QElsMsgRecordList/src/QElsMsgRecordList.vue +123 -124
  56. package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsEdit.vue +66 -18
  57. package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsList.vue +151 -122
  58. package/src/lib/components/QI18nList/src/QI18nList.vue +365 -361
  59. package/src/lib/components/QImChatGroupList/src/QImChatGroupList.vue +103 -94
  60. package/src/lib/components/QMqRecordList/src/QMqRecordList.vue +109 -105
  61. package/src/lib/components/QPermissionDataList/src/QPermissionDataAuth.vue +3 -3
  62. package/src/lib/components/QPermissionDataList/src/QPermissionDataEdit.vue +218 -221
  63. package/src/lib/components/QPermissionDataList/src/QPermissionDataList.vue +110 -117
  64. package/src/lib/components/QPermissionDataList/src/form.vue +109 -109
  65. package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeDetail.vue +1 -1
  66. package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeEdit.vue +120 -32
  67. package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeList.vue +189 -163
  68. package/src/lib/components/QPurchaseNoticeList/src/use-field-select-modal-hook.ts +84 -0
  69. package/src/lib/components/QPurchaseNoticeList/src/useConfigData.ts +22 -22
  70. package/src/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateList.vue +134 -85
  71. package/src/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateModal.vue +91 -0
  72. package/src/lib/components/QQuartzJobList/src/QQuartzJobList.vue +276 -263
  73. package/src/lib/components/QRoleList/src/QRoleList.vue +332 -288
  74. package/src/lib/components/QRoleList/src/useConfigData.ts +1 -6
  75. package/src/lib/components/QSupplierAccountList/src/QSupplierAccountList.vue +304 -302
  76. package/src/lib/components/QUsageList/src/QUsageList.vue +287 -82
  77. package/src/lib/components/QUsageList/src/useConfigData.ts +147 -13
  78. package/src/lib/components/QcustomConfigEdit/component/AddDictCodeModal.vue +140 -140
  79. package/src/lib/components/QcustomConfigEdit/component/regexComponent.tsx +28 -28
  80. package/src/lib/components/QcustomConfigEdit/src/QcustomConfigEdit.vue +130 -42
  81. package/src/lib/components/QcustomConfigEdit/src/QcustomConfigRender.tsx +2 -2
  82. package/src/lib/components/QcustomConfigEdit/src/useConfigData.ts +2 -2
  83. package/src/lib/components/QcustomConfigEdit/src/useConstant.ts +12 -12
  84. package/src/lib/components/QcustomConfigList/src/QcustomConfigList.vue +276 -268
  85. package/src/lib/components/QcustomConfigList/src/useConfigData.ts +1 -1
  86. package/src/lib/components/QsysConfigList/src/QsysConfigList.vue +124 -125
  87. package/src/lib/components/index.ts +78 -78
  88. package/src/lib/components/integratedNodesList/src/QIntegratedNodesEdit.vue +2 -10
  89. package/src/lib/components/integratedNodesList/src/index.vue +130 -136
  90. package/src/lib/components/integratedReportList/src/index.vue +55 -30
  91. package/src/lib/components/integratedReportSearchList/src/index.vue +106 -66
  92. package/src/lib/components/loginAbnormalLogList/src/index.vue +43 -50
  93. package/src/lib/components/loginLogList/src/index.vue +51 -57
  94. package/src/lib/components/loginSupplierLogList/src/index.vue +53 -63
  95. package/src/lib/components/operateLogList/src/index.vue +46 -57
  96. package/src/vite-env.d.ts +13 -13
  97. package/tsconfig.json +24 -24
  98. package/vite.config.ts +1 -1
  99. package/dist/lib/components/QCompanyermissionList/src/form.vue.d.ts +0 -80
  100. package/dist/lib/components/QCompanyermissionList/src/types.d.ts +0 -44
  101. package/dist/lib/components/integratedReportList/src/index.vue.d.ts +0 -70
  102. package/src/lib/components/QCompanyermissionList/src/editTree.vue +0 -291
  103. package/src/lib/components/QCompanyermissionList/src/form.vue +0 -238
  104. package/src/lib/components/QCompanyermissionList/src/index.vue +0 -309
  105. package/src/lib/components/QCompanyermissionList/src/types.ts +0 -44
@@ -1,288 +1,332 @@
1
- <template>
2
- <div style="height: 100%">
3
- <q-list-layout ref="listLayoutRef" v-if="!showAuth && !showEditPage" :pageData="pageData" :apiUrls="apiUrls" />
4
-
5
- <!--复制功能-->
6
- <vxe-modal v-model="copyRoleShow" title="复制角色" type="confirm" :showFooter="false">
7
- <vxe-form title-colon title-align="right" title-width="160" :data="copyRoleFrom" :rules="userInformsFromRules" @submit="copyRolesubmitEvent">
8
- <vxe-form-gather span="24">
9
- <vxe-form-item title="角色名称" field="roleName" span="24">
10
- <template #default="{ data }">
11
- <vxe-input v-model="data.roleName" type="text" placeholder="请输入角色名称"></vxe-input>
12
- </template>
13
- </vxe-form-item>
14
- <vxe-form-item title="角色编码" field="roleCode" span="24">
15
- <template #default="{ data }">
16
- <vxe-input v-model="data.roleCode" type="text" placeholder="请输入角色编码"></vxe-input>
17
- </template>
18
- </vxe-form-item>
19
-
20
- <vxe-form-item align="center" span="24">
21
- <template #default>
22
- <vxe-button content="取消" @click="copyRoleShow = false"></vxe-button>
23
- <vxe-button type="submit" status="primary" content="保存"></vxe-button>
24
- </template>
25
- </vxe-form-item>
26
- </vxe-form-gather>
27
- </vxe-form>
28
- </vxe-modal>
29
-
30
- <!--新增-->
31
-
32
- <vxe-modal v-model="userInformsFromShow" title="基本信息" type="confirm" :showFooter="false">
33
- <vxe-form title-colon title-align="right" title-width="160" :rules="userInformsFromRules" :data="userInformsFrom" @submit="userInformFormEvent">
34
- <vxe-form-gather span="24">
35
- <vxe-form-item title="角色名称" field="roleName" span="24">
36
- <template #default="{ data }">
37
- <vxe-input v-model="data.roleName" type="text" placeholder="请输入角色名称"></vxe-input>
38
- </template>
39
- </vxe-form-item>
40
- <vxe-form-item title="角色编码" field="roleCode" span="24">
41
- <template #default="{ data }">
42
- <vxe-input :disabled="!!userInformsFrom.id" v-model="data.roleCode" type="text" placeholder="请输入角色编码"></vxe-input>
43
- </template>
44
- </vxe-form-item>
45
-
46
- <vxe-form-item title="描述" field="description" span="24">
47
- <template #default="{ data }">
48
- <vxe-textarea :autosize="{ minRows: 6, maxRows: 10 }" v-model="data.description" type="text" placeholder="请输入描述"></vxe-textarea>
49
- </template>
50
- </vxe-form-item>
51
-
52
- <vxe-form-item span="24">
53
- <template #default>
54
- <vxe-button
55
- content="取消"
56
- @click="
57
- () => {
58
- userInformsFromShow = false
59
- userInformsFrom = {}
60
- }
61
- "
62
- ></vxe-button>
63
- <vxe-button type="submit" status="primary" content="保存"></vxe-button>
64
- </template>
65
- </vxe-form-item>
66
- </vxe-form-gather>
67
- </vxe-form>
68
- </vxe-modal>
69
-
70
- <!-- 租户授权 -->
71
- <user-authorization v-if="showAuth" parentPath="RoleList" :rows="currentRows" @authCancel="handleAuthCancel"></user-authorization>
72
- </div>
73
- </template>
74
-
75
- <script lang="ts">
76
- //JS
77
- import { ref, defineComponent, reactive, nextTick, inject } from 'vue'
78
- //hook
79
- import { useConfigData } from './useConfigData'
80
- import { INJECT_HTTP, HttpClient, MapObjectNoneType } from '../../../utils/global.types'
81
- import { message } from '@qqt-product/ui'
82
-
83
- import UserAuthorization from './components/userAuthorization'
84
-
85
- export default defineComponent({
86
- name: 'QRoleList',
87
- props: {
88
- userInfo: {
89
- type: Object,
90
- defalut: () => {
91
- return {}
92
- },
93
- },
94
- },
95
- components: {
96
- UserAuthorization,
97
- },
98
- setup() {
99
- //data-hook
100
- const { userInformsFromRules, userInformsFromShow, userInformsFrom, showEditPage, apiUrls, copyRoleShow, copyRoleFrom, itemRow, listLayoutRef } = useConfigData()
101
- // const { userInfo } = toRefs(props)
102
- const qHttp = inject(INJECT_HTTP) as HttpClient
103
-
104
- const showAuth = ref(false)
105
- const currentRows = ref([])
106
-
107
- const handleAuth = ({ row }: { row: never }) => {
108
- showAuth.value = true
109
- if (Array.isArray(row)) {
110
- currentRows.value = [...row] as never
111
- } else {
112
- currentRows.value.push(row as never)
113
- }
114
- }
115
-
116
- const handleAuthCancel = () => {
117
- showAuth.value = false
118
- currentRows.value = []
119
- }
120
-
121
- //data
122
- const pageData = reactive({
123
- statusConfig: {
124
- show: false,
125
- },
126
- optColumn: {
127
- attrs: {},
128
- extend: {},
129
- optColumnList: [
130
- { authorityCode: 'role#Role:edit', type: 'edit', title: '编辑', click: handleEdit },
131
- { authorityCode: 'role#Role:copy', type: 'copy', title: '复制', click: handleCopy },
132
- {
133
- type: 'authorization',
134
- title: '授权',
135
- click: handleAuth,
136
- authorityCode: 'role#Permissio:saveRolePermission',
137
- },
138
- {
139
- authorityCode: 'role#Role:delete',
140
- type: 'delete',
141
- title: '删除',
142
- args: {
143
- url: apiUrls.value.delete,
144
- },
145
- disabled: allowDelete,
146
- },
147
- // { authorityCode: 'role#Role:userSet', type: 'usersList', title: srmI18n(`${getLangAccount()}#i18n_btn_jDER_36c46210`, '用户配置'), clickFn: this.handleUsersList },
148
- ],
149
- },
150
- buttonConfig: {
151
- attrs: {},
152
- extend: {},
153
- buttons: [
154
- {
155
- authorityCode: 'role#Role:add',
156
- label: '新增',
157
- icon: {
158
- type: 'icon-Q-add',
159
- },
160
- attrs: {
161
- type: 'primary',
162
- },
163
- click: handleAdd,
164
- },
165
- // {label: srmI18n(`${getLangAccount()}#i18n_title_listCustom`, '列自定义'), icon: 'setting', clickFn: this.settingColumns},
166
- // {label: srmI18n(`${getLangAccount()}#i18n_title_helpText`, '帮助说明'), icon: 'file-text', folded: true, isDocument: true, clickFn: this.showHelpText},
167
- // {label: srmI18n(`${getLangAccount()}#i18n_title_attachment`, '说明附件'), icon: 'file-pdf', folded: true, isDocument: true, clickFn: this.showHelpPDF}
168
- ],
169
- },
170
- queryConfig: {
171
- attrs: {},
172
- extend: {},
173
- form: [
174
- {
175
- type: 'input',
176
- label: '角色名称',
177
- fieldName: 'roleName',
178
- placeholder: '请输入角色名称',
179
- },
180
- ],
181
- formState: {},
182
- },
183
- pagerConfig: {},
184
- })
185
-
186
- //method
187
- function handleCopy({ row = {} as MapObjectNoneType }) {
188
- itemRow.value = row
189
- nextTick(() => {
190
- copyRoleShow.value = true
191
- })
192
- }
193
-
194
- function allowDelete({ row = {} as MapObjectNoneType }) {
195
- if (row.roleCode == 'companyAdmin' || row.roleCode == 'admin') {
196
- return true
197
- } else {
198
- return false
199
- }
200
- }
201
-
202
- function copyRolesubmitEvent() {
203
- if (copyRoleFrom.value.roleName == '') {
204
- message.warning('请输入角色名称')
205
- return
206
- }
207
- if (copyRoleFrom.value.roleCode == '') {
208
- message.warning('请输入角色编码')
209
- return
210
- }
211
-
212
- let data = { id: itemRow.value.id, roleName: copyRoleFrom.value.roleName, roleCode: copyRoleFrom.value.roleCode }
213
- listLayoutRef.value.loading = true
214
- qHttp
215
- .post({
216
- url: apiUrls.value.copy,
217
- data,
218
- })
219
- .then((res) => {
220
- listLayoutRef.value.loading = false
221
- if (res.success) {
222
- listLayoutRef.value.fetchListData()
223
- message.success(res.message)
224
- } else {
225
- message.warning(res.message)
226
- }
227
- })
228
- .finally(() => {
229
- itemRow.value = {}
230
- copyRoleFrom.value = {}
231
- copyRoleShow.value = false
232
- })
233
- }
234
-
235
- function handleAdd() {
236
- nextTick(() => {
237
- userInformsFromShow.value = true
238
- })
239
- }
240
- function handleEdit({ row = {} as MapObjectNoneType }) {
241
- userInformsFrom.value = { ...row }
242
- nextTick(() => {
243
- userInformsFromShow.value = true
244
- })
245
- }
246
- function userInformFormEvent() {
247
- let url = userInformsFrom.value.id ? '/account/role/edit' : '/account/role/add'
248
- qHttp
249
- .post({
250
- url,
251
- data: {
252
- ...userInformsFrom.value,
253
- },
254
- })
255
- .then((res) => {
256
- listLayoutRef.value.loading = false
257
- if (res.success) {
258
- listLayoutRef.value.fetchListData()
259
- message.success(res.message)
260
- } else {
261
- message.warning(res.message)
262
- }
263
- })
264
- .finally(() => {
265
- userInformsFrom.value = {}
266
- userInformsFromShow.value = false
267
- })
268
- }
269
-
270
- return {
271
- userInformsFromRules,
272
- userInformFormEvent,
273
- userInformsFromShow,
274
- userInformsFrom,
275
- listLayoutRef,
276
- copyRolesubmitEvent,
277
- copyRoleFrom,
278
- showEditPage,
279
- apiUrls,
280
- pageData,
281
- copyRoleShow,
282
- showAuth,
283
- currentRows,
284
- handleAuthCancel,
285
- }
286
- },
287
- })
288
- </script>
1
+ <template>
2
+ <div style="height: 100%">
3
+ <q-list-layout ref="listLayoutRef" v-if="!showAuth && !showEditPage" :pageData="pageData" :apiUrls="apiUrls" />
4
+
5
+ <!--复制功能-->
6
+ <vxe-modal v-model="copyRoleShow" title="复制角色" type="confirm" :showFooter="false">
7
+ <vxe-form title-colon title-align="right" title-width="160" :data="copyRoleFrom" :rules="userInformsFromRules" @submit="copyRolesubmitEvent">
8
+ <vxe-form-gather span="24">
9
+ <vxe-form-item title="角色名称" field="roleName" span="24">
10
+ <template #default="{ data }">
11
+ <vxe-input v-model="data.roleName" type="text" placeholder="请输入角色名称"></vxe-input>
12
+ </template>
13
+ </vxe-form-item>
14
+ <vxe-form-item title="角色编码" field="roleCode" span="24">
15
+ <template #default="{ data }">
16
+ <vxe-input v-model="data.roleCode" type="text" placeholder="请输入角色编码"></vxe-input>
17
+ </template>
18
+ </vxe-form-item>
19
+
20
+ <vxe-form-item align="center" span="24">
21
+ <template #default>
22
+ <vxe-button content="取消" @click="copyRoleShow = false"></vxe-button>
23
+ <vxe-button type="submit" status="primary" content="保存"></vxe-button>
24
+ </template>
25
+ </vxe-form-item>
26
+ </vxe-form-gather>
27
+ </vxe-form>
28
+ </vxe-modal>
29
+
30
+ <!--新增-->
31
+
32
+ <vxe-modal :width="560" v-model="userInformsFromShow" title="基本信息" type="confirm" :showFooter="false">
33
+ <vxe-form title-colon title-align="right" title-width="100" :rules="userInformsFromRules" :data="userInformsFrom" @submit="userInformFormEvent">
34
+ <vxe-form-gather span="24">
35
+ <vxe-form-item title="角色名称" field="roleName" span="24">
36
+ <template #default="{ data }">
37
+ <vxe-input v-model="data.roleName" type="text" placeholder="请输入角色名称"></vxe-input>
38
+ </template>
39
+ </vxe-form-item>
40
+ <vxe-form-item title="角色编码" field="roleCode" span="24">
41
+ <template #default="{ data }">
42
+ <vxe-input :disabled="!!userInformsFrom.id" v-model="data.roleCode" type="text" placeholder="请输入角色编码"></vxe-input>
43
+ </template>
44
+ </vxe-form-item>
45
+
46
+ <vxe-form-item title="描述" field="description" span="24">
47
+ <template #default="{ data }">
48
+ <vxe-textarea :autosize="{ minRows: 6, maxRows: 10 }" v-model="data.description" type="text" placeholder="请输入描述"></vxe-textarea>
49
+ </template>
50
+ </vxe-form-item>
51
+
52
+ <vxe-form-item align="center" span="24">
53
+ <template #default>
54
+ <vxe-button
55
+ content="取消"
56
+ @click="
57
+ () => {
58
+ userInformsFromShow = false
59
+ userInformsFrom = {}
60
+ }
61
+ "
62
+ ></vxe-button>
63
+ <vxe-button type="submit" status="primary" content="保存"></vxe-button>
64
+ </template>
65
+ </vxe-form-item>
66
+ </vxe-form-gather>
67
+ </vxe-form>
68
+ </vxe-modal>
69
+
70
+ <!-- 租户授权 -->
71
+ <user-authorization v-if="showAuth" parentPath="RoleList" :rows="currentRows" @authCancel="handleAuthCancel"></user-authorization>
72
+ </div>
73
+ </template>
74
+
75
+ <script lang="ts">
76
+ //JS
77
+ import { ref, defineComponent, reactive, nextTick, inject } from 'vue'
78
+ //hook
79
+ import { useConfigData } from './useConfigData'
80
+ import { INJECT_HTTP, HttpClient, MapObjectNoneType } from '../../../utils/global.types'
81
+ import { message } from '@qqt-product/ui'
82
+
83
+ import UserAuthorization from './components/userAuthorization'
84
+
85
+ export default defineComponent({
86
+ name: 'QRoleList',
87
+ props: {
88
+ userInfo: {
89
+ type: Object,
90
+ defalut: () => {
91
+ return {}
92
+ },
93
+ },
94
+ },
95
+ components: {
96
+ UserAuthorization,
97
+ },
98
+ setup() {
99
+ //data-hook
100
+ const { userInformsFromShow, userInformsFrom, showEditPage, apiUrls, copyRoleShow, copyRoleFrom, itemRow, listLayoutRef } = useConfigData()
101
+ // const { userInfo } = toRefs(props)
102
+ const qHttp = inject(INJECT_HTTP) as HttpClient
103
+ const srmI18n = inject('Q_SRM_I18N', (i18nKey: string, defaultValue: string, account?: string | number): string => {
104
+ if (i18nKey) {
105
+ if (account) {
106
+ return account + defaultValue
107
+ }
108
+ return defaultValue
109
+ }
110
+ return defaultValue
111
+ })
112
+
113
+ const userInformsFromRules = ref({
114
+ roleName: [{ required: true, message: '请输入角色名称' }],
115
+ roleCode: [
116
+ { required: true, message: '请输入角色编码' },
117
+ {
118
+ // todo:异步校验
119
+ validator: async ({ itemValue }) => {
120
+ if (/[\u4E00-\u9FA5]/g.test(itemValue)) {
121
+ message.warn('角色编码不可输入汉字!')
122
+ return Promise.reject('角色编码不可输入汉字!')
123
+ } else {
124
+ if (userInformsFrom.value.id) {
125
+ return Promise.resolve()
126
+ } else {
127
+ const params = {
128
+ tableName: 'els_role',
129
+ fieldName: 'role_code',
130
+ fieldVal: itemValue,
131
+ dataId: copyRoleFrom.value.id,
132
+ }
133
+ const res = await qHttp.get({ url: '/base/duplicate/check', params })
134
+ if (res && res.success) {
135
+ return Promise.resolve()
136
+ } else {
137
+ message.warn(res.message)
138
+ return Promise.reject(res.message)
139
+ }
140
+ }
141
+ }
142
+ },
143
+ },
144
+ ],
145
+ })
146
+ const showAuth = ref(false)
147
+ const currentRows = ref([])
148
+
149
+ const handleAuth = ({ row }: { row: never }) => {
150
+ showAuth.value = true
151
+ if (Array.isArray(row)) {
152
+ currentRows.value = [...row] as never
153
+ } else {
154
+ currentRows.value.push(row as never)
155
+ }
156
+ }
157
+
158
+ const handleAuthCancel = () => {
159
+ showAuth.value = false
160
+ currentRows.value = []
161
+ }
162
+
163
+ //data
164
+ const pageData = reactive({
165
+ statusConfig: {
166
+ show: false,
167
+ },
168
+ optionConfig: {
169
+ attrs: {},
170
+ extend: {},
171
+ options: [
172
+ { authorityCode: 'role#Role:edit', type: 'edit', title: '编辑', click: handleEdit },
173
+ { authorityCode: 'role#Role:copy', type: 'copy', title: '复制', click: handleCopy },
174
+ {
175
+ type: 'authorization',
176
+ title: '授权',
177
+ click: handleAuth,
178
+ authorityCode: 'role#Permissio:saveRolePermission',
179
+ },
180
+ {
181
+ authorityCode: 'role#Role:delete',
182
+ type: 'delete',
183
+ title: '删除',
184
+ args: {
185
+ url: apiUrls.value.delete,
186
+ },
187
+ disabled: allowDelete,
188
+ },
189
+ // { authorityCode: 'role#Role:userSet', type: 'usersList', title: srmI18n(`${getLangAccount()}#i18n_btn_jDER_36c46210`, '用户配置'), clickFn: this.handleUsersList },
190
+ ],
191
+ },
192
+ buttonConfig: {
193
+ attrs: {},
194
+ extend: {},
195
+ buttons: [
196
+ {
197
+ authorityCode: 'role#Role:add',
198
+ label: srmI18n('i18n_title_add', '新增'),
199
+ icon: {
200
+ type: 'icon-Q-add',
201
+ },
202
+ attrs: {
203
+ type: 'primary',
204
+ },
205
+ click: handleAdd,
206
+ },
207
+ {
208
+ label: srmI18n('i18n_title_listCustom', '列自定义'),
209
+ icon: {
210
+ type: 'icon-Q-setting',
211
+ },
212
+ type: 'setting',
213
+ },
214
+ ],
215
+ },
216
+ queryConfig: {
217
+ attrs: {},
218
+ extend: {},
219
+ form: [
220
+ {
221
+ type: 'input',
222
+ label: '角色名称',
223
+ fieldName: 'roleName',
224
+ placeholder: '请输入角色名称',
225
+ },
226
+ ],
227
+ },
228
+ pagerConfig: {},
229
+ })
230
+
231
+ //method
232
+ function handleCopy({ row = {} as MapObjectNoneType }) {
233
+ itemRow.value = row
234
+ nextTick(() => {
235
+ copyRoleShow.value = true
236
+ })
237
+ }
238
+
239
+ function allowDelete({ row = {} as MapObjectNoneType }) {
240
+ if (row.roleCode == 'companyAdmin' || row.roleCode == 'admin') {
241
+ return true
242
+ } else {
243
+ return false
244
+ }
245
+ }
246
+
247
+ function copyRolesubmitEvent() {
248
+ if (copyRoleFrom.value.roleName == '') {
249
+ message.warning('请输入角色名称')
250
+ return
251
+ }
252
+ if (copyRoleFrom.value.roleCode == '') {
253
+ message.warning('请输入角色编码')
254
+ return
255
+ }
256
+
257
+ let data = { id: itemRow.value.id, roleName: copyRoleFrom.value.roleName, roleCode: copyRoleFrom.value.roleCode }
258
+ listLayoutRef.value.loading = true
259
+ qHttp
260
+ .post({
261
+ url: apiUrls.value.copy,
262
+ data,
263
+ })
264
+ .then((res) => {
265
+ listLayoutRef.value.loading = false
266
+ if (res.success) {
267
+ listLayoutRef.value.fetchListData()
268
+ message.success(res.message)
269
+ } else {
270
+ message.warning(res.message)
271
+ }
272
+ })
273
+ .finally(() => {
274
+ itemRow.value = {}
275
+ copyRoleFrom.value = {}
276
+ copyRoleShow.value = false
277
+ })
278
+ }
279
+
280
+ function handleAdd() {
281
+ userInformsFrom.value = {}
282
+ nextTick(() => {
283
+ userInformsFromShow.value = true
284
+ })
285
+ }
286
+ function handleEdit({ row = {} as MapObjectNoneType }) {
287
+ userInformsFrom.value = { ...row }
288
+ nextTick(() => {
289
+ userInformsFromShow.value = true
290
+ })
291
+ }
292
+ function userInformFormEvent() {
293
+ let url = userInformsFrom.value.id ? '/account/role/edit' : '/account/role/add'
294
+ qHttp
295
+ .post({
296
+ url,
297
+ data: {
298
+ ...userInformsFrom.value,
299
+ },
300
+ })
301
+ .then((res) => {
302
+ listLayoutRef.value.loading = false
303
+ if (res.success) {
304
+ listLayoutRef.value.fetchListData()
305
+ message.success(res.message)
306
+ userInformsFrom.value = {}
307
+ userInformsFromShow.value = false
308
+ } else {
309
+ message.warning(res.message)
310
+ }
311
+ })
312
+ }
313
+
314
+ return {
315
+ userInformsFromRules,
316
+ userInformFormEvent,
317
+ userInformsFromShow,
318
+ userInformsFrom,
319
+ listLayoutRef,
320
+ copyRolesubmitEvent,
321
+ copyRoleFrom,
322
+ showEditPage,
323
+ apiUrls,
324
+ pageData,
325
+ copyRoleShow,
326
+ showAuth,
327
+ currentRows,
328
+ handleAuthCancel,
329
+ }
330
+ },
331
+ })
332
+ </script>
@@ -24,10 +24,5 @@ export function useConfigData() {
24
24
  const userInformsFrom = ref<MapObjectNoneType>({})
25
25
  const userInformsFromShow = shallowRef<boolean>(false)
26
26
 
27
- const userInformsFromRules = ref({
28
- roleName: [{ required: true, message: '请输入角色名称' }],
29
- roleCode: [{ required: true, message: '请输入角色编码' }],
30
- })
31
-
32
- return { userInformsFromRules, userInformsFromShow, userInformsFrom, itemRow, copyRoleFrom, copyRoleShow, apiUrls, showEditPage, currentEditRow, listLayoutRef, uploadShow }
27
+ return { userInformsFromShow, userInformsFrom, itemRow, copyRoleFrom, copyRoleShow, apiUrls, showEditPage, currentEditRow, listLayoutRef, uploadShow }
33
28
  }