@dazhicheng/ui 1.6.49 → 1.6.51
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/dist/components/tt-custom-export-modal/src/TtCustomExportModal.vue.d.ts +36 -25
- package/dist/components/tt-custom-export-modal/src/TtCustomExportModal.vue.js +56 -298
- package/dist/components/tt-custom-export-modal/src/components/TemplateManagerSection.vue.js +71 -54
- package/dist/components/tt-custom-export-panel/index.d.ts +8 -0
- package/dist/components/tt-custom-export-panel/index.js +21 -0
- package/dist/components/tt-custom-export-panel/src/TtCustomExportPanel.vue.d.ts +19 -0
- package/dist/components/tt-custom-export-panel/src/TtCustomExportPanel.vue.js +289 -0
- package/dist/components/tt-custom-export-panel/src/TtCustomExportPanel.vue2.js +4 -0
- package/dist/components/tt-custom-export-panel/src/types/index.d.ts +6 -0
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +2 -2
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +1 -0
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.js +8 -7
- package/dist/components/tt-panel-select/src/components/PanelRight.vue.js +1 -1
- package/dist/components/tt-panel-select/src/index.vue.d.ts +3 -0
- package/dist/components/tt-panel-select/src/index.vue.js +17 -14
- package/dist/components/tt-panel-select/src/types.d.ts +4 -0
- package/dist/components/tt-table/index.d.ts +27 -0
- package/dist/components/tt-table/index.js +8 -5
- package/dist/components/tt-table/src/Table.vue.d.ts +9 -0
- package/dist/components/tt-table/src/TableForm.vue.d.ts +74 -90
- package/dist/components/tt-table/src/TableForm.vue.js +179 -175
- package/dist/components/tt-table/src/components/TableExportButton.vue.d.ts +12 -0
- package/dist/components/tt-table/src/components/TableExportButton.vue.js +44 -0
- package/dist/components/tt-table/src/components/TableExportButton.vue2.js +4 -0
- package/dist/components/tt-table/src/components/TableToolbarTools.vue.js +36 -42
- package/dist/components/tt-table/src/props.d.ts +6 -0
- package/dist/components/tt-table/src/props.js +5 -0
- package/dist/components/tt-table/src/types/table.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +111 -107
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { defineComponent as B, mergeModels as
|
|
1
|
+
import { defineComponent as B, mergeModels as N, useModel as D, ref as E, computed as S, watch as I, createElementBlock as y, openBlock as r, createElementVNode as l, createVNode as u, createCommentVNode as c, createBlock as f, unref as s, withCtx as i, Fragment as h, renderList as z, toDisplayString as v, createTextVNode as g } from "vue";
|
|
2
2
|
import { TtButton as T } from "../../../tt-button/index.js";
|
|
3
|
-
import { ElSelect as H, ElOption as j, ElTag as
|
|
3
|
+
import { ElSelect as H, ElOption as j, ElTag as b, ElInput as U } from "element-plus";
|
|
4
4
|
import F from "../assets/star.svg.js";
|
|
5
5
|
import O from "../assets/trash.svg.js";
|
|
6
|
-
const q = { class: "space-y-2.5 rounded-md border border-(--el-border-color-lighter) bg-(--el-fill-color-light)/40 p-3.5" }, A = { class: "flex flex-wrap items-center gap-2.5" }, G = { class: "flex h-full items-center justify-between text-xs" },
|
|
6
|
+
const q = { class: "space-y-2.5 rounded-md border border-(--el-border-color-lighter) bg-(--el-fill-color-light)/40 p-3.5" }, A = { class: "flex flex-wrap items-center gap-2.5" }, G = { class: "flex items-center gap-2" }, J = { class: "min-w-0 truncate" }, K = { class: "flex h-full items-center justify-between text-xs" }, P = ["innerHTML"], Q = ["innerHTML"], R = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "text-xs text-(--el-text-color-secondary)"
|
|
9
|
-
},
|
|
9
|
+
}, W = { class: "flex flex-wrap items-center gap-2.5" }, te = /* @__PURE__ */ B({
|
|
10
10
|
name: "TemplateManagerSection",
|
|
11
11
|
__name: "TemplateManagerSection",
|
|
12
|
-
props: /* @__PURE__ */
|
|
12
|
+
props: /* @__PURE__ */ N({
|
|
13
13
|
templateList: { default: () => [] },
|
|
14
14
|
isSaving: { type: Boolean, default: !1 }
|
|
15
15
|
}, {
|
|
16
16
|
selectedTemplateId: {},
|
|
17
17
|
selectedTemplateIdModifiers: {}
|
|
18
18
|
}),
|
|
19
|
-
emits: /* @__PURE__ */
|
|
19
|
+
emits: /* @__PURE__ */ N(["selectTemplate", "setDefault", "delete", "save"], ["update:selectedTemplateId"]),
|
|
20
20
|
setup(m, { emit: V }) {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
24
|
-
}),
|
|
21
|
+
const _ = m, p = V, n = D(m, "selectedTemplateId"), d = E(""), o = S(() => {
|
|
22
|
+
if (n.value)
|
|
23
|
+
return _.templateList.find((t) => t.id === n.value);
|
|
24
|
+
}), x = S(() => {
|
|
25
25
|
var t;
|
|
26
26
|
return !!((t = o.value) != null && t.defaultTemplate);
|
|
27
|
-
}),
|
|
27
|
+
}), w = (t) => {
|
|
28
28
|
p("selectTemplate", t);
|
|
29
|
-
},
|
|
30
|
-
|
|
29
|
+
}, C = () => {
|
|
30
|
+
n.value && p("setDefault", n.value);
|
|
31
|
+
}, M = () => {
|
|
32
|
+
!n.value || !o.value || p("delete", n.value, o.value.templateName || "未命名模板");
|
|
31
33
|
}, L = () => {
|
|
32
|
-
!l.value || !o.value || p("delete", l.value, o.value.templateName || "未命名模板");
|
|
33
|
-
}, _ = () => {
|
|
34
34
|
const t = d.value.trim();
|
|
35
35
|
t && p("save", t);
|
|
36
36
|
};
|
|
@@ -41,39 +41,56 @@ const q = { class: "space-y-2.5 rounded-md border border-(--el-border-color-ligh
|
|
|
41
41
|
},
|
|
42
42
|
{ immediate: !0 }
|
|
43
43
|
), (t, e) => {
|
|
44
|
-
var
|
|
45
|
-
return r(),
|
|
46
|
-
|
|
47
|
-
e[
|
|
44
|
+
var k;
|
|
45
|
+
return r(), y("div", q, [
|
|
46
|
+
l("div", A, [
|
|
47
|
+
e[7] || (e[7] = l("span", { class: "shrink-0 text-sm font-medium text-(--el-text-color-regular)" }, "导出模板", -1)),
|
|
48
48
|
u(s(H), {
|
|
49
|
-
modelValue:
|
|
50
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
49
|
+
modelValue: n.value,
|
|
50
|
+
"onUpdate:modelValue": e[0] || (e[0] = (a) => n.value = a),
|
|
51
51
|
placeholder: "请选择导出模板",
|
|
52
52
|
clearable: "",
|
|
53
53
|
style: { width: "240px" },
|
|
54
|
-
onChange:
|
|
54
|
+
onChange: w
|
|
55
55
|
}, {
|
|
56
|
+
label: i(({ label: a }) => [
|
|
57
|
+
l("span", G, [
|
|
58
|
+
l("span", J, v(a), 1),
|
|
59
|
+
x.value ? (r(), f(s(b), {
|
|
60
|
+
key: 0,
|
|
61
|
+
type: "success",
|
|
62
|
+
size: "small",
|
|
63
|
+
effect: "plain",
|
|
64
|
+
class: "shrink-0"
|
|
65
|
+
}, {
|
|
66
|
+
default: i(() => [...e[2] || (e[2] = [
|
|
67
|
+
g(" 默认 ", -1)
|
|
68
|
+
])]),
|
|
69
|
+
_: 1
|
|
70
|
+
})) : c("", !0)
|
|
71
|
+
])
|
|
72
|
+
]),
|
|
56
73
|
default: i(() => [
|
|
57
|
-
(r(!0),
|
|
58
|
-
key:
|
|
59
|
-
label:
|
|
60
|
-
value:
|
|
74
|
+
(r(!0), y(h, null, z(m.templateList, (a) => (r(), f(s(j), {
|
|
75
|
+
key: a.id,
|
|
76
|
+
label: a.templateName,
|
|
77
|
+
value: a.id ?? 0
|
|
61
78
|
}, {
|
|
62
79
|
default: i(() => [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
80
|
+
l("div", K, [
|
|
81
|
+
l("span", null, v(a.templateName), 1),
|
|
82
|
+
a.defaultTemplate ? (r(), f(s(b), {
|
|
66
83
|
key: 0,
|
|
67
84
|
type: "success",
|
|
68
85
|
size: "small",
|
|
69
86
|
effect: "plain",
|
|
70
87
|
class: "ml-2"
|
|
71
88
|
}, {
|
|
72
|
-
default: i(() => [...e[
|
|
73
|
-
|
|
89
|
+
default: i(() => [...e[3] || (e[3] = [
|
|
90
|
+
g("默认", -1)
|
|
74
91
|
])]),
|
|
75
92
|
_: 1
|
|
76
|
-
})) :
|
|
93
|
+
})) : c("", !0)
|
|
77
94
|
])
|
|
78
95
|
]),
|
|
79
96
|
_: 2
|
|
@@ -82,50 +99,50 @@ const q = { class: "space-y-2.5 rounded-md border border-(--el-border-color-ligh
|
|
|
82
99
|
_: 1
|
|
83
100
|
}, 8, ["modelValue"]),
|
|
84
101
|
u(s(T), {
|
|
85
|
-
disabled: !
|
|
86
|
-
onClick:
|
|
102
|
+
disabled: !n.value || x.value,
|
|
103
|
+
onClick: C
|
|
87
104
|
}, {
|
|
88
105
|
default: i(() => [
|
|
89
|
-
|
|
106
|
+
l("span", {
|
|
90
107
|
class: "mr-1 inline-flex items-center justify-center align-middle [&_svg]:block [&_svg]:size-3.5",
|
|
91
108
|
innerHTML: s(F)
|
|
92
|
-
}, null, 8,
|
|
93
|
-
e[
|
|
109
|
+
}, null, 8, P),
|
|
110
|
+
e[4] || (e[4] = l("span", null, "设为默认", -1))
|
|
94
111
|
]),
|
|
95
112
|
_: 1
|
|
96
113
|
}, 8, ["disabled"]),
|
|
97
114
|
u(s(T), {
|
|
98
115
|
type: "danger",
|
|
99
116
|
plain: "",
|
|
100
|
-
disabled: !
|
|
101
|
-
onClick:
|
|
117
|
+
disabled: !n.value,
|
|
118
|
+
onClick: M
|
|
102
119
|
}, {
|
|
103
120
|
default: i(() => [
|
|
104
|
-
|
|
121
|
+
l("span", {
|
|
105
122
|
class: "mr-1 inline-flex items-center justify-center align-middle [&_svg]:block [&_svg]:size-3.5",
|
|
106
123
|
innerHTML: s(O)
|
|
107
|
-
}, null, 8,
|
|
108
|
-
e[
|
|
124
|
+
}, null, 8, Q),
|
|
125
|
+
e[5] || (e[5] = l("span", null, "删除", -1))
|
|
109
126
|
]),
|
|
110
127
|
_: 1
|
|
111
128
|
}, 8, ["disabled"]),
|
|
112
|
-
o.value ? (r(),
|
|
113
|
-
|
|
129
|
+
o.value ? (r(), y("span", R, " 当前:" + v(o.value.templateName) + "(" + v(((k = o.value.fields) == null ? void 0 : k.length) ?? 0) + " 字段) ", 1)) : c("", !0),
|
|
130
|
+
x.value ? (r(), f(s(b), {
|
|
114
131
|
key: 1,
|
|
115
132
|
type: "success",
|
|
116
133
|
size: "small",
|
|
117
134
|
effect: "plain"
|
|
118
135
|
}, {
|
|
119
|
-
default: i(() => [...e[
|
|
120
|
-
|
|
136
|
+
default: i(() => [...e[6] || (e[6] = [
|
|
137
|
+
g("默认字段", -1)
|
|
121
138
|
])]),
|
|
122
139
|
_: 1
|
|
123
|
-
})) :
|
|
140
|
+
})) : c("", !0)
|
|
124
141
|
]),
|
|
125
|
-
|
|
142
|
+
l("div", W, [
|
|
126
143
|
u(s(U), {
|
|
127
144
|
modelValue: d.value,
|
|
128
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
145
|
+
"onUpdate:modelValue": e[1] || (e[1] = (a) => d.value = a),
|
|
129
146
|
placeholder: "输入模板名称,保存当前勾选字段",
|
|
130
147
|
clearable: "",
|
|
131
148
|
style: { width: "280px" }
|
|
@@ -134,19 +151,19 @@ const q = { class: "space-y-2.5 rounded-md border border-(--el-border-color-ligh
|
|
|
134
151
|
type: "primary",
|
|
135
152
|
loading: m.isSaving,
|
|
136
153
|
disabled: !d.value.trim(),
|
|
137
|
-
onClick:
|
|
154
|
+
onClick: L
|
|
138
155
|
}, {
|
|
139
|
-
default: i(() => [...e[
|
|
140
|
-
|
|
156
|
+
default: i(() => [...e[8] || (e[8] = [
|
|
157
|
+
g(" 保存为模板 ", -1)
|
|
141
158
|
])]),
|
|
142
159
|
_: 1
|
|
143
160
|
}, 8, ["loading", "disabled"]),
|
|
144
|
-
e[
|
|
161
|
+
e[9] || (e[9] = l("span", { class: "text-xs text-(--el-text-color-secondary)" }, "同名模板将被覆盖", -1))
|
|
145
162
|
])
|
|
146
163
|
]);
|
|
147
164
|
};
|
|
148
165
|
}
|
|
149
166
|
});
|
|
150
167
|
export {
|
|
151
|
-
|
|
168
|
+
te as default
|
|
152
169
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Plugin } from 'vue';
|
|
2
|
+
import { default as TtCustomExportPanelConstructor } from './src/TtCustomExportPanel.vue';
|
|
3
|
+
/** 可直接嵌入页面的导出字段与模板管理面板。 */
|
|
4
|
+
export declare const TtCustomExportPanel: typeof TtCustomExportPanelConstructor & Plugin;
|
|
5
|
+
/** 面板实例,可等待 ready、重新加载或由外部调用 confirm() 获取当前选择。 */
|
|
6
|
+
export type TtCustomExportPanelInstance = InstanceType<typeof TtCustomExportPanelConstructor>;
|
|
7
|
+
export type { TtCustomExportPanelProps } from './src/types';
|
|
8
|
+
export default TtCustomExportPanel;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "axios";
|
|
2
|
+
import "element-plus";
|
|
3
|
+
import "dayjs";
|
|
4
|
+
import "vue";
|
|
5
|
+
import { withInstall as t } from "../../packages/utils/src/install.js";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
8
|
+
import "dayjs/plugin/utc";
|
|
9
|
+
import "dayjs/plugin/timezone";
|
|
10
|
+
import "../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
11
|
+
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
12
|
+
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
13
|
+
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
|
+
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
|
+
import "lodash-es";
|
|
16
|
+
import o from "./src/TtCustomExportPanel.vue.js";
|
|
17
|
+
const w = t(o);
|
|
18
|
+
export {
|
|
19
|
+
w as TtCustomExportPanel,
|
|
20
|
+
w as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VxeTableDefines } from 'vxe-table';
|
|
2
|
+
import { TtCustomExportPanelProps } from './types';
|
|
3
|
+
import { ExportConfirmPayload, ReportAPI } from '../../tt-custom-export-modal/src/types';
|
|
4
|
+
declare const _default: import('vue').DefineComponent<TtCustomExportPanelProps, {
|
|
5
|
+
reload: () => Promise<void>;
|
|
6
|
+
ready: import('vue').ShallowRef<Promise<void>, Promise<void>>;
|
|
7
|
+
confirm: () => ExportConfirmPayload | undefined;
|
|
8
|
+
isLoading: import('vue').Ref<boolean, boolean>;
|
|
9
|
+
fieldCount: import('vue').ComputedRef<number>;
|
|
10
|
+
selectedCount: import('vue').ComputedRef<number>;
|
|
11
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
12
|
+
templateChange: (template: ReportAPI.ExportTemplateCO | undefined) => any;
|
|
13
|
+
}, string, import('vue').PublicProps, Readonly<TtCustomExportPanelProps> & Readonly<{
|
|
14
|
+
onTemplateChange?: ((template: ReportAPI.ExportTemplateCO | undefined) => any) | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
listColumns: string[] | VxeTableDefines.ColumnOptions<any>[] | import('vue').Ref<string[] | VxeTableDefines.ColumnOptions<any>[] | undefined, string[] | VxeTableDefines.ColumnOptions<any>[] | undefined> | import('vue').ShallowRef<string[] | VxeTableDefines.ColumnOptions<any>[] | undefined, string[] | VxeTableDefines.ColumnOptions<any>[] | undefined> | import('vue').WritableComputedRef<string[] | VxeTableDefines.ColumnOptions<any>[] | undefined, string[] | VxeTableDefines.ColumnOptions<any>[] | undefined> | import('vue').ComputedRef<string[] | VxeTableDefines.ColumnOptions<any>[] | undefined> | (() => string[] | VxeTableDefines.ColumnOptions<any>[] | undefined);
|
|
17
|
+
businessCode: string;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { defineComponent as te, shallowRef as w, ref as T, computed as c, toValue as le, watch as ae, onBeforeUnmount as se, createElementBlock as _, openBlock as k, withDirectives as ie, createVNode as F, unref as oe } from "vue";
|
|
2
|
+
import "axios";
|
|
3
|
+
import { vLoading as ne, ElMessage as m, ElMessageBox as de } from "element-plus";
|
|
4
|
+
import { isString as re } from "../../../packages/utils/src/is.js";
|
|
5
|
+
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
8
|
+
import "dayjs/plugin/utc";
|
|
9
|
+
import "dayjs/plugin/timezone";
|
|
10
|
+
import { subtract as M, add as ue } from "../../../packages/utils/src/calc.js";
|
|
11
|
+
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
12
|
+
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
13
|
+
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
|
+
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
|
+
import "lodash-es";
|
|
16
|
+
import { setDefaultTemplatesExportApi as ce, deleteTemplatesExportApi as fe, saveTemplatesExportApi as ve, listTemplatesExportApi as pe, fieldsTemplatesExportApi as me } from "../../tt-custom-export-modal/src/api.js";
|
|
17
|
+
import Ce from "../../tt-custom-export-modal/src/components/FieldGridSection.vue.js";
|
|
18
|
+
import Se from "../../tt-custom-export-modal/src/components/FieldToolbarSection.vue.js";
|
|
19
|
+
import he from "../../tt-custom-export-modal/src/components/TemplateManagerSection.vue.js";
|
|
20
|
+
const we = { class: "TtCustomExportPanel flex min-w-0 flex-col gap-3" }, $e = /* @__PURE__ */ te({
|
|
21
|
+
name: "TtCustomExportPanel",
|
|
22
|
+
__name: "TtCustomExportPanel",
|
|
23
|
+
props: {
|
|
24
|
+
defaultSelectedCodes: {},
|
|
25
|
+
businessCode: { default: "BUSINESS_SALES_REPORT" },
|
|
26
|
+
availableFields: {},
|
|
27
|
+
listColumns: { default: () => [] },
|
|
28
|
+
fetchFieldsApi: {},
|
|
29
|
+
fetchTemplatesApi: {},
|
|
30
|
+
saveTemplateApi: {},
|
|
31
|
+
deleteTemplateApi: {},
|
|
32
|
+
setDefaultTemplateApi: {}
|
|
33
|
+
},
|
|
34
|
+
emits: ["templateChange"],
|
|
35
|
+
setup(P, { expose: R, emit: U }) {
|
|
36
|
+
const i = P, b = U;
|
|
37
|
+
let a = Symbol();
|
|
38
|
+
const N = w(a), A = w(Promise.resolve()), v = T(!1), C = T(!1), o = w([]), u = w([]), f = T(void 0), g = T(""), n = w(/* @__PURE__ */ new Set()), $ = c(() => new Map(o.value.map((e) => [e.fieldCode, e]))), p = c(() => [...n.value].map((e) => $.value.get(e)).filter((e) => !!e)), d = c(() => i.businessCode), V = c(() => o.value.length), z = c(() => p.value.length), x = (e = le(i.listColumns)) => (e ?? []).flatMap((t) => {
|
|
39
|
+
var l;
|
|
40
|
+
return re(t) ? [t] : t.visible === !1 ? [] : (l = t.children) != null && l.length ? x(t.children) : t.field ? [t.field] : [];
|
|
41
|
+
}), G = c(() => x()), S = c(() => {
|
|
42
|
+
const e = g.value.trim().toLowerCase();
|
|
43
|
+
return e ? o.value.filter((t) => {
|
|
44
|
+
const l = (t.fieldName ?? "").toLowerCase().includes(e), s = (t.fieldCode ?? "").toLowerCase().includes(e);
|
|
45
|
+
return l || s;
|
|
46
|
+
}) : o.value;
|
|
47
|
+
}), B = c(() => S.value.length === 0 ? !1 : S.value.every((e) => n.value.has(e.fieldCode || ""))), D = () => {
|
|
48
|
+
const e = u.value.find((t) => t.defaultTemplate);
|
|
49
|
+
if (f.value = e == null ? void 0 : e.id, e && e.fields && e.fields.length > 0) {
|
|
50
|
+
const t = /* @__PURE__ */ new Set();
|
|
51
|
+
[...e.fields].sort((l, s) => M(l.sortNo ?? 0, s.sortNo ?? 0)).forEach((l) => {
|
|
52
|
+
l.fieldCode && t.add(l.fieldCode);
|
|
53
|
+
}), o.value.forEach((l) => {
|
|
54
|
+
l.requiredSelected && l.fieldCode && t.add(l.fieldCode);
|
|
55
|
+
}), n.value = t;
|
|
56
|
+
}
|
|
57
|
+
}, I = async (e) => {
|
|
58
|
+
const t = i.availableFields;
|
|
59
|
+
if (t && t.length > 0) {
|
|
60
|
+
o.value = [...t], E();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (i.fetchFieldsApi) {
|
|
64
|
+
try {
|
|
65
|
+
const l = await i.fetchFieldsApi({ businessCode: d.value });
|
|
66
|
+
if (e !== a) return;
|
|
67
|
+
o.value = l ?? [];
|
|
68
|
+
} catch {
|
|
69
|
+
if (e !== a) return;
|
|
70
|
+
o.value = [];
|
|
71
|
+
}
|
|
72
|
+
E();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (d.value) {
|
|
76
|
+
try {
|
|
77
|
+
const l = await me({
|
|
78
|
+
businessCode: d.value
|
|
79
|
+
});
|
|
80
|
+
if (e !== a) return;
|
|
81
|
+
o.value = l ?? [];
|
|
82
|
+
} catch {
|
|
83
|
+
if (e !== a) return;
|
|
84
|
+
o.value = [];
|
|
85
|
+
}
|
|
86
|
+
E();
|
|
87
|
+
}
|
|
88
|
+
}, y = async (e) => {
|
|
89
|
+
if (e === a) {
|
|
90
|
+
if (i.fetchTemplatesApi) {
|
|
91
|
+
try {
|
|
92
|
+
const t = await i.fetchTemplatesApi({ businessCode: d.value });
|
|
93
|
+
if (e !== a) return;
|
|
94
|
+
u.value = t ?? [];
|
|
95
|
+
} catch {
|
|
96
|
+
if (e !== a) return;
|
|
97
|
+
u.value = [];
|
|
98
|
+
}
|
|
99
|
+
D();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (d.value) {
|
|
103
|
+
try {
|
|
104
|
+
const t = await pe({
|
|
105
|
+
businessCode: d.value
|
|
106
|
+
});
|
|
107
|
+
if (e !== a) return;
|
|
108
|
+
u.value = t ?? [];
|
|
109
|
+
} catch {
|
|
110
|
+
if (e !== a) return;
|
|
111
|
+
u.value = [];
|
|
112
|
+
}
|
|
113
|
+
D();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}, E = () => {
|
|
117
|
+
const e = /* @__PURE__ */ new Set();
|
|
118
|
+
o.value.forEach((t) => {
|
|
119
|
+
(t.requiredSelected || t.defaultSelected) && t.fieldCode && e.add(t.fieldCode);
|
|
120
|
+
}), n.value = e;
|
|
121
|
+
}, L = (e) => {
|
|
122
|
+
if (f.value = e, !e) {
|
|
123
|
+
b("templateChange", void 0);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const t = u.value.find((l) => l.id === e);
|
|
127
|
+
if (b("templateChange", t), t && t.fields && t.fields.length > 0) {
|
|
128
|
+
const l = /* @__PURE__ */ new Set();
|
|
129
|
+
[...t.fields].sort((s, h) => M(s.sortNo ?? 0, h.sortNo ?? 0)).forEach((s) => {
|
|
130
|
+
s.fieldCode && l.add(s.fieldCode);
|
|
131
|
+
}), o.value.forEach((s) => {
|
|
132
|
+
s.requiredSelected && s.fieldCode && l.add(s.fieldCode);
|
|
133
|
+
}), n.value = l;
|
|
134
|
+
}
|
|
135
|
+
}, K = async (e) => {
|
|
136
|
+
if (!d.value || !a) return;
|
|
137
|
+
const t = a;
|
|
138
|
+
try {
|
|
139
|
+
if (i.setDefaultTemplateApi ? await i.setDefaultTemplateApi({
|
|
140
|
+
businessCode: d.value,
|
|
141
|
+
templateId: e
|
|
142
|
+
}) : await ce({
|
|
143
|
+
businessCode: d.value,
|
|
144
|
+
templateId: e
|
|
145
|
+
}), t !== a) return;
|
|
146
|
+
m.success("已设为默认模板"), await y(t);
|
|
147
|
+
} catch {
|
|
148
|
+
}
|
|
149
|
+
}, O = async (e, t) => {
|
|
150
|
+
if (!d.value || !a) return;
|
|
151
|
+
const l = a;
|
|
152
|
+
try {
|
|
153
|
+
if (await de.confirm(`确定要删除导出模板「${t}」吗?`, "删除确认", {
|
|
154
|
+
type: "warning",
|
|
155
|
+
confirmButtonText: "确定删除",
|
|
156
|
+
cancelButtonText: "取消"
|
|
157
|
+
}), l !== a || (i.deleteTemplateApi ? await i.deleteTemplateApi({
|
|
158
|
+
businessCode: d.value,
|
|
159
|
+
templateId: e
|
|
160
|
+
}) : await fe({
|
|
161
|
+
businessCode: d.value,
|
|
162
|
+
templateId: e
|
|
163
|
+
}), l !== a)) return;
|
|
164
|
+
m.success("模板删除成功"), f.value = void 0, await y(l);
|
|
165
|
+
} catch {
|
|
166
|
+
}
|
|
167
|
+
}, j = async (e) => {
|
|
168
|
+
if (v.value || C.value || !a) return;
|
|
169
|
+
if (p.value.length === 0) {
|
|
170
|
+
m.warning("请至少勾选一个导出字段后再保存模板");
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const t = a;
|
|
174
|
+
try {
|
|
175
|
+
C.value = !0;
|
|
176
|
+
const l = p.value.map((r, ee) => ({
|
|
177
|
+
fieldId: r.id,
|
|
178
|
+
customColumnName: r.fieldName,
|
|
179
|
+
sortNo: ue(ee, 1)
|
|
180
|
+
})), s = {
|
|
181
|
+
businessCode: d.value,
|
|
182
|
+
templateName: e,
|
|
183
|
+
fields: l
|
|
184
|
+
};
|
|
185
|
+
if (i.saveTemplateApi ? await i.saveTemplateApi(s) : await ve(s), t !== a || (m.success(`模板「${e}」保存成功`), await y(t), t !== a)) return;
|
|
186
|
+
const h = u.value.find((r) => r.templateName === e);
|
|
187
|
+
h && L(h.id);
|
|
188
|
+
} catch {
|
|
189
|
+
} finally {
|
|
190
|
+
t === a && (C.value = !1);
|
|
191
|
+
}
|
|
192
|
+
}, H = (e) => {
|
|
193
|
+
if (e.requiredSelected || !e.fieldCode) return;
|
|
194
|
+
const t = new Set(n.value);
|
|
195
|
+
t.has(e.fieldCode) ? t.delete(e.fieldCode) : t.add(e.fieldCode), n.value = t;
|
|
196
|
+
}, J = () => {
|
|
197
|
+
const e = new Set(n.value);
|
|
198
|
+
B.value ? S.value.forEach((t) => {
|
|
199
|
+
!t.requiredSelected && t.fieldCode && e.delete(t.fieldCode);
|
|
200
|
+
}) : S.value.forEach((t) => {
|
|
201
|
+
t.fieldCode && e.add(t.fieldCode);
|
|
202
|
+
}), n.value = e;
|
|
203
|
+
}, Q = () => {
|
|
204
|
+
const e = x();
|
|
205
|
+
if (e.length === 0) return;
|
|
206
|
+
const t = new Set(e), l = /* @__PURE__ */ new Set();
|
|
207
|
+
o.value.forEach((s) => {
|
|
208
|
+
s.fieldCode && (s.requiredSelected || t.has(s.fieldCode)) && l.add(s.fieldCode);
|
|
209
|
+
}), n.value = l, m.success("已同步表格当前展示列");
|
|
210
|
+
}, W = () => {
|
|
211
|
+
const e = /* @__PURE__ */ new Set();
|
|
212
|
+
o.value.forEach((t) => {
|
|
213
|
+
t.requiredSelected && t.fieldCode && e.add(t.fieldCode);
|
|
214
|
+
}), n.value = e;
|
|
215
|
+
}, X = () => {
|
|
216
|
+
if (v.value || !a) return;
|
|
217
|
+
if (p.value.length === 0) {
|
|
218
|
+
m.warning("请至少勾选一个导出字段");
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const e = p.value, t = e.map((r) => r.fieldCode || "").filter(Boolean), l = e.map((r) => r.fieldName || r.fieldCode || "").filter(Boolean), s = u.value.find((r) => r.id === f.value);
|
|
222
|
+
return {
|
|
223
|
+
businessCode: d.value,
|
|
224
|
+
selectedFields: e,
|
|
225
|
+
selectedFieldCodes: t,
|
|
226
|
+
selectedFieldNames: l,
|
|
227
|
+
templateName: s == null ? void 0 : s.templateName,
|
|
228
|
+
templateId: s == null ? void 0 : s.id
|
|
229
|
+
};
|
|
230
|
+
}, Y = async () => {
|
|
231
|
+
const e = Symbol();
|
|
232
|
+
a = e, o.value = [], u.value = [], n.value = /* @__PURE__ */ new Set(), N.value = e, f.value = void 0, g.value = "", C.value = !1, v.value = !0;
|
|
233
|
+
try {
|
|
234
|
+
if (await I(e), e !== a || (await y(e), e !== a)) return;
|
|
235
|
+
if (i.defaultSelectedCodes && i.defaultSelectedCodes.length > 0) {
|
|
236
|
+
const t = new Set(i.defaultSelectedCodes);
|
|
237
|
+
o.value.forEach((l) => {
|
|
238
|
+
l.requiredSelected && l.fieldCode && t.add(l.fieldCode);
|
|
239
|
+
}), n.value = t;
|
|
240
|
+
}
|
|
241
|
+
} finally {
|
|
242
|
+
e === a && (v.value = !1);
|
|
243
|
+
}
|
|
244
|
+
}, q = () => (A.value = Y(), A.value), Z = () => {
|
|
245
|
+
a = void 0;
|
|
246
|
+
};
|
|
247
|
+
return ae(() => i.businessCode, q, { immediate: !0 }), se(Z), R({ reload: q, ready: A, confirm: X, isLoading: v, fieldCount: V, selectedCount: z }), (e, t) => (k(), _("section", we, [
|
|
248
|
+
ie((k(), _("div", {
|
|
249
|
+
key: N.value,
|
|
250
|
+
class: "flex flex-col gap-3 py-1"
|
|
251
|
+
}, [
|
|
252
|
+
F(he, {
|
|
253
|
+
"selected-template-id": f.value,
|
|
254
|
+
"onUpdate:selectedTemplateId": t[0] || (t[0] = (l) => f.value = l),
|
|
255
|
+
"template-list": u.value,
|
|
256
|
+
"is-saving": C.value,
|
|
257
|
+
onSelectTemplate: L,
|
|
258
|
+
onSetDefault: K,
|
|
259
|
+
onDelete: O,
|
|
260
|
+
onSave: j
|
|
261
|
+
}, null, 8, ["selected-template-id", "template-list", "is-saving"]),
|
|
262
|
+
F(Se, {
|
|
263
|
+
keyword: g.value,
|
|
264
|
+
"onUpdate:keyword": t[1] || (t[1] = (l) => g.value = l),
|
|
265
|
+
"is-all-selected": B.value,
|
|
266
|
+
"has-list-columns": G.value.length > 0,
|
|
267
|
+
onToggleSelectAll: J,
|
|
268
|
+
onSelectByListColumns: Q,
|
|
269
|
+
onClearAll: W
|
|
270
|
+
}, null, 8, ["keyword", "is-all-selected", "has-list-columns"]),
|
|
271
|
+
F(Ce, {
|
|
272
|
+
"filtered-fields": S.value,
|
|
273
|
+
"total-field-count": o.value.length,
|
|
274
|
+
"selected-code-set": n.value,
|
|
275
|
+
"selected-fields": p.value,
|
|
276
|
+
onReorder: t[2] || (t[2] = (l) => {
|
|
277
|
+
n.value = new Set(l);
|
|
278
|
+
}),
|
|
279
|
+
onToggleField: H
|
|
280
|
+
}, null, 8, ["filtered-fields", "total-field-count", "selected-code-set", "selected-fields"])
|
|
281
|
+
])), [
|
|
282
|
+
[oe(ne), v.value]
|
|
283
|
+
])
|
|
284
|
+
]));
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
export {
|
|
288
|
+
$e as default
|
|
289
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TtCustomExportModalProps } from '../../../tt-custom-export-modal/src/types';
|
|
2
|
+
/** 内嵌导出面板配置;字段、模板接口及列来源与弹框共用。 */
|
|
3
|
+
export interface TtCustomExportPanelProps extends Omit<TtCustomExportModalProps, "title"> {
|
|
4
|
+
/** 初始化时最后应用的非空预选编码;按传入顺序排列,并补齐必选字段。 */
|
|
5
|
+
defaultSelectedCodes?: string[];
|
|
6
|
+
}
|
|
@@ -4,24 +4,24 @@ import { FieldEntry } from '../../types/forms';
|
|
|
4
4
|
export declare const FormArrayRegister: import('vue').DefineComponent<{
|
|
5
5
|
disabled?: boolean | undefined;
|
|
6
6
|
hide?: boolean | undefined;
|
|
7
|
-
fieldName: string;
|
|
8
7
|
rules?: import('../../types').FormSchemaRuleType | undefined;
|
|
9
8
|
defaultValue?: any;
|
|
10
9
|
wrapperClass?: string | undefined;
|
|
11
10
|
arraySchema?: FormSchema<Record<string, any>>[] | ((entry: FieldEntry<Recordable>, currentIndex: number, ctx: ArraySchemaContext) => FormSchema<Record<string, any>>[]) | undefined;
|
|
12
11
|
dependencies?: import('./types').ArrayRegisterDependencies<Record<string, any>> | undefined;
|
|
12
|
+
fieldName: string;
|
|
13
13
|
formItemClass?: (() => string) | string | undefined;
|
|
14
14
|
virtual?: boolean | undefined;
|
|
15
15
|
progressive?: boolean | undefined;
|
|
16
16
|
}, () => import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
17
17
|
disabled?: boolean | undefined;
|
|
18
18
|
hide?: boolean | undefined;
|
|
19
|
-
fieldName: string;
|
|
20
19
|
rules?: import('../../types').FormSchemaRuleType | undefined;
|
|
21
20
|
defaultValue?: any;
|
|
22
21
|
wrapperClass?: string | undefined;
|
|
23
22
|
arraySchema?: FormSchema<Record<string, any>>[] | ((entry: FieldEntry<Recordable>, currentIndex: number, ctx: ArraySchemaContext) => FormSchema<Record<string, any>>[]) | undefined;
|
|
24
23
|
dependencies?: import('./types').ArrayRegisterDependencies<Record<string, any>> | undefined;
|
|
24
|
+
fieldName: string;
|
|
25
25
|
formItemClass?: (() => string) | string | undefined;
|
|
26
26
|
virtual?: boolean | undefined;
|
|
27
27
|
progressive?: boolean | undefined;
|
|
@@ -20,6 +20,7 @@ declare const _default: import('vue').DefineComponent<PanelMiddleProps, {
|
|
|
20
20
|
onOptionsCheck?: ((values: PanelSelectValue[], checked: boolean) => any) | undefined;
|
|
21
21
|
}>, {
|
|
22
22
|
disabled: boolean;
|
|
23
|
+
showMultiple: boolean;
|
|
23
24
|
scrollToGroupValue: PanelSelectValue;
|
|
24
25
|
pasteSearch: boolean;
|
|
25
26
|
separator: import('../types').PanelSelectSeparator;
|