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

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 (94) hide show
  1. package/build/plugins.ts +39 -37
  2. package/dist/{403-BuP9jvH9.js → 403-CP2RkkAy.js} +10 -10
  3. package/dist/{404-DfQk8kKl.js → 404-DwK-0wNQ.js} +4 -4
  4. package/dist/{500-OgROWdiZ.js → 500-CLbJDqnd.js} +1 -1
  5. package/dist/{AuthorityInfo-q2ksfkWH.js → AuthorityInfo-Bi1_uhMu.js} +1 -1
  6. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-Bwsf6lMH.js → AuthorityInfo.vue_vue_type_style_index_0_lang-RUhvzu76.js} +8 -9
  7. package/dist/{Company-DgqowAxc.js → Company-B--cokc6.js} +3 -3
  8. package/dist/{CompanyPanel-BNb1rUhD.js → CompanyPanel-B_gmcZ9L.js} +6 -6
  9. package/dist/{Department-Cl8CROSU.js → Department-DbKdyNzK.js} +3 -3
  10. package/dist/{DepartmentPanel-D5VkqKeP.js → DepartmentPanel-BmEttboJ.js} +23 -24
  11. package/dist/{DesignPanel-BGvEusHC.js → DesignPanel-LL68_36s.js} +1 -1
  12. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-BQF1uQ7w.js → DesignPanel.vue_vue_type_style_index_0_lang-DWPmFegv.js} +8 -9
  13. package/dist/{DictView-BnxfaOBv.js → DictView-B8j-EWx5.js} +1 -1
  14. package/dist/{InvOrganization-5y79ZLdY.js → InvOrganization-DnGQlESM.js} +7 -8
  15. package/dist/Org-Dg9Xkd34.js +34 -0
  16. package/dist/{Preview-BaGmXH7r.js → Preview-yot4NBW5.js} +1 -1
  17. package/dist/{ReportDefine-DkQdBErt.js → ReportDefine-DHadqNYy.js} +1 -1
  18. package/dist/{ReportDesign-DzB_A_G6.js → ReportDesign-CBihGRth.js} +23 -24
  19. package/dist/{ReportQuery-DRcMb6ya.js → ReportQuery-CwHQ6LUU.js} +1 -1
  20. package/dist/{ReportQueryFrom-CeA9xhR4.js → ReportQueryFrom-ie6lQcGL.js} +1 -1
  21. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-CgGtcs5V.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-B8LJNK0m.js} +1 -1
  22. package/dist/{ReportTemplate-qaiTMQuT.js → ReportTemplate-B2Smwo-z.js} +18 -18
  23. package/dist/{Role-DsFulAjq.js → Role-Cf7DB7uS.js} +3 -3
  24. package/dist/{RoleAssign-DMRdocpa.js → RoleAssign-upUnqs_i.js} +3 -3
  25. package/dist/{RolePanel-wXVysDHM.js → RolePanel-BBGDGK8V.js} +1 -1
  26. package/dist/{RolePanel-B9POS_pg.js → RolePanel-EXL_FLvM.js} +1 -1
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-t6S_0zmJ.js → RolePanel.vue_vue_type_script_setup_true_lang-BwfL_JVZ.js} +8 -9
  28. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-CleVvkcY.js → RolePanel.vue_vue_type_script_setup_true_lang-DF8qJKwW.js} +9 -9
  29. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-DlXUs0j9.js → ScrollPanel.vue_vue_type_style_index_0_lang-DbBGg32H.js} +13 -13
  30. package/dist/{Staff-Cq4V7ruC.js → Staff-DYu5ZEyR.js} +3 -3
  31. package/dist/{StaffInfo-CJDKMbud.js → StaffInfo-CHvNGjtz.js} +1 -1
  32. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-DQ4DL1KY.js → StaffInfo.vue_vue_type_script_setup_true_lang-XRJVEJ-s.js} +14 -14
  33. package/dist/{StaffPanel-CG-uggdr.js → StaffPanel-C-ygEY65.js} +1 -1
  34. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-DAgN7zN2.js → StaffPanel.vue_vue_type_script_setup_true_lang-BvLrF4Yw.js} +6 -6
  35. package/dist/{SysUser-kwnzRNdD.js → SysUser-BHk_szpK.js} +2 -2
  36. package/dist/{SysUserPanel-DTlZf3vk.js → SysUserPanel-DFvzA5d-.js} +1 -1
  37. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-BW6PlGjM.js → SysUserPanel.vue_vue_type_script_setup_true_lang-B9zUXXwa.js} +24 -25
  38. package/dist/{SystemMenu-BVT0n-L2.js → SystemMenu-5TK9ZA11.js} +34 -35
  39. package/dist/{UserInfo-BbTQ9Zat.js → UserInfo-Bx3zQqHa.js} +1 -1
  40. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-D_bpYDmI.js → UserInfo.vue_vue_type_style_index_0_lang-C2sqUQdg.js} +12 -13
  41. package/dist/{childView-BJbIhjmf.js → childView-BSUWnii7.js} +1 -1
  42. package/dist/{childView-DCsGFrG-.js → childView-CFC3gA_U.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-CDtsalCm.js → childView.vue_vue_type_style_index_0_lang-EcT-Dux7.js} +48 -49
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-BCDxpVoD.js → childView.vue_vue_type_style_index_0_lang-WQVLSJR8.js} +9 -10
  45. package/dist/{code-rule-DePU6cdp.js → code-rule-DybjhotB.js} +6 -8
  46. package/dist/core.es.js +14 -11
  47. package/dist/{cron-task-DUM1SIGL.js → cron-task-DGdknqaF.js} +7 -8
  48. package/dist/{frameView-CEUTDtSm.js → frameView-BOOZRv1S.js} +1 -1
  49. package/dist/index-BDE4-ZvN.js +5091 -0
  50. package/dist/{layoutView-PCjwVwkX.js → layoutView-BWeDLY9C.js} +11 -12
  51. package/dist/{login-B1CjWVKu.js → login-BcuCHhGE.js} +21 -21
  52. package/dist/{login-log-CvVnyGi3.js → login-log-kqKzKTto.js} +1 -1
  53. package/dist/{lov-view-D8wwkxFJ.js → lov-view-DDgzqYSW.js} +8 -9
  54. package/dist/{menuInfo-B5JKVwrB.js → menuInfo-B3MOxomU.js} +1 -1
  55. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-CcM9WX4n.js → menuInfo.vue_vue_type_style_index_0_lang-BXMrNMUs.js} +19 -18
  56. package/dist/{pda-app-DIa1p1Ww.js → pda-app-Dy9WMHEG.js} +19 -20
  57. package/dist/{resource-CCQ7Dd-5.js → resource-BoCP7-dM.js} +8 -8
  58. package/dist/{su-welcome-CLp9YaJa.js → su-welcome-DXpI1MHr.js} +97 -98
  59. package/dist/{sys-config-BBmf_SqF.js → sys-config-BiUWzxGU.js} +19 -20
  60. package/dist/udp-core.css +2 -2
  61. package/dist/{utogether-Bkptx2lB.js → utogether-DXDcsKt7.js} +1 -1
  62. package/index.ts +40 -36
  63. package/package.json +1 -1
  64. package/src/App.vue +1 -1
  65. package/src/api/index.ts +1 -1
  66. package/src/components/udp/count-down.vue +536 -0
  67. package/src/components/udp/form.vue +107 -0
  68. package/src/components/udp/grid.vue +6 -1
  69. package/src/components/udp/index.ts +4 -1
  70. package/src/components/udp/modal-form.vue +9 -0
  71. package/src/components/udp/upload.vue +425 -0
  72. package/src/components/udp/utils.ts +72 -3
  73. package/src/directives/permission/index.ts +1 -1
  74. package/src/layout/components/lay-panel/index.vue +3 -3
  75. package/src/main.ts +111 -110
  76. package/src/plugins/vxe-table/index.ts +3 -3
  77. package/src/router/index.ts +187 -183
  78. package/src/router/modules/remaining.ts +58 -83
  79. package/src/style/vxetable.scss +30 -1
  80. package/src/utils/authority/index.ts +1 -1
  81. package/src/utils/{http → udp/http}/index.ts +8 -24
  82. package/src/utils/{http → udp/http}/types.d.ts +8 -5
  83. package/src/views/login/login-view.vue +1 -1
  84. package/src/views/system/menu/menuInfo.vue +7 -3
  85. package/src/views/system/sys/sys-config.vue +1 -1
  86. package/src/views/udev/dict/childView.vue +6 -1
  87. package/src/views/uhome/su-welcome.vue +1 -1
  88. package/src/views/ulogin/login.vue +3 -2
  89. package/src/views/upms/user/login-log.vue +1 -1
  90. package/src/views/urpt/design/ReportDesign.vue +3 -3
  91. package/types/global.d.ts +2 -1
  92. package/dist/Org-2oBAXN2r.js +0 -35
  93. package/dist/await-to-js.es5-BtRbN2QH.js +0 -10
  94. package/dist/index-ZdgOD7cF.js +0 -3399
@@ -0,0 +1,107 @@
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2022-03-02 17:07:59
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-07-30 18:57:09
6
+ * @Description: SuForm
7
+ -->
8
+
9
+ <template>
10
+ <div class="width: 100%">
11
+ <vxe-form
12
+ ref="xForm"
13
+ v-model:collapse-status="collapseStatus"
14
+ :data="record"
15
+ :items="formItems"
16
+ :rules="rules"
17
+ :loading="loading"
18
+ :vertical="vertical"
19
+ title-align="right"
20
+ :title-width="titleWidth"
21
+ >
22
+ <template #dividerPrefix>
23
+ <div class="w-2 h-4 bg-amber-600">5555</div>
24
+ </template>
25
+ <template #collapseNode>
26
+ <div class="flex justify-start">
27
+ <vxe-checkbox
28
+ v-model="collapseStatus"
29
+ content="查看更多"
30
+ :checked-value="false"
31
+ :unchecked-value="true"
32
+ class="pl-10"
33
+ />
34
+ </div>
35
+ </template>
36
+ </vxe-form>
37
+ </div>
38
+ </template>
39
+
40
+ <script lang="ts">
41
+ export default {
42
+ name: 'UtForm'
43
+ };
44
+ </script>
45
+ <script setup lang="ts">
46
+ import { useI18n } from 'vue-i18n';
47
+ import { ref, computed } from 'vue';
48
+ // import { formatRules } from '@utogether/utils';
49
+ import { formatItems, formatRules } from './utils';
50
+ // import type { IRecord, IFormItemProps } from '../../types';
51
+
52
+ export interface IProps {
53
+ record: IRecord; // 数据对象
54
+ items: Array<IFormItemProps>; // form item
55
+ loading?: boolean;
56
+ vertical?: boolean;
57
+ titleWidth?: number;
58
+ span?: number;
59
+ dataStatus?: string;
60
+ }
61
+
62
+ const props = withDefaults(defineProps<IProps>(), {
63
+ record: (): IRecord => {
64
+ return {};
65
+ },
66
+ items: () => [],
67
+ loading: false,
68
+ vertical: false,
69
+ titleWidth: 100,
70
+ span: 6,
71
+ dataStatus: 'detail'
72
+ });
73
+ const xForm = ref(undefined);
74
+ const { t } = useI18n();
75
+ const collapseStatus = ref(true);
76
+ /**
77
+ * @description: 根据items 获取必填选
78
+ */
79
+ const rules = computed(() => {
80
+ if (!props.items.length) return {};
81
+ return formatRules(props.items, t);
82
+ });
83
+
84
+ const formItems = computed(() => {
85
+ if (!props.items.length) return props.items;
86
+ return formatItems(props.items, props.dataStatus, 6);
87
+ });
88
+
89
+ /**
90
+ * @deprecated
91
+ * @description 使用validate替换
92
+ * @param cb
93
+ */
94
+ const validateForm = (cb: Function) => {
95
+ (xForm as any).value.validate(cb);
96
+ };
97
+ const validate = (cb: Function) => {
98
+ (xForm as any).value.validate(cb);
99
+ setTimeout(() => {
100
+ xForm.value.clearValidate();
101
+ }, 1600);
102
+ };
103
+ defineExpose({
104
+ validateForm,
105
+ validate
106
+ });
107
+ </script>
@@ -191,7 +191,8 @@ const data = reactive<VxeGridProps>({
191
191
  queryAll: ({ form }) => queryAll(props, serviceApi, form),
192
192
  query: ({ page, form }) => query(props, form, page, serviceApi, $mode),
193
193
  delete: ({ body: { removeRecords } }) => del(serviceApi, removeRecords, props),
194
- save: ({ body }) => Promise.all(save(serviceApi, body, props))
194
+ save: ({ body }) => Promise.all(save(serviceApi, body, props)),
195
+ querySuccess: e => querySuccess(e)
195
196
  }
196
197
  },
197
198
  columns: !attrs.gridId ? getColumns() : [],
@@ -401,6 +402,10 @@ const onSearch = data => {
401
402
  refreshData();
402
403
  };
403
404
 
405
+ const querySuccess = e => {
406
+ console.log(e);
407
+ };
408
+
404
409
  /**
405
410
  * @description Vue实例对外暴露的相关方法或属性
406
411
  */
@@ -3,5 +3,8 @@ import FormUpload2 from './form-upload.vue';
3
3
  import utLov2 from './lov.vue';
4
4
  import UtModalGrid2 from './modal-grid.vue';
5
5
  import UtGrid2 from './grid.vue';
6
+ import UtForm2 from './form.vue';
7
+ import UtUpload2 from './upload.vue';
8
+ import UtCountdown2 from './count-down.vue';
6
9
 
7
- export { UtGrid2, UtModalForm2, FormUpload2, utLov2, UtModalGrid2 };
10
+ export { UtGrid2, UtModalForm2, FormUpload2, utLov2, UtModalGrid2, UtForm2, UtCountdown2, UtUpload2 };
@@ -34,6 +34,14 @@
34
34
  />
35
35
  </template>
36
36
  <template #footer>
37
+ <vxe-checkbox
38
+ v-if="!url && dataStatus === 'add'"
39
+ v-model="continuous"
40
+ content="连续添加"
41
+ unchecked-value="0"
42
+ checked-value="1"
43
+ style="margin-right: 12px"
44
+ />
37
45
  <ut-button status="warning" content="cancel" icon="ri-close-line" @tap="onClose" />
38
46
  <ut-button status="u-cyan" content="confirm" icon="ri-save-3-line" @tap="onConfirm" />
39
47
  </template>
@@ -86,6 +94,7 @@ const props = withDefaults(defineProps<IProps>(), {
86
94
 
87
95
  const attrs: IRecord = getAttrs(useAttrs());
88
96
 
97
+ const continuous = ref('0');
89
98
  const loading = ref(false);
90
99
  const instance = getCurrentInstance()!;
91
100
 
@@ -0,0 +1,425 @@
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2022-06-21 14:50:52
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-08-03 16:01:16
6
+ * @Description: excel数据导入
7
+ -->
8
+ <template>
9
+ <vxe-modal v-model="visible" :show-header="false" fullscreen remember @close="onClose">
10
+ <template #default>
11
+ <vxe-grid ref="xgrid" v-bind="gridOptions" v-on="gridEvents">
12
+ <template v-for="col in columns" :key="col.field" #[col.field!]="{ row }">
13
+ <el-select v-if="col.dictCode && !col.disabled" v-model.trim="row[col.field!]" clearable>
14
+ <el-option
15
+ v-for="child in dict[col.dictCode]?.children"
16
+ :key="child.dictCode"
17
+ :value="child.dictCode"
18
+ :label="child.dictName"
19
+ />
20
+ </el-select>
21
+ <el-date-picker
22
+ v-else-if="['date', 'month', 'datetime'].includes(col.dataType) && !col.disabled"
23
+ v-model.trim="row[col.field!]"
24
+ :type="col.dataType"
25
+ value-format="YYYY-MM-DD hh:mm:ss"
26
+ />
27
+ <input v-else-if="!col.da && !col.disabled" v-model.trim="row[col.field!]" class="ut-input" />
28
+ <span v-else-if="!showErrorMsg">{{ row[col.field!] }}</span>
29
+ <span v-else>{{ row[col.field!] }}</span>
30
+ </template>
31
+ <template #pager>
32
+ <vxe-pager
33
+ v-model:current-page="listQuery.currentPage"
34
+ v-model:page-size="listQuery.pageSize"
35
+ :layouts="layouts"
36
+ :page-sizes="[200, 500, 1000, 2000, 5000, 10000]"
37
+ :total="listQuery.total"
38
+ @page-change="handlePageChange"
39
+ /></template>
40
+ </vxe-grid>
41
+ </template>
42
+ </vxe-modal>
43
+ </template>
44
+
45
+ <script lang="ts">
46
+ export default {
47
+ name: 'UtUpload'
48
+ };
49
+ </script>
50
+ <script setup lang="ts">
51
+ import { reactive, ref, watch, getCurrentInstance } from 'vue';
52
+ import { toDateString } from 'xe-utils';
53
+ import { storageLocal, cookies, warnMessage } from '@utogether/utils';
54
+ import Big from 'big.js';
55
+ import { useI18n } from 'vue-i18n';
56
+ // import type { IRecord, ITableColProps } from '../../types';
57
+ import { VxeTableInstance, VxeGridProps, VxeGridListeners } from 'vxe-table';
58
+ import { VxeUI } from 'vxe-pc-ui';
59
+ import type { VxePagerPropTypes, VxePagerEvents } from 'vxe-pc-ui';
60
+
61
+ export interface IProps {
62
+ defaultParams?: IRecord;
63
+ options?: IRecord;
64
+ columns: Array<ITableColProps>;
65
+ templateData?: Array<ITableColProps>;
66
+ serviceCode?: string;
67
+ url?: string;
68
+ sourceList?: string;
69
+ }
70
+
71
+ const props = withDefaults(defineProps<IProps>(), {
72
+ defaultParams: (): IRecord => {
73
+ return {};
74
+ },
75
+ options: (): IRecord => {
76
+ return {
77
+ filename: '数据模板',
78
+ errorField: 'errorMsg',
79
+ errListField: 'list'
80
+ };
81
+ },
82
+ columns: () => [],
83
+ templateData: () => [],
84
+ sourceList: 'list'
85
+ });
86
+
87
+ const instance = getCurrentInstance()!;
88
+ const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
89
+ const visible = defineModel<boolean>('visible');
90
+
91
+ const { t } = useI18n();
92
+
93
+ const showErrorMsg = ref(false);
94
+
95
+ const dict = storageLocal.getItem('kLov');
96
+
97
+ watch(
98
+ () => visible.value,
99
+ nv => {
100
+ if (nv) {
101
+ gridOptions.data = [];
102
+ }
103
+ }
104
+ );
105
+
106
+ const getColumns = () => {
107
+ const columns = props.columns.map(col => {
108
+ col.slots = { default: col.field };
109
+ col.title = col.field;
110
+ return col;
111
+ });
112
+ const col: ITableColProps = {
113
+ type: 'checkbox',
114
+ width: 40,
115
+ align: 'center',
116
+ fixed: 'left'
117
+ };
118
+ columns.unshift(col);
119
+ return columns;
120
+ };
121
+
122
+ const listQuery = ref({ pageSize: 200, currentPage: 1, total: 0 });
123
+
124
+ const layouts: VxePagerPropTypes.Layouts = [
125
+ 'Sizes',
126
+ 'PrevJump',
127
+ 'PrevPage',
128
+ 'Number',
129
+ 'NextPage',
130
+ 'NextJump',
131
+ 'FullJump',
132
+ 'Total'
133
+ ];
134
+
135
+ const height = window.innerHeight - 25;
136
+
137
+ const xgrid = ref<VxeTableInstance>();
138
+ // 导入的所有数据
139
+ let dataList: ITableColProps[] = [];
140
+
141
+ const importConfig = {
142
+ mode: 'covering',
143
+ types: ['csv', 'xlsx'],
144
+ afterImportMethod: onImportMethod
145
+ };
146
+
147
+ const gridOptions = reactive<VxeGridProps>({
148
+ border: true,
149
+ height,
150
+ data: [],
151
+ importConfig,
152
+ showOverflow: true,
153
+ loading: false,
154
+ toolbarConfig: {
155
+ buttons: [
156
+ {
157
+ code: 'import_plus',
158
+ name: t('message.btn.upload'),
159
+ icon: 'ri-upload-2-line',
160
+ status: 'primary'
161
+ },
162
+ {
163
+ code: 'save_plus',
164
+ name: t('message.btn.save'),
165
+ icon: 'ri-save-3-line',
166
+ status: 'success'
167
+ },
168
+ {
169
+ code: 'del_plus',
170
+ name: t('message.btn.delete'),
171
+ icon: 'ri-delete-bin-line',
172
+ status: 'danger'
173
+ },
174
+ {
175
+ code: 'export_plus',
176
+ name: t('message.btn.downloadTemp'),
177
+ icon: 'ri-download-2-line',
178
+ status: 'warning'
179
+ }
180
+ ],
181
+ tools: [
182
+ {
183
+ code: 'question',
184
+ name: t('message.btn.FAQ'),
185
+ status: 'primary',
186
+ icon: 'vxe-icon-info-circle-fill'
187
+ },
188
+ {
189
+ code: 'replay',
190
+ name: t('message.btn.back'),
191
+ status: 'info',
192
+ icon: 'vxe-icon-undo'
193
+ }
194
+ ]
195
+ },
196
+ columns: getColumns()
197
+ });
198
+
199
+ const gridEvents: VxeGridListeners = {
200
+ toolbarButtonClick({ code }) {
201
+ // const $grid = xgrid.value;
202
+ switch (code) {
203
+ case 'import_plus': {
204
+ handleImport();
205
+ break;
206
+ }
207
+ case 'save_plus': {
208
+ handleSave();
209
+ break;
210
+ }
211
+ case 'del_plus': {
212
+ handleDelete();
213
+ break;
214
+ }
215
+ case 'export_plus': {
216
+ handleDownLoadFile();
217
+ break;
218
+ }
219
+ }
220
+ },
221
+ toolbarToolClick({ code }) {
222
+ // const $grid = xgrid.value;
223
+ switch (code) {
224
+ case 'replay': {
225
+ onClose();
226
+ break;
227
+ }
228
+ case 'question': {
229
+ showImportQuestion();
230
+ break;
231
+ }
232
+ }
233
+ }
234
+ };
235
+
236
+ const handleImport = () => {
237
+ dataList = [];
238
+ xgrid.value?.openImport();
239
+ };
240
+ // 导入后获取数据
241
+ function onImportMethod(options: any) {
242
+ dataList = options.$table.getTableData().fullData;
243
+ // 标题会默认导入,删除第一行
244
+ // dataList.splice(0, 1);
245
+ const columns = getColumns().filter(f => !f.type && f.mapField !== props.options.errorField);
246
+ columns.forEach(col => {
247
+ const idx = dataList.findIndex(data => data[col.field!] === col.field);
248
+ idx !== -1 && dataList.splice(idx, 1);
249
+ });
250
+ props.columns.forEach(col => {
251
+ if (col.dateFormatter || col.valueType === 'number') {
252
+ dataList.forEach(data => {
253
+ if (col.dateFormatter) {
254
+ data[col.field!] = toDateString(data[col.field!], col.dateFormatter || 'yyyy-MM-dd HH:mm:ss');
255
+ } else {
256
+ data[col.field!] = Big(data[col.field!]).toFixed(col.decimal || 6);
257
+ }
258
+ });
259
+ }
260
+ });
261
+ listQuery.value.total = dataList.length;
262
+ getDataList();
263
+ }
264
+
265
+ const getDataList = () => {
266
+ const { currentPage, pageSize } = listQuery.value;
267
+ gridOptions.data = dataList.filter(
268
+ (data, idx) => idx < pageSize * currentPage && idx >= pageSize * (currentPage - 1)
269
+ );
270
+ };
271
+ // 切换页数
272
+ const handlePageChange: VxePagerEvents.PageChange = ({ currentPage, pageSize }) => {
273
+ listQuery.value.currentPage = currentPage;
274
+ listQuery.value.pageSize = pageSize;
275
+ getDataList();
276
+ };
277
+ // 模板下载
278
+ const handleDownLoadFile = () => {
279
+ const data: ITableColProps[] = [];
280
+ if (props.templateData.length) {
281
+ data.push(...props.templateData);
282
+ } else {
283
+ const obj: ITableColProps = {};
284
+ getColumns()
285
+ .filter(f => f.type !== 'checkbox')
286
+ .forEach(col => {
287
+ obj[col.field!] = '案例';
288
+ });
289
+ data.push(obj);
290
+ }
291
+ const opt: IRecord = {
292
+ filename: props.options.filename,
293
+ type: 'xlsx',
294
+ columns: getColumns().filter(f => f.mapField !== props.options.errorField && f.type !== 'checkbox'),
295
+ data
296
+ };
297
+ xgrid.value?.exportData(opt);
298
+ };
299
+
300
+ const handleSave = async () => {
301
+ if (!dataList.length) {
302
+ return warnMessage(t('message.importEmpty'));
303
+ }
304
+ const type = await VxeUI.modal.confirm(t('message.importRecord'));
305
+ if (type === 'confirm') {
306
+ gridOptions.loading = true;
307
+ const { url } = props;
308
+ formatterData('toSave');
309
+ serviceApi
310
+ .post(url, dataList)
311
+ .then((res: any) => {
312
+ if (res?.status === 'error' || res?.length) {
313
+ showErrorMsg.value = true;
314
+ setErrorMessage(res?.length ? res : res[props.options.errListField || props.sourceList]);
315
+ VxeUI.modal.message({
316
+ content: t('message.importFailed'),
317
+ status: 'error'
318
+ });
319
+ } else {
320
+ VxeUI.modal.message({
321
+ content: t('message.importSuccess'),
322
+ status: 'success'
323
+ });
324
+ onClose();
325
+ }
326
+ })
327
+ .finally(() => {
328
+ showErrorMsg.value = false;
329
+ gridOptions.loading = false;
330
+ });
331
+ }
332
+ };
333
+
334
+ /**
335
+ * @description:删除行
336
+ */
337
+ const handleDelete = () => {
338
+ const checkboxRecords = xgrid.value?.getCheckboxRecords();
339
+ if (!checkboxRecords?.length) {
340
+ return VxeUI.modal.message({
341
+ content: t('message.selectedRecord'),
342
+ status: 'warning'
343
+ });
344
+ }
345
+ checkboxRecords.forEach(record => {
346
+ const idx = dataList.findIndex(data => data._X_ROW_KEY === record._X_ROW_KEY)!;
347
+ idx !== -1 && dataList.splice(idx, 1);
348
+ });
349
+ gridOptions.data = dataList;
350
+ };
351
+
352
+ const setErrorMessage = (array: ITableColProps[]) => {
353
+ listQuery.value.total = array.length;
354
+ dataList = array.map((item, idx) => {
355
+ item._X_ROW_KEY = idx;
356
+ return item;
357
+ });
358
+ formatterData('toShow');
359
+ getDataList();
360
+ };
361
+ const formatterData = (formatterType: string) => {
362
+ gridOptions.columns!.forEach((col: any) => {
363
+ if (formatterType === 'toSave') {
364
+ const commonParam = cookies.get('kCookies_param')
365
+ ? JSON.parse(cookies.get('kCookies_param')!)
366
+ : {};
367
+ dataList.forEach(data => {
368
+ data[col.mapField] = data[col.field];
369
+ Object.assign(data, commonParam, props.defaultParams);
370
+ });
371
+ } else {
372
+ dataList.forEach(data => {
373
+ data[col.field] = data[col.mapField];
374
+ });
375
+ }
376
+ });
377
+ };
378
+
379
+ const showImportQuestion = () => {
380
+ VxeUI.modal.alert(t('message.importTip'), t('message.udp.tip'));
381
+ };
382
+
383
+ const emit = defineEmits<{ (e: 'close'): void }>();
384
+
385
+ const onClose = () => {
386
+ visible.value = false;
387
+ emit('close');
388
+ };
389
+ </script>
390
+
391
+ <style lang="scss" scoped>
392
+ .ut-input {
393
+ box-sizing: border-box;
394
+ box-sizing: border-box;
395
+ display: inline-block;
396
+ width: 100%;
397
+ height: 28px;
398
+ padding: 0 15px;
399
+ font-size: 13px;
400
+ line-height: 28px;
401
+ color: #606266;
402
+ background-color: #fff;
403
+ background-image: none;
404
+ border: 1px solid #dcdfe6;
405
+ border-radius: 4px;
406
+ outline: 0;
407
+ transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
408
+ transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
409
+ appearance: none;
410
+
411
+ &:hover {
412
+ border-color: #c0c4cc;
413
+ }
414
+
415
+ &:focus {
416
+ border-color: #409eff;
417
+ outline: 0;
418
+ }
419
+
420
+ &:disabled {
421
+ background-color: #f5f7fa;
422
+ outline: none;
423
+ }
424
+ }
425
+ </style>
@@ -2,22 +2,25 @@
2
2
  * @Author: levi7754 levi7754@163.com
3
3
  * @Date: 2025-07-14 17:38:38
4
4
  * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-07-23 10:31:52
5
+ * @LastEditTime: 2025-07-30 15:00:49
6
6
  * @FilePath: \udp-front\packages\udp-core\src\components\udp\utils.ts
7
7
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
8
  */
9
- import { clone, isString, isEmpty, toDateString, isObject, isFunction } from 'xe-utils';
10
- import { cookies, storageLocal } from '@utogether/utils';
9
+ import { clone, isString, isEmpty, toDateString, isObject, isFunction, merge } from 'xe-utils';
10
+ import { cookies, storageLocal, useRender } from '@utogether/utils';
11
11
  /** 系统配置的key */
12
12
  const kSYSCONFIG = 'kSysConfig';
13
13
  const kCOOKIES = 'kCookies_param';
14
14
 
15
15
  const sysConfig = storageLocal.getItem(kSYSCONFIG);
16
16
 
17
+ const renderHook = useRender();
18
+
17
19
  /** 工具栏按钮标准化 */
18
20
  export const formatButton = (buttons, auth?) => {
19
21
  buttons.forEach(btn => {
20
22
  btn.auth = auth ? auth[btn.code] || btn.auth : btn.auth;
23
+ debugger;
21
24
  if (!btn.name) {
22
25
  btn.name = `message.btn.${btn.code}`;
23
26
  } else if (sysConfig?.i18nEnabled === 'Y' && !btn.name.startsWith('message.')) {
@@ -377,3 +380,69 @@ export const getAttrs = attrs => {
377
380
  });
378
381
  return data;
379
382
  };
383
+
384
+ export const formatItems = (items, status, span = 24) => {
385
+ if (!items.length) return items;
386
+ return items.map(item => {
387
+ if (item.children?.length) {
388
+ item.children = formatItems(item.children, status, span);
389
+ return item;
390
+ } else {
391
+ item.title = item.title || `message.${item.field}`;
392
+ item.span = item.span || span;
393
+ if (item.type === 'collapseNode') {
394
+ // 折叠项目,title和宽度不需要
395
+ item.title = '';
396
+ item.titleWidth = 0;
397
+ }
398
+ let disabled = false;
399
+ if (status === 'detail') {
400
+ disabled = true;
401
+ item.placeholder = null;
402
+ } else {
403
+ disabled =
404
+ item.disabled === false ? item.disabled : item.disabled || item.itemRender?.props?.disabled;
405
+ }
406
+ let itemRender = {
407
+ name: 'VxeInput',
408
+ props: { disabled, placeholder: disabled ? '' : item.placeholder }
409
+ };
410
+ if (item.code && !item.itemRender) {
411
+ itemRender = renderHook.renderDict(item.code);
412
+ }
413
+ item.itemRender = item.itemRender || itemRender;
414
+ item.itemRender['props'] = Object.assign(item.itemRender.props || {}, {
415
+ disabled
416
+ });
417
+ return item;
418
+ }
419
+ });
420
+ };
421
+
422
+ /**
423
+ * @description: 标准化必填数据
424
+ * @param {*} records 数据列表
425
+ * @param {*} t i18n对象
426
+ * @return {*} rule数据
427
+ */
428
+ export const formatRules = (records, t) => {
429
+ const rule = {};
430
+ records.forEach(item => {
431
+ if (item.children?.length) {
432
+ const subRuls = formatRules(item.children, t);
433
+ merge(rule, subRuls);
434
+ } else {
435
+ if (item.required) {
436
+ const { field, title } = item;
437
+ const i18n = title?.startsWith('message.');
438
+ rule[field] = [
439
+ {
440
+ required: true,
441
+ message: `${t('message.required')}${title && i18n ? t(title) : title || t(`message.${field}`)}`
442
+ }
443
+ ];
444
+ }
445
+ }
446
+ });
447
+ return rule;
448
+ };
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { usePermissionStoreHook } from '../../store/modules/permission';
10
10
  import type { Directive } from 'vue';
11
- import router from '../../router';
11
+ import { router } from '../../router';
12
12
  import type { DirectiveBinding } from 'vue';
13
13
 
14
14
  export const auth: Directive = {