@dt-frames/ui 2.0.13 → 2.0.15
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/es/components/container/index.d.ts +93 -2
- package/es/components/curd/index.js +6 -3
- package/es/components/curd/src/components/Curd.d.ts +12 -6
- package/es/components/curd/src/props.d.ts +6 -3
- package/es/components/form/index.js +21 -5
- package/es/components/form/index.less +30 -3
- package/es/components/form/src/components/FormButtons.d.ts +7 -0
- package/es/components/form/src/props.d.ts +3 -3
- package/es/components/form/src/types/form.type.d.ts +3 -3
- package/es/components/form/src/types/items.type.d.ts +25 -0
- package/es/components/modal/index.js +13 -3
- package/es/components/modal/src/components/ModalFooter.d.ts +6 -0
- package/es/components/modal/src/index.d.ts +6 -0
- package/es/components/source/hooks/useSource.d.ts +2 -0
- package/es/components/source/index.js +4 -1
- package/es/components/source/types/source.type.d.ts +1 -0
- package/es/components/table/index.js +107 -38
- package/es/components/table/index.less +11 -0
- package/es/components/table/src/components/TableAction.d.ts +13 -0
- package/es/components/table/src/index.d.ts +11 -4
- package/es/components/table/src/props.d.ts +4 -1
- package/es/components/table/src/types/table.type.d.ts +1 -0
- package/es/components/upload/index.d.ts +2 -0
- package/es/components/upload/index.js +216 -89
- package/es/components/upload/index.less +37 -7
- package/es/components/upload/src/basicProps.d.ts +4 -6
- package/es/components/upload/src/components/WordView.d.ts +6 -0
- package/es/components/upload/src/hooks/useFile.d.ts +2 -1
- package/es/components/upload/src/index.d.ts +23 -18
- package/es/components/upload/src/utils/upload.d.ts +1 -1
- package/es/packages/ui/src/assets/locales/en.d.ts +103 -0
- package/es/packages/ui/src/assets/locales/index.d.ts +2 -0
- package/es/packages/ui/src/assets/locales/zh.d.ts +104 -0
- package/es/packages/ui/src/components/form/index.d.ts +7 -0
- package/es/packages/ui/src/components/form/src/components/FormButtons.d.ts +105 -0
- package/es/packages/ui/src/components/form/src/components/FormItem.d.ts +159 -0
- package/es/packages/ui/src/components/form/src/components/componentMap.d.ts +4 -0
- package/es/packages/ui/src/components/form/src/components/formIcon.d.ts +1223 -0
- package/es/packages/ui/src/components/form/src/components/formInputUseDialog.d.ts +911 -0
- package/es/packages/ui/src/components/form/src/components/index.d.ts +4 -0
- package/es/packages/ui/src/components/form/src/components/radioButton.d.ts +34 -0
- package/es/packages/ui/src/components/form/src/enums/index.d.ts +7 -0
- package/es/packages/ui/src/components/form/src/hooks/helper.d.ts +14 -0
- package/es/packages/ui/src/components/form/src/hooks/useForm.d.ts +6 -0
- package/es/packages/ui/src/components/form/src/hooks/useFormActions.d.ts +12 -0
- package/es/packages/ui/src/components/form/src/hooks/useFormEvent.d.ts +25 -0
- package/es/packages/ui/src/components/form/src/hooks/useFormValue.d.ts +3 -0
- package/es/packages/ui/src/components/form/src/hooks/useFormValues.d.ts +11 -0
- package/es/packages/ui/src/components/form/src/hooks/useLabelWidth.d.ts +6 -0
- package/es/packages/ui/src/components/form/src/props.d.ts +127 -0
- package/es/packages/ui/src/components/form/src/types/actions.type.d.ts +15 -0
- package/es/packages/ui/src/components/form/src/types/form.type.d.ts +79 -0
- package/es/packages/ui/src/components/form/src/types/items.type.d.ts +409 -0
- package/es/packages/ui/src/components/iframe/index.d.ts +2 -0
- package/es/packages/ui/src/components/modal/index.d.ts +4 -0
- package/es/packages/ui/src/components/modal/src/hooks/useModal.d.ts +5 -0
- package/es/packages/ui/src/components/modal/src/props.d.ts +101 -0
- package/es/packages/ui/src/components/modal/src/types/modal.type.d.ts +17 -0
- package/es/packages/ui/src/components/upload/index.d.ts +4 -0
- package/es/packages/ui/src/components/upload/src/basicProps.d.ts +87 -0
- package/es/packages/ui/src/components/upload/src/components/PdfView.d.ts +9 -0
- package/es/packages/ui/src/components/upload/src/components/WordView.d.ts +6 -0
- package/es/packages/ui/src/components/upload/src/hooks/useFile.d.ts +16 -0
- package/es/packages/ui/src/components/upload/src/index.d.ts +242 -0
- package/es/packages/ui/src/components/upload/src/type/file.d.ts +10 -0
- package/es/packages/ui/src/components/upload/src/utils/upload.d.ts +2 -0
- package/es/packages/ui/src/global.d.ts +7 -0
- package/es/packages/ui/src/theme/index.d.ts +12 -0
- package/es/packages/ui/src/theme/src/components/header/helper/menu-tree.d.ts +4 -0
- package/es/packages/ui/src/theme/src/enums/index.d.ts +1 -0
- package/es/packages/ui/src/theme/src/enums/theme.enum.d.ts +34 -0
- package/es/packages/ui/src/theme/src/hooks/index.d.ts +6 -0
- package/es/packages/ui/src/theme/src/hooks/useDragLine.d.ts +2 -0
- package/es/packages/ui/src/theme/src/hooks/useHeader.d.ts +25 -0
- package/es/packages/ui/src/theme/src/hooks/useMenu.d.ts +29 -0
- package/es/packages/ui/src/theme/src/hooks/useMultifyTab.d.ts +8 -0
- package/es/packages/ui/src/theme/src/hooks/useOpenKeys.d.ts +7 -0
- package/es/packages/ui/src/theme/src/hooks/useTheme.d.ts +9 -0
- package/es/packages/ui/src/theme/src/setting/theme.setting.d.ts +2 -0
- package/es/packages/ui/src/theme/src/stores/index.d.ts +3 -0
- package/es/packages/ui/src/theme/src/stores/routeReuse.store.d.ts +25 -0
- package/es/packages/ui/src/theme/src/stores/theme.store.d.ts +19 -0
- package/es/packages/ui/src/theme/src/types/index.d.ts +3 -0
- package/es/packages/ui/src/theme/src/types/menu.type.d.ts +15 -0
- package/es/packages/ui/src/theme/src/types/theme.type.d.ts +62 -0
- package/es/packages/ui/src/utils/withInstall.d.ts +4 -0
- package/es/theme/index.js +616 -221
- package/es/theme/index.less +185 -11
- package/es/theme/src/components/header/components/lock/Lockscreen.d.ts +85 -0
- package/es/theme/src/components/header/components/lock/Recharge.d.ts +32 -0
- package/es/theme/src/components/header/components/lock/index.d.ts +2 -0
- package/es/theme/src/components/header/components/lock/useBattery.d.ts +11 -0
- package/es/theme/src/components/header/components/lock/useTime.d.ts +7 -0
- package/es/theme/src/components/header/components/logo.d.ts +1 -3
- package/es/theme/src/components/header/components/notify.d.ts +1 -3
- package/es/theme/src/components/header/components/user-info.d.ts +10 -3
- package/es/theme/src/components/header/index.d.ts +812 -809
- package/es/theme/src/components/header/multiple-header.d.ts +921 -918
- package/es/theme/src/components/sider/index.d.ts +1 -3
- package/es/theme/src/components/sider/mix-sider.d.ts +1 -3
- package/es/theme/src/hooks/useHeader.d.ts +1 -0
- package/es/theme/src/index.d.ts +2152 -2059
- package/es/theme/src/stores/lockscreen.store.d.ts +7 -0
- package/manualContentPath.js +4 -0
- package/package.json +2 -1
- package/vite.config.ts +1 -0
|
@@ -10,6 +10,9 @@ export declare const TableProps: {
|
|
|
10
10
|
type: BooleanConstructor;
|
|
11
11
|
default: boolean;
|
|
12
12
|
};
|
|
13
|
+
authPrefix: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
};
|
|
13
16
|
clickToSelectRow: {
|
|
14
17
|
type: BooleanConstructor;
|
|
15
18
|
default: boolean;
|
|
@@ -76,7 +79,7 @@ export declare const TableProps: {
|
|
|
76
79
|
type: BooleanConstructor;
|
|
77
80
|
default: boolean;
|
|
78
81
|
};
|
|
79
|
-
|
|
82
|
+
expandActions: {
|
|
80
83
|
type: BooleanConstructor;
|
|
81
84
|
default: boolean;
|
|
82
85
|
};
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { Button,
|
|
2
|
-
import "ant-design-vue/es/upload/style";
|
|
1
|
+
import { Button, Upload, Image } from "ant-design-vue/es";
|
|
3
2
|
import "ant-design-vue/es/image/style";
|
|
3
|
+
import "ant-design-vue/es/upload/style";
|
|
4
4
|
import "ant-design-vue/es/button/style";
|
|
5
|
-
import {
|
|
5
|
+
import { computed, unref, ref, watch, defineComponent, openBlock, createBlock, withCtx, createVNode, createElementVNode, toRefs, createElementBlock, mergeProps, isRef, createSlots, toDisplayString, Fragment, renderList, normalizeClass, createCommentVNode, renderSlot, normalizeProps, guardReactiveProps } from "vue";
|
|
6
6
|
import { takeRight, omit } from "lodash-es";
|
|
7
|
-
import { useAppStore, useMessage, isFunction, http, HttpContentTypeEnum } from "@dt-frames/core";
|
|
7
|
+
import { useAppStore, useMessage, isString, dispatchResize, isFunction, http, HttpContentTypeEnum } from "@dt-frames/core";
|
|
8
8
|
import { useModal, DtModal, useModalOut } from "../modal";
|
|
9
9
|
import { DtIframe } from "../iframe";
|
|
10
|
+
import { renderAsync } from "docx-preview";
|
|
10
11
|
const basicProps = {
|
|
11
12
|
uploadUrl: {
|
|
12
|
-
type:
|
|
13
|
-
default: null
|
|
13
|
+
type: Object
|
|
14
14
|
},
|
|
15
15
|
downloadUrl: {
|
|
16
|
-
type:
|
|
17
|
-
default: null
|
|
16
|
+
type: Object
|
|
18
17
|
},
|
|
19
18
|
buttonText: {
|
|
20
19
|
type: String,
|
|
@@ -28,9 +27,9 @@ const basicProps = {
|
|
|
28
27
|
type: Object,
|
|
29
28
|
default: {}
|
|
30
29
|
},
|
|
31
|
-
|
|
30
|
+
fileName: {
|
|
32
31
|
type: String,
|
|
33
|
-
default: "
|
|
32
|
+
default: "file"
|
|
34
33
|
},
|
|
35
34
|
accept: {
|
|
36
35
|
type: Array,
|
|
@@ -130,22 +129,22 @@ function useFile({
|
|
|
130
129
|
}
|
|
131
130
|
const maxNumber = unref(maxCountRef);
|
|
132
131
|
if (maxNumber && maxNumber !== Infinity) {
|
|
133
|
-
helpTexts.push(`\u6700\u591A\u53EF\
|
|
132
|
+
helpTexts.push(`\u6700\u591A\u53EF\u4E0A\u4F20${maxNumber}\u4E2A\u6587\u4EF6`);
|
|
134
133
|
}
|
|
135
134
|
return helpTexts.join(", ");
|
|
136
135
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
136
|
+
const setFile = (file) => {
|
|
137
|
+
let _downloadUrl = getAppConf.pages?.downloadUrl;
|
|
138
|
+
return {
|
|
139
|
+
...file,
|
|
140
|
+
name: file.fileName ?? file.fileId,
|
|
141
|
+
fileType: file.fileName ? takeRight(file.fileName.split("."))[0] : null,
|
|
142
|
+
status: "done",
|
|
143
|
+
uid: file.id ?? file.fileId,
|
|
144
|
+
url: `${getAppConf.http?.baseUrl}${isString(_downloadUrl) ? _downloadUrl : _downloadUrl.api}?id=${file.fileId}`
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
const fileList = ref(unref(fileListRef).map((it) => setFile(it)));
|
|
149
148
|
function beforeUpload(file) {
|
|
150
149
|
const { size } = file;
|
|
151
150
|
const maxSize = unref(maxSizeRef);
|
|
@@ -153,26 +152,69 @@ function useFile({
|
|
|
153
152
|
message.error(`\u53EA\u80FD\u4E0A\u4F20\u4E0D\u8D85\u8FC7${maxSize}MB\u7684\u6587\u4EF6!`);
|
|
154
153
|
return;
|
|
155
154
|
}
|
|
155
|
+
const maxNumber = unref(maxCountRef);
|
|
156
|
+
if (maxNumber && maxNumber !== Infinity && unref(fileList).length >= maxNumber) {
|
|
157
|
+
message.error(`\u6700\u591A\u53EF\u4E0A\u4F20${maxNumber}\u4E2A\u6587\u4EF6!`);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
156
160
|
}
|
|
161
|
+
watch(
|
|
162
|
+
() => unref(fileListRef),
|
|
163
|
+
(v) => {
|
|
164
|
+
fileList.value = v.map((it) => setFile(it));
|
|
165
|
+
}
|
|
166
|
+
);
|
|
157
167
|
return {
|
|
158
168
|
getAccept,
|
|
159
169
|
getStringAccept,
|
|
160
170
|
getHelpText,
|
|
161
|
-
|
|
171
|
+
fileList,
|
|
172
|
+
setFile,
|
|
162
173
|
beforeUpload
|
|
163
174
|
};
|
|
164
175
|
}
|
|
165
|
-
const getFileThumb = (
|
|
166
|
-
|
|
176
|
+
const getFileThumb = (fileType) => {
|
|
177
|
+
switch (fileType) {
|
|
178
|
+
case "pptx":
|
|
179
|
+
case "ppt":
|
|
180
|
+
return "/imgs/fu_ppt.gif";
|
|
181
|
+
case "docx":
|
|
182
|
+
case "doc":
|
|
183
|
+
return "/imgs/fu_doc.gif";
|
|
184
|
+
case "pdf":
|
|
185
|
+
return "/imgs/fu_pdf.gif";
|
|
186
|
+
case "jpg":
|
|
187
|
+
case "jpeg":
|
|
188
|
+
case "png":
|
|
189
|
+
case "bmp":
|
|
190
|
+
case "ofd":
|
|
191
|
+
case "gif":
|
|
192
|
+
return "/imgs/fu_bmp.gif";
|
|
193
|
+
case "xls":
|
|
194
|
+
case "xlsx":
|
|
195
|
+
return "/imgs/fu_exl.gif";
|
|
196
|
+
case "csv":
|
|
197
|
+
return "/imgs/fu_txt.gif";
|
|
198
|
+
case "txt":
|
|
199
|
+
return "/imgs/fu_txt.gif";
|
|
200
|
+
case "rar":
|
|
201
|
+
case "zip":
|
|
202
|
+
case "7z":
|
|
203
|
+
case "tar":
|
|
204
|
+
case "gz":
|
|
205
|
+
return "/imgs/fu_rar.gif";
|
|
206
|
+
default:
|
|
207
|
+
return "/imgs/fu_blank.gif";
|
|
208
|
+
}
|
|
167
209
|
};
|
|
168
|
-
const _sfc_main$
|
|
210
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
169
211
|
__name: "PdfView",
|
|
170
212
|
setup(__props) {
|
|
171
213
|
const exeReduce = ref(233);
|
|
172
214
|
const pdfUrlRef = ref();
|
|
173
215
|
const [register] = useModal({
|
|
174
216
|
width: "70%",
|
|
175
|
-
title:
|
|
217
|
+
title: (data) => `\u9644\u4EF6\u9884\u89C8 - ${data.fileName}`,
|
|
176
218
|
useWrapper: false,
|
|
177
219
|
wrapClassName: "dt-pdf",
|
|
178
220
|
maskClosable: false,
|
|
@@ -184,14 +226,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
184
226
|
exeReduce.value = isFullscreen ? 55 : 233;
|
|
185
227
|
}
|
|
186
228
|
return (_ctx, _cache) => {
|
|
187
|
-
return openBlock(), createBlock(unref
|
|
188
|
-
onRegister: unref
|
|
229
|
+
return openBlock(), createBlock(unref(DtModal), {
|
|
230
|
+
onRegister: unref(register),
|
|
189
231
|
onToggleFullscreen: toggleFullscreen
|
|
190
232
|
}, {
|
|
191
233
|
default: withCtx(() => [
|
|
192
|
-
createVNode(unref
|
|
193
|
-
src:
|
|
194
|
-
exeReduce:
|
|
234
|
+
createVNode(unref(DtIframe), {
|
|
235
|
+
src: pdfUrlRef.value,
|
|
236
|
+
exeReduce: exeReduce.value
|
|
195
237
|
}, null, 8, ["src", "exeReduce"])
|
|
196
238
|
]),
|
|
197
239
|
_: 1
|
|
@@ -199,26 +241,73 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
199
241
|
};
|
|
200
242
|
}
|
|
201
243
|
});
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
244
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
245
|
+
__name: "WordView",
|
|
246
|
+
setup(__props) {
|
|
247
|
+
const ID = `word-view-${Math.ceil(Math.random() * 1e6)}`;
|
|
248
|
+
const [register] = useModal({
|
|
249
|
+
width: "900px",
|
|
250
|
+
title: (data) => `\u9644\u4EF6\u9884\u89C8 - ${data.fileName}`,
|
|
251
|
+
useWrapper: false,
|
|
252
|
+
wrapClassName: "dt-word",
|
|
253
|
+
maskClosable: false,
|
|
254
|
+
footer: null
|
|
255
|
+
}, (data) => {
|
|
256
|
+
const fileReader = new FileReader();
|
|
257
|
+
fileReader.addEventListener("load", (event) => {
|
|
258
|
+
const arrayBuffer = event.target.result;
|
|
259
|
+
renderAsync(arrayBuffer, document.getElementById(ID), null, {
|
|
260
|
+
className: "docx",
|
|
261
|
+
inWrapper: true,
|
|
262
|
+
ignoreWidth: false,
|
|
263
|
+
ignoreHeight: false,
|
|
264
|
+
ignoreFonts: false,
|
|
265
|
+
breakPages: true,
|
|
266
|
+
ignoreLastRenderedPageBreak: true,
|
|
267
|
+
experimental: false,
|
|
268
|
+
trimXmlDeclaration: true,
|
|
269
|
+
debug: false
|
|
270
|
+
}).then((rsp) => {
|
|
271
|
+
dispatchResize();
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
fileReader.readAsArrayBuffer(data.data);
|
|
275
|
+
});
|
|
276
|
+
return (_ctx, _cache) => {
|
|
277
|
+
return openBlock(), createBlock(unref(DtModal), { onRegister: unref(register) }, {
|
|
278
|
+
default: withCtx(() => [
|
|
279
|
+
createElementVNode("div", {
|
|
280
|
+
id: ID,
|
|
281
|
+
class: "word-view"
|
|
282
|
+
})
|
|
283
|
+
]),
|
|
284
|
+
_: 1
|
|
285
|
+
}, 8, ["onRegister"]);
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
const _hoisted_1 = { class: "flex items-center" };
|
|
206
290
|
const _hoisted_2 = { class: "pl-3" };
|
|
207
|
-
const _hoisted_3 = {
|
|
208
|
-
const _hoisted_4 = {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const
|
|
291
|
+
const _hoisted_3 = { class: "flex justify-between border border-solid border-gray-300 p-1 mt-2" };
|
|
292
|
+
const _hoisted_4 = { class: "flex items-center" };
|
|
293
|
+
const _hoisted_5 = ["src"];
|
|
294
|
+
const _hoisted_6 = { class: "flex items-center" };
|
|
295
|
+
const _hoisted_7 = ["onClick"];
|
|
296
|
+
const _hoisted_8 = { key: 0 };
|
|
297
|
+
const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "i ic:baseline-file-upload" }, null, -1);
|
|
298
|
+
const _hoisted_10 = /* @__PURE__ */ createElementVNode("div", null, "\u6587\u4EF6\u4E0A\u4F20", -1);
|
|
299
|
+
const _hoisted_11 = [
|
|
300
|
+
_hoisted_9,
|
|
301
|
+
_hoisted_10
|
|
302
|
+
];
|
|
216
303
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
217
304
|
__name: "index",
|
|
218
305
|
props: basicProps,
|
|
219
|
-
|
|
306
|
+
emits: ["change"],
|
|
307
|
+
setup(__props, { emit: emits }) {
|
|
220
308
|
const props = __props;
|
|
221
309
|
const [registerPdf, { openModal: openPdfModal }] = useModalOut();
|
|
310
|
+
const [registerDocx, { openModal: openDocxModal }] = useModalOut();
|
|
222
311
|
const { message } = useMessage();
|
|
223
312
|
const {
|
|
224
313
|
defaultFiles: fileListRef,
|
|
@@ -230,7 +319,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
230
319
|
const {
|
|
231
320
|
getStringAccept,
|
|
232
321
|
getHelpText,
|
|
233
|
-
|
|
322
|
+
fileList,
|
|
234
323
|
beforeUpload
|
|
235
324
|
} = useFile({
|
|
236
325
|
fileListRef,
|
|
@@ -254,19 +343,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
254
343
|
class: "mdi:delete-outline",
|
|
255
344
|
show: () => props.showDelete,
|
|
256
345
|
click: (file) => {
|
|
257
|
-
|
|
346
|
+
fileList.value = unref(fileList).filter((f) => f.fileId !== file.fileId);
|
|
258
347
|
}
|
|
259
348
|
}
|
|
260
349
|
];
|
|
261
350
|
const getBind = computed(() => {
|
|
262
351
|
return {
|
|
352
|
+
maxCount: Infinity,
|
|
263
353
|
...omit(unref(props), [
|
|
264
354
|
"api",
|
|
265
355
|
"onChange"
|
|
266
356
|
]),
|
|
267
357
|
class: "dt-upload",
|
|
268
358
|
accept: unref(getStringAccept),
|
|
269
|
-
fileList: getFileList(),
|
|
270
359
|
beforeUpload: props.beforeUpload && isFunction(props.beforeUpload) ? props.beforeUpload : beforeUpload,
|
|
271
360
|
customRequest: props.customRequest ? props.customRequest : uploadFile
|
|
272
361
|
};
|
|
@@ -283,32 +372,42 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
283
372
|
src: unref(imgSrcRef)
|
|
284
373
|
};
|
|
285
374
|
});
|
|
375
|
+
const handlePreview = async (file) => {
|
|
376
|
+
imgSrcRef.value = file.url;
|
|
377
|
+
imgVisable.value = true;
|
|
378
|
+
};
|
|
286
379
|
const uploadFile = async ({ file, onSuccess, onError, onProgress }) => {
|
|
287
380
|
const { getAppConf } = useAppStore();
|
|
288
|
-
const { uploadUrl = getAppConf.pages.uploadUrl, downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
289
|
-
|
|
381
|
+
const { uploadUrl = getAppConf.pages.uploadUrl, downloadUrl = getAppConf.pages.downloadUrl, fileName } = props;
|
|
382
|
+
let _uploadUrl = isString(uploadUrl) ? uploadUrl : uploadUrl.api;
|
|
383
|
+
let _downloadUrl = isString(downloadUrl) ? downloadUrl : downloadUrl.api;
|
|
384
|
+
if (!_uploadUrl) {
|
|
290
385
|
message.error("\u8BF7\u914D\u7F6E\u4E0A\u4F20\u7684\u6587\u4EF6\u8DEF\u5F84");
|
|
291
386
|
return;
|
|
292
387
|
}
|
|
293
|
-
if (!
|
|
388
|
+
if (!_downloadUrl) {
|
|
294
389
|
message.error("\u8BF7\u914D\u7F6E\u4E0B\u8F7D\u7684\u6587\u4EF6\u8DEF\u5F84");
|
|
295
390
|
return;
|
|
296
391
|
}
|
|
297
392
|
try {
|
|
298
393
|
let result = await http.uploadFile(
|
|
299
394
|
{
|
|
300
|
-
url:
|
|
395
|
+
url: _uploadUrl + `?t=${new Date().getTime()}`,
|
|
301
396
|
onUploadProgress({ loaded, total }) {
|
|
302
397
|
onProgress({ percent: Math.ceil(loaded / total * 100) });
|
|
303
398
|
}
|
|
304
399
|
},
|
|
305
400
|
{
|
|
306
401
|
...props.extraParams,
|
|
307
|
-
file
|
|
402
|
+
[fileName || "file"]: file
|
|
308
403
|
}
|
|
309
404
|
);
|
|
310
|
-
file
|
|
311
|
-
|
|
405
|
+
Object.assign(file, {
|
|
406
|
+
fileId: result?.data?.fileId,
|
|
407
|
+
url: `${getAppConf.http?.baseUrl}${_downloadUrl}?id=${result?.data?.fileId}`,
|
|
408
|
+
fileName: result?.data?.fileName,
|
|
409
|
+
fileType: takeRight(result?.data?.fileName?.split("."))?.[0]
|
|
410
|
+
});
|
|
312
411
|
onSuccess(result);
|
|
313
412
|
} catch (err) {
|
|
314
413
|
onError(err);
|
|
@@ -318,18 +417,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
318
417
|
try {
|
|
319
418
|
const { getAppConf } = useAppStore();
|
|
320
419
|
const { downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
420
|
+
let _downloadUrl = isString(downloadUrl) ? downloadUrl : downloadUrl.api;
|
|
321
421
|
if (["jpg", "jpeg", "png", "bmp", "gif"].includes(file.fileType)) {
|
|
322
|
-
imgSrcRef.value =
|
|
422
|
+
imgSrcRef.value = `${_downloadUrl}?id=${file.fileId}`;
|
|
323
423
|
imgVisable.value = true;
|
|
324
424
|
return;
|
|
325
425
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
{ url: "https://www.antdv.com/components/image-cn" }
|
|
329
|
-
);
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
let result = await http.get(downloadUrl, { id: file.id }, {
|
|
426
|
+
let result = await http.get(_downloadUrl, { id: file.fileId }, {
|
|
427
|
+
onlyData: false,
|
|
333
428
|
responseType: "blob",
|
|
334
429
|
isTransformResponse: false,
|
|
335
430
|
headers: {
|
|
@@ -338,35 +433,58 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
338
433
|
});
|
|
339
434
|
switch (file.fileType) {
|
|
340
435
|
case "pdf":
|
|
341
|
-
openPdfModal(
|
|
342
|
-
|
|
343
|
-
|
|
436
|
+
openPdfModal({
|
|
437
|
+
fileName: file.fileName,
|
|
438
|
+
url: URL.createObjectURL(result.data)
|
|
439
|
+
});
|
|
344
440
|
break;
|
|
345
441
|
case "docx":
|
|
442
|
+
openDocxModal({
|
|
443
|
+
fileName: file.fileName,
|
|
444
|
+
data: result.data
|
|
445
|
+
});
|
|
346
446
|
break;
|
|
347
447
|
}
|
|
348
448
|
} catch (err) {
|
|
349
449
|
console.log(err);
|
|
350
450
|
}
|
|
351
451
|
}
|
|
352
|
-
function download() {
|
|
452
|
+
function download(file) {
|
|
453
|
+
const { getAppConf } = useAppStore();
|
|
454
|
+
const { downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
455
|
+
http.exportFile(downloadUrl, { id: file.fileId }, file.fileName);
|
|
353
456
|
}
|
|
457
|
+
watch(
|
|
458
|
+
() => unref(fileList),
|
|
459
|
+
async (v) => {
|
|
460
|
+
let ids = unref(fileList).map((it) => it.fileId);
|
|
461
|
+
if (ids.length === v.length)
|
|
462
|
+
emits("change", ids.join(","));
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
deep: true,
|
|
466
|
+
immediate: true
|
|
467
|
+
}
|
|
468
|
+
);
|
|
354
469
|
return (_ctx, _cache) => {
|
|
355
470
|
const _component_AButton = Button;
|
|
356
|
-
const _component_AImage = Image;
|
|
357
471
|
const _component_AUpload = Upload;
|
|
472
|
+
const _component_AImage = Image;
|
|
358
473
|
return openBlock(), createElementBlock("div", null, [
|
|
359
|
-
|
|
474
|
+
unref(getBind).listType === "text" ? (openBlock(), createBlock(_component_AUpload, mergeProps({ key: 0 }, unref(getBind), {
|
|
475
|
+
fileList: unref(fileList),
|
|
476
|
+
"onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => isRef(fileList) ? fileList.value = $event : null)
|
|
477
|
+
}), createSlots({
|
|
360
478
|
itemRender: withCtx(({ file, actions }) => [
|
|
361
|
-
|
|
362
|
-
createElementVNode("div",
|
|
479
|
+
createElementVNode("div", _hoisted_3, [
|
|
480
|
+
createElementVNode("div", _hoisted_4, [
|
|
363
481
|
createElementVNode("img", {
|
|
364
|
-
src: unref
|
|
482
|
+
src: unref(getFileThumb)(file.fileType),
|
|
365
483
|
class: "w-9 h-9 mr-2 p-1"
|
|
366
|
-
}, null, 8,
|
|
367
|
-
createElementVNode("span", null, toDisplayString(file.
|
|
484
|
+
}, null, 8, _hoisted_5),
|
|
485
|
+
createElementVNode("span", null, toDisplayString(file.fileName), 1)
|
|
368
486
|
]),
|
|
369
|
-
createElementVNode("div",
|
|
487
|
+
createElementVNode("div", _hoisted_6, [
|
|
370
488
|
(openBlock(), createElementBlock(Fragment, null, renderList(btns, (btn) => {
|
|
371
489
|
return openBlock(), createElementBlock(Fragment, {
|
|
372
490
|
key: btn.class
|
|
@@ -375,29 +493,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
375
493
|
key: 0,
|
|
376
494
|
class: normalizeClass(["i w-7 h-7 !text-base text-center leading-7 text-gray-600 cursor-pointer hover:bg-gray-200 hover:bg-opacity-50 transition-all duration-300", btn.class]),
|
|
377
495
|
onClick: ($event) => btn.click(file)
|
|
378
|
-
}, null, 10,
|
|
496
|
+
}, null, 10, _hoisted_7)) : createCommentVNode("", true)
|
|
379
497
|
], 64);
|
|
380
498
|
}), 64))
|
|
381
499
|
])
|
|
382
|
-
])
|
|
500
|
+
])
|
|
383
501
|
]),
|
|
384
502
|
default: withCtx(() => [
|
|
385
|
-
|
|
386
|
-
createTextVNode(" \u8FD9\u662F\u5361\u7247\u56FE\u7247 ")
|
|
387
|
-
], 64)) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
503
|
+
createElementVNode("div", _hoisted_1, [
|
|
388
504
|
createVNode(_component_AButton, null, {
|
|
389
505
|
default: withCtx(() => [
|
|
390
506
|
createElementVNode("i", {
|
|
391
|
-
class: normalizeClass(["i mr-1", unref
|
|
507
|
+
class: normalizeClass(["i mr-1", unref(getBind).preIcon])
|
|
392
508
|
}, null, 2),
|
|
393
|
-
createElementVNode("span", null, toDisplayString(unref
|
|
509
|
+
createElementVNode("span", null, toDisplayString(unref(getBind).buttonText), 1)
|
|
394
510
|
]),
|
|
395
511
|
_: 1
|
|
396
512
|
}),
|
|
397
|
-
createElementVNode("p", _hoisted_2, toDisplayString(unref
|
|
398
|
-
])
|
|
399
|
-
|
|
400
|
-
createVNode(_sfc_main$1, { onRegister: unref
|
|
513
|
+
createElementVNode("p", _hoisted_2, toDisplayString(unref(getHelpText)), 1)
|
|
514
|
+
]),
|
|
515
|
+
createVNode(_sfc_main$2, { onRegister: unref(registerPdf) }, null, 8, ["onRegister"]),
|
|
516
|
+
createVNode(_sfc_main$1, { onRegister: unref(registerDocx) }, null, 8, ["onRegister"])
|
|
401
517
|
]),
|
|
402
518
|
_: 2
|
|
403
519
|
}, [
|
|
@@ -409,7 +525,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
409
525
|
])
|
|
410
526
|
};
|
|
411
527
|
})
|
|
412
|
-
]), 1040)
|
|
528
|
+
]), 1040, ["fileList"])) : createCommentVNode("", true),
|
|
529
|
+
unref(getBind).listType === "picture-card" ? (openBlock(), createBlock(_component_AUpload, mergeProps({ key: 1 }, unref(getBind), {
|
|
530
|
+
fileList: unref(fileList),
|
|
531
|
+
"onUpdate:fileList": _cache[1] || (_cache[1] = ($event) => isRef(fileList) ? fileList.value = $event : null),
|
|
532
|
+
onPreview: handlePreview
|
|
533
|
+
}), {
|
|
534
|
+
default: withCtx(() => [
|
|
535
|
+
!_ctx.maxCount || !unref(fileList).length || unref(fileList).length < _ctx.maxCount ? (openBlock(), createElementBlock("div", _hoisted_8, _hoisted_11)) : createCommentVNode("", true)
|
|
536
|
+
]),
|
|
537
|
+
_: 1
|
|
538
|
+
}, 16, ["fileList"])) : createCommentVNode("", true),
|
|
539
|
+
unref(bindImg).src ? (openBlock(), createBlock(_component_AImage, mergeProps({ key: 2 }, unref(bindImg), { style: { display: "none" } }), null, 16)) : createCommentVNode("", true)
|
|
413
540
|
]);
|
|
414
541
|
};
|
|
415
542
|
}
|
|
@@ -5,13 +5,7 @@
|
|
|
5
5
|
display: initial;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.dt-
|
|
9
|
-
.ant-upload{
|
|
10
|
-
display: flex;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.dt-pdf{
|
|
8
|
+
.dt-pdf, .dt-word{
|
|
15
9
|
&.fullscreen-modal{
|
|
16
10
|
min-height: calc(100% + 8px);
|
|
17
11
|
&>.ant-modal{
|
|
@@ -33,5 +27,41 @@
|
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
29
|
}
|
|
30
|
+
|
|
31
|
+
.word-view{
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
36
34
|
}
|
|
37
35
|
}
|
|
36
|
+
|
|
37
|
+
.word-view{
|
|
38
|
+
width: 900px;
|
|
39
|
+
height: calc(100vh - 260px);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dt-image-item{
|
|
43
|
+
.ant-image, .ant-image-img{
|
|
44
|
+
height: 100%;
|
|
45
|
+
width: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ant-image-mask-info{
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.dt-upload{
|
|
55
|
+
.ant-upload-list-picture-card{
|
|
56
|
+
min-height: 112px;
|
|
57
|
+
.ant-upload-list-item, .ant-upload {
|
|
58
|
+
height: 104px !important;
|
|
59
|
+
width: 104px !important;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ant-upload-list-item-actions{
|
|
64
|
+
display: flex;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { PropType, Ref, ComputedRef } from "vue";
|
|
2
2
|
import { UploadFile } from "./type/file";
|
|
3
3
|
import { UploadRequestOption } from "ant-design-vue/es/vc-upload/interface";
|
|
4
|
-
import { Recordable } from "@dt-frames/core";
|
|
4
|
+
import { ApiType, Recordable } from "@dt-frames/core";
|
|
5
5
|
export declare const basicProps: {
|
|
6
6
|
uploadUrl: {
|
|
7
|
-
type:
|
|
8
|
-
default: any;
|
|
7
|
+
type: PropType<string | ApiType>;
|
|
9
8
|
};
|
|
10
9
|
downloadUrl: {
|
|
11
|
-
type:
|
|
12
|
-
default: any;
|
|
10
|
+
type: PropType<string | ApiType>;
|
|
13
11
|
};
|
|
14
12
|
buttonText: {
|
|
15
13
|
type: StringConstructor;
|
|
@@ -23,7 +21,7 @@ export declare const basicProps: {
|
|
|
23
21
|
type: PropType<object | ((file: UploadFile) => object)>;
|
|
24
22
|
default: {};
|
|
25
23
|
};
|
|
26
|
-
|
|
24
|
+
fileName: {
|
|
27
25
|
type: StringConstructor;
|
|
28
26
|
default: string;
|
|
29
27
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const _sfc_main: import("vue").DefineComponent<{}, {
|
|
2
|
+
ID: string;
|
|
3
|
+
register: import("../../../modal/src/types/modal.type").RegisterFn;
|
|
4
|
+
readonly DtModal: import("vue").DefineComponent<{}, {}, any, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
5
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
6
|
+
export default _sfc_main;
|
|
@@ -10,6 +10,7 @@ export declare function useFile({ fileListRef, acceptRef, helpTextRef, maxCountR
|
|
|
10
10
|
getAccept: import("vue").ComputedRef<string[]>;
|
|
11
11
|
getStringAccept: import("vue").ComputedRef<string>;
|
|
12
12
|
getHelpText: import("vue").ComputedRef<string>;
|
|
13
|
-
|
|
13
|
+
fileList: Ref<any[]>;
|
|
14
|
+
setFile: (file: any) => any;
|
|
14
15
|
beforeUpload: (file: File) => void;
|
|
15
16
|
};
|