@dt-frames/ui 1.0.45 → 1.0.47
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.
|
@@ -3,7 +3,7 @@ import { ComputedRef, VNodeChild } from "vue";
|
|
|
3
3
|
import { FormSchema, FormProps } from "../../../forms/src/types/form.type";
|
|
4
4
|
export declare type CrudOptType = {
|
|
5
5
|
t?: string;
|
|
6
|
-
title?: string | ComputedRef;
|
|
6
|
+
title?: string | ComputedRef | Function;
|
|
7
7
|
width?: string | number;
|
|
8
8
|
schemas: FormSchema[];
|
|
9
9
|
footer?: VNodeChild | JSX.Element | ButtonProps[];
|
|
@@ -21,7 +21,7 @@ export declare function useSource(opt: SourceType): {
|
|
|
21
21
|
total: number;
|
|
22
22
|
}>;
|
|
23
23
|
onTableChange: (params: TableParamsType, needSearch?: boolean) => void;
|
|
24
|
-
onDownload: (excelData: DownloadType) => void;
|
|
24
|
+
onDownload: (excelData: DownloadType, extraData?: any[]) => void;
|
|
25
25
|
loading: Ref<boolean>;
|
|
26
26
|
};
|
|
27
27
|
curd: {
|
|
@@ -38,6 +38,6 @@ export declare function useSource(opt: SourceType): {
|
|
|
38
38
|
onDeletes: (ids: any) => void;
|
|
39
39
|
onUpdate: (model: Recordable) => Promise<unknown>;
|
|
40
40
|
onTableChange: (params: TableParamsType, needSearch?: boolean) => void;
|
|
41
|
-
onDownload: (excelData: DownloadType) => void;
|
|
41
|
+
onDownload: (excelData: DownloadType, extraData?: any[]) => void;
|
|
42
42
|
onSearch: (model?: Recordable) => void;
|
|
43
43
|
};
|
package/es/index.js
CHANGED
|
@@ -6841,7 +6841,7 @@ function useFetch(api, baseUrl = "") {
|
|
|
6841
6841
|
};
|
|
6842
6842
|
}
|
|
6843
6843
|
function useDownload(exportUrl, exportName) {
|
|
6844
|
-
function download(excelData) {
|
|
6844
|
+
function download(excelData, extraData = []) {
|
|
6845
6845
|
const { params: searchDTO, type, columns } = excelData;
|
|
6846
6846
|
switch (type) {
|
|
6847
6847
|
case "all":
|
|
@@ -6854,7 +6854,7 @@ function useDownload(exportUrl, exportName) {
|
|
|
6854
6854
|
break;
|
|
6855
6855
|
case "current":
|
|
6856
6856
|
case "select":
|
|
6857
|
-
handleDownloadPage(excelData, unref(exportName));
|
|
6857
|
+
handleDownloadPage(excelData, unref(exportName), extraData);
|
|
6858
6858
|
break;
|
|
6859
6859
|
}
|
|
6860
6860
|
}
|
|
@@ -6880,7 +6880,7 @@ function useDownload(exportUrl, exportName) {
|
|
|
6880
6880
|
return column;
|
|
6881
6881
|
});
|
|
6882
6882
|
}
|
|
6883
|
-
function handleDownloadPage({ columns = [], rows = [] }, exportName2 = "") {
|
|
6883
|
+
function handleDownloadPage({ columns = [], rows = [] }, exportName2 = "", extraData = []) {
|
|
6884
6884
|
const titles = columns.map((it) => it.title);
|
|
6885
6885
|
const content = rows.reduce((total, it) => {
|
|
6886
6886
|
const rowData = columns.map((column) => {
|
|
@@ -6910,7 +6910,11 @@ function useDownload(exportUrl, exportName) {
|
|
|
6910
6910
|
total.push(rowData);
|
|
6911
6911
|
return total;
|
|
6912
6912
|
}, []);
|
|
6913
|
-
|
|
6913
|
+
let excelHeader = [titles];
|
|
6914
|
+
if (extraData && extraData.length > 0) {
|
|
6915
|
+
excelHeader = [...extraData, titles];
|
|
6916
|
+
}
|
|
6917
|
+
export2Excel(excelHeader.concat(content), exportName2);
|
|
6914
6918
|
}
|
|
6915
6919
|
function export2Excel(data = [], exportName2 = "") {
|
|
6916
6920
|
const worksheet = xlsx.utils.aoa_to_sheet(data);
|
|
@@ -7074,11 +7078,11 @@ function useSource(opt) {
|
|
|
7074
7078
|
});
|
|
7075
7079
|
}
|
|
7076
7080
|
const { download } = useDownload(apiFul.export, exportName);
|
|
7077
|
-
function onDownload(excelData) {
|
|
7081
|
+
function onDownload(excelData, extraData = []) {
|
|
7078
7082
|
download({
|
|
7079
7083
|
...excelData,
|
|
7080
7084
|
params: baseData
|
|
7081
|
-
});
|
|
7085
|
+
}, extraData);
|
|
7082
7086
|
}
|
|
7083
7087
|
const form = {
|
|
7084
7088
|
onSearch,
|
|
@@ -7224,7 +7228,7 @@ function useCurd(curdOpt) {
|
|
|
7224
7228
|
t
|
|
7225
7229
|
} = useI18n("UI");
|
|
7226
7230
|
const actType = ref(null);
|
|
7227
|
-
const title = computed(() => unref(actType) + unref(curdOpt.title));
|
|
7231
|
+
const title = computed(() => isFunction(curdOpt.title) ? curdOpt.title() : unref(actType) + unref(curdOpt.title));
|
|
7228
7232
|
const DtCurdModal = () => {
|
|
7229
7233
|
return h(createVNode("div", {
|
|
7230
7234
|
"class": "curdModal"
|