@utogether/udp-core 2.0.0-beta.21 → 2.0.0-beta.22
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.
- package/dist/{403-DICzHwBh.js → 403-CAQ-gKzB.js} +1 -1
- package/dist/{404-CE2ilza7.js → 404-Bt741znF.js} +3 -3
- package/dist/{500-DqbOUpFQ.js → 500-D2jT-L5U.js} +1 -1
- package/dist/{AuthorityInfo-DD9xMuFM.js → AuthorityInfo-rrhMImq9.js} +1 -1
- package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-aH0WIYDG.js → AuthorityInfo.vue_vue_type_style_index_0_lang-t3TtTkNB.js} +1 -1
- package/dist/{Company-CZSbX6Cr.js → Company-OyHHgUiy.js} +3 -3
- package/dist/{CompanyPanel-DRz2RdEP.js → CompanyPanel-D-V5PE9g.js} +1 -1
- package/dist/{Department-B8HWfFX7.js → Department-Do3AcdWQ.js} +3 -3
- package/dist/{DepartmentPanel-DXfqf0O-.js → DepartmentPanel-DIchoE6d.js} +1 -1
- package/dist/{DesignPanel-DCemiRmN.js → DesignPanel-BsiGLb2w.js} +1 -1
- package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-BpI6lZ8h.js → DesignPanel.vue_vue_type_style_index_0_lang-BsVJx8eH.js} +2 -2
- package/dist/{DictView-CQZ_Z-_n.js → DictView-BKnZ5JxT.js} +1 -1
- package/dist/{InvOrganization-Nq87pxzj.js → InvOrganization-VDNOjLdb.js} +1 -1
- package/dist/{Org-DuqSCs0N.js → Org-C952e0fi.js} +1 -1
- package/dist/{Preview-Du_1OWoT.js → Preview-dC0AaoU7.js} +1 -1
- package/dist/{ReportDefine-QSidK9OU.js → ReportDefine-B0ZonkeO.js} +1 -1
- package/dist/{ReportDesign-BH7WbI4K.js → ReportDesign-DR5HJeO5.js} +2 -2
- package/dist/{ReportQuery-Br5UKVjQ.js → ReportQuery-BPFvznsJ.js} +1 -1
- package/dist/{ReportQueryFrom-Dg-DjcMi.js → ReportQueryFrom-CFlIzHWH.js} +1 -1
- package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-D3RWJEGQ.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-C3x30JMB.js} +1 -1
- package/dist/{ReportTemplate-BU3VS8FO.js → ReportTemplate-BRmUyR0F.js} +1 -1
- package/dist/{Role-CN18RZjI.js → Role-CSIjXuu-.js} +3 -3
- package/dist/{RoleAssign-DXloJByw.js → RoleAssign-C65mKTY3.js} +3 -3
- package/dist/{RolePanel-DGW5mWjQ.js → RolePanel-T2688066.js} +1 -1
- package/dist/{RolePanel-CZmXekBA.js → RolePanel-fXVapub8.js} +1 -1
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DdvxxsMl.js → RolePanel.vue_vue_type_script_setup_true_lang-UcdeYYCU.js} +3 -3
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DAtJnQI4.js → RolePanel.vue_vue_type_script_setup_true_lang-vCQj6JUM.js} +1 -1
- package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-DzZ9CZig.js → ScrollPanel.vue_vue_type_style_index_0_lang-BMX37C_H.js} +1 -1
- package/dist/{Staff-qG73AUgD.js → Staff-BTVwMPI4.js} +3 -3
- package/dist/{StaffInfo-COP7bCup.js → StaffInfo-DMTV0fkA.js} +1 -1
- package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-BityQi7n.js → StaffInfo.vue_vue_type_script_setup_true_lang-Di6Tay8o.js} +1 -1
- package/dist/{StaffPanel-CB7cBhYD.js → StaffPanel-2NlyN2og.js} +1 -1
- package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-DcPck6b8.js → StaffPanel.vue_vue_type_script_setup_true_lang-Dcsi9178.js} +2 -2
- package/dist/{SysUser-Dmfu9N7S.js → SysUser-BPn3kj57.js} +2 -2
- package/dist/{SysUserPanel-C2O-P9nB.js → SysUserPanel-DnQdgH26.js} +1 -1
- package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-DyF3Tmps.js → SysUserPanel.vue_vue_type_script_setup_true_lang-BWhieaeS.js} +1 -1
- package/dist/{SystemMenu-QZaHtPet.js → SystemMenu-BEH6JSE4.js} +2 -2
- package/dist/{UserInfo-CxP5kr_T.js → UserInfo-BbdolDWz.js} +1 -1
- package/dist/{UserInfo.vue_vue_type_style_index_0_lang-pe7FALf9.js → UserInfo.vue_vue_type_style_index_0_lang-BWb0ey1b.js} +1 -1
- package/dist/{childView-LCu_Df1q.js → childView-D8IQ-Eik.js} +1 -1
- package/dist/{childView-ohYBzZ0o.js → childView-DWjpPkND.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-jbOoVsYJ.js → childView.vue_vue_type_style_index_0_lang-C5JuSstn.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-DJletJUx.js → childView.vue_vue_type_style_index_0_lang-DBXMbacv.js} +1 -1
- package/dist/{code-rule-B9eZeeo8.js → code-rule-Ch6YNyCA.js} +1 -1
- package/dist/core.es.js +6 -6
- package/dist/{cron-task-Dp71tYa4.js → cron-task--_VgTkCZ.js} +1 -1
- package/dist/{frameView-02snW4T6.js → frameView-BIFR0oH0.js} +1 -1
- package/dist/{index-gL1hMTqJ.js → index-DPTWuyo7.js} +2670 -2071
- package/dist/{layout-home-DCrNKejz.js → layout-home-adtU8Yoh.js} +1 -1
- package/dist/{layoutView-Cu3YZ1zM.js → layoutView-qTmcDeoI.js} +554 -558
- package/dist/{log-in-C0oqCCsq.js → log-in-iYiw0kPB.js} +1 -1
- package/dist/{log-out-DsTsQcQT.js → log-out-H2Kni3Qk.js} +1 -1
- package/dist/{login-_IgWG4L5.js → login-C7Z-Xg5H.js} +14 -14
- package/dist/{lov-view-B4HvQI1i.js → lov-view-CyYhwwrT.js} +2 -2
- package/dist/{menuInfo-y_CFBZLU.js → menuInfo-BBUlFO0X.js} +1 -1
- package/dist/{menuInfo.vue_vue_type_style_index_0_lang-BNgwCBo4.js → menuInfo.vue_vue_type_style_index_0_lang-fUKEpjAA.js} +1 -1
- package/dist/{pda-app-DplNCuYS.js → pda-app-DU146LR1.js} +18 -18
- package/dist/{resource-C2fCs2gF.js → resource-fTfF9epk.js} +5 -5
- package/dist/{su-welcome-Q0C5LnI_.js → su-welcome-BRFxhduP.js} +3 -3
- package/dist/{sys-config-Bsb7aFcn.js → sys-config-Do7SIoN-.js} +13 -13
- package/dist/udp-core.css +1 -1
- package/dist/{useNav-D5jP-2AH.js → useNav-BRX5xftp.js} +20 -20
- package/package.json +1 -1
- package/src/api/index.ts +47 -33
- package/src/components/udp/content/index.vue +93 -88
- package/src/components/udp/grid/index.vue +546 -524
- package/src/components/udp/index.ts +8 -6
- package/src/components/udp/upload/index.vue +444 -0
- package/src/main.ts +111 -111
- package/types/global.d.ts +234 -232
- package/src/components/SuTable/SuTable.vue +0 -334
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import UtGrid2 from './grid/index.vue';
|
|
2
|
-
import UtForm2 from './form/form.vue';
|
|
3
|
-
import UtContent2 from './content/index.vue';
|
|
4
|
-
import FormUpload2 from './form-upload/form-upload.vue';
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import UtGrid2 from './grid/index.vue';
|
|
2
|
+
import UtForm2 from './form/form.vue';
|
|
3
|
+
import UtContent2 from './content/index.vue';
|
|
4
|
+
import FormUpload2 from './form-upload/form-upload.vue';
|
|
5
|
+
import UtStampBadge2 from './ut-stamp-badge/index.vue';
|
|
6
|
+
import UtUpload2 from './upload/index.vue';
|
|
7
|
+
|
|
8
|
+
export { UtGrid2, UtForm2, UtContent2, FormUpload2, UtStampBadge2, UtUpload2 };
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2022-06-21 14:50:52
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2026-03-23 14:39:47
|
|
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 accounting from 'accounting';
|
|
55
|
+
import { useI18n } from 'vue-i18n';
|
|
56
|
+
import { VxeTableInstance, VxeGridProps, VxeGridListeners } from 'vxe-table';
|
|
57
|
+
import { VxeUI } from 'vxe-pc-ui';
|
|
58
|
+
import type { VxePagerPropTypes, VxePagerEvents } from 'vxe-pc-ui';
|
|
59
|
+
|
|
60
|
+
export interface IProps {
|
|
61
|
+
defaultParams?: IRecord;
|
|
62
|
+
options?: IRecord;
|
|
63
|
+
columns: Array<ITableColProps>;
|
|
64
|
+
templateData?: Array<ITableColProps>;
|
|
65
|
+
serviceCode?: string;
|
|
66
|
+
url?: string;
|
|
67
|
+
sourceList?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// const importOptions = {
|
|
71
|
+
// template: [
|
|
72
|
+
// {
|
|
73
|
+
// [t('message.seqNum')]: 10,
|
|
74
|
+
// [t('message.valueCode')]: 'red',
|
|
75
|
+
// [t('message.valueDesc')]: '红色',
|
|
76
|
+
// [t('message.valueDescEn')]: '1000,88.00'
|
|
77
|
+
// }
|
|
78
|
+
// ],
|
|
79
|
+
// columns: [
|
|
80
|
+
// { field: t('message.seqNum'), mapField: 'seqNum' },
|
|
81
|
+
// { field: t('message.valueCode'), mapField: 'valueCode' },
|
|
82
|
+
// { field: t('message.valueDesc'), mapField: 'valueDesc' },
|
|
83
|
+
// { field: t('message.valueDescEn'), mapField: 'valueDescEn', valueType: 'number', decimal: 2 },
|
|
84
|
+
// { field: '异常信息', mapField: 'errorMessage', disabled: true, minWidth: 150 }
|
|
85
|
+
// ],
|
|
86
|
+
// options: {
|
|
87
|
+
// errorField: 'errorMessage',
|
|
88
|
+
// filename: '值集导入模板'
|
|
89
|
+
// }
|
|
90
|
+
// }
|
|
91
|
+
|
|
92
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
93
|
+
defaultParams: (): IRecord => {
|
|
94
|
+
return {};
|
|
95
|
+
},
|
|
96
|
+
options: (): IRecord => {
|
|
97
|
+
return {
|
|
98
|
+
filename: '数据模板',
|
|
99
|
+
errorField: 'errorMsg',
|
|
100
|
+
errListField: 'list'
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
columns: () => [],
|
|
104
|
+
templateData: () => [],
|
|
105
|
+
sourceList: 'list'
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const instance = getCurrentInstance()!;
|
|
109
|
+
const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
|
|
110
|
+
const visible = defineModel<boolean>('visible');
|
|
111
|
+
|
|
112
|
+
const { t } = useI18n();
|
|
113
|
+
|
|
114
|
+
const showErrorMsg = ref(false);
|
|
115
|
+
|
|
116
|
+
const dict = storageLocal.getItem('kLov');
|
|
117
|
+
|
|
118
|
+
watch(
|
|
119
|
+
() => visible.value,
|
|
120
|
+
nv => {
|
|
121
|
+
if (nv) {
|
|
122
|
+
gridOptions.data = [];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const getColumns = () => {
|
|
128
|
+
const columns = props.columns.map(col => {
|
|
129
|
+
col.slots = { default: col.field };
|
|
130
|
+
col.title = col.field;
|
|
131
|
+
col.decimal = col.decimal;
|
|
132
|
+
return col;
|
|
133
|
+
});
|
|
134
|
+
const col = {
|
|
135
|
+
type: 'checkbox',
|
|
136
|
+
width: 40,
|
|
137
|
+
align: 'center',
|
|
138
|
+
fixed: 'left'
|
|
139
|
+
};
|
|
140
|
+
columns.unshift(col);
|
|
141
|
+
console.log('columns===', columns);
|
|
142
|
+
return columns;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const listQuery = ref({ pageSize: 200, currentPage: 1, total: 0 });
|
|
146
|
+
|
|
147
|
+
const layouts: VxePagerPropTypes.Layouts = [
|
|
148
|
+
'Sizes',
|
|
149
|
+
'PrevJump',
|
|
150
|
+
'PrevPage',
|
|
151
|
+
'Number',
|
|
152
|
+
'NextPage',
|
|
153
|
+
'NextJump',
|
|
154
|
+
'FullJump',
|
|
155
|
+
'Total'
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
const height = window.innerHeight - 20;
|
|
159
|
+
|
|
160
|
+
const xgrid = ref<VxeTableInstance>();
|
|
161
|
+
// 导入的所有数据
|
|
162
|
+
let dataList = [];
|
|
163
|
+
|
|
164
|
+
const importConfig = {
|
|
165
|
+
mode: 'covering',
|
|
166
|
+
types: ['csv', 'xlsx'],
|
|
167
|
+
afterImportMethod: onImportMethod
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const gridOptions = reactive<VxeGridProps>({
|
|
171
|
+
border: true,
|
|
172
|
+
height,
|
|
173
|
+
data: [],
|
|
174
|
+
importConfig,
|
|
175
|
+
showOverflow: true,
|
|
176
|
+
loading: false,
|
|
177
|
+
toolbarConfig: {
|
|
178
|
+
buttons: [
|
|
179
|
+
{
|
|
180
|
+
code: 'import_plus',
|
|
181
|
+
name: t('message.btn.upload'),
|
|
182
|
+
icon: 'ri-upload-2-line',
|
|
183
|
+
status: 'primary'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
code: 'save_plus',
|
|
187
|
+
name: t('message.btn.save'),
|
|
188
|
+
icon: 'ri-save-3-line',
|
|
189
|
+
status: 'success'
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
code: 'del_plus',
|
|
193
|
+
name: t('message.btn.delete'),
|
|
194
|
+
icon: 'ri-delete-bin-line',
|
|
195
|
+
status: 'danger'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
code: 'export_plus',
|
|
199
|
+
name: t('message.btn.downloadTemp'),
|
|
200
|
+
icon: 'ri-download-2-line',
|
|
201
|
+
status: 'warning'
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
tools: [
|
|
205
|
+
{
|
|
206
|
+
code: 'question',
|
|
207
|
+
name: t('message.btn.FAQ'),
|
|
208
|
+
status: 'primary',
|
|
209
|
+
icon: 'vxe-icon-info-circle-fill'
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
code: 'replay',
|
|
213
|
+
name: t('message.btn.back'),
|
|
214
|
+
status: 'info',
|
|
215
|
+
icon: 'vxe-icon-undo'
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
columns: getColumns()
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const gridEvents: VxeGridListeners = {
|
|
223
|
+
toolbarButtonClick({ code }) {
|
|
224
|
+
// const $grid = xgrid.value;
|
|
225
|
+
switch (code) {
|
|
226
|
+
case 'import_plus': {
|
|
227
|
+
handleImport();
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
case 'save_plus': {
|
|
231
|
+
handleSave();
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
case 'del_plus': {
|
|
235
|
+
handleDelete();
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
case 'export_plus': {
|
|
239
|
+
handleDownLoadFile();
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
toolbarToolClick({ code }) {
|
|
245
|
+
// const $grid = xgrid.value;
|
|
246
|
+
switch (code) {
|
|
247
|
+
case 'replay': {
|
|
248
|
+
onClose();
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
case 'question': {
|
|
252
|
+
showImportQuestion();
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const handleImport = () => {
|
|
260
|
+
dataList = [];
|
|
261
|
+
xgrid.value?.openImport();
|
|
262
|
+
};
|
|
263
|
+
// 导入后获取数据
|
|
264
|
+
function onImportMethod(options: any) {
|
|
265
|
+
dataList = options.$table.getTableData().fullData;
|
|
266
|
+
// 标题会默认导入,删除第一行
|
|
267
|
+
// dataList.splice(0, 1);
|
|
268
|
+
const columns = getColumns().filter(f => !f.type && f.mapField !== props.options.errorField);
|
|
269
|
+
columns.forEach(col => {
|
|
270
|
+
const idx = dataList.findIndex(data => data[col.field!] === col.field);
|
|
271
|
+
idx !== -1 && dataList.splice(idx, 1);
|
|
272
|
+
});
|
|
273
|
+
props.columns.forEach(col => {
|
|
274
|
+
if (col.dateFormatter || col.valueType === 'number') {
|
|
275
|
+
dataList.forEach(data => {
|
|
276
|
+
if (col.dateFormatter) {
|
|
277
|
+
data[col.field!] = toDateString(data[col.field!], col.dateFormatter || 'yyyy-MM-dd HH:mm:ss');
|
|
278
|
+
} else {
|
|
279
|
+
data[col.field!] = accounting.unformat(data[col.field]).toFixed(col.decimal || 6);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
listQuery.value.total = dataList.length;
|
|
285
|
+
getDataList();
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const getDataList = () => {
|
|
289
|
+
const { currentPage, pageSize } = listQuery.value;
|
|
290
|
+
gridOptions.data = dataList.filter(
|
|
291
|
+
(data, idx) => idx < pageSize * currentPage && idx >= pageSize * (currentPage - 1)
|
|
292
|
+
);
|
|
293
|
+
};
|
|
294
|
+
// 切换页数
|
|
295
|
+
const handlePageChange: VxePagerEvents.PageChange = ({ currentPage, pageSize }) => {
|
|
296
|
+
listQuery.value.currentPage = currentPage;
|
|
297
|
+
listQuery.value.pageSize = pageSize;
|
|
298
|
+
getDataList();
|
|
299
|
+
};
|
|
300
|
+
// 模板下载
|
|
301
|
+
const handleDownLoadFile = () => {
|
|
302
|
+
const data: ITableColProps[] = [];
|
|
303
|
+
if (props.templateData.length) {
|
|
304
|
+
data.push(...props.templateData);
|
|
305
|
+
} else {
|
|
306
|
+
const obj: ITableColProps = {};
|
|
307
|
+
getColumns()
|
|
308
|
+
.filter(f => f.type !== 'checkbox')
|
|
309
|
+
.forEach(col => {
|
|
310
|
+
obj[col.field!] = '案例';
|
|
311
|
+
});
|
|
312
|
+
data.push(obj);
|
|
313
|
+
}
|
|
314
|
+
const opt: IRecord = {
|
|
315
|
+
filename: props.options.filename,
|
|
316
|
+
type: 'xlsx',
|
|
317
|
+
columns: getColumns().filter(f => f.mapField !== props.options.errorField && f.type !== 'checkbox'),
|
|
318
|
+
data
|
|
319
|
+
};
|
|
320
|
+
xgrid.value?.exportData(opt);
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
const handleSave = async () => {
|
|
324
|
+
if (!dataList.length) {
|
|
325
|
+
return warnMessage(t('message.importEmpty'));
|
|
326
|
+
}
|
|
327
|
+
const type = await VxeUI.modal.confirm(t('message.importRecord'));
|
|
328
|
+
if (type === 'confirm') {
|
|
329
|
+
gridOptions.loading = true;
|
|
330
|
+
const { url } = props;
|
|
331
|
+
formatterData('toSave');
|
|
332
|
+
serviceApi
|
|
333
|
+
.post(url, dataList)
|
|
334
|
+
.then((res: any) => {
|
|
335
|
+
if (res?.status === 'error' || res?.length) {
|
|
336
|
+
showErrorMsg.value = true;
|
|
337
|
+
setErrorMessage(res?.length ? res : res[props.options.errListField || props.sourceList]);
|
|
338
|
+
VxeUI.modal.message({
|
|
339
|
+
content: t('message.importFailed'),
|
|
340
|
+
status: 'error'
|
|
341
|
+
});
|
|
342
|
+
} else {
|
|
343
|
+
VxeUI.modal.message({
|
|
344
|
+
content: t('message.importSuccess'),
|
|
345
|
+
status: 'success'
|
|
346
|
+
});
|
|
347
|
+
onClose();
|
|
348
|
+
}
|
|
349
|
+
})
|
|
350
|
+
.finally(() => {
|
|
351
|
+
showErrorMsg.value = false;
|
|
352
|
+
gridOptions.loading = false;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @description:删除行
|
|
359
|
+
*/
|
|
360
|
+
const handleDelete = () => {
|
|
361
|
+
const checkboxRecords = xgrid.value?.getCheckboxRecords();
|
|
362
|
+
if (!checkboxRecords?.length) {
|
|
363
|
+
return VxeUI.modal.message({
|
|
364
|
+
content: t('message.selectedRecord'),
|
|
365
|
+
status: 'warning'
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
checkboxRecords.forEach(record => {
|
|
369
|
+
const idx = dataList.findIndex(data => data._X_ROW_KEY === record._X_ROW_KEY)!;
|
|
370
|
+
idx !== -1 && dataList.splice(idx, 1);
|
|
371
|
+
});
|
|
372
|
+
gridOptions.data = dataList;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const setErrorMessage = (array: ITableColProps[]) => {
|
|
376
|
+
listQuery.value.total = array.length;
|
|
377
|
+
dataList = array.map((item, idx) => {
|
|
378
|
+
item._X_ROW_KEY = idx;
|
|
379
|
+
return item;
|
|
380
|
+
});
|
|
381
|
+
formatterData('toShow');
|
|
382
|
+
getDataList();
|
|
383
|
+
};
|
|
384
|
+
const formatterData = (formatterType: string) => {
|
|
385
|
+
gridOptions.columns!.forEach((col: any) => {
|
|
386
|
+
if (formatterType === 'toSave') {
|
|
387
|
+
const commonParam = cookies.get('kCookies_param') ? JSON.parse(cookies.get('kCookies_param')!) : {};
|
|
388
|
+
dataList.forEach(data => {
|
|
389
|
+
data[col.mapField] = data[col.field];
|
|
390
|
+
Object.assign(data, commonParam, props.defaultParams);
|
|
391
|
+
});
|
|
392
|
+
} else {
|
|
393
|
+
dataList.forEach(data => {
|
|
394
|
+
data[col.field] = data[col.mapField];
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
const showImportQuestion = () => {
|
|
401
|
+
VxeUI.modal.alert(t('message.importTip'), t('message.udp.tip'));
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
const emit = defineEmits<{ (e: 'close'): void }>();
|
|
405
|
+
|
|
406
|
+
const onClose = () => {
|
|
407
|
+
visible.value = false;
|
|
408
|
+
emit('close');
|
|
409
|
+
};
|
|
410
|
+
</script>
|
|
411
|
+
|
|
412
|
+
<style lang="scss" scoped>
|
|
413
|
+
.ut-input {
|
|
414
|
+
box-sizing: border-box;
|
|
415
|
+
display: inline-block;
|
|
416
|
+
width: 100%;
|
|
417
|
+
height: 28px;
|
|
418
|
+
padding: 0 15px;
|
|
419
|
+
font-size: 13px;
|
|
420
|
+
line-height: 28px;
|
|
421
|
+
color: #606266;
|
|
422
|
+
appearance: none;
|
|
423
|
+
outline: 0;
|
|
424
|
+
background-color: #fff;
|
|
425
|
+
background-image: none;
|
|
426
|
+
border: 1px solid #dcdfe6;
|
|
427
|
+
border-radius: 4px;
|
|
428
|
+
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
429
|
+
|
|
430
|
+
&:hover {
|
|
431
|
+
border-color: #c0c4cc;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
&:focus {
|
|
435
|
+
outline: 0;
|
|
436
|
+
border-color: #409eff;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
&:disabled {
|
|
440
|
+
outline: none;
|
|
441
|
+
background-color: #f5f7fa;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
</style>
|
package/src/main.ts
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: levi7754 levi7754@163.com
|
|
3
|
-
* @Date: 2025-07-25 13:38:20
|
|
4
|
-
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
-
* @LastEditTime:
|
|
6
|
-
* @FilePath: \udp-front\packages\udp-core\src\main.ts
|
|
7
|
-
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
-
*/
|
|
9
|
-
import { createApp, type Directive } from 'vue';
|
|
10
|
-
import App from './App.vue';
|
|
11
|
-
// import router from './router';
|
|
12
|
-
import { setViews } from './router';
|
|
13
|
-
import { setupStore } from './store';
|
|
14
|
-
import { setConfig, setSystemEnv } from './config';
|
|
15
|
-
import { useI18n, transformI18n } from '../src/plugins/i18n';
|
|
16
|
-
import { setTableConfig } from '../src/plugins/vxe-table';
|
|
17
|
-
import { injectResponsiveStorage } from './utils/storage';
|
|
18
|
-
import hasAuthority from './utils/authority';
|
|
19
|
-
import { getServiceApi, getBaseURL, setRouter, setBaseUrl } from './api';
|
|
20
|
-
|
|
21
|
-
import 'nprogress/nprogress.css';
|
|
22
|
-
// 一定要在main.ts中导入tailwind.css,防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
|
|
23
|
-
import './style/tailwind.css';
|
|
24
|
-
// // 引入重置样式
|
|
25
|
-
import './style/reset.scss';
|
|
26
|
-
// 导入公共样式
|
|
27
|
-
import './style/index.scss';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
//
|
|
50
|
-
import
|
|
51
|
-
|
|
52
|
-
import 'tippy
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
app.config.globalProperties.$
|
|
65
|
-
app.config.globalProperties.$
|
|
66
|
-
app.config.globalProperties.$url = getBaseURL();
|
|
67
|
-
window.$i18n = transformI18n;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const setGlobalDirective = app => {
|
|
71
|
-
Object.keys(directives).forEach(key => {
|
|
72
|
-
app.directive(key, (directives as { [key: string]: Directive })[key]);
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const init = ({ router, config, lang, views, env, tableConfig }) => {
|
|
77
|
-
setViews(views, router);
|
|
78
|
-
app.use(router);
|
|
79
|
-
setRouter(router);
|
|
80
|
-
setConfig(app, config);
|
|
81
|
-
setSystemEnv(env);
|
|
82
|
-
setTableConfig(tableConfig);
|
|
83
|
-
return new Promise(resolve => {
|
|
84
|
-
useI18n(app, lang);
|
|
85
|
-
app.component('IconifyIconOffline', IconifyIconOffline);
|
|
86
|
-
app.component('FontIcon', FontIcon);
|
|
87
|
-
// app.component('uAttachment', uAttachment).component('UGrid', UGrid);
|
|
88
|
-
// .component('UtDivider', UtDivider)
|
|
89
|
-
// app.component('UtModalForm2', UtModalForm2);
|
|
90
|
-
app.component('UtGrid2', UtGrid2);
|
|
91
|
-
|
|
92
|
-
// app.component('UtModalGrid2', UtModalGrid2);
|
|
93
|
-
// .component('UtIconSelect', UtIconSelect)
|
|
94
|
-
app.component('FormUpload2', FormUpload2);
|
|
95
|
-
// .component('UtCalendar', UtCalendar)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// .component('UtModalGrid', UtModalGrid);
|
|
99
|
-
// app.use(VueViewer, { defaultOptions: { zIndex: 9999 } });
|
|
100
|
-
setGlobal(app);
|
|
101
|
-
setBaseUrl(getBaseURL());
|
|
102
|
-
setGlobalDirective(app);
|
|
103
|
-
// 全局组件
|
|
104
|
-
setupStore(app);
|
|
105
|
-
injectResponsiveStorage(app, config);
|
|
106
|
-
const result = { app, router };
|
|
107
|
-
resolve(result);
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export default init;
|
|
1
|
+
/*
|
|
2
|
+
* @Author: levi7754 levi7754@163.com
|
|
3
|
+
* @Date: 2025-07-25 13:38:20
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2026-03-30 13:50:20
|
|
6
|
+
* @FilePath: \udp-front\packages\udp-core\src\main.ts
|
|
7
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
+
*/
|
|
9
|
+
import { createApp, type Directive } from 'vue';
|
|
10
|
+
import App from './App.vue';
|
|
11
|
+
// import router from './router';
|
|
12
|
+
import { setViews } from './router';
|
|
13
|
+
import { setupStore } from './store';
|
|
14
|
+
import { setConfig, getEnv, setSystemEnv } from './config';
|
|
15
|
+
import { useI18n, transformI18n } from '../src/plugins/i18n';
|
|
16
|
+
import { setTableConfig } from '../src/plugins/vxe-table';
|
|
17
|
+
import { injectResponsiveStorage } from './utils/storage';
|
|
18
|
+
import hasAuthority from './utils/authority';
|
|
19
|
+
import { getServiceApi, getBaseURL, setRouter, setBaseUrl, getDebugBaseURL } from './api';
|
|
20
|
+
|
|
21
|
+
import 'nprogress/nprogress.css';
|
|
22
|
+
// 一定要在main.ts中导入tailwind.css,防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
|
|
23
|
+
import './style/tailwind.css';
|
|
24
|
+
// // 引入重置样式
|
|
25
|
+
import './style/reset.scss';
|
|
26
|
+
// 导入公共样式
|
|
27
|
+
import './style/index.scss';
|
|
28
|
+
|
|
29
|
+
import {
|
|
30
|
+
// utLov2,
|
|
31
|
+
// UtDivider,
|
|
32
|
+
// UtModalForm2
|
|
33
|
+
FormUpload2,
|
|
34
|
+
// UtForm2,
|
|
35
|
+
UtGrid2,
|
|
36
|
+
UtContent2,
|
|
37
|
+
UtStampBadge2,
|
|
38
|
+
// UtModalGrid2
|
|
39
|
+
UtUpload2
|
|
40
|
+
// UtIconSelect,
|
|
41
|
+
// UtCalendar
|
|
42
|
+
// uAttachment
|
|
43
|
+
} from './components/udp';
|
|
44
|
+
|
|
45
|
+
const app = createApp(App);
|
|
46
|
+
|
|
47
|
+
// 全局注册`@iconify/vue`图标库
|
|
48
|
+
import { IconifyIconOffline, FontIcon } from './components/ReIcon';
|
|
49
|
+
// 全局注册`vue-tippy`
|
|
50
|
+
import 'tippy.js/dist/tippy.css';
|
|
51
|
+
import 'tippy.js/animations/perspective.css';
|
|
52
|
+
import VueTippy from 'vue-tippy';
|
|
53
|
+
|
|
54
|
+
app.use(VueTippy, {
|
|
55
|
+
defaultProps: { animation: 'perspective' }
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// 自定义指令
|
|
59
|
+
import * as directives from './directives';
|
|
60
|
+
|
|
61
|
+
const setGlobal = app => {
|
|
62
|
+
app.config.globalProperties.$hasAuthority = hasAuthority;
|
|
63
|
+
app.config.globalProperties.$debugModel = getEnv().VITE_DEBUG === 'true';
|
|
64
|
+
app.config.globalProperties.$serviceApi = getServiceApi();
|
|
65
|
+
app.config.globalProperties.$debuggerApi = getDebugBaseURL();
|
|
66
|
+
app.config.globalProperties.$url = getBaseURL();
|
|
67
|
+
window.$i18n = transformI18n;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const setGlobalDirective = app => {
|
|
71
|
+
Object.keys(directives).forEach(key => {
|
|
72
|
+
app.directive(key, (directives as { [key: string]: Directive })[key]);
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const init = ({ router, config, lang, views, env, tableConfig }) => {
|
|
77
|
+
setViews(views, router);
|
|
78
|
+
app.use(router);
|
|
79
|
+
setRouter(router);
|
|
80
|
+
setConfig(app, config);
|
|
81
|
+
setSystemEnv(env);
|
|
82
|
+
setTableConfig(tableConfig);
|
|
83
|
+
return new Promise(resolve => {
|
|
84
|
+
useI18n(app, lang);
|
|
85
|
+
app.component('IconifyIconOffline', IconifyIconOffline);
|
|
86
|
+
app.component('FontIcon', FontIcon);
|
|
87
|
+
// app.component('uAttachment', uAttachment).component('UGrid', UGrid);
|
|
88
|
+
// .component('UtDivider', UtDivider)
|
|
89
|
+
// app.component('UtModalForm2', UtModalForm2);
|
|
90
|
+
app.component('UtGrid2', UtGrid2);
|
|
91
|
+
app.component('UtUpload2', UtUpload2);
|
|
92
|
+
// app.component('UtModalGrid2', UtModalGrid2);
|
|
93
|
+
// .component('UtIconSelect', UtIconSelect)
|
|
94
|
+
app.component('FormUpload2', FormUpload2);
|
|
95
|
+
// .component('UtCalendar', UtCalendar)
|
|
96
|
+
app.component('UtContent2', UtContent2);
|
|
97
|
+
app.component('UtStampBadge2', UtStampBadge2);
|
|
98
|
+
// .component('UtModalGrid', UtModalGrid);
|
|
99
|
+
// app.use(VueViewer, { defaultOptions: { zIndex: 9999 } });
|
|
100
|
+
setGlobal(app);
|
|
101
|
+
setBaseUrl(getBaseURL());
|
|
102
|
+
setGlobalDirective(app);
|
|
103
|
+
// 全局组件
|
|
104
|
+
setupStore(app);
|
|
105
|
+
injectResponsiveStorage(app, config);
|
|
106
|
+
const result = { app, router };
|
|
107
|
+
resolve(result);
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default init;
|