@utogether/udp-core 1.0.0 → 1.0.1-beta.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 +8 -2
- package/dist/{403-B1R-4vXw.js → 403-BBQoJwTM.js} +9 -8
- package/dist/{404-fXPl8csw.js → 404-BbJPSIWM.js} +15 -14
- package/dist/{500-eI5842YB.js → 500-BtFL9R4M.js} +11 -10
- package/dist/{AuthorityInfo-CfVH6PaB.js → AuthorityInfo-DhiwCeLN.js} +1 -1
- package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-DbK-f8jH.js → AuthorityInfo.vue_vue_type_style_index_0_lang-Duyweh89.js} +3 -3
- package/dist/{AuthorityPanel-BaLMwMgW.js → AuthorityPanel-BeBNiwqc.js} +1 -1
- package/dist/{AuthorityPanel.vue_vue_type_style_index_0_lang-C_bkqLD9.js → AuthorityPanel.vue_vue_type_style_index_0_lang-CIYmnP9-.js} +6 -6
- package/dist/{Company-CYC9Avfz.js → Company-CGqmslx-.js} +3 -3
- package/dist/{CompanyPanel-B4MzoqN_.js → CompanyPanel-hlDsxD-6.js} +10 -10
- package/dist/{Department-B4BNSiYx.js → Department-BZyJtacc.js} +3 -3
- package/dist/{DepartmentPanel-zJO89L2O.js → DepartmentPanel-D-a_EBFt.js} +23 -23
- package/dist/{DesignPanel-S8P0J97f.js → DesignPanel-Bl4luWDV.js} +1 -1
- package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-DW-_Vqrr.js → DesignPanel.vue_vue_type_style_index_0_lang-I8C3iGvz.js} +6 -6
- package/dist/{DictView-bIS5-rK-.js → DictView-B4a7Hs1X.js} +9 -9
- package/dist/InvOrganization-q4T3y8dQ.js +260 -0
- package/dist/{Org-kXHSjsgJ.js → Org-BTGTrAVz.js} +3 -3
- package/dist/{Preview-CRyiwUIR.js → Preview-pHD84xqI.js} +1 -1
- package/dist/{ReportDefine-WZYIx8Sm.js → ReportDefine-DnnCNQWS.js} +1 -1
- package/dist/{ReportDesign-D-7GKgpb.js → ReportDesign-BnI_Q4pg.js} +10 -10
- package/dist/{ReportQuery-BIIJny6w.js → ReportQuery-Dby2MmtM.js} +5 -5
- package/dist/{ReportQueryFrom-OoUl7N2O.js → ReportQueryFrom-Blm1N8P1.js} +1 -1
- package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-B878fgj8.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-CnG_Ybnt.js} +6 -5
- package/dist/{ReportTemplate-Cfeq9US-.js → ReportTemplate-D65RXRY_.js} +11 -11
- package/dist/{Role-BwTV2QMH.js → Role-eFZoTpXc.js} +3 -3
- package/dist/{RoleAssign-De1JjOun.js → RoleAssign-D9-Y3UNz.js} +3 -3
- package/dist/{RolePanel-pUBXsqCM.js → RolePanel-CoUOc3sX.js} +1 -1
- package/dist/{RolePanel-E3RcdByM.js → RolePanel-DlFw6HSf.js} +1 -1
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-B2pQwHb0.js → RolePanel.vue_vue_type_script_setup_true_lang-Clwk-MHw.js} +12 -12
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-CTIad9_Q.js → RolePanel.vue_vue_type_script_setup_true_lang-DKHgNWQP.js} +4 -4
- package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-vMR1fBi0.js → ScrollPanel.vue_vue_type_style_index_0_lang-M2FQJwPU.js} +8 -8
- package/dist/{Staff-Czm7A8vI.js → Staff-DFBLCsAd.js} +3 -3
- package/dist/StaffInfo-d2CK0oBA.js +4 -0
- package/dist/{StaffInfo.vue_vue_type_style_index_0_lang-DMTL7KCh.js → StaffInfo.vue_vue_type_script_setup_true_lang-4m8wK9tq.js} +7 -7
- package/dist/{StaffPanel-CHk60LEz.js → StaffPanel-D6aWLKN3.js} +1 -1
- package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-iPKLb5wG.js → StaffPanel.vue_vue_type_script_setup_true_lang-C7YT2CVb.js} +46 -49
- package/dist/{SysUser-BGwbttRn.js → SysUser-BdZvYxQH.js} +2 -2
- package/dist/{SysUserPanel-BCbKoLKt.js → SysUserPanel-BIVa6LLr.js} +1 -1
- package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-0QUjnhjF.js → SysUserPanel.vue_vue_type_script_setup_true_lang-BsBKpYR7.js} +1 -2
- package/dist/{SystemMenu-BkqZSDKl.js → SystemMenu-C-5VKlHK.js} +51 -49
- package/dist/{UserInfo-BsyAcT2d.js → UserInfo-DqXCRZts.js} +1 -1
- package/dist/{UserInfo.vue_vue_type_style_index_0_lang-D0-KDxAh.js → UserInfo.vue_vue_type_style_index_0_lang-N3TwfpPx.js} +13 -13
- package/dist/{childView-CyuLTUqC.js → childView-B2lSsqS3.js} +1 -1
- package/dist/{childView-CF83nhxb.js → childView-DRUNqgjI.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-Cch4lE-i.js → childView.vue_vue_type_style_index_0_lang-B9XBDDU_.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-CNSgGda3.js → childView.vue_vue_type_style_index_0_lang-oGriyFTv.js} +6 -6
- package/dist/{code-rule-Bz-gnktN.js → code-rule-DZC9T6cl.js} +6 -6
- package/dist/core.es.js +4 -4
- package/dist/{cron-task-CIifSUdW.js → cron-task-BJwPeA5F.js} +11 -11
- package/dist/{frameView-_d2mqjjQ.js → frameView-C6wkvok-.js} +15 -14
- package/dist/index-DZc3qRTx.js +2650 -0
- package/dist/{layoutView-DLKVepB8.js → layoutView-CeJBpZb_.js} +658 -653
- package/dist/{login-LREiDfFU.js → login-BOxwzwdB.js} +26 -25
- package/dist/{lov-view-DDrIVILB.js → lov-view-DRF-99U4.js} +5 -5
- package/dist/{menuInfo-B1FUV-Sk.js → menuInfo-3Sjvs9nM.js} +1 -1
- package/dist/{menuInfo.vue_vue_type_style_index_0_lang-Cnk3vdtD.js → menuInfo.vue_vue_type_style_index_0_lang-DrQ560nm.js} +95 -94
- package/dist/pda-app-B9tn7jdv.js +696 -0
- package/dist/redirect-BqegffKC.js +15 -0
- package/dist/{resource-BCwx9fEv.js → resource-BqnxbQNe.js} +7 -7
- package/dist/{su-welcome-189A7N4r.js → su-welcome-VwifUK_O.js} +41 -40
- package/dist/{sys-config-BZ3sejow.js → sys-config-C0-gSBFO.js} +18 -18
- package/dist/udp-core.css +2 -2
- package/dist/{utogether-r08LNiIZ.js → utogether-Di1byIum.js} +6 -6
- package/package.json +18 -16
- package/src/App.vue +3 -3
- package/src/components/udp/form-upload.vue +183 -0
- package/src/components/udp/index.ts +4 -0
- package/src/components/udp/modal-form.vue +180 -0
- package/src/components/udp/utils.ts +40 -0
- package/src/main.ts +109 -108
- package/src/plugins/vxe-table/index.ts +53 -46
- package/src/plugins/vxe-table/render.tsx +604 -184
- package/src/utils/udp/useRender.ts +420 -0
- package/src/views/organization/inv-org/InvOrganization.vue +2 -1
- package/src/views/organization/staff/StaffInfo.vue +0 -30
- package/src/views/organization/staff/StaffPanel.vue +4 -3
- package/src/views/system/menu/AuthorityPanel.vue +2 -2
- package/src/views/system/menu/SystemMenu.vue +197 -191
- package/src/views/system/menu/menuInfo.vue +11 -6
- package/src/views/system/role/AuthorityInfo.vue +1 -19
- package/src/views/system/sysUser/SysUserPanel.vue +1 -1
- package/src/views/udev/dict/DictView.vue +2 -2
- package/src/views/uhome/components/menu-favorite.vue +1 -1
- package/src/views/uhome/su-welcome.vue +1 -1
- package/src/views/ulogin/login.vue +1 -1
- package/types/global.d.ts +0 -1
- package/vite.config.ts +9 -2
- package/dist/InvOrganization-MuM2jtsG.js +0 -66
- package/dist/StaffInfo-DJzvBuxy.js +0 -4
- package/dist/core.umd.js +0 -173
- package/dist/index-BKIw8tSn.js +0 -9195
- package/dist/pda-app-CRhVGijN.js +0 -2209
- package/dist/redirect-DiaNDu8F.js +0 -15
- package/src/assets/images/empty.png +0 -0
- package/src/assets/images/logo.png +0 -0
- package/src/components/ReCountTo/README.md +0 -2
- package/src/components/ReCountTo/index.ts +0 -18
- package/src/components/ReCountTo/src/normal/index.tsx +0 -165
- package/src/components/ReCountTo/src/normal/props.ts +0 -37
- package/src/components/ReCountTo/src/rebound/index.tsx +0 -67
- package/src/components/ReCountTo/src/rebound/props.ts +0 -14
- package/src/components/ReCountTo/src/rebound/rebound.css +0 -77
- package/src/components/ReCropper/index.ts +0 -14
- package/src/components/ReCropper/src/index.tsx +0 -141
- package/src/components/ReFlicker/index.css +0 -39
- package/src/components/ReFlicker/index.ts +0 -50
- package/src/components/ReFlop/index.ts +0 -14
- package/src/components/ReFlop/src/Filpper.tsx +0 -99
- package/src/components/ReFlop/src/filpper.css +0 -184
- package/src/components/ReFlop/src/index.vue +0 -126
- package/src/components/ReFlowChart/index.ts +0 -24
- package/src/components/ReFlowChart/src/Control.vue +0 -139
- package/src/components/ReFlowChart/src/DataDialog.vue +0 -12
- package/src/components/ReFlowChart/src/NodePanel.vue +0 -151
- package/src/components/ReFlowChart/src/adpterForTurbo.ts +0 -160
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.css +0 -49
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.eot +0 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.js +0 -61
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.json +0 -58
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.svg +0 -47
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.woff +0 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.woff2 +0 -0
- package/src/components/ReFlowChart/src/config.ts +0 -62
- package/src/components/ReSplitPane/index.css +0 -49
- package/src/components/ReSplitPane/index.tsx +0 -119
- package/src/components/ReSplitPane/resizer.css +0 -45
- package/src/components/ReSplitPane/resizer.tsx +0 -30
- package/src/components/SuCommon/card/components/Card.vue +0 -148
- package/src/components/SuCommon/card/components/DialogForm.vue +0 -127
- package/src/components/SuCommon/card/index.vue +0 -142
- package/src/components/SuCommon/icon-select/index.vue +0 -241
- package/src/components/SuCommon/table/index.vue +0 -208
- package/src/components/SuCommon/utils/index.ts +0 -103
- package/src/components/SuCommon/utils/slot.tsx +0 -50
- package/src/views/components/contextmenu/basic.vue +0 -74
- package/src/views/components/contextmenu/context-menu.vue +0 -40
- package/src/views/components/contextmenu/menuDynamic.vue +0 -99
- package/src/views/components/contextmenu/menuGroup.vue +0 -71
- package/src/views/components/count-to/index.vue +0 -43
- package/src/views/components/cropping/index.vue +0 -59
- package/src/views/components/cropping/picture.jpeg +0 -0
- package/src/views/components/split-pane/index.vue +0 -82
- package/src/views/components/video/index.vue +0 -57
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { computed as W, ref as L } from "vue";
|
|
2
|
-
import { useGlobal as
|
|
3
|
-
import {
|
|
2
|
+
import { useGlobal as g, storageLocal as u, deviceDetection as H, cookies as C, storageSession as M } from "@utogether/utils";
|
|
3
|
+
import { y as P, j as E, s as j, g as h, v as d, z as J, l as K, m as R, n as V, u as S, r as G, o as O, A as x, B as Z } from "./index-DZc3qRTx.js";
|
|
4
4
|
import { useI18n as f } from "vue-i18n";
|
|
5
5
|
import { defineStore as v } from "pinia";
|
|
6
6
|
function I() {
|
|
7
|
-
const { $storage: t, $config: e } =
|
|
8
|
-
P().multiTagsCache && (!t.tags || t.tags.length === 0) && (t.tags =
|
|
7
|
+
const { $storage: t, $config: e } = g(), r = () => {
|
|
8
|
+
P().multiTagsCache && (!t.tags || t.tags.length === 0) && (t.tags = E), t != null && t.locale || (f().locale.value = (e == null ? void 0 : e.Locale) ?? "zh"), t && !(t != null && t.layout) && (t.layout = {
|
|
9
9
|
layout: (e == null ? void 0 : e.Layout) ?? "vertical",
|
|
10
10
|
theme: (e == null ? void 0 : e.Theme) ?? "default",
|
|
11
11
|
darkMode: (e == null ? void 0 : e.DarkMode) ?? !1,
|
|
@@ -116,7 +116,7 @@ function $() {
|
|
|
116
116
|
{ color: "#eb2f96", themeColor: "pink" },
|
|
117
117
|
/* 深紫罗兰色 */
|
|
118
118
|
{ color: "#722ed1", themeColor: "saucePurple" }
|
|
119
|
-
]), { $storage: s } =
|
|
119
|
+
]), { $storage: s } = g(), m = L((T = s == null ? void 0 : s.layout) == null ? void 0 : T.darkMode), y = L((D = s == null ? void 0 : s.layout) == null ? void 0 : D.overallStyle), w = document.documentElement;
|
|
120
120
|
function p(a, l, o) {
|
|
121
121
|
const i = o || document.body;
|
|
122
122
|
let { className: n } = i;
|
|
@@ -157,7 +157,7 @@ function $() {
|
|
|
157
157
|
function B() {
|
|
158
158
|
C.remove(K), C.remove(R), C.remove(V), u.clear(), M.clear();
|
|
159
159
|
const { Grey: a, Weak: l, MultiTagsCache: o, EpThemeColor: i, Layout: n } = h();
|
|
160
|
-
X().setLayout(n), c(i), S().multiTagsCacheChange(o), p(a, "html-grey", document.querySelector("html")), p(l, "html-weakness", document.querySelector("html")), G.push("/login"), S().handleTags("equal", [...
|
|
160
|
+
X().setLayout(n), c(i), S().multiTagsCacheChange(o), p(a, "html-grey", document.querySelector("html")), p(l, "html-weakness", document.querySelector("html")), G.push("/login"), S().handleTags("equal", [...E]), O();
|
|
161
161
|
}
|
|
162
162
|
return {
|
|
163
163
|
body: w,
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@utogether/udp-core",
|
|
3
|
-
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"description": "",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@utogether/udp-core",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "1.0.1-beta.2",
|
|
5
|
+
"description": "",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main1": "index.ts",
|
|
8
|
+
"main": "dist/core.es.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "vite",
|
|
11
|
+
"build": "vite build",
|
|
12
|
+
"preview:build": "pnpm build && vite preview",
|
|
13
|
+
"report": "rimraf dist && vite build"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [],
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "ISC"
|
|
18
|
+
}
|
package/src/App.vue
CHANGED
|
@@ -64,7 +64,7 @@ export default defineComponent({
|
|
|
64
64
|
});
|
|
65
65
|
</script>
|
|
66
66
|
<style lang="scss">
|
|
67
|
-
.hiprint-printElement-image-content img {
|
|
68
|
-
|
|
69
|
-
}
|
|
67
|
+
// .hiprint-printElement-image-content img {
|
|
68
|
+
// content: url('/images/logo.png');
|
|
69
|
+
// }
|
|
70
70
|
</style>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2022-11-04 14:53:36
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2025-07-20 17:23:11
|
|
6
|
+
* @Description: form upload
|
|
7
|
+
-->
|
|
8
|
+
<template>
|
|
9
|
+
<div v-spinning="loading" class="ut-upload-wrapper">
|
|
10
|
+
<el-upload
|
|
11
|
+
v-model:file-list="fileList"
|
|
12
|
+
:action="baseUrl + '/ufil/file/uploadMultipart'"
|
|
13
|
+
:disabled="dataStatus === 'detail'"
|
|
14
|
+
list-type="picture-card"
|
|
15
|
+
:headers="headers"
|
|
16
|
+
:before-upload="beforeUpload"
|
|
17
|
+
:on-success="onSuccess"
|
|
18
|
+
:on-preview="onPreview"
|
|
19
|
+
:on-remove="handleRemove"
|
|
20
|
+
:http-request="httpRequest"
|
|
21
|
+
>
|
|
22
|
+
<template #default>
|
|
23
|
+
<i v-if="fileList.length < limit && dataStatus !== 'detail'" class="ri-add-line" />
|
|
24
|
+
</template>
|
|
25
|
+
</el-upload>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
export default { name: 'FormUpload' };
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<script setup lang="ts">
|
|
34
|
+
import { ref, computed, getCurrentInstance } from 'vue';
|
|
35
|
+
import { cookies } from '@utogether/utils';
|
|
36
|
+
import compressorjs from 'compressorjs';
|
|
37
|
+
|
|
38
|
+
export interface IProps {
|
|
39
|
+
record: object;
|
|
40
|
+
field: string;
|
|
41
|
+
dataStatus: string;
|
|
42
|
+
limit?: number;
|
|
43
|
+
compassorSize?: number;
|
|
44
|
+
quality?: number;
|
|
45
|
+
size?: number;
|
|
46
|
+
beforeUpload?: Function;
|
|
47
|
+
onSuccess?: Function;
|
|
48
|
+
onRemove?: Function;
|
|
49
|
+
}
|
|
50
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
51
|
+
record: () => {
|
|
52
|
+
return {};
|
|
53
|
+
},
|
|
54
|
+
field: '',
|
|
55
|
+
dataStatus: '',
|
|
56
|
+
size: 60,
|
|
57
|
+
limit: 1,
|
|
58
|
+
quality: 0.6,
|
|
59
|
+
compassorSize: 2
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const instance = getCurrentInstance()!;
|
|
63
|
+
const baseUrl = instance.appContext.config.globalProperties.$url;
|
|
64
|
+
const viewerApi = instance.appContext.config.globalProperties.$viewerApi;
|
|
65
|
+
const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
|
|
66
|
+
|
|
67
|
+
const imgTypes = ['image/gif', 'image/jpeg', 'image/png'];
|
|
68
|
+
|
|
69
|
+
const headers = computed(() => {
|
|
70
|
+
const kTOKENKEY = 'authorized-token';
|
|
71
|
+
const token = cookies.get(kTOKENKEY)!;
|
|
72
|
+
const data = JSON.parse(token);
|
|
73
|
+
const headers = {
|
|
74
|
+
Authorization: 'Bearer ' + data.accessToken
|
|
75
|
+
};
|
|
76
|
+
return headers;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const fileList = ref([]);
|
|
80
|
+
const loading = ref(false);
|
|
81
|
+
const display = ref('flex');
|
|
82
|
+
const image_size = ref(props.size + 'px');
|
|
83
|
+
const process_size = ref(props.size - 10 + 'px');
|
|
84
|
+
|
|
85
|
+
const beforeUpload = file => {
|
|
86
|
+
if (props.beforeUpload) {
|
|
87
|
+
return props.beforeUpload(file);
|
|
88
|
+
}
|
|
89
|
+
loading.value = true;
|
|
90
|
+
return true;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const httpRequest = options => {
|
|
94
|
+
if (imgTypes.includes(options.file.type) && options.file.size > 1024 * 1024 * props.compassorSize) {
|
|
95
|
+
return new Promise((resolve, reject) => {
|
|
96
|
+
new compressorjs(options.file, {
|
|
97
|
+
quality: props.quality,
|
|
98
|
+
mimeType: options.file.type,
|
|
99
|
+
success(result: File) {
|
|
100
|
+
const file = new File([result], result.name, { type: result.type });
|
|
101
|
+
uploadProcess(resolve, reject, file);
|
|
102
|
+
console.log({ result, file });
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
} else {
|
|
107
|
+
return new Promise((resolve, reject) => uploadProcess(resolve, reject, options.file));
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const uploadProcess = (resolve, reject, file) => {
|
|
112
|
+
const formBody = new FormData();
|
|
113
|
+
formBody.append('file', file);
|
|
114
|
+
|
|
115
|
+
return serviceApi
|
|
116
|
+
.post('/ufil/file/uploadMultipart', formBody, { headers })
|
|
117
|
+
.then(async data => {
|
|
118
|
+
loading.value = false;
|
|
119
|
+
file.path = data;
|
|
120
|
+
resolve(file);
|
|
121
|
+
})
|
|
122
|
+
.catch(() => {
|
|
123
|
+
loading.value = false;
|
|
124
|
+
reject(null);
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const onSuccess = file => {
|
|
129
|
+
loading.value = false;
|
|
130
|
+
if (props.onSuccess) {
|
|
131
|
+
return props.onSuccess(file);
|
|
132
|
+
} else {
|
|
133
|
+
const field = props.field;
|
|
134
|
+
Object.assign(props.record, { [field]: file.path });
|
|
135
|
+
display.value = props.limit > fileList.value.length ? 'flex' : 'none';
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const handleRemove = (uploadFile, uploadFiles) => {
|
|
140
|
+
if (props.onRemove) {
|
|
141
|
+
return props.onRemove(uploadFile, fileList);
|
|
142
|
+
}
|
|
143
|
+
loading.value = false;
|
|
144
|
+
console.log(uploadFile, uploadFiles);
|
|
145
|
+
display.value = 'flex';
|
|
146
|
+
emit('remove', uploadFile, fileList);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const onPreview = file => {
|
|
150
|
+
if (imgTypes.includes(file.raw.type)) {
|
|
151
|
+
const src = `${baseUrl}/ufil${file.response.path}`;
|
|
152
|
+
viewerApi({ options: { toolbar: true, url: 'data-source' }, images: [{ src, 'data-source': src }] });
|
|
153
|
+
} else {
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const emit = defineEmits<{
|
|
157
|
+
(e: 'remove', file: File, fileList: any): void;
|
|
158
|
+
}>();
|
|
159
|
+
</script>
|
|
160
|
+
|
|
161
|
+
<style lang="scss">
|
|
162
|
+
.ut-upload-wrapper {
|
|
163
|
+
.el-upload--picture-card {
|
|
164
|
+
display: v-bind(display);
|
|
165
|
+
width: v-bind(image_size) !important;
|
|
166
|
+
height: v-bind(image_size) !important;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.el-upload-list--picture-card .el-upload-list__item {
|
|
170
|
+
width: v-bind(image_size) !important;
|
|
171
|
+
height: v-bind(image_size) !important;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.el-upload-list--picture-card .el-progress {
|
|
175
|
+
width: v-bind(process_size) !important;
|
|
176
|
+
|
|
177
|
+
.el-progress-circle {
|
|
178
|
+
width: v-bind(process_size) !important;
|
|
179
|
+
height: v-bind(process_size) !important;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
</style>
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2021-11-29 21:02:43
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2025-07-14 17:38:19
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div>
|
|
11
|
+
<vxe-modal
|
|
12
|
+
v-model="showModal"
|
|
13
|
+
:title="title"
|
|
14
|
+
:width="width"
|
|
15
|
+
:height="height"
|
|
16
|
+
:loading="loading"
|
|
17
|
+
:show-footer="dataStatus !== 'detail'"
|
|
18
|
+
v-bind="modalAttrs"
|
|
19
|
+
min-width="240"
|
|
20
|
+
min-height="300"
|
|
21
|
+
destroy-on-close
|
|
22
|
+
resize
|
|
23
|
+
@close="onClose"
|
|
24
|
+
>
|
|
25
|
+
<template #default>
|
|
26
|
+
<vxe-form
|
|
27
|
+
ref="xForm"
|
|
28
|
+
:data="record"
|
|
29
|
+
:items="formItems"
|
|
30
|
+
:rules="rules"
|
|
31
|
+
title-align="right"
|
|
32
|
+
:title-width="formAttrs.titleWidth || 90"
|
|
33
|
+
v-bind="formAttrs"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
<template #footer>
|
|
37
|
+
<ut-button status="warning" content="cancel" icon="ri-close-line" @tap="onClose" />
|
|
38
|
+
<ut-button status="u-cyan" content="confirm" icon="ri-save-3-line" @tap="onConfirm" />
|
|
39
|
+
</template>
|
|
40
|
+
</vxe-modal>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
export default {
|
|
46
|
+
name: 'UtModalForm'
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
<script lang="ts" setup>
|
|
50
|
+
import { onBeforeMount, ref, computed, getCurrentInstance, useAttrs } from 'vue';
|
|
51
|
+
import { useI18n } from 'vue-i18n';
|
|
52
|
+
import { getAttrs, formatItems } from './utils';
|
|
53
|
+
import to from 'await-to-js';
|
|
54
|
+
import { formatRules, successMessage } from '@utogether/utils';
|
|
55
|
+
|
|
56
|
+
// import type { IRecord, IFormItemProps } from '../../types';
|
|
57
|
+
|
|
58
|
+
export interface IProps {
|
|
59
|
+
record: IRecord; // 数据对象
|
|
60
|
+
formAttrs?: IRecord;
|
|
61
|
+
modalAttrs?: IRecord;
|
|
62
|
+
items: Array<IFormItemProps>; // form item
|
|
63
|
+
url?: string; // 服务路径
|
|
64
|
+
method?: string; // 请求方式
|
|
65
|
+
title?: string; // 标题
|
|
66
|
+
dataStatus?: string; // 状态
|
|
67
|
+
width?: number;
|
|
68
|
+
height?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
72
|
+
record: (): IRecord => {
|
|
73
|
+
return {};
|
|
74
|
+
},
|
|
75
|
+
formAttrs: (): IRecord => {
|
|
76
|
+
return {};
|
|
77
|
+
},
|
|
78
|
+
items: () => [],
|
|
79
|
+
title: '数据记录',
|
|
80
|
+
width: 420,
|
|
81
|
+
height: 360,
|
|
82
|
+
dataStatus: 'detail',
|
|
83
|
+
url: '',
|
|
84
|
+
method: 'post'
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const attrs: IRecord = getAttrs(useAttrs());
|
|
88
|
+
|
|
89
|
+
const loading = ref(false);
|
|
90
|
+
const instance = getCurrentInstance()!;
|
|
91
|
+
|
|
92
|
+
const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @description: 根据items 获取必填选
|
|
96
|
+
*/
|
|
97
|
+
const rules = computed(() => {
|
|
98
|
+
if (!props.items.length) return {};
|
|
99
|
+
return formatRules(props.items, t);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const formItems = computed(() => {
|
|
103
|
+
if (!props.items.length) return props.items;
|
|
104
|
+
return formatItems(props.items, props.dataStatus);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const { t } = useI18n();
|
|
108
|
+
const showModal = ref(false);
|
|
109
|
+
|
|
110
|
+
const xForm = ref(null);
|
|
111
|
+
/**
|
|
112
|
+
* @description: 弹框确认
|
|
113
|
+
*/
|
|
114
|
+
const onConfirm = () => {
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
xForm.value.validate(async (valid: boolean) => {
|
|
117
|
+
if (!valid) {
|
|
118
|
+
const { record, url, method } = props;
|
|
119
|
+
if (url) {
|
|
120
|
+
showLoading();
|
|
121
|
+
const body = attrs?.dataProcessMethod ? attrs?.dataProcessMethod(record) : record;
|
|
122
|
+
if (url) {
|
|
123
|
+
const [err, data] = await to(serviceApi[method](url, body));
|
|
124
|
+
if (!err) {
|
|
125
|
+
successMessage();
|
|
126
|
+
emit('confirm', data);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
hiddenLoading();
|
|
130
|
+
onClose();
|
|
131
|
+
} else {
|
|
132
|
+
emit('confirm');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @description: 显示加载框
|
|
140
|
+
*/
|
|
141
|
+
const showLoading = () => {
|
|
142
|
+
loading.value = true;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @description: 关闭加载框
|
|
147
|
+
*/
|
|
148
|
+
const hiddenLoading = () => {
|
|
149
|
+
loading.value = false;
|
|
150
|
+
};
|
|
151
|
+
const validateForm = (cb: Function) => {
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
xForm.value.validate(cb);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @description: 关闭弹框
|
|
158
|
+
*/
|
|
159
|
+
const onClose = () => {
|
|
160
|
+
showModal.value = false;
|
|
161
|
+
emit('close');
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @description: 打开弹框
|
|
165
|
+
*/
|
|
166
|
+
const openModal = () => {
|
|
167
|
+
showModal.value = true;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const emit = defineEmits<{
|
|
171
|
+
(e: 'close'): void;
|
|
172
|
+
(e: 'confirm', record?: any): void;
|
|
173
|
+
}>();
|
|
174
|
+
|
|
175
|
+
defineExpose({ showLoading, hiddenLoading, openModal, validateForm });
|
|
176
|
+
|
|
177
|
+
onBeforeMount(() => {
|
|
178
|
+
openModal();
|
|
179
|
+
});
|
|
180
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useRender } from '@utogether/utils';
|
|
2
|
+
|
|
3
|
+
export const getAttrs = attrs => {
|
|
4
|
+
const data = {};
|
|
5
|
+
Object.keys(attrs).forEach(key => {
|
|
6
|
+
const nKey = key.replace(/-(\w)/g, str => str.slice(1).toUpperCase());
|
|
7
|
+
data[nKey] = attrs[key];
|
|
8
|
+
});
|
|
9
|
+
return data;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const formatItems = (items, status, span = 24) => {
|
|
13
|
+
const renderHook = useRender();
|
|
14
|
+
|
|
15
|
+
if (!items.length) return items;
|
|
16
|
+
return items.map(item => {
|
|
17
|
+
item.title = item.title || `message.${item.field}`;
|
|
18
|
+
item.span = item.span || span;
|
|
19
|
+
let disabled = false;
|
|
20
|
+
if (status === 'detail') {
|
|
21
|
+
disabled = true;
|
|
22
|
+
item.placeholder = null;
|
|
23
|
+
} else {
|
|
24
|
+
disabled =
|
|
25
|
+
item.disabled === false ? item.disabled : item.disabled || item.itemRender?.props?.disabled;
|
|
26
|
+
}
|
|
27
|
+
let itemRender = {
|
|
28
|
+
name: 'VxeInput',
|
|
29
|
+
props: { disabled, placeholder: disabled ? '' : item.placeholder }
|
|
30
|
+
};
|
|
31
|
+
if (item.code && !item.itemRender) {
|
|
32
|
+
itemRender = renderHook.renderDict(item.code);
|
|
33
|
+
}
|
|
34
|
+
item.itemRender = item.itemRender || itemRender;
|
|
35
|
+
item.itemRender['props'] = Object.assign(item.itemRender.props || {}, {
|
|
36
|
+
disabled
|
|
37
|
+
});
|
|
38
|
+
return item;
|
|
39
|
+
});
|
|
40
|
+
};
|