@dt-frames/ui 2.0.10 → 2.0.12
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 +2 -93
- package/es/components/curd/index.js +7 -2966
- package/es/components/curd/src/components/Curd.d.ts +19 -891
- package/es/components/curd/src/hooks/useCurd.d.ts +2 -2
- package/es/components/curd/src/props.d.ts +6 -4
- package/es/components/curd/src/types/curd.type.d.ts +2 -2
- package/es/components/drawer/index.d.ts +10 -167
- package/es/components/drawer/index.js +24 -462
- package/es/components/drawer/src/components/DrawerFooter.d.ts +1 -84
- package/es/components/drawer/src/index.d.ts +10 -167
- package/es/components/drawer/src/types/index.type.d.ts +2 -2
- package/es/components/form/index.d.ts +5 -1
- package/es/components/form/index.js +81 -485
- package/es/components/form/src/components/FormItem.d.ts +3 -1
- package/es/components/form/src/components/formIcon.d.ts +3 -11
- package/es/components/form/src/components/formInputUseDialog.d.ts +2 -2
- package/es/components/form/src/props.d.ts +7 -5
- package/es/components/form/src/types/form.type.d.ts +3 -0
- package/es/components/form/src/types/items.type.d.ts +6 -4
- package/es/components/icons/index.d.ts +497 -497
- package/es/components/iframe/index.d.ts +2 -0
- package/es/components/iframe/index.js +72 -0
- package/es/components/iframe/index.less +29 -0
- package/es/components/iframe/src/index.d.ts +38 -0
- package/es/components/modal/index.d.ts +2 -1
- package/es/components/modal/index.js +23 -475
- package/es/components/modal/src/components/Modal.d.ts +1 -1
- package/es/components/modal/src/components/ModalFooter.d.ts +2 -95
- package/es/components/modal/src/components/ModalWrap.d.ts +1 -75
- package/es/components/modal/src/index.d.ts +14 -179
- package/es/components/table/index.js +328 -2030
- package/es/components/table/src/components/TableAction.d.ts +1 -1
- package/es/components/table/src/components/editTable/EditTableCell.d.ts +1 -1
- package/es/components/table/src/components/tableSetting/DownloadCtrl.d.ts +1 -877
- package/es/components/table/src/index.d.ts +10 -10
- package/es/components/tree/src/components/TreeHeader.d.ts +1 -1
- package/es/components/tree/src/index.d.ts +2 -2
- package/es/components/upload/index.d.ts +2 -0
- package/es/components/upload/index.js +419 -0
- package/es/components/upload/index.less +37 -0
- package/es/components/upload/src/basicProps.d.ts +89 -0
- package/es/components/upload/src/components/PdfView.d.ts +9 -0
- package/es/components/upload/src/hooks/useFile.d.ts +15 -0
- package/es/components/upload/src/index.d.ts +236 -0
- package/es/components/upload/src/type/file.d.ts +10 -0
- package/es/components/upload/src/utils/upload.d.ts +2 -0
- package/es/theme/index.d.ts +2 -1
- package/es/theme/index.js +98 -145
- package/es/theme/index.less +5 -1
- package/es/theme/src/components/content/index.d.ts +2 -0
- package/es/theme/src/components/header/index.d.ts +809 -809
- package/es/theme/src/components/header/multiple-header.d.ts +918 -918
- package/es/theme/src/hooks/useMenu.d.ts +1 -1
- package/es/theme/src/index.d.ts +2059 -2057
- package/index.d.ts +3 -1
- package/index.js +24 -2
- package/manualContentPath.js +124 -0
- package/package.json +8 -3
- package/vite.config.ts +19 -4
- package/es/components/curd/index.less +0 -2
- package/es/components/form/src/index.d.ts +0 -2922
- package/es/components/table/src/components/TableHeader.d.ts +0 -1136
- package/es/components/table/src/components/tableSetting/Download.d.ts +0 -922
- package/es/components/table/src/components/tableSetting/index.d.ts +0 -1030
|
@@ -187,8 +187,14 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
187
187
|
innerPropsRef: import("vue").Ref<BasicTableProps>;
|
|
188
188
|
getProps: import("vue").ComputedRef<{
|
|
189
189
|
components?: import("ant-design-vue/es/vc-table/interface").TableComponents<any>;
|
|
190
|
+
id?: string;
|
|
190
191
|
size?: import("ant-design-vue/es/button").ButtonSize;
|
|
191
|
-
|
|
192
|
+
locale?: import("ant-design-vue/es/table/interface").TableLocale;
|
|
193
|
+
prefixCls?: string;
|
|
194
|
+
onChange?: (pagination: import("ant-design-vue/es/table").TablePaginationConfig, filters: Record<string, import("ant-design-vue/es/table/interface").FilterValue>, sorter: import("ant-design-vue/es/table/interface").SorterResult<any> | import("ant-design-vue/es/table/interface").SorterResult<any>[], extra: import("ant-design-vue/es/table/interface").TableCurrentDataSource<any>) => void;
|
|
195
|
+
rowKey: string | (import("ant-design-vue/es/vc-table/interface").GetRowKey<any> & string);
|
|
196
|
+
dataSource: import("@dt-frames/core").Recordable<any>[];
|
|
197
|
+
bordered: boolean;
|
|
192
198
|
loading: (boolean | Partial<import("vue").ExtractPropTypes<{
|
|
193
199
|
prefixCls: StringConstructor;
|
|
194
200
|
spinning: {
|
|
@@ -201,14 +207,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
201
207
|
delay: NumberConstructor;
|
|
202
208
|
indicator: import("vue-types").VueTypeValidableDef<any>;
|
|
203
209
|
}>>) & boolean;
|
|
204
|
-
footer?: import("ant-design-vue/es/vc-table/interface").PanelRender<any>;
|
|
205
|
-
id?: string;
|
|
206
|
-
locale?: import("ant-design-vue/es/table/interface").TableLocale;
|
|
207
|
-
prefixCls?: string;
|
|
208
|
-
onChange?: (pagination: import("ant-design-vue/es/table").TablePaginationConfig, filters: Record<string, import("ant-design-vue/es/table/interface").FilterValue>, sorter: import("ant-design-vue/es/table/interface").SorterResult<any> | import("ant-design-vue/es/table/interface").SorterResult<any>[], extra: import("ant-design-vue/es/table/interface").TableCurrentDataSource<any>) => void;
|
|
209
|
-
rowKey: string | (import("ant-design-vue/es/vc-table/interface").GetRowKey<any> & string);
|
|
210
|
-
dataSource: import("@dt-frames/core").Recordable<any>[];
|
|
211
|
-
bordered: boolean;
|
|
212
210
|
rowClassName: (record: any, index: number) => string;
|
|
213
211
|
scroll: {
|
|
214
212
|
x?: string | number | true;
|
|
@@ -223,6 +221,8 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
223
221
|
customRow: import("ant-design-vue/es/vc-table/interface").GetComponentProps<any> & ((record: any, index: any) => void);
|
|
224
222
|
childrenColumnName: string;
|
|
225
223
|
tableLayout?: import("ant-design-vue/es/vc-table/interface").TableLayout;
|
|
224
|
+
title?: import("ant-design-vue/es/vc-table/interface").PanelRender<any>;
|
|
225
|
+
footer?: import("ant-design-vue/es/vc-table/interface").PanelRender<any>;
|
|
226
226
|
showHeader?: boolean;
|
|
227
227
|
customHeaderRow?: import("ant-design-vue/es/vc-table/interface").GetComponentProps<import("ant-design-vue/es/vc-table/interface").ColumnType<any>[]>;
|
|
228
228
|
direction?: "ltr" | "rtl";
|
|
@@ -584,7 +584,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
584
584
|
"onRow-mouseleave"?: (...args: any[]) => any;
|
|
585
585
|
"onEdit-change"?: (...args: any[]) => any;
|
|
586
586
|
}, {
|
|
587
|
-
loading: boolean;
|
|
588
587
|
autoFetch: boolean;
|
|
589
588
|
clickToSelectRow: boolean;
|
|
590
589
|
tableSetting: {};
|
|
@@ -607,6 +606,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
607
606
|
bordered: boolean;
|
|
608
607
|
canResize: boolean;
|
|
609
608
|
pagination: any;
|
|
609
|
+
loading: boolean;
|
|
610
610
|
scroll: {};
|
|
611
611
|
onTableChange: Function;
|
|
612
612
|
onDownload: Function;
|
|
@@ -87,10 +87,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
87
87
|
}>> & {
|
|
88
88
|
onSearch?: (...args: any[]) => any;
|
|
89
89
|
}, {
|
|
90
|
-
search: boolean;
|
|
91
90
|
checkable: boolean;
|
|
92
91
|
title: string;
|
|
93
92
|
toolbar: boolean;
|
|
93
|
+
search: boolean;
|
|
94
94
|
searchText: string;
|
|
95
95
|
checkAll: Function;
|
|
96
96
|
expandAll: Function;
|
|
@@ -6402,10 +6402,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
6402
6402
|
}>> & {
|
|
6403
6403
|
onSearch?: (...args: any[]) => any;
|
|
6404
6404
|
}, {
|
|
6405
|
-
search: boolean;
|
|
6406
6405
|
checkable: boolean;
|
|
6407
6406
|
title: string;
|
|
6408
6407
|
toolbar: boolean;
|
|
6408
|
+
search: boolean;
|
|
6409
6409
|
searchText: string;
|
|
6410
6410
|
checkAll: Function;
|
|
6411
6411
|
expandAll: Function;
|
|
@@ -6502,7 +6502,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
6502
6502
|
onClickNode?: (...args: any[]) => any;
|
|
6503
6503
|
"onUpdate:searchValue"?: (...args: any[]) => any;
|
|
6504
6504
|
}, {
|
|
6505
|
-
search: boolean;
|
|
6506
6505
|
defaultExpandAll: boolean;
|
|
6507
6506
|
showIcon: boolean;
|
|
6508
6507
|
loading: boolean;
|
|
@@ -6522,5 +6521,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
6522
6521
|
selectedOnSearch: boolean;
|
|
6523
6522
|
title: string;
|
|
6524
6523
|
toolbar: boolean;
|
|
6524
|
+
search: boolean;
|
|
6525
6525
|
}>;
|
|
6526
6526
|
export default _sfc_main;
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { Button, Image, Upload } from "ant-design-vue/es";
|
|
2
|
+
import "ant-design-vue/es/upload/style";
|
|
3
|
+
import "ant-design-vue/es/image/style";
|
|
4
|
+
import "ant-design-vue/es/button/style";
|
|
5
|
+
import { defineComponent, openBlock, createBlock, unref as unref$1, withCtx, createVNode, createElementBlock, normalizeProps, guardReactiveProps, createSlots, createElementVNode, toDisplayString, Fragment, renderList, normalizeClass, createCommentVNode, createTextVNode, mergeProps, renderSlot } from "vue";
|
|
6
|
+
import { takeRight, omit } from "lodash-es";
|
|
7
|
+
import { useAppStore, useMessage, isFunction, http, HttpContentTypeEnum } from "@dt-frames/core";
|
|
8
|
+
import { useModal, DtModal, useModalOut } from "../modal";
|
|
9
|
+
import { DtIframe } from "../iframe";
|
|
10
|
+
const basicProps = {
|
|
11
|
+
uploadUrl: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: null
|
|
14
|
+
},
|
|
15
|
+
downloadUrl: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
buttonText: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "\u6587\u4EF6\u4E0A\u4F20"
|
|
22
|
+
},
|
|
23
|
+
preIcon: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "ic:baseline-file-upload"
|
|
26
|
+
},
|
|
27
|
+
data: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: {}
|
|
30
|
+
},
|
|
31
|
+
filename: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "filename"
|
|
34
|
+
},
|
|
35
|
+
accept: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: () => []
|
|
38
|
+
},
|
|
39
|
+
beforeUpload: {
|
|
40
|
+
type: Function
|
|
41
|
+
},
|
|
42
|
+
customRequest: {
|
|
43
|
+
type: Function
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
defaultFiles: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () => []
|
|
52
|
+
},
|
|
53
|
+
headers: {
|
|
54
|
+
type: Object
|
|
55
|
+
},
|
|
56
|
+
listType: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "text"
|
|
59
|
+
},
|
|
60
|
+
maxCount: {
|
|
61
|
+
type: Number
|
|
62
|
+
},
|
|
63
|
+
maxSize: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: 2
|
|
66
|
+
},
|
|
67
|
+
helpText: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: ""
|
|
70
|
+
},
|
|
71
|
+
multiple: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
75
|
+
onChange: {
|
|
76
|
+
type: Function
|
|
77
|
+
},
|
|
78
|
+
extraParams: {
|
|
79
|
+
type: Object,
|
|
80
|
+
default: () => ({})
|
|
81
|
+
},
|
|
82
|
+
showView: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: true
|
|
85
|
+
},
|
|
86
|
+
showDownload: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: true
|
|
89
|
+
},
|
|
90
|
+
showDelete: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: true
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
function useFile({
|
|
96
|
+
fileListRef = ref([]),
|
|
97
|
+
acceptRef,
|
|
98
|
+
helpTextRef,
|
|
99
|
+
maxCountRef,
|
|
100
|
+
maxSizeRef
|
|
101
|
+
}) {
|
|
102
|
+
const { getAppConf } = useAppStore();
|
|
103
|
+
const { message } = useMessage();
|
|
104
|
+
const getAccept = computed(() => {
|
|
105
|
+
const accept = unref(acceptRef);
|
|
106
|
+
return accept && accept.length > 0 ? accept : [];
|
|
107
|
+
});
|
|
108
|
+
const getStringAccept = computed(() => {
|
|
109
|
+
return unref(getAccept).map((item) => {
|
|
110
|
+
if (item.indexOf("/") > 0 || item.startsWith(".")) {
|
|
111
|
+
return item;
|
|
112
|
+
} else {
|
|
113
|
+
return `.${item}`;
|
|
114
|
+
}
|
|
115
|
+
}).join(",");
|
|
116
|
+
});
|
|
117
|
+
const getHelpText = computed(() => {
|
|
118
|
+
const helpText = unref(helpTextRef);
|
|
119
|
+
if (helpText) {
|
|
120
|
+
return helpText;
|
|
121
|
+
}
|
|
122
|
+
const helpTexts = [];
|
|
123
|
+
const accept = unref(acceptRef);
|
|
124
|
+
if (accept.length > 0) {
|
|
125
|
+
helpTexts.push(`\u652F\u6301${accept.join("\u3001").replaceAll(".", "")}\u683C\u5F0F`);
|
|
126
|
+
}
|
|
127
|
+
const maxSize = unref(maxSizeRef);
|
|
128
|
+
if (maxSize) {
|
|
129
|
+
helpTexts.push(`\u4E0D\u8D85\u8FC7${maxSize}M`);
|
|
130
|
+
}
|
|
131
|
+
const maxNumber = unref(maxCountRef);
|
|
132
|
+
if (maxNumber && maxNumber !== Infinity) {
|
|
133
|
+
helpTexts.push(`\u6700\u591A\u53EF\u9009\u62E9${maxNumber}\u5F20\u56FE\u7247`);
|
|
134
|
+
}
|
|
135
|
+
return helpTexts.join(", ");
|
|
136
|
+
});
|
|
137
|
+
function getFileList() {
|
|
138
|
+
return unref(fileListRef).map((it) => {
|
|
139
|
+
return {
|
|
140
|
+
...it,
|
|
141
|
+
name: it.filename ?? it.fileId,
|
|
142
|
+
fileType: it.filename ? takeRight(it.filename.split("."))[0] : null,
|
|
143
|
+
status: "done",
|
|
144
|
+
uid: it.id ?? it.fileId,
|
|
145
|
+
url: `${getAppConf.pages?.downloadUrl}?id=${it.fileId}`
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function beforeUpload(file) {
|
|
150
|
+
const { size } = file;
|
|
151
|
+
const maxSize = unref(maxSizeRef);
|
|
152
|
+
if (maxSize && size / 1024 / 1024 >= maxSize) {
|
|
153
|
+
message.error(`\u53EA\u80FD\u4E0A\u4F20\u4E0D\u8D85\u8FC7${maxSize}MB\u7684\u6587\u4EF6!`);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
getAccept,
|
|
159
|
+
getStringAccept,
|
|
160
|
+
getHelpText,
|
|
161
|
+
getFileList,
|
|
162
|
+
beforeUpload
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const getFileThumb = (filename) => {
|
|
166
|
+
return "/imgs/fu_rar.gif";
|
|
167
|
+
};
|
|
168
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
169
|
+
__name: "PdfView",
|
|
170
|
+
setup(__props) {
|
|
171
|
+
const exeReduce = ref(233);
|
|
172
|
+
const pdfUrlRef = ref();
|
|
173
|
+
const [register] = useModal({
|
|
174
|
+
width: "70%",
|
|
175
|
+
title: "\u9644\u4EF6\u9884\u89C8",
|
|
176
|
+
useWrapper: false,
|
|
177
|
+
wrapClassName: "dt-pdf",
|
|
178
|
+
maskClosable: false,
|
|
179
|
+
footer: null
|
|
180
|
+
}, (data) => {
|
|
181
|
+
pdfUrlRef.value = data.url;
|
|
182
|
+
});
|
|
183
|
+
function toggleFullscreen(isFullscreen) {
|
|
184
|
+
exeReduce.value = isFullscreen ? 55 : 233;
|
|
185
|
+
}
|
|
186
|
+
return (_ctx, _cache) => {
|
|
187
|
+
return openBlock(), createBlock(unref$1(DtModal), {
|
|
188
|
+
onRegister: unref$1(register),
|
|
189
|
+
onToggleFullscreen: toggleFullscreen
|
|
190
|
+
}, {
|
|
191
|
+
default: withCtx(() => [
|
|
192
|
+
createVNode(unref$1(DtIframe), {
|
|
193
|
+
src: unref$1(pdfUrlRef),
|
|
194
|
+
exeReduce: unref$1(exeReduce)
|
|
195
|
+
}, null, 8, ["src", "exeReduce"])
|
|
196
|
+
]),
|
|
197
|
+
_: 1
|
|
198
|
+
}, 8, ["onRegister"]);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const _hoisted_1 = {
|
|
203
|
+
key: 1,
|
|
204
|
+
class: "flex items-center"
|
|
205
|
+
};
|
|
206
|
+
const _hoisted_2 = { class: "pl-3" };
|
|
207
|
+
const _hoisted_3 = { key: 0 };
|
|
208
|
+
const _hoisted_4 = {
|
|
209
|
+
key: 1,
|
|
210
|
+
class: "flex justify-between border border-solid border-gray-300 p-1 mt-2"
|
|
211
|
+
};
|
|
212
|
+
const _hoisted_5 = { class: "flex items-center" };
|
|
213
|
+
const _hoisted_6 = ["src"];
|
|
214
|
+
const _hoisted_7 = { class: "flex items-center" };
|
|
215
|
+
const _hoisted_8 = ["onClick"];
|
|
216
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
217
|
+
__name: "index",
|
|
218
|
+
props: basicProps,
|
|
219
|
+
setup(__props) {
|
|
220
|
+
const props = __props;
|
|
221
|
+
const [registerPdf, { openModal: openPdfModal }] = useModalOut();
|
|
222
|
+
const { message } = useMessage();
|
|
223
|
+
const {
|
|
224
|
+
defaultFiles: fileListRef,
|
|
225
|
+
accept: acceptRef,
|
|
226
|
+
helpText: helpTextRef,
|
|
227
|
+
maxCount: maxCountRef,
|
|
228
|
+
maxSize: maxSizeRef
|
|
229
|
+
} = toRefs(props);
|
|
230
|
+
const {
|
|
231
|
+
getStringAccept,
|
|
232
|
+
getHelpText,
|
|
233
|
+
getFileList,
|
|
234
|
+
beforeUpload
|
|
235
|
+
} = useFile({
|
|
236
|
+
fileListRef,
|
|
237
|
+
acceptRef,
|
|
238
|
+
helpTextRef,
|
|
239
|
+
maxCountRef,
|
|
240
|
+
maxSizeRef
|
|
241
|
+
});
|
|
242
|
+
const btns = [
|
|
243
|
+
{
|
|
244
|
+
class: "ic:baseline-remove-red-eye",
|
|
245
|
+
show: (file) => props.showView && ["pdf", "jpg", "jpeg", "png", "bmp", "gif", "docx"].includes(file.fileType),
|
|
246
|
+
click: fileView
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
class: "ic:baseline-file-download",
|
|
250
|
+
show: () => props.showDownload,
|
|
251
|
+
click: download
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
class: "mdi:delete-outline",
|
|
255
|
+
show: () => props.showDelete,
|
|
256
|
+
click: (file) => {
|
|
257
|
+
fileListRef.value = unref(fileListRef).filter((f) => f.fileId !== file.fileId);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
];
|
|
261
|
+
const getBind = computed(() => {
|
|
262
|
+
return {
|
|
263
|
+
...omit(unref(props), [
|
|
264
|
+
"api",
|
|
265
|
+
"onChange"
|
|
266
|
+
]),
|
|
267
|
+
class: "dt-upload",
|
|
268
|
+
accept: unref(getStringAccept),
|
|
269
|
+
fileList: getFileList(),
|
|
270
|
+
beforeUpload: props.beforeUpload && isFunction(props.beforeUpload) ? props.beforeUpload : beforeUpload,
|
|
271
|
+
customRequest: props.customRequest ? props.customRequest : uploadFile
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
const imgVisable = ref(false);
|
|
275
|
+
const imgSrcRef = ref();
|
|
276
|
+
const bindImg = computed(() => {
|
|
277
|
+
return {
|
|
278
|
+
preview: {
|
|
279
|
+
width: 200,
|
|
280
|
+
visible: unref(imgVisable),
|
|
281
|
+
onVisibleChange: (v) => imgVisable.value = v
|
|
282
|
+
},
|
|
283
|
+
src: unref(imgSrcRef)
|
|
284
|
+
};
|
|
285
|
+
});
|
|
286
|
+
const uploadFile = async ({ file, onSuccess, onError, onProgress }) => {
|
|
287
|
+
const { getAppConf } = useAppStore();
|
|
288
|
+
const { uploadUrl = getAppConf.pages.uploadUrl, downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
289
|
+
if (!uploadUrl) {
|
|
290
|
+
message.error("\u8BF7\u914D\u7F6E\u4E0A\u4F20\u7684\u6587\u4EF6\u8DEF\u5F84");
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (!downloadUrl) {
|
|
294
|
+
message.error("\u8BF7\u914D\u7F6E\u4E0B\u8F7D\u7684\u6587\u4EF6\u8DEF\u5F84");
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
try {
|
|
298
|
+
let result = await http.uploadFile(
|
|
299
|
+
{
|
|
300
|
+
url: uploadUrl,
|
|
301
|
+
onUploadProgress({ loaded, total }) {
|
|
302
|
+
onProgress({ percent: Math.ceil(loaded / total * 100) });
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
...props.extraParams,
|
|
307
|
+
file
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
file.fileId = result?.data?.id;
|
|
311
|
+
file.url = `${downloadUrl}?id=${result?.data?.id}`;
|
|
312
|
+
onSuccess(result);
|
|
313
|
+
} catch (err) {
|
|
314
|
+
onError(err);
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
async function fileView(file) {
|
|
318
|
+
try {
|
|
319
|
+
const { getAppConf } = useAppStore();
|
|
320
|
+
const { downloadUrl = getAppConf.pages.downloadUrl } = props;
|
|
321
|
+
if (["jpg", "jpeg", "png", "bmp", "gif"].includes(file.fileType)) {
|
|
322
|
+
imgSrcRef.value = "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png";
|
|
323
|
+
imgVisable.value = true;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (file.fileType === "pdf") {
|
|
327
|
+
openPdfModal(
|
|
328
|
+
{ url: "https://www.antdv.com/components/image-cn" }
|
|
329
|
+
);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
let result = await http.get(downloadUrl, { id: file.id }, {
|
|
333
|
+
responseType: "blob",
|
|
334
|
+
isTransformResponse: false,
|
|
335
|
+
headers: {
|
|
336
|
+
"Content-Type": HttpContentTypeEnum.FORM_DATA
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
switch (file.fileType) {
|
|
340
|
+
case "pdf":
|
|
341
|
+
openPdfModal(
|
|
342
|
+
{ url: URL.createObjectURL(result) }
|
|
343
|
+
);
|
|
344
|
+
break;
|
|
345
|
+
case "docx":
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
} catch (err) {
|
|
349
|
+
console.log(err);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function download() {
|
|
353
|
+
}
|
|
354
|
+
return (_ctx, _cache) => {
|
|
355
|
+
const _component_AButton = Button;
|
|
356
|
+
const _component_AImage = Image;
|
|
357
|
+
const _component_AUpload = Upload;
|
|
358
|
+
return openBlock(), createElementBlock("div", null, [
|
|
359
|
+
createVNode(_component_AUpload, normalizeProps(guardReactiveProps(unref$1(getBind))), createSlots({
|
|
360
|
+
itemRender: withCtx(({ file, actions }) => [
|
|
361
|
+
unref$1(getBind).listType === "picture-card" ? (openBlock(), createElementBlock("div", _hoisted_3)) : (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
362
|
+
createElementVNode("div", _hoisted_5, [
|
|
363
|
+
createElementVNode("img", {
|
|
364
|
+
src: unref$1(getFileThumb)(file.filename),
|
|
365
|
+
class: "w-9 h-9 mr-2 p-1"
|
|
366
|
+
}, null, 8, _hoisted_6),
|
|
367
|
+
createElementVNode("span", null, toDisplayString(file.filename) + "\u6587\u4EF6\u540D", 1)
|
|
368
|
+
]),
|
|
369
|
+
createElementVNode("div", _hoisted_7, [
|
|
370
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(btns, (btn) => {
|
|
371
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
372
|
+
key: btn.class
|
|
373
|
+
}, [
|
|
374
|
+
btn.show(file) ? (openBlock(), createElementBlock("i", {
|
|
375
|
+
key: 0,
|
|
376
|
+
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
|
+
onClick: ($event) => btn.click(file)
|
|
378
|
+
}, null, 10, _hoisted_8)) : createCommentVNode("", true)
|
|
379
|
+
], 64);
|
|
380
|
+
}), 64))
|
|
381
|
+
])
|
|
382
|
+
]))
|
|
383
|
+
]),
|
|
384
|
+
default: withCtx(() => [
|
|
385
|
+
unref$1(getBind).listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
386
|
+
createTextVNode(" \u8FD9\u662F\u5361\u7247\u56FE\u7247 ")
|
|
387
|
+
], 64)) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
388
|
+
createVNode(_component_AButton, null, {
|
|
389
|
+
default: withCtx(() => [
|
|
390
|
+
createElementVNode("i", {
|
|
391
|
+
class: normalizeClass(["i mr-1", unref$1(getBind).preIcon])
|
|
392
|
+
}, null, 2),
|
|
393
|
+
createElementVNode("span", null, toDisplayString(unref$1(getBind).buttonText), 1)
|
|
394
|
+
]),
|
|
395
|
+
_: 1
|
|
396
|
+
}),
|
|
397
|
+
createElementVNode("p", _hoisted_2, toDisplayString(unref$1(getHelpText)), 1)
|
|
398
|
+
])),
|
|
399
|
+
unref$1(bindImg).src ? (openBlock(), createBlock(_component_AImage, mergeProps({ key: 2 }, unref$1(bindImg), { style: { display: "none" } }), null, 16)) : createCommentVNode("", true),
|
|
400
|
+
createVNode(_sfc_main$1, { onRegister: unref$1(registerPdf) }, null, 8, ["onRegister"])
|
|
401
|
+
]),
|
|
402
|
+
_: 2
|
|
403
|
+
}, [
|
|
404
|
+
renderList(Object.keys(_ctx.$slots), (item) => {
|
|
405
|
+
return {
|
|
406
|
+
name: item,
|
|
407
|
+
fn: withCtx((data) => [
|
|
408
|
+
renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data || {})))
|
|
409
|
+
])
|
|
410
|
+
};
|
|
411
|
+
})
|
|
412
|
+
]), 1040)
|
|
413
|
+
]);
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
export {
|
|
418
|
+
_sfc_main as DtUpload
|
|
419
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@import '../iframe/index.less';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.ant-image-preview-img {
|
|
5
|
+
display: initial;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dt-upload{
|
|
9
|
+
.ant-upload{
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dt-pdf{
|
|
15
|
+
&.fullscreen-modal{
|
|
16
|
+
min-height: calc(100% + 8px);
|
|
17
|
+
&>.ant-modal{
|
|
18
|
+
width: 100% !important;
|
|
19
|
+
height: 100% !important;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
top: 0 !important;
|
|
24
|
+
.ant-modal-content{
|
|
25
|
+
height: 100%;
|
|
26
|
+
|
|
27
|
+
.ant-modal-body{
|
|
28
|
+
height: calc(100% - 55px);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ant-spin-nested-loading, .ant-spin-container{
|
|
32
|
+
height: 100%;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { PropType, Ref, ComputedRef } from "vue";
|
|
2
|
+
import { UploadFile } from "./type/file";
|
|
3
|
+
import { UploadRequestOption } from "ant-design-vue/es/vc-upload/interface";
|
|
4
|
+
import { Recordable } from "@dt-frames/core";
|
|
5
|
+
export declare const basicProps: {
|
|
6
|
+
uploadUrl: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: any;
|
|
9
|
+
};
|
|
10
|
+
downloadUrl: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: any;
|
|
13
|
+
};
|
|
14
|
+
buttonText: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
preIcon: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
data: {
|
|
23
|
+
type: PropType<object | ((file: UploadFile) => object)>;
|
|
24
|
+
default: {};
|
|
25
|
+
};
|
|
26
|
+
filename: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
accept: {
|
|
31
|
+
type: PropType<string[]>;
|
|
32
|
+
default: () => any[];
|
|
33
|
+
};
|
|
34
|
+
beforeUpload: {
|
|
35
|
+
type: PropType<(<T = any>(file: UploadFile, fileList: UploadFile[]) => boolean | Promise<T>)>;
|
|
36
|
+
};
|
|
37
|
+
customRequest: {
|
|
38
|
+
type: PropType<(params: UploadRequestOption) => void>;
|
|
39
|
+
};
|
|
40
|
+
disabled: {
|
|
41
|
+
type: PropType<Boolean | Ref<Boolean> | ComputedRef<Boolean>>;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
defaultFiles: {
|
|
45
|
+
type: PropType<UploadFile[]>;
|
|
46
|
+
default: () => any[];
|
|
47
|
+
};
|
|
48
|
+
headers: {
|
|
49
|
+
type: ObjectConstructor;
|
|
50
|
+
};
|
|
51
|
+
listType: {
|
|
52
|
+
type: PropType<"text" | "picture-card">;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
maxCount: {
|
|
56
|
+
type: NumberConstructor;
|
|
57
|
+
};
|
|
58
|
+
maxSize: {
|
|
59
|
+
type: NumberConstructor;
|
|
60
|
+
default: number;
|
|
61
|
+
};
|
|
62
|
+
helpText: {
|
|
63
|
+
type: StringConstructor;
|
|
64
|
+
default: string;
|
|
65
|
+
};
|
|
66
|
+
multiple: {
|
|
67
|
+
type: BooleanConstructor;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
70
|
+
onChange: {
|
|
71
|
+
type: PropType<(ids: string[] | number[], files: UploadFile[]) => void>;
|
|
72
|
+
};
|
|
73
|
+
extraParams: {
|
|
74
|
+
type: PropType<Recordable<any>>;
|
|
75
|
+
default: () => {};
|
|
76
|
+
};
|
|
77
|
+
showView: {
|
|
78
|
+
type: BooleanConstructor;
|
|
79
|
+
default: boolean;
|
|
80
|
+
};
|
|
81
|
+
showDownload: {
|
|
82
|
+
type: BooleanConstructor;
|
|
83
|
+
default: boolean;
|
|
84
|
+
};
|
|
85
|
+
showDelete: {
|
|
86
|
+
type: BooleanConstructor;
|
|
87
|
+
default: boolean;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _sfc_main: import("vue").DefineComponent<{}, {
|
|
2
|
+
exeReduce: import("vue").Ref<number>;
|
|
3
|
+
pdfUrlRef: import("vue").Ref<any>;
|
|
4
|
+
register: import("../../../modal/src/types/modal.type").RegisterFn;
|
|
5
|
+
toggleFullscreen: (isFullscreen: boolean) => void;
|
|
6
|
+
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<{}>>, {}>;
|
|
7
|
+
readonly DtIframe: 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<{}>>, {}>;
|
|
8
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
9
|
+
export default _sfc_main;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
import { UploadFile } from "../type/file";
|
|
3
|
+
export declare function useFile({ fileListRef, acceptRef, helpTextRef, maxCountRef, maxSizeRef, }: {
|
|
4
|
+
fileListRef: Ref<UploadFile[]>;
|
|
5
|
+
acceptRef: Ref<string[]>;
|
|
6
|
+
helpTextRef: Ref<string>;
|
|
7
|
+
maxCountRef: Ref<number>;
|
|
8
|
+
maxSizeRef: Ref<number>;
|
|
9
|
+
}): {
|
|
10
|
+
getAccept: import("vue").ComputedRef<string[]>;
|
|
11
|
+
getStringAccept: import("vue").ComputedRef<string>;
|
|
12
|
+
getHelpText: import("vue").ComputedRef<string>;
|
|
13
|
+
getFileList: () => UploadFile[];
|
|
14
|
+
beforeUpload: (file: File) => void;
|
|
15
|
+
};
|