@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,291 +0,0 @@
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>
@@ -1,238 +0,0 @@
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>