@utogether/udp-core 1.0.1-beta.9 → 1.0.2
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/build/plugins.ts +37 -39
- package/dist/{403-BOzKHdlm.js → 403-B1rIjAAu.js} +6 -6
- package/dist/{404-uwgt4Nll.js → 404-mBqc2y4t.js} +4 -4
- package/dist/{500-4HBf6V9m.js → 500-BoI45Zdh.js} +2 -2
- package/dist/{AuthorityInfo-DvbIh1vT.js → AuthorityInfo-B08NBIIn.js} +1 -1
- package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-BlCPvwXU.js → AuthorityInfo.vue_vue_type_style_index_0_lang-BLP1SaiH.js} +3 -3
- package/dist/{Company-D7Q9BFmr.js → Company-JGGyWEWH.js} +3 -3
- package/dist/{CompanyPanel-C0-PJlrt.js → CompanyPanel-BQ_cCmDx.js} +7 -7
- package/dist/{Department-h2hlXACv.js → Department-z2iO6hwM.js} +10 -10
- package/dist/{DepartmentPanel-B6hDEQpG.js → DepartmentPanel-BtQe7zwU.js} +108 -78
- package/dist/{DesignPanel-cS58-1v9.js → DesignPanel-7mhtVWas.js} +1 -1
- package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-LdvLC8VU.js → DesignPanel.vue_vue_type_style_index_0_lang-4EsHemj_.js} +6 -6
- package/dist/{DictView-T3TmpBa8.js → DictView-CjchV2Yk.js} +15 -16
- package/dist/InvOrganization-Pn1O_XP0.js +74 -0
- package/dist/{Org-CnCBDGKF.js → Org-BqytV_vi.js} +1 -1
- package/dist/{Preview-BaktKXB1.js → Preview-CLpUUMay.js} +2 -2
- package/dist/{ReportDefine-5Rb0PO9A.js → ReportDefine-Cz1KtEUF.js} +1 -1
- package/dist/{ReportDesign-DYdkVREA.js → ReportDesign-BaORYud4.js} +13 -13
- package/dist/{ReportQuery-BwhzIXMt.js → ReportQuery-CPCPXiXz.js} +1 -1
- package/dist/{ReportQueryFrom-PHtWwlOe.js → ReportQueryFrom-C_AcrfkJ.js} +1 -1
- package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-BE5yZNPM.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-Bm67ejay.js} +1 -1
- package/dist/{ReportTemplate-DaadVXIi.js → ReportTemplate-CFiNMz79.js} +11 -11
- package/dist/{Role-Dtg3nAmG.js → Role-B-XDoJd5.js} +3 -3
- package/dist/{RoleAssign-DEGtLssH.js → RoleAssign-BolW8YVs.js} +8 -8
- package/dist/{RolePanel-DpUzfE_o.js → RolePanel-2kfs5tw9.js} +1 -1
- package/dist/{RolePanel-CT7BTPmy.js → RolePanel-HilSuYns.js} +1 -1
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-Xyo0YEI0.js → RolePanel.vue_vue_type_script_setup_true_lang-CE4gApUY.js} +7 -7
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-Dg2A6DJu.js → RolePanel.vue_vue_type_script_setup_true_lang-DPzgfAyV.js} +13 -13
- package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-CyutzDZS.js → ScrollPanel.vue_vue_type_style_index_0_lang-CCTH4RkH.js} +4 -4
- package/dist/{Staff-_NlAGkrh.js → Staff-BTk3whFC.js} +3 -3
- package/dist/{StaffInfo-DVgUvVgd.js → StaffInfo-d3AuSzlA.js} +1 -1
- package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-C8hmlFgX.js → StaffInfo.vue_vue_type_script_setup_true_lang-eOL4VlfE.js} +5 -5
- package/dist/{StaffPanel-DKNZE3IE.js → StaffPanel-DV-D4jjz.js} +1 -1
- package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-4sFq3CEo.js +135 -0
- package/dist/{SysUser-kQUf7XKz.js → SysUser-BnjYytws.js} +2 -2
- package/dist/{SysUserPanel-C191uX3U.js → SysUserPanel-CBoyD-Qi.js} +1 -1
- package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-PrTlTZR-.js +341 -0
- package/dist/{SystemMenu-DwuSvHnj.js → SystemMenu-kYB_ZaUt.js} +36 -36
- package/dist/{UserInfo-DIsInFld.js → UserInfo-4dx97VBL.js} +1 -1
- package/dist/{UserInfo.vue_vue_type_style_index_0_lang-CnvGdbej.js → UserInfo.vue_vue_type_style_index_0_lang-BpbC_ZDm.js} +10 -10
- package/dist/{childView-3Bs2UBEw.js → childView-CHPNfTEb.js} +1 -1
- package/dist/{childView-BawyULD7.js → childView-CKA_JgVZ.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-YpWF-p2F.js → childView.vue_vue_type_style_index_0_lang-Bym2fQRd.js} +7 -7
- package/dist/childView.vue_vue_type_style_index_0_lang-W7bCtXeu.js +177 -0
- package/dist/{code-rule-DVaYcn8S.js → code-rule-CbxuZg0-.js} +40 -38
- package/dist/core.es.js +18 -12
- package/dist/{cron-task-xuzP-BpE.js → cron-task-nTOpqQYf.js} +7 -7
- package/dist/flow-task-B07st2aD.js +10 -0
- package/dist/{frameView-Cudt06qS.js → frameView-Z1tPUyCh.js} +1 -1
- package/dist/index-C3q8HoJM.js +4650 -0
- package/dist/{layoutView-BlFTV2jX.js → layoutView--MGA9zUB.js} +1766 -1760
- package/dist/{log-in-e7D5Ss1P.js → log-in-CSYJDA6m.js} +36 -29
- package/dist/log-out-DiwGCg7p.js +130 -0
- package/dist/login-C6Y0ajDp.js +251 -0
- package/dist/{login-log-kqKzKTto.js → login-log-C0V-_l3F.js} +5 -3
- package/dist/{lov-view-B2HaxyMs.js → lov-view-Cmv7wZZ9.js} +6 -6
- package/dist/{menuInfo-BxCTJ1VW.js → menuInfo-UeutJpOa.js} +1 -1
- package/dist/{menuInfo.vue_vue_type_style_index_0_lang-CLOPNeUW.js → menuInfo.vue_vue_type_style_index_0_lang-CWX4Mu67.js} +118 -98
- package/dist/{pda-app-DPsAFNiw.js → pda-app-B6w99SJo.js} +10 -10
- package/dist/{resource-Dibb7t8u.js → resource-BybJvUv0.js} +4 -4
- package/dist/{su-welcome-DejR0KkM.js → su-welcome-C1bmxHoY.js} +119 -121
- package/dist/sys-config-BnmIDnCj.js +370 -0
- package/dist/udp-core.css +1 -9
- package/dist/utogether-MlnyYtNS.js +4 -0
- package/index.ts +49 -40
- package/package.json +18 -18
- package/src/App.vue +65 -65
- package/src/api/http.ts +1 -4
- package/src/api/index.ts +4 -2
- package/src/api/user.ts +2 -2
- package/src/components/SuCharts/src/UserInfo.vue +78 -78
- package/src/components/SuScrollTree/ScrollPanel.vue +1 -6
- package/src/components/udp/content/index.vue +88 -0
- package/src/components/udp/{form.vue → form/form.vue} +13 -16
- package/src/components/udp/{grid.vue → grid/index.vue} +56 -27
- package/src/components/udp/index.ts +4 -9
- package/src/components/udp/ut-stamp-badge/index.vue +271 -0
- package/src/components/udp/utils.ts +66 -105
- package/src/layout/components/lay-navbar/index.vue +8 -6
- package/src/layout/components/lay-panel/index.vue +150 -150
- package/src/layout/components/lay-search/index.vue +25 -25
- package/src/layout/components/lay-select-org/index.vue +4 -9
- package/src/layout/components/lay-setting/index.vue +503 -510
- package/src/layout/components/lay-sidebar/horizontal.vue +8 -6
- package/src/layout/components/lay-sidebar/mixNav.vue +260 -258
- package/src/layout/components/lay-sidebar/sidebar-logo.vue +101 -98
- package/src/layout/components/lay-tag/index.vue +24 -51
- package/src/layout/hooks/useDataThemeChange.ts +1 -1
- package/src/layout/hooks/useNav.ts +176 -173
- package/src/layout/hooks/useTag.ts +227 -233
- package/src/layout/types.ts +93 -92
- package/src/main.ts +115 -119
- package/src/plugins/i18n/en.ts +302 -302
- package/src/plugins/i18n/module/u-workflow.ts +1 -1
- package/src/plugins/i18n/zh.ts +21 -6
- package/src/plugins/vxe-table/index.ts +116 -53
- package/src/plugins/vxe-table/render.tsx +945 -956
- package/src/router/index.ts +17 -17
- package/src/router/modules/flow.ts +35 -0
- package/src/router/modules/home.ts +32 -32
- package/src/router/modules/remaining.ts +58 -58
- package/src/router/utils.ts +420 -377
- package/src/store/modules/app.ts +2 -4
- package/src/store/modules/epTheme.ts +48 -49
- package/src/store/modules/multiTags.ts +15 -14
- package/src/store/modules/permission.ts +25 -15
- package/src/store/modules/system.ts +1 -3
- package/src/style/button.scss +85 -85
- package/src/style/login.css +1 -1
- package/src/style/vxetable.scss +61 -2
- package/src/utils/dataFormat/index.ts +223 -223
- package/src/utils/index.ts +3 -1
- package/src/utils/lifecycle.ts +39 -20
- package/src/utils/propTypes.ts +1 -6
- package/src/utils/storage/index.ts +2 -2
- package/src/utils/udp/http/index.ts +24 -11
- package/src/utils/udp/http/types.d.ts +3 -10
- package/src/views/login/login-view.vue +4 -18
- package/src/views/organization/company/CompanyPanel.vue +259 -259
- package/src/views/organization/department/Department.vue +58 -58
- package/src/views/organization/department/DepartmentPanel.vue +303 -283
- package/src/views/organization/inv-org/InvOrganization.vue +22 -7
- package/src/views/organization/staff/StaffInfo.vue +127 -133
- package/src/views/organization/staff/StaffPanel.vue +162 -145
- package/src/views/system/cron/cron-task.vue +2 -12
- package/src/views/system/menu/SystemMenu.vue +185 -183
- package/src/views/system/menu/menuInfo.vue +384 -363
- package/src/views/system/role/UserInfo.vue +195 -195
- package/src/views/system/role-assign/RoleAssign.vue +57 -57
- package/src/views/system/role-assign/RolePanel.vue +139 -139
- package/src/views/system/sys/sys-config.vue +69 -20
- package/src/views/system/sysUser/SysUserPanel.vue +97 -28
- package/src/views/uapp/pda/pda-app.vue +208 -208
- package/src/views/udev/coderule/code-rule.vue +132 -121
- package/src/views/udev/dict/DictView.vue +2 -2
- package/src/views/udev/dict/childView.vue +183 -222
- package/src/views/udev/lov/childView.vue +1 -7
- package/src/views/udev/lov/lov-view.vue +91 -91
- package/src/views/uhome/components/menu-favorite.vue +314 -331
- package/src/views/uhome/su-welcome.vue +319 -339
- package/src/views/ulogin/login.vue +325 -321
- package/src/views/upms/interface/log-in.vue +100 -106
- package/src/views/upms/interface/log-out.vue +104 -107
- package/src/views/upms/user/login-log.vue +54 -60
- package/src/views/urpt/design/DesignPanel.vue +507 -507
- package/src/views/urpt/design/Preview.vue +1 -0
- package/src/views/urpt/design/ReportDesign.vue +2 -4
- package/src/views/utask/flow-task.vue +18 -0
- package/types/global.d.ts +231 -236
- package/dist/InvOrganization-BVuOhzbt.js +0 -66
- package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-BOOO6Cek.js +0 -111
- package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-SwNbAEvW.js +0 -294
- package/dist/childView.vue_vue_type_style_index_0_lang-DWIFCX3X.js +0 -187
- package/dist/index-CKnq5xIa.js +0 -2623
- package/dist/log-out--RRncZhN.js +0 -120
- package/dist/login-CpKykfdf.js +0 -253
- package/dist/sys-config-DiySRWns.js +0 -277
- package/dist/utogether-Dct_14Zk.js +0 -182
- package/src/components/udp/count-down.vue +0 -536
- package/src/components/udp/flip-down/FlipCard/flip-card.vue +0 -251
- package/src/components/udp/flip-down/FlipCard/interfaces.ts +0 -4
- package/src/components/udp/flip-down/FlipClock/flip-clock.vue +0 -113
- package/src/components/udp/form-upload.vue +0 -482
- package/src/components/udp/lov.vue +0 -388
- package/src/components/udp/modal-form.vue +0 -189
- package/src/components/udp/modal-grid.vue +0 -288
- package/src/components/udp/upload.vue +0 -423
- package/src/utils/udp/useRender.ts +0 -431
|
@@ -1,288 +0,0 @@
|
|
|
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>
|
|
@@ -1,423 +0,0 @@
|
|
|
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') ? JSON.parse(cookies.get('kCookies_param')!) : {};
|
|
365
|
-
dataList.forEach(data => {
|
|
366
|
-
data[col.mapField] = data[col.field];
|
|
367
|
-
Object.assign(data, commonParam, props.defaultParams);
|
|
368
|
-
});
|
|
369
|
-
} else {
|
|
370
|
-
dataList.forEach(data => {
|
|
371
|
-
data[col.field] = data[col.mapField];
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
const showImportQuestion = () => {
|
|
378
|
-
VxeUI.modal.alert(t('message.importTip'), t('message.udp.tip'));
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
const emit = defineEmits<{ (e: 'close'): void }>();
|
|
382
|
-
|
|
383
|
-
const onClose = () => {
|
|
384
|
-
visible.value = false;
|
|
385
|
-
emit('close');
|
|
386
|
-
};
|
|
387
|
-
</script>
|
|
388
|
-
|
|
389
|
-
<style lang="scss" scoped>
|
|
390
|
-
.ut-input {
|
|
391
|
-
box-sizing: border-box;
|
|
392
|
-
box-sizing: border-box;
|
|
393
|
-
display: inline-block;
|
|
394
|
-
width: 100%;
|
|
395
|
-
height: 28px;
|
|
396
|
-
padding: 0 15px;
|
|
397
|
-
font-size: 13px;
|
|
398
|
-
line-height: 28px;
|
|
399
|
-
color: #606266;
|
|
400
|
-
background-color: #fff;
|
|
401
|
-
background-image: none;
|
|
402
|
-
border: 1px solid #dcdfe6;
|
|
403
|
-
border-radius: 4px;
|
|
404
|
-
outline: 0;
|
|
405
|
-
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
406
|
-
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
407
|
-
appearance: none;
|
|
408
|
-
|
|
409
|
-
&:hover {
|
|
410
|
-
border-color: #c0c4cc;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
&:focus {
|
|
414
|
-
border-color: #409eff;
|
|
415
|
-
outline: 0;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
&:disabled {
|
|
419
|
-
background-color: #f5f7fa;
|
|
420
|
-
outline: none;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
</style>
|