@utogether/udp-core 1.0.1-beta.5 → 1.0.1-beta.7

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 (98) hide show
  1. package/dist/{403-CP2RkkAy.js → 403-BQZ5OAKL.js} +10 -10
  2. package/dist/{404-DwK-0wNQ.js → 404-H55ex36i.js} +4 -4
  3. package/dist/{500-CLbJDqnd.js → 500-bbrspTnK.js} +1 -1
  4. package/dist/{AuthorityInfo-Bi1_uhMu.js → AuthorityInfo-BWni4UPQ.js} +1 -1
  5. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-7WtOL6Hs.js +100 -0
  6. package/dist/{Company-B--cokc6.js → Company-CuebFrQ0.js} +3 -3
  7. package/dist/{CompanyPanel-B_gmcZ9L.js → CompanyPanel-DxPdJs6x.js} +6 -6
  8. package/dist/{Department-DbKdyNzK.js → Department-D2a6Juur.js} +3 -3
  9. package/dist/{DepartmentPanel-BmEttboJ.js → DepartmentPanel-C_s2R9yl.js} +24 -23
  10. package/dist/{DesignPanel-LL68_36s.js → DesignPanel-CexZj3HF.js} +1 -1
  11. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-DWPmFegv.js → DesignPanel.vue_vue_type_style_index_0_lang-DfmysqwB.js} +25 -24
  12. package/dist/{DictView-B8j-EWx5.js → DictView-C0GS72rG.js} +19 -18
  13. package/dist/{InvOrganization-DnGQlESM.js → InvOrganization-a1tQ2CEH.js} +8 -7
  14. package/dist/Org-DifvzLLy.js +35 -0
  15. package/dist/{Preview-yot4NBW5.js → Preview-BOv5j9i6.js} +1 -1
  16. package/dist/{ReportDefine-DHadqNYy.js → ReportDefine-Dli1Q0TB.js} +1 -1
  17. package/dist/{ReportDesign-CBihGRth.js → ReportDesign-zSWkcL_O.js} +37 -36
  18. package/dist/{ReportQuery-CwHQ6LUU.js → ReportQuery-D5r3bvFc.js} +1 -1
  19. package/dist/{ReportQueryFrom-ie6lQcGL.js → ReportQueryFrom-DiostHrX.js} +1 -1
  20. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-B8LJNK0m.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-Cr2eKMmr.js} +1 -1
  21. package/dist/{ReportTemplate-B2Smwo-z.js → ReportTemplate-CYy4cZHQ.js} +24 -24
  22. package/dist/{Role-Cf7DB7uS.js → Role-BFQFxfQS.js} +6 -6
  23. package/dist/{RoleAssign-upUnqs_i.js → RoleAssign-BIdWSLTR.js} +8 -8
  24. package/dist/{RolePanel-EXL_FLvM.js → RolePanel-C7ybSknr.js} +1 -1
  25. package/dist/{RolePanel-BBGDGK8V.js → RolePanel-KC-UgmtF.js} +1 -1
  26. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-C91CJO4e.js +132 -0
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DF8qJKwW.js → RolePanel.vue_vue_type_script_setup_true_lang-C_ZsMf1f.js} +40 -34
  28. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-DbBGg32H.js → ScrollPanel.vue_vue_type_style_index_0_lang-botBBgto.js} +17 -17
  29. package/dist/{Staff-DYu5ZEyR.js → Staff-CY0DLsTN.js} +3 -3
  30. package/dist/{StaffInfo-CHvNGjtz.js → StaffInfo-DA7p265h.js} +1 -1
  31. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-XRJVEJ-s.js → StaffInfo.vue_vue_type_script_setup_true_lang-f29A44gS.js} +5 -5
  32. package/dist/{StaffPanel-C-ygEY65.js → StaffPanel-DYP-mMp9.js} +1 -1
  33. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-BvLrF4Yw.js → StaffPanel.vue_vue_type_script_setup_true_lang-C0YAG2xV.js} +6 -6
  34. package/dist/{SysUser-BHk_szpK.js → SysUser-FqS3Ctne.js} +2 -2
  35. package/dist/{SysUserPanel-DFvzA5d-.js → SysUserPanel-C_t6F99T.js} +1 -1
  36. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-B9zUXXwa.js → SysUserPanel.vue_vue_type_script_setup_true_lang-CKZjy0OF.js} +93 -86
  37. package/dist/{SystemMenu-5TK9ZA11.js → SystemMenu-ChFrMzRg.js} +14 -13
  38. package/dist/{UserInfo-Bx3zQqHa.js → UserInfo-I36LAXVj.js} +1 -1
  39. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-C2sqUQdg.js → UserInfo.vue_vue_type_style_index_0_lang-BGY-LYeL.js} +28 -25
  40. package/dist/await-to-js.es5-BtRbN2QH.js +10 -0
  41. package/dist/{childView-BSUWnii7.js → childView-CYpuOzRx.js} +1 -1
  42. package/dist/{childView-CFC3gA_U.js → childView-Csnlaqfs.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-EcT-Dux7.js → childView.vue_vue_type_style_index_0_lang-B8EnA03l.js} +18 -17
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-WQVLSJR8.js → childView.vue_vue_type_style_index_0_lang-DNVlDM_a.js} +10 -9
  45. package/dist/{code-rule-DybjhotB.js → code-rule-DHBSC5Qp.js} +14 -13
  46. package/dist/core.es.js +2 -2
  47. package/dist/{cron-task-DGdknqaF.js → cron-task-CiI1MFla.js} +8 -7
  48. package/dist/{frameView-BOOZRv1S.js → frameView-ZWKlbz9p.js} +1 -1
  49. package/dist/index-COBMRlmJ.js +5379 -0
  50. package/dist/{layoutView-BWeDLY9C.js → layoutView-5OsbpP0u.js} +11 -10
  51. package/dist/{login-BcuCHhGE.js → login-C55sa9gN.js} +26 -25
  52. package/dist/{lov-view-DDgzqYSW.js → lov-view-DFfaUQ5m.js} +9 -8
  53. package/dist/{menuInfo-B3MOxomU.js → menuInfo-CZdLtLjN.js} +1 -1
  54. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-BXMrNMUs.js → menuInfo.vue_vue_type_style_index_0_lang-DgG0aHRy.js} +16 -15
  55. package/dist/{pda-app-Dy9WMHEG.js → pda-app-fLe8mrx-.js} +213 -196
  56. package/dist/{resource-BoCP7-dM.js → resource-ohWKO6Fh.js} +20 -20
  57. package/dist/{su-welcome-DXpI1MHr.js → su-welcome-_UZTfrXX.js} +84 -84
  58. package/dist/{sys-config-BiUWzxGU.js → sys-config-DVuBsK7p.js} +19 -18
  59. package/dist/udp-core.css +1 -1
  60. package/dist/{utogether-DXDcsKt7.js → utogether-CxobZqGL.js} +1 -1
  61. package/package.json +18 -18
  62. package/src/components/SuScrollTree/ScrollPanel.vue +3 -3
  63. package/src/components/udp/flip-down/FlipCard/flip-card.vue +251 -0
  64. package/src/components/udp/flip-down/FlipCard/interfaces.ts +4 -0
  65. package/src/components/udp/flip-down/FlipClock/flip-clock.vue +113 -0
  66. package/src/components/udp/grid.vue +12 -6
  67. package/src/components/udp/index.ts +2 -2
  68. package/src/components/udp/lov.vue +1 -1
  69. package/src/components/udp/modal-grid.vue +288 -297
  70. package/src/components/udp/utils.ts +4 -11
  71. package/src/layout/components/lay-search/index.vue +25 -25
  72. package/src/main.ts +18 -10
  73. package/src/plugins/i18n/zh.ts +348 -338
  74. package/src/plugins/vxe-table/index.ts +2 -2
  75. package/src/plugins/vxe-table/render.tsx +95 -18
  76. package/src/views/login/login-view.vue +1 -1
  77. package/src/views/system/role/AuthorityInfo.vue +19 -15
  78. package/src/views/system/role/Role.vue +1 -5
  79. package/src/views/system/role/RolePanel.vue +11 -2
  80. package/src/views/system/role/UserInfo.vue +5 -3
  81. package/src/views/system/role-assign/RoleAssign.vue +57 -57
  82. package/src/views/system/role-assign/RolePanel.vue +139 -136
  83. package/src/views/system/sysUser/SysUserPanel.vue +37 -37
  84. package/src/views/uapp/pda/pda-app.vue +41 -10
  85. package/src/views/udev/dict/DictView.vue +6 -1
  86. package/src/views/udev/dict/childView.vue +1 -6
  87. package/src/views/ufile/aggregation/File.vue +5 -5
  88. package/src/views/ufile/file/water-mark.vue +14 -14
  89. package/src/views/uhome/su-welcome.vue +2 -2
  90. package/src/views/ulogin/login.vue +8 -0
  91. package/src/views/urpt/design/DesignPanel.vue +10 -33
  92. package/src/views/urpt/design/ReportDesign.vue +12 -16
  93. package/src/views/urpt/static-resource/resource.vue +3 -3
  94. package/src/views/urpt/template/ReportTemplate.vue +7 -7
  95. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-RUhvzu76.js +0 -101
  96. package/dist/Org-Dg9Xkd34.js +0 -34
  97. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-BwfL_JVZ.js +0 -125
  98. package/dist/index-BDE4-ZvN.js +0 -5091
@@ -1,297 +1,288 @@
1
- <!--
2
- * @Author: wei.li
3
- * @Date: 2021-11-24 17:53:49
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-07-22 11:42:46
6
- * @Description: 共用弹框
7
- -->
8
- <template>
9
- <div>
10
- <vxe-modal
11
- v-model="showModal"
12
- :title="title"
13
- :width="width"
14
- :height="height"
15
- :loading="data.loading"
16
- :show-footer="showFooter"
17
- resize
18
- destroy-on-close
19
- @close="close"
20
- >
21
- <template #default>
22
- <slot />
23
- <vxe-grid
24
- ref="xGrid"
25
- v-bind="data"
26
- resizable
27
- v-on="attrs.events || {}"
28
- @edit-activated="onEditActived"
29
- @toolbarButtonClick="toolbarButtonClick"
30
- @toolbarToolClick="toolbarButtonClick"
31
- @cell-click="cellClick"
32
- />
33
- </template>
34
- <template #footer>
35
- <slot name="bottom" />
36
- <ut-button icon="ri-close-line" status="warning" content="cancel" @tap="close" />
37
- <ut-button icon="ri-save-3-line" content="confirm" @tap="onConfirm" />
38
- </template>
39
- </vxe-modal>
40
- </div>
41
- </template>
42
- <script lang="ts">
43
- export default {
44
- name: 'UtModalGrid'
45
- };
46
- </script>
47
- <script lang="ts" setup>
48
- // @ts-nocheck
49
- import { onBeforeMount, reactive, ref, toRaw, getCurrentInstance, useAttrs } from 'vue';
50
- import { useI18n } from 'vue-i18n';
51
- import { VxeGridProps } from 'vxe-table';
52
- import { formatGridItems, i18nColums, formatRules, successMessage, warnMessage } from '@utogether/utils';
53
- import { clone, isFunction } from 'xe-utils';
54
- import {
55
- queryAll,
56
- query,
57
- del,
58
- save,
59
- footerSumMethod,
60
- getToolBarConfig,
61
- onCheckMethod,
62
- getAttrs
63
- } from './utils';
64
-
65
- // import type { IRecord, IFormItemProps, ITableColProps } from '../../types';
66
-
67
- export interface IProps {
68
- checkMethod?: Function;
69
- columns: Array<ITableColProps>; // 列表行
70
- defaultValue?: IRecord;
71
- defaultParams?: IRecord;
72
- gridOptions?: IRecord;
73
- auth?: IRecord;
74
- url?: string; // 查询服务路径
75
- submitUrl?: string; // 确认
76
- checkRowKeys?: Array<string>; // 默认选中列表
77
- items?: Array<IFormItemProps>; // 查询条件
78
- title?: string; // 标题
79
- width?: number | string;
80
- height?: number;
81
- editable?: boolean; // 可编辑
82
- needExport?: boolean; // 是否需要导出
83
- showFooter?: boolean; // 显示底部按钮
84
- addChild?: boolean; // 可编辑
85
- autoClose?: boolean; // 组件自主关闭
86
- autoLoad?: boolean; // 是否自动加载查询数据
87
- }
88
- const attrs: IRecord = getAttrs(useAttrs());
89
-
90
- const props = withDefaults(defineProps<IProps>(), {
91
- gridOptions: () => {
92
- return {};
93
- },
94
- items: () => [],
95
- columns: () => [],
96
- checkRowKeys: () => [],
97
- addChild: false,
98
- editable: true,
99
- showFooter: false,
100
- autoLoad: true,
101
- needExport: true,
102
- autoClose: true,
103
- width: '520',
104
- height: 420,
105
- title: '数据记录',
106
- url: '',
107
- submitUrl: ''
108
- });
109
-
110
- const showModal = ref(false);
111
-
112
- const xGrid = ref(null);
113
- const instance = getCurrentInstance()!;
114
-
115
- const hasAuthority = instance.appContext.config.globalProperties.$hasAuthority;
116
- const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
117
- const $mode = instance.appContext.config.globalProperties.$mode;
118
-
119
- const { t } = useI18n();
120
-
121
- /**
122
- * @description: colum 统一添加国家化
123
- */
124
- const getColumns = () => {
125
- const col = props.columns.map(m => {
126
- if (!props.editable) {
127
- m.editRender = { enabled: false };
128
- } else if (!m.type && !m.editRender && props.editable && !!m.editable) {
129
- m.editRender = { name: 'VxeInput' };
130
- }
131
- return m;
132
- });
133
- return i18nColums(col);
134
- };
135
-
136
- const getItems = () => {
137
- if (!props.items.length) return props.items;
138
- return formatGridItems(clone(props.items, true));
139
- };
140
-
141
- /**
142
- * @description: 根据items 获取必填选
143
- */
144
- const getRules = () => {
145
- if (!props.columns.length) return {};
146
- return formatRules(props.columns, t);
147
- };
148
-
149
- const data = reactive<VxeGridProps>({
150
- loading: false,
151
- border: true,
152
- pagerConfig: {},
153
- formConfig: {},
154
- toolbarConfig: { enabled: false },
155
- height: 'auto',
156
- editConfig: {},
157
- rowConfig: { keyField: '_X_ROW_KEY' },
158
- editRules: getRules(),
159
- proxyConfig: {
160
- form: true, // 查询是需要启用表单代理
161
- autoLoad: props.autoLoad,
162
- ajax: {
163
- queryAll: ({ form }) => queryAll(props, serviceApi, form),
164
- query: ({ page, form }) => query(props, form, page, serviceApi, $mode),
165
- delete: ({ body: { removeRecords } }) => del(serviceApi, removeRecords, props),
166
- save: ({ body }) => Promise.all(save(serviceApi, body, props))
167
- }
168
- },
169
- checkboxConfig: {
170
- checkMethod: ({ row }) => onCheckMethod(row, props),
171
- checkRowKeys: props.checkRowKeys
172
- },
173
- columns: getColumns(),
174
- ...props.gridOptions
175
- });
176
-
177
- // 确认数据
178
- const onConfirm = async () => {
179
- let records = null;
180
- const type = props.columns[0].type;
181
- if (type === 'checkbox') {
182
- records = xGrid.value.getCheckboxRecords();
183
- } else if (type === 'radio') {
184
- records = xGrid.value.getRadioRecord();
185
- } else {
186
- records = xGrid.value.getTableData().fullData;
187
- }
188
- if (type === 'checkbox' && !records.length && !props.addChild) {
189
- return warnMessage(t('message.selectedRecord'));
190
- } else if (type === 'radio' && !records) {
191
- return warnMessage(t('message.selectedRecord'));
192
- }
193
- if (isFunction(attrs.beforeConfirm) && !attrs.beforeConfirm(records)) return;
194
- const { submitUrl } = props;
195
- // 服务submitUrl
196
- if (submitUrl) {
197
- showLoading();
198
- let res;
199
- try {
200
- records.forEach(record => Object.assign(record, props.defaultParams));
201
- res = await serviceApi.post(submitUrl, records);
202
- } finally {
203
- res && emit('confirm', res);
204
- res && successMessage(t('message.operateSuccess'));
205
- close();
206
- hiddenLoading();
207
- }
208
- } else {
209
- props.autoClose && close();
210
- emit('confirm', records);
211
- }
212
- };
213
- // 请求数据
214
- const refreshData = () => {
215
- xGrid.value.commitProxy('query');
216
- };
217
- const refreshColumn = () => {
218
- data.editRules = getRules();
219
- xGrid.value.refreshColumn();
220
- };
221
- const getInstance = () => {
222
- return toRaw(xGrid.value);
223
- };
224
- const cellClick = ({ row }) => {
225
- const type = props.columns[0].type;
226
- if (type === 'checkbox') {
227
- xGrid.value.setCheckboxRow(row, true);
228
- } else if (type === 'radio') {
229
- xGrid.value.setRadioRow(row);
230
- }
231
- };
232
- // 单元格被激活编辑激活回调
233
- const onEditActived = data => {
234
- emit('actived', data);
235
- };
236
- const toolbarButtonClick = ({ code }) => {
237
- emit('buttonClick', code);
238
- };
239
- const showLoading = () => {
240
- data.loading = true;
241
- };
242
- const hiddenLoading = () => {
243
- data.loading = false;
244
- };
245
- const emit = defineEmits<{
246
- (e: 'close'): void;
247
- (e: 'confirm', record: any): void;
248
- (e: 'actived', record: any): void;
249
- (e: 'buttonClick', code: string): void;
250
- }>();
251
- // 关闭弹框
252
- const close = () => {
253
- if (isFunction(attrs.beforeClose) && !attrs.beforeClose()) return;
254
- showModal.value = false;
255
- emit('close');
256
- };
257
-
258
- /**
259
- * @description: 设置grid参数
260
- */
261
-
262
- const setGridConfig = () => {
263
- // 查询
264
- if (props.items.length) {
265
- data.formConfig = {
266
- titleWidth: 100,
267
- titleAlign: 'right',
268
- items: getItems(),
269
- rules: formatRules(props.items, t),
270
- validConfig: { showMessage: false }
271
- };
272
- }
273
- // tool bar
274
- const obj = getToolBarConfig(data, props, attrs, hasAuthority);
275
- Object.assign(data, obj);
276
-
277
- // 合计方法
278
- if (attrs.mergeFooter) {
279
- data.showFooter = true;
280
- data.footerMethod = ({ columns, data }) => footerSumMethod({ columns, data }, attrs.mergeFooter);
281
- }
282
- };
283
-
284
- // 子组件需对外暴露方法
285
- defineExpose({
286
- refreshData,
287
- refreshColumn,
288
- getInstance,
289
- showLoading,
290
- hiddenLoading,
291
- close
292
- });
293
- onBeforeMount(() => {
294
- showModal.value = true;
295
- setGridConfig();
296
- });
297
- </script>
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2021-11-24 17:53:49
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-07-22 11:42:46
6
+ * @Description: 共用弹框
7
+ -->
8
+ <template>
9
+ <div>
10
+ <vxe-modal
11
+ v-model="showModal"
12
+ :title="title"
13
+ :width="width"
14
+ :height="height"
15
+ :loading="data.loading"
16
+ :show-footer="showFooter"
17
+ resize
18
+ destroy-on-close
19
+ @close="close"
20
+ >
21
+ <template #default>
22
+ <slot />
23
+ <vxe-grid
24
+ ref="xGrid"
25
+ v-bind="data"
26
+ resizable
27
+ v-on="attrs.events || {}"
28
+ @edit-activated="onEditActived"
29
+ @toolbarButtonClick="toolbarButtonClick"
30
+ @toolbarToolClick="toolbarButtonClick"
31
+ @cell-click="cellClick"
32
+ />
33
+ </template>
34
+ <template #footer>
35
+ <slot name="bottom" />
36
+ <ut-button icon="ri-close-line" status="warning" content="cancel" @tap="close" />
37
+ <ut-button icon="ri-save-3-line" content="confirm" @tap="onConfirm" />
38
+ </template>
39
+ </vxe-modal>
40
+ </div>
41
+ </template>
42
+ <script lang="ts">
43
+ export default {
44
+ name: 'UtModalGrid'
45
+ };
46
+ </script>
47
+ <script lang="ts" setup>
48
+ // @ts-nocheck
49
+ import { onBeforeMount, reactive, ref, toRaw, getCurrentInstance, useAttrs } from 'vue';
50
+ import { useI18n } from 'vue-i18n';
51
+ import { VxeGridProps } from 'vxe-table';
52
+ import { formatGridItems, i18nColums, formatRules, successMessage, warnMessage } from '@utogether/utils';
53
+ import { clone, isFunction, merge } from 'xe-utils';
54
+ import { queryAll, query, del, save, footerSumMethod, getToolBarConfig, onCheckMethod, getAttrs } from './utils';
55
+
56
+ // import type { IRecord, IFormItemProps, ITableColProps } from '../../types';
57
+
58
+ export interface IProps {
59
+ checkMethod?: Function;
60
+ columns: Array<ITableColProps>; // 列表行
61
+ defaultValue?: IRecord;
62
+ defaultParams?: IRecord;
63
+ gridOptions?: IRecord;
64
+ auth?: IRecord;
65
+ url?: string; // 查询服务路径
66
+ submitUrl?: string; // 确认
67
+ checkRowKeys?: Array<string>; // 默认选中列表
68
+ items?: Array<IFormItemProps>; // 查询条件
69
+ title?: string; // 标题
70
+ width?: number | string;
71
+ height?: number;
72
+ editable?: boolean; // 可编辑
73
+ needExport?: boolean; // 是否需要导出
74
+ showFooter?: boolean; // 显示底部按钮
75
+ addChild?: boolean; // 可编辑
76
+ autoClose?: boolean; // 组件自主关闭
77
+ autoLoad?: boolean; // 是否自动加载查询数据
78
+ }
79
+ const attrs: IRecord = getAttrs(useAttrs());
80
+
81
+ const props = withDefaults(defineProps<IProps>(), {
82
+ gridOptions: () => {
83
+ return {};
84
+ },
85
+ items: () => [],
86
+ columns: () => [],
87
+ checkRowKeys: () => [],
88
+ addChild: false,
89
+ editable: true,
90
+ showFooter: false,
91
+ autoLoad: true,
92
+ needExport: true,
93
+ autoClose: true,
94
+ width: '520',
95
+ height: 420,
96
+ title: '数据记录',
97
+ url: '',
98
+ submitUrl: ''
99
+ });
100
+
101
+ const showModal = ref(false);
102
+
103
+ const xGrid = ref(null);
104
+ const instance = getCurrentInstance()!;
105
+
106
+ const hasAuthority = instance.appContext.config.globalProperties.$hasAuthority;
107
+ const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
108
+ const $mode = instance.appContext.config.globalProperties.$mode;
109
+
110
+ const { t } = useI18n();
111
+
112
+ /**
113
+ * @description: colum 统一添加国家化
114
+ */
115
+ const getColumns = () => {
116
+ const col = props.columns.map(m => {
117
+ if (!props.editable) {
118
+ m.editRender = { enabled: false };
119
+ } else if (!m.type && !m.editRender && props.editable && !!m.editable) {
120
+ m.editRender = { name: 'VxeInput' };
121
+ }
122
+ return m;
123
+ });
124
+ return i18nColums(col);
125
+ };
126
+
127
+ const getItems = () => {
128
+ if (!props.items.length) return props.items;
129
+ return formatGridItems(clone(props.items, true));
130
+ };
131
+
132
+ /**
133
+ * @description: 根据items 获取必填选
134
+ */
135
+ const getRules = () => {
136
+ if (!props.columns.length) return {};
137
+ return formatRules(props.columns, t);
138
+ };
139
+
140
+ const data = reactive<VxeGridProps>({
141
+ loading: false,
142
+ border: true,
143
+ pagerConfig: {},
144
+ formConfig: {},
145
+ toolbarConfig: { enabled: false },
146
+ height: 'auto',
147
+ editConfig: {},
148
+ rowConfig: { keyField: '_X_ROW_KEY' },
149
+ editRules: getRules(),
150
+ proxyConfig: {
151
+ form: true, // 查询是需要启用表单代理
152
+ autoLoad: props.autoLoad,
153
+ ajax: {
154
+ queryAll: ({ form }) => queryAll(props, serviceApi, form),
155
+ query: ({ page, form }) => query(props, form, page, serviceApi, $mode),
156
+ delete: ({ body: { removeRecords } }) => del(serviceApi, removeRecords, props),
157
+ save: ({ body }) => Promise.all(save(serviceApi, body, props))
158
+ }
159
+ },
160
+ checkboxConfig: {
161
+ checkMethod: ({ row }) => onCheckMethod(row, props),
162
+ checkRowKeys: props.checkRowKeys
163
+ },
164
+ columns: getColumns()
165
+ });
166
+
167
+ // 确认数据
168
+ const onConfirm = async () => {
169
+ let records = null;
170
+ const type = props.columns[0].type;
171
+ if (type === 'checkbox') {
172
+ records = xGrid.value.getCheckboxRecords();
173
+ } else if (type === 'radio') {
174
+ records = xGrid.value.getRadioRecord();
175
+ } else {
176
+ records = xGrid.value.getTableData().fullData;
177
+ }
178
+ if (type === 'checkbox' && !records.length && !props.addChild) {
179
+ return warnMessage(t('message.selectedRecord'));
180
+ } else if (type === 'radio' && !records) {
181
+ return warnMessage(t('message.selectedRecord'));
182
+ }
183
+ if (isFunction(attrs.beforeConfirm) && !attrs.beforeConfirm(records)) return;
184
+ const { submitUrl } = props;
185
+ // 服务submitUrl
186
+ if (submitUrl) {
187
+ showLoading();
188
+ let res;
189
+ try {
190
+ records.forEach(record => Object.assign(record, props.defaultParams));
191
+ res = await serviceApi.post(submitUrl, records);
192
+ } finally {
193
+ res && emit('confirm', res);
194
+ res && successMessage(t('message.operateSuccess'));
195
+ close();
196
+ hiddenLoading();
197
+ }
198
+ } else {
199
+ props.autoClose && close();
200
+ emit('confirm', records);
201
+ }
202
+ };
203
+ // 请求数据
204
+ const refreshData = () => {
205
+ xGrid.value.commitProxy('query');
206
+ };
207
+ const refreshColumn = () => {
208
+ data.editRules = getRules();
209
+ xGrid.value.refreshColumn();
210
+ };
211
+ const getInstance = () => {
212
+ return toRaw(xGrid.value);
213
+ };
214
+ const cellClick = ({ row }) => {
215
+ const type = props.columns[0].type;
216
+ if (type === 'checkbox') {
217
+ xGrid.value.setCheckboxRow(row, true);
218
+ } else if (type === 'radio') {
219
+ xGrid.value.setRadioRow(row);
220
+ }
221
+ };
222
+ // 单元格被激活编辑激活回调
223
+ const onEditActived = data => {
224
+ emit('actived', data);
225
+ };
226
+ const toolbarButtonClick = ({ code }) => {
227
+ emit('buttonClick', code);
228
+ };
229
+ const showLoading = () => {
230
+ data.loading = true;
231
+ };
232
+ const hiddenLoading = () => {
233
+ data.loading = false;
234
+ };
235
+ const emit = defineEmits<{
236
+ (e: 'close'): void;
237
+ (e: 'confirm', record: any): void;
238
+ (e: 'actived', record: any): void;
239
+ (e: 'buttonClick', code: string): void;
240
+ }>();
241
+ // 关闭弹框
242
+ const close = () => {
243
+ if (isFunction(attrs.beforeClose) && !attrs.beforeClose()) return;
244
+ showModal.value = false;
245
+ emit('close');
246
+ };
247
+
248
+ /**
249
+ * @description: 设置grid参数
250
+ */
251
+
252
+ const setGridConfig = () => {
253
+ // 查询
254
+ if (props.items.length) {
255
+ data.formConfig = {
256
+ titleWidth: 100,
257
+ titleAlign: 'right',
258
+ items: getItems(),
259
+ rules: formatRules(props.items, t),
260
+ validConfig: { showMessage: false }
261
+ };
262
+ }
263
+ // tool bar
264
+ const obj = getToolBarConfig(data, props, attrs, hasAuthority);
265
+ Object.assign(data, obj);
266
+
267
+ // 合计方法
268
+ if (attrs.mergeFooter) {
269
+ data.showFooter = true;
270
+ data.footerMethod = ({ columns, data }) => footerSumMethod({ columns, data }, attrs.mergeFooter);
271
+ }
272
+ merge(data, props.gridOptions);
273
+ };
274
+
275
+ // 子组件需对外暴露方法
276
+ defineExpose({
277
+ refreshData,
278
+ refreshColumn,
279
+ getInstance,
280
+ showLoading,
281
+ hiddenLoading,
282
+ close
283
+ });
284
+ onBeforeMount(() => {
285
+ showModal.value = true;
286
+ setGridConfig();
287
+ });
288
+ </script>
@@ -217,8 +217,7 @@ export const getExportConfig = attrs => {
217
217
  types: ['xlsx', 'csv'],
218
218
  modes: ['current', 'selected', 'all'],
219
219
  useStyle: true,
220
- sheetMethod: ({ worksheet }) =>
221
- attrs.onSheetMethod ? attrs.onSheetMethod(worksheet) : onSheetMethod(worksheet),
220
+ sheetMethod: ({ worksheet }) => (attrs.onSheetMethod ? attrs.onSheetMethod(worksheet) : onSheetMethod(worksheet)),
222
221
  columnFilterMethod: ({ column }) =>
223
222
  attrs.columnFilter
224
223
  ? !!attrs.columnFilter(column)
@@ -259,19 +258,14 @@ export const getToolBarConfig = (data, props, attrs, hasAuthority) => {
259
258
  toolButtons.reverse().forEach(btn => {
260
259
  !buttons.some(s => s.code === btn.code) && buttons.unshift(btn);
261
260
  if (attrs.authPrefix && !['print', 'export'].includes(btn.auth)) {
262
- btn.auth =
263
- attrs.authPrefix +
264
- btn.auth.slice(0, 1).toLocaleUpperCase() +
265
- btn.auth.slice(1).toLocaleLowerCase();
261
+ btn.auth = attrs.authPrefix + btn.auth.slice(0, 1).toLocaleUpperCase() + btn.auth.slice(1).toLocaleLowerCase();
266
262
  }
267
263
  });
268
264
 
269
265
  buttons = formatButton(buttons, props.auth).filter(button => {
270
266
  const flag = button.auth ? hasAuthority(button.auth) : true;
271
267
  if (button.dropdowns?.length) {
272
- button.dropdowns = button.dropdowns.filter(
273
- btn => !btn.auth || (btn.auth && hasAuthority(btn.auth))
274
- );
268
+ button.dropdowns = button.dropdowns.filter(btn => !btn.auth || (btn.auth && hasAuthority(btn.auth)));
275
269
  }
276
270
  return flag;
277
271
  });
@@ -400,8 +394,7 @@ export const formatItems = (items, status, span = 24) => {
400
394
  disabled = true;
401
395
  item.placeholder = null;
402
396
  } else {
403
- disabled =
404
- item.disabled === false ? item.disabled : item.disabled || item.itemRender?.props?.disabled;
397
+ disabled = item.disabled === false ? item.disabled : item.disabled || item.itemRender?.props?.disabled;
405
398
  }
406
399
  let itemRender = {
407
400
  name: 'VxeInput',