@utogether/udp-core 1.0.3 → 1.0.4-beta.1

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 (78) hide show
  1. package/dist/{403-D6H3sArg.js → 403-CH-5FVhN.js} +1 -1
  2. package/dist/{404-DTyfysQ2.js → 404-CFk6Ivq-.js} +1 -1
  3. package/dist/{500-DKaVDaBm.js → 500-DRjSNKN3.js} +1 -1
  4. package/dist/{AuthorityInfo-DQULR69Y.js → AuthorityInfo-DxNFwxdz.js} +1 -1
  5. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-CzAnoTnO.js → AuthorityInfo.vue_vue_type_style_index_0_lang-BI2PKcqq.js} +1 -1
  6. package/dist/{AuthorityPanel-BeBNiwqc.js → AuthorityPanel-BzIh29KB.js} +1 -1
  7. package/dist/{AuthorityPanel.vue_vue_type_style_index_0_lang-CIYmnP9-.js → AuthorityPanel.vue_vue_type_style_index_0_lang-D3GN0Ybz.js} +32 -24
  8. package/dist/{Company-BWFrR-Cq.js → Company-DGFD7_MF.js} +3 -3
  9. package/dist/{CompanyPanel-Dh814lsw.js → CompanyPanel-BHXndpIr.js} +1 -1
  10. package/dist/{Department-DagPxerl.js → Department-CFcjdf8m.js} +3 -3
  11. package/dist/{DepartmentPanel-BVy2YGED.js → DepartmentPanel-DrBtJClY.js} +1 -1
  12. package/dist/{DesignPanel-DKfjfj2S.js → DesignPanel-EAKuwOqp.js} +1 -1
  13. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-D-a8W08Y.js → DesignPanel.vue_vue_type_style_index_0_lang-BOP4Q41a.js} +2 -2
  14. package/dist/{DictView-CE5nEiKu.js → DictView-CpRvxDO0.js} +1 -1
  15. package/dist/{InvOrganization-CZk_EbFZ.js → InvOrganization-DZC9aKKv.js} +1 -1
  16. package/dist/{Org-BO8jfnqN.js → Org-D5heLogi.js} +1 -1
  17. package/dist/{Preview-DYJaP96f.js → Preview-DWuThn2_.js} +1 -1
  18. package/dist/{ReportDefine-DZXbs7iX.js → ReportDefine-FeHx3B-B.js} +1 -1
  19. package/dist/{ReportDesign-CSdqOQ1D.js → ReportDesign-Deo5AK76.js} +2 -2
  20. package/dist/{ReportQuery-_Vdt3CnA.js → ReportQuery-WK5BPREv.js} +1 -1
  21. package/dist/{ReportQueryFrom-BWKddh9p.js → ReportQueryFrom-BcbRvwcp.js} +1 -1
  22. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-DbdGwioi.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-DEXuBXHO.js} +1 -1
  23. package/dist/{ReportTemplate-DS-DGao8.js → ReportTemplate-DAk0qIJq.js} +1 -1
  24. package/dist/{Role-BM0kEu7y.js → Role-sSVr8txF.js} +3 -3
  25. package/dist/{RoleAssign-Cp05HUWn.js → RoleAssign-gg9O7P1_.js} +3 -3
  26. package/dist/{RolePanel-hXeshcCZ.js → RolePanel-D2M-Wc-X.js} +1 -1
  27. package/dist/{RolePanel-DeuHpCdK.js → RolePanel-DsyVPcoq.js} +1 -1
  28. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-CNyWCIJm.js → RolePanel.vue_vue_type_script_setup_true_lang-C4fuYoIS.js} +1 -1
  29. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-Bf0pSCTN.js → RolePanel.vue_vue_type_script_setup_true_lang-RR24avbF.js} +3 -3
  30. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-BiKe39xG.js → ScrollPanel.vue_vue_type_style_index_0_lang-6v5vVx-e.js} +1 -1
  31. package/dist/{Staff-DLltLFMl.js → Staff-DTDrOuE0.js} +3 -3
  32. package/dist/{StaffInfo-pfELaI_i.js → StaffInfo-B2H_6lwQ.js} +1 -1
  33. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-BKKdNggm.js → StaffInfo.vue_vue_type_script_setup_true_lang-BkDRBn9p.js} +1 -1
  34. package/dist/{StaffPanel-D3Pk28JN.js → StaffPanel-dpmnAD0A.js} +1 -1
  35. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-D9HLeyKe.js → StaffPanel.vue_vue_type_script_setup_true_lang-dgV9B37R.js} +2 -2
  36. package/dist/{SysUser-BOh7ejz3.js → SysUser-BjpQdzSo.js} +2 -2
  37. package/dist/{SysUserPanel-RElVo0BV.js → SysUserPanel-C5IHO7JB.js} +1 -1
  38. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-DoW0v5y9.js → SysUserPanel.vue_vue_type_script_setup_true_lang-HvJ4Hrps.js} +1 -1
  39. package/dist/{SystemMenu-DZneBqKO.js → SystemMenu-D7W9E8SF.js} +52 -49
  40. package/dist/{UserInfo-D9qo_f_9.js → UserInfo-D_lbSbUh.js} +1 -1
  41. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-CY4dtMnZ.js → UserInfo.vue_vue_type_style_index_0_lang-NLl8VJ5I.js} +1 -1
  42. package/dist/{childView-CmlGxD9G.js → childView-B1XV2jZ7.js} +1 -1
  43. package/dist/{childView-DStrPumM.js → childView-LQllG9vw.js} +1 -1
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-Dtv1rrdP.js → childView.vue_vue_type_style_index_0_lang-DN19uWOO.js} +1 -1
  45. package/dist/{childView.vue_vue_type_style_index_0_lang-B9k694be.js → childView.vue_vue_type_style_index_0_lang-Dpo_nfX9.js} +1 -1
  46. package/dist/{code-rule-CxzgQDH_.js → code-rule-DkKKcosO.js} +1 -1
  47. package/dist/core.es.js +1 -1
  48. package/dist/{cron-task-kbyRTz97.js → cron-task-bGVrr2Jg.js} +1 -1
  49. package/dist/{frameView-BawZlIge.js → frameView-B3n2JXTj.js} +1 -1
  50. package/dist/{index-nkstuOxE.js → index-DYT0k5Sg.js} +3562 -961
  51. package/dist/{layoutView-DVGqPJmA.js → layoutView-bh22tftc.js} +144 -145
  52. package/dist/{log-in-j2PZGLQH.js → log-in-Dk_xyZ_l.js} +1 -1
  53. package/dist/{log-out-DIJU-Vpf.js → log-out-CERhlqtr.js} +1 -1
  54. package/dist/{login-DvmHMcgD.js → login-C5EJWWLi.js} +124 -134
  55. package/dist/{lov-view-C-dIDLh8.js → lov-view-BNGHpq-d.js} +2 -2
  56. package/dist/{menuInfo-D0mcKmrT.js → menuInfo-2DBTH6Vf.js} +1 -1
  57. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-CbwS7aGl.js → menuInfo.vue_vue_type_style_index_0_lang-KtLS__XM.js} +37 -35
  58. package/dist/{pda-app-BjvyTDkw.js → pda-app-BzmHIT9A.js} +1 -1
  59. package/dist/{resource-BknIxaTQ.js → resource-D6UY8vN8.js} +1 -1
  60. package/dist/{su-welcome-CwtvamZC.js → su-welcome-okexK2W2.js} +1 -1
  61. package/dist/{sys-config-CCKhGcCL.js → sys-config-9F_C1LzR.js} +1 -1
  62. package/dist/udp-core.css +1 -1
  63. package/package.json +1 -1
  64. package/src/App.vue +73 -65
  65. package/src/components/udp/form-upload/form-upload.vue +492 -0
  66. package/src/components/udp/index.ts +2 -1
  67. package/src/layout/components/lay-content/index.vue +136 -143
  68. package/src/layout/components/lay-sidebar/sidebar-logo.vue +1 -1
  69. package/src/layout/layoutView.vue +7 -6
  70. package/src/main.ts +2 -2
  71. package/src/plugins/i18n/zh.ts +1 -0
  72. package/src/plugins/vxe-table/index.ts +1 -1
  73. package/src/plugins/vxe-table/render.tsx +19 -1
  74. package/src/style/vxetable.scss +356 -348
  75. package/src/views/system/menu/AuthorityPanel.vue +142 -140
  76. package/src/views/system/menu/SystemMenu.vue +10 -1
  77. package/src/views/system/menu/menuInfo.vue +384 -384
  78. package/src/views/ulogin/login.vue +34 -23
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@utogether/udp-core",
3
3
  "private": false,
4
- "version": "1.0.3",
4
+ "version": "1.0.4-beta.1",
5
5
  "description": "",
6
6
  "type": "module",
7
7
  "main1": "index.ts",
package/src/App.vue CHANGED
@@ -1,65 +1,73 @@
1
- <!--
2
- * @Author: wei.li
3
- * @Date: 2021-12-23 17:33:19
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-08-13 08:39:18
6
- * @Description: file content
7
- -->
8
- <template>
9
- <el-config-provider size="small" :z-index="5555" :locale="currentLocale">
10
- <router-view />
11
- </el-config-provider>
12
- </template>
13
-
14
- <script lang="ts">
15
- import { defineComponent } from 'vue';
16
- import { ElConfigProvider } from 'element-plus';
17
- import { checkVersion } from 'version-rocket';
18
- import { useI18n } from 'vue-i18n';
19
- import en from 'element-plus/es/locale/lang/en';
20
- import zhCn from 'element-plus/es/locale/lang/zh-cn';
21
- import { storageLocal } from '@utogether/utils';
22
- import { kSYSCONFIG } from './contant';
23
- import { getServiceApi } from './api';
24
-
25
- export default defineComponent({
26
- name: 'app',
27
- components: {
28
- [ElConfigProvider.name]: ElConfigProvider
29
- },
30
- beforeRouteEnter(to, from, next) {
31
- getServiceApi()
32
- .get('/upfm/v1/sysConfig', {})
33
- .then(res => {
34
- console.log(res);
35
- next();
36
- });
37
- },
38
- computed: {
39
- currentLocale() {
40
- return this.$storage?.locale?.locale === 'zh' ? zhCn : en;
41
- }
42
- },
43
- beforeCreate() {
44
- const { t } = useI18n();
45
- const sysConfig = storageLocal.getItem(kSYSCONFIG);
46
- const config = sysConfig || { title: 'U-DP' };
47
- const title = config['title'];
48
- // 版本实时更新检测,只作用于线上环境
49
- // 5分钟检测一次版本
50
- checkVersion(
51
- {
52
- pollingTime: 300000,
53
- checkOriginSpecifiedFilesUrl: [`${location.origin}/index.html`],
54
- enable: process.env.NODE_ENV !== 'development'
55
- },
56
- {
57
- title,
58
- description: t('message.udp.newVersion'),
59
- buttonText: t('message.udp.updatenow'),
60
- cancelButtonText: t('message.udp.updateLater')
61
- }
62
- );
63
- }
64
- });
65
- </script>
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2021-12-23 17:33:19
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-12-23 13:42:57
6
+ * @Description: file content
7
+ -->
8
+ <template>
9
+ <el-config-provider size="small" :z-index="5555" :locale="currentLocale">
10
+ <router-view />
11
+ </el-config-provider>
12
+ </template>
13
+
14
+ <script lang="ts">
15
+ import { defineComponent } from 'vue';
16
+ import { ElConfigProvider } from 'element-plus';
17
+ import { checkVersion } from 'version-rocket';
18
+ import { useI18n } from 'vue-i18n';
19
+ import en from 'element-plus/es/locale/lang/en';
20
+ import zhCn from 'element-plus/es/locale/lang/zh-cn';
21
+ import { storageLocal } from '@utogether/utils';
22
+ import { kSYSCONFIG } from './contant';
23
+ import { getServiceApi, getBaseURL } from './api';
24
+
25
+ export default defineComponent({
26
+ name: 'app',
27
+ components: {
28
+ [ElConfigProvider.name]: ElConfigProvider
29
+ },
30
+ computed: {
31
+ currentLocale() {
32
+ return this.$storage?.locale?.locale === 'zh' ? zhCn : en;
33
+ }
34
+ },
35
+ async beforeCreate() {
36
+ await getServiceApi()
37
+ .get('/upfm/v1/sysConfig', {})
38
+ .then(res => {
39
+ const config = {};
40
+ res.list?.forEach(item => {
41
+ config[item.configCode] = item.configValue;
42
+ if (item.fileName) {
43
+ config[item.configCode] = getBaseURL() + '/ufil' + item.configValue;
44
+ }
45
+ });
46
+ const title = res.list?.find(f => f.configCode === 'title')?.configValue;
47
+ config['title'] = title || 'U-DP';
48
+ this.pollingVersion(config['title']);
49
+ storageLocal.setItem(kSYSCONFIG, config);
50
+ });
51
+ },
52
+ methods: {
53
+ // / 版本实时更新检测,只作用于线上环境
54
+ pollingVersion(title) {
55
+ const { t } = useI18n();
56
+ // 5分钟检测一次版本
57
+ checkVersion(
58
+ {
59
+ pollingTime: 300000,
60
+ checkOriginSpecifiedFilesUrl: [`${location.origin}/index.html`],
61
+ enable: process.env.NODE_ENV !== 'development'
62
+ },
63
+ {
64
+ title,
65
+ description: t('message.udp.newVersion'),
66
+ buttonText: t('message.udp.updatenow'),
67
+ cancelButtonText: t('message.udp.updateLater')
68
+ }
69
+ );
70
+ }
71
+ }
72
+ });
73
+ </script>
@@ -0,0 +1,492 @@
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2022-11-04 14:53:36
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-12-15 16:20:41
6
+ * @Description: form upload
7
+ -->
8
+ <template>
9
+ <div class="flex w-full flex-wrap">
10
+ <div class="ut-upload-list flex flex-wrap items-center">
11
+ <div v-for="(item, idx) in fileList" :key="item" :class="'ut-upload-item--' + size">
12
+ <div class="ut-upload--image flex items-center justify-center">
13
+ <img
14
+ v-if="getItemType(item) === 'img'"
15
+ :src="item.url"
16
+ class="ut-image select-none"
17
+ @click="onPreview(item)"
18
+ />
19
+ <div v-else-if="renderMode === 'item' || dataStatus !== 'detail'" class="ut-image-hover">
20
+ <div class="ut-image-file--wrapper">
21
+ <i :class="getItemType(item)" class="ut-image-file ut-image" style="line-height: 1" />
22
+ <div class="px-1 ut-image" :style="{ fontSize: size === 'small' ? '11px' : '10px' }">
23
+ {{ maskFilenameFromPath(item) }}
24
+ </div>
25
+ </div>
26
+ <i
27
+ class="vxe-icon-download ut-download-icon"
28
+ :style="{ fontSize: renderMode === 'item' ? '60px' : '48px' }"
29
+ @click="onDownload(item)"
30
+ />
31
+ </div>
32
+ <vxe-tooltip v-else :content="item.name" class="cursor-pointer">
33
+ <div class="ut-image-hover">
34
+ <div class="ut-image-file--wrapper">
35
+ <i :class="getItemType(item)" class="ut-image-file ut-image" style="font-size: 32px" />
36
+ <div class="px-1 ut-image" :style="{ fontSize: size === 'small' ? '11px' : '10px' }">
37
+ {{ maskFilenameFromPath(item) }}
38
+ </div>
39
+ </div>
40
+ <i
41
+ class="vxe-icon-download ut-download-icon"
42
+ :style="{ fontSize: renderMode === 'item' ? '60px' : '48px' }"
43
+ @click="onDownload(item)"
44
+ />
45
+ </div>
46
+ </vxe-tooltip>
47
+ </div>
48
+ <div v-if="dataStatus !== 'detail'" class="ut-upload--image-item-btn-wrapper">
49
+ <div class="ut-upload-remove--btn">
50
+ <i class="vxe-icon-close" @click="onRemove(item, idx)" />
51
+ </div>
52
+ </div>
53
+ </div>
54
+ <div
55
+ v-if="dataStatus !== 'detail'"
56
+ :class="'ut-upload-item--' + size"
57
+ class="ut-upload--btn"
58
+ style="border: 1px dashed var(--vxe-ui-input-border-color)"
59
+ @click="onStartUpload"
60
+ >
61
+ <div class="flex items-center justify-center h-full flex-col cursor-pointer ut-upload--btn">
62
+ <span v-if="!loading" class="vxe-icon-add" style="font-size: 18px" />
63
+ <div v-if="!loading" style="padding: 0 1px; font-size: 11px; text-align: center">点击上传</div>
64
+ <vxe-icon v-if="loading" name="spinner" status="primary" roll style="font-size: 24px" />
65
+ <div v-if="loading" style="padding: 0 1px; font-size: 11px; text-align: center">
66
+ {{ progressText }}
67
+ </div>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ <vxe-upload
72
+ ref="xupload"
73
+ v-model="list"
74
+ style="display: none"
75
+ v-bind="$attrs"
76
+ :limit-count="limitCount"
77
+ :limit-size="limitSize"
78
+ :size="size"
79
+ :mode="mode"
80
+ :single-mode="singleMode"
81
+ :image-types="imageTypes"
82
+ :auto-hidden-button="autoHiddenButton"
83
+ :show-error-status="showErrorStatus"
84
+ :remove-method="handleRemove"
85
+ :upload-method="httpRequest"
86
+ :multiple="multiple"
87
+ :show-download-button="showDownloadButton"
88
+ :show-list="false"
89
+ show-progress
90
+ @upload-success="onSuccess"
91
+ />
92
+ </div>
93
+ </template>
94
+
95
+ <script lang="ts">
96
+ export default { name: 'FormUpload' };
97
+ </script>
98
+
99
+ <script setup lang="ts">
100
+ import { ref, computed, watch, onBeforeMount, getCurrentInstance } from 'vue';
101
+ import { cookies } from '@utogether/utils';
102
+ import compressorjs from 'compressorjs';
103
+ import { isString, isArray } from 'xe-utils';
104
+ import { VxeUI, VxeUploadPropTypes } from 'vxe-pc-ui';
105
+ import axios from 'axios';
106
+
107
+ export interface IProps {
108
+ record: object;
109
+ imageTypes?: Array<string>;
110
+ field: string;
111
+ dataStatus?: string;
112
+ renderMode?: string;
113
+ size?: VxeUploadPropTypes.Size;
114
+ mode?: VxeUploadPropTypes.Mode;
115
+ limitCount?: number;
116
+ limitSize?: number;
117
+ compassorSize?: number;
118
+ quality?: number;
119
+ singleMode?: boolean;
120
+ autoHiddenButton?: boolean;
121
+ showErrorStatus?: boolean;
122
+ showDownloadButton?: boolean;
123
+ multiple?: boolean;
124
+ success?: Function;
125
+ remove?: Function;
126
+ }
127
+ const props = withDefaults(defineProps<IProps>(), {
128
+ record: () => {
129
+ return {};
130
+ },
131
+ imageTypes: () => {
132
+ return ['jpg', 'jpeg', 'png', 'gif'];
133
+ },
134
+ field: '',
135
+ renderMode: 'item',
136
+ dataStatus: '',
137
+ size: 'mini',
138
+ mode: '',
139
+ singleMode: false,
140
+ autoHiddenButton: false,
141
+ showDownloadButton: false,
142
+ multiple: false,
143
+ limitSize: 30,
144
+ limitCount: 9,
145
+ quality: 0.6,
146
+ compassorSize: 2
147
+ });
148
+
149
+ watch(
150
+ () => props.record[props.field],
151
+ val => {
152
+ initData();
153
+ }
154
+ );
155
+
156
+ const instance = getCurrentInstance()!;
157
+ const baseUrl = instance.appContext.config.globalProperties.$url;
158
+ // const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
159
+ const progressText = ref('');
160
+ const loading = ref(false);
161
+
162
+ const imgTypes = ['image/gif', 'image/jpeg', 'image/png'];
163
+ const xupload = ref(null);
164
+
165
+ const headers = computed(() => {
166
+ const kTOKENKEY = 'authorized-token';
167
+ const token = cookies.get(kTOKENKEY)!;
168
+ const data = JSON.parse(token);
169
+ const headers = {
170
+ Authorization: 'Bearer ' + data.accessToken
171
+ };
172
+ return headers;
173
+ });
174
+ const list = ref([]);
175
+ const fileList = ref<any>([]);
176
+
177
+ const httpRequest = options => {
178
+ if (imgTypes.includes(options.file.type) && options.file.size > 1024 * 1024 * props.compassorSize) {
179
+ return new Promise((resolve, reject) => {
180
+ new compressorjs(options.file, {
181
+ quality: props.quality,
182
+ mimeType: options.file.type,
183
+ success(result: File) {
184
+ const file = new File([result], result.name, { type: result.type });
185
+ uploadProcess(resolve, reject, file);
186
+ console.log({ result, file });
187
+ }
188
+ });
189
+ });
190
+ } else {
191
+ return new Promise((resolve, reject) => uploadProcess(resolve, reject, options.file));
192
+ }
193
+ };
194
+
195
+ const uploadProcess = (resolve, reject, file) => {
196
+ const formBody = new FormData();
197
+ formBody.append('file', file);
198
+ const url = baseUrl + '/ufil/file/uploadMultipart';
199
+ loading.value = true;
200
+ return axios
201
+ .post(url, formBody, {
202
+ headers: Object.assign({ 'Content-Type': 'multipart/form-data' }, headers.value),
203
+ onUploadProgress(progressEvent) {
204
+ const progress = Math.round((progressEvent.loaded * 100) / (progressEvent.total || 0));
205
+ progressText.value = `进度${progress}%`;
206
+ }
207
+ })
208
+ .then(async response => {
209
+ progressText.value = `处理中...`;
210
+ file.path = response.data.data;
211
+ file.url = `${baseUrl}/ufil${file.path}`;
212
+ fileList.value.push(file);
213
+ console.log(file);
214
+ loading.value = false;
215
+ resolve(file);
216
+ })
217
+ .catch(() => {
218
+ loading.value = false;
219
+ reject(null);
220
+ });
221
+ };
222
+
223
+ const onStartUpload = () => {
224
+ xupload.value.choose();
225
+ };
226
+
227
+ const onSuccess = ({ data }) => {
228
+ if (props.success) {
229
+ return props.success(data);
230
+ } else {
231
+ const field = props.field;
232
+ Object.assign(props.record, { [field]: data.path });
233
+ }
234
+ console.log(props.record, fileList);
235
+ };
236
+
237
+ const handleRemove: VxeUploadPropTypes.RemoveMethod = ({ option }) => {
238
+ if (props.remove) {
239
+ return props.remove(option, fileList);
240
+ }
241
+ emit('remove', option, fileList);
242
+ };
243
+
244
+ const onRemove = (file, idx) => {
245
+ fileList.value.splice(idx, 1);
246
+ emit('remove', file, fileList);
247
+ };
248
+
249
+ const onPreview = item => {
250
+ // console.log(item.url);
251
+ VxeUI.previewImage({ activeIndex: 0, urlList: [item.url] });
252
+ };
253
+
254
+ const getItemType = item => {
255
+ const type = item.type || item.url.split('.').pop();
256
+ let icon = '';
257
+ switch (type) {
258
+ case 'jpg':
259
+ case 'png':
260
+ case 'jpeg':
261
+ case 'webp':
262
+ case 'image/jpeg':
263
+ case 'image/png':
264
+ case 'image/gif':
265
+ icon = 'img';
266
+ break;
267
+ case 'doc':
268
+ case 'docx':
269
+ icon = 'vxe-icon-file-word';
270
+ break;
271
+ case 'xlsx':
272
+ case 'xls':
273
+ icon = 'vxe-icon-file-excel';
274
+ break;
275
+ case 'pdf':
276
+ icon = 'vxe-icon-file-pdf';
277
+ break;
278
+ case 'txt':
279
+ icon = 'vxe-icon-file-txt';
280
+ break;
281
+ case 'ppt':
282
+ icon = 'vxe-icon-file-ppt';
283
+ break;
284
+ case 'markdown':
285
+ icon = 'vxe-icon-file-markdown';
286
+ break;
287
+ case 'apk':
288
+ icon = 'ri-android-fill';
289
+ break;
290
+ case 'ipa':
291
+ icon = 'ri-apple-line';
292
+ break;
293
+
294
+ default:
295
+ icon = 'vxe-icon-file';
296
+ break;
297
+ }
298
+ return icon;
299
+ };
300
+
301
+ const maskFilenameFromPath = file => {
302
+ let total = props.size === 'small' ? 10 : 9;
303
+ // 提取纯文件名(含扩展名)
304
+ const extractFilename = file => {
305
+ if (file.name) return file.name;
306
+ const path = file.url;
307
+ const separator = path.includes('\\') ? '\\' : '/';
308
+ return path.split(separator).pop();
309
+ };
310
+
311
+ // 处理文件名脱敏
312
+ const maskFilename = filename => {
313
+ const dotPos = filename.lastIndexOf('.');
314
+ const name = dotPos > 0 ? filename.substring(0, dotPos) : filename;
315
+ const ext = dotPos > 0 ? filename.substring(dotPos) : '';
316
+
317
+ if (name.length <= total) return filename;
318
+
319
+ const prefix = props.renderMode === 'item' ? name.substring(0, total - 5) : '';
320
+ const suffix = name.substring(name.length - (total - 6));
321
+ return `${prefix}...${suffix}${ext}`;
322
+ };
323
+
324
+ return maskFilename(extractFilename(file));
325
+ };
326
+
327
+ const onDownload = file => {
328
+ console.log(file);
329
+ };
330
+ const emit = defineEmits<{
331
+ (e: 'remove', file: any, fileList: any): void;
332
+ }>();
333
+
334
+ const initData = () => {
335
+ const fileUrl = props.record[props.field];
336
+ fileList.value = [];
337
+ if (fileUrl) {
338
+ if (fileUrl && isString(fileUrl)) {
339
+ const name = fileUrl.match(/[^\/\\]+$/)[0];
340
+ const file = { name, url: `${baseUrl}/ufil${fileUrl}` };
341
+ if (props.singleMode) {
342
+ fileList.value = file;
343
+ } else {
344
+ fileList.value.push(file);
345
+ }
346
+ } else if (isArray(fileUrl)) {
347
+ fileUrl.forEach(file => {
348
+ if (isString(file)) {
349
+ const name = file.match(/[^\/\\]+$/)[0];
350
+ fileList.value.push({ name, url: `${baseUrl}/ufil${file}` });
351
+ } else {
352
+ fileList.value.push({
353
+ name: file.name,
354
+ url: `${baseUrl}/ufil${file.realpath}`
355
+ });
356
+ }
357
+ });
358
+ }
359
+ }
360
+ };
361
+
362
+ onBeforeMount(() => {
363
+ initData();
364
+ console.log('fileList');
365
+ });
366
+ </script>
367
+
368
+ <style lang="scss">
369
+ .ut-upload-item--small {
370
+ position: relative;
371
+ width: var(--vxe-ui-upload-image-wh-small);
372
+ height: var(--vxe-ui-upload-image-wh-small);
373
+ margin: var(--vxe-ui-layout-padding-half);
374
+ border: 1px solid var(--vxe-ui-input-border-color);
375
+ border-radius: var(--vxe-ui-base-border-radius);
376
+
377
+ .ut-upload--image {
378
+ position: relative;
379
+ width: var(--vxe-ui-upload-image-wh-small);
380
+ height: var(--vxe-ui-upload-image-wh-small);
381
+ border-radius: var(--vxe-ui-base-border-radius);
382
+
383
+ .ut-image-file--wrapper {
384
+ display: flex;
385
+ flex-direction: column;
386
+ align-items: center;
387
+
388
+ .ut-image-file {
389
+ font-size: 48px;
390
+ }
391
+ }
392
+ }
393
+ }
394
+
395
+ .ut-upload-item--mini {
396
+ position: relative;
397
+ width: var(--vxe-ui-upload-image-wh-mini);
398
+ height: var(--vxe-ui-upload-image-wh-mini);
399
+ margin: var(--vxe-ui-layout-padding-half);
400
+ border: 1px solid var(--vxe-ui-input-border-color);
401
+ border-radius: var(--vxe-ui-base-border-radius);
402
+
403
+ .ut-upload--image {
404
+ position: relative;
405
+ width: var(--vxe-ui-upload-image-wh-mini);
406
+ height: var(--vxe-ui-upload-image-wh-mini);
407
+ border-radius: var(--vxe-ui-base-border-radius);
408
+
409
+ .ut-image-file--wrapper {
410
+ display: flex;
411
+ flex-direction: column;
412
+ align-items: center;
413
+
414
+ .ut-image-file {
415
+ font-size: 42px;
416
+ }
417
+ }
418
+ }
419
+ }
420
+
421
+ .ut-upload-item--xs {
422
+ position: relative;
423
+ width: 48px;
424
+ height: 48px;
425
+ margin: var(--vxe-ui-layout-padding-half);
426
+ border: 1px solid var(--vxe-ui-input-border-color);
427
+ border-radius: var(--vxe-ui-base-border-radius);
428
+
429
+ .ut-upload--image {
430
+ position: relative;
431
+ width: 48px;
432
+ height: 48px;
433
+ border-radius: var(--vxe-ui-base-border-radius);
434
+
435
+ .ut-image-file--wrapper {
436
+ display: flex;
437
+ flex-direction: column;
438
+ align-items: center;
439
+
440
+ .ut-image-file {
441
+ font-size: 32px;
442
+ }
443
+ }
444
+ }
445
+ }
446
+
447
+ .ut-upload--btn:hover {
448
+ color: var(--udp-theme-vxeColor);
449
+ border: 1px dashed var(--udp-theme-vxeColor);
450
+ }
451
+
452
+ .ut-upload--image-item-btn-wrapper {
453
+ position: absolute;
454
+ top: calc(var(--vxe-ui-layout-padding-half) * -1);
455
+ right: calc(var(--vxe-ui-layout-padding-half) * -1);
456
+ display: inline-flex;
457
+ justify-content: center;
458
+
459
+ .ut-upload-remove--btn {
460
+ z-index: 3;
461
+ display: flex;
462
+ flex-direction: row;
463
+ align-items: center;
464
+ justify-content: center;
465
+ width: 1.8em;
466
+ height: 1.8em;
467
+ font-size: 0.8em;
468
+ color: #fff;
469
+ cursor: pointer;
470
+ background-color: var(--vxe-ui-status-error-color);
471
+ border-radius: 50%;
472
+ }
473
+ }
474
+
475
+ .ut-image {
476
+ height: 100%;
477
+ border-radius: var(--vxe-ui-base-border-radius);
478
+ }
479
+
480
+ .ut-image-hover:hover > .ut-image-file--wrapper {
481
+ display: none;
482
+ }
483
+
484
+ .ut-image-hover:hover > .ut-download-icon {
485
+ display: block;
486
+ }
487
+
488
+ .ut-download-icon {
489
+ display: none;
490
+ cursor: pointer;
491
+ }
492
+ </style>
@@ -1,5 +1,6 @@
1
1
  import UtGrid2 from './grid/index.vue';
2
2
  import UtForm2 from './form/form.vue';
3
3
  import UtContent2 from './content/index.vue';
4
+ import FormUpload2 from './form-upload/form-upload.vue';
4
5
 
5
- export { UtGrid2, UtForm2, UtContent2 };
6
+ export { UtGrid2, UtForm2, UtContent2, FormUpload2 };