@dazhicheng/ui 1.5.247 → 1.5.248

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.
@@ -1,14 +1,14 @@
1
- import { defineComponent as Y, ref as S, reactive as Z, computed as C, watch as T, createBlock as E, openBlock as m, unref as s, normalizeClass as b, createSlots as ee, withCtx as d, createElementVNode as c, createVNode as a, toDisplayString as h, createElementBlock as v, Fragment as M, renderList as $, createTextVNode as F, createCommentVNode as le, withModifiers as te, renderSlot as V } from "vue";
2
- import oe from "../../../../assets/svg/close.svg.js";
3
- import se from "../../../../assets/svg/drag.svg.js";
4
- import { TtIcon as B } from "../../../tt-icon/index.js";
5
- import { TtText as ne } from "../../../tt-text/index.js";
1
+ import { defineComponent as Q, ref as x, computed as b, createBlock as F, openBlock as f, unref as e, normalizeClass as a, createSlots as W, withCtx as s, createElementVNode as c, createVNode as r, createTextVNode as h, toDisplayString as $, createElementBlock as C, Fragment as w, renderList as T, createCommentVNode as X, withModifiers as Y, renderSlot as V } from "vue";
2
+ import Z from "../../../../assets/svg/close.svg.js";
3
+ import ee from "../../../../assets/svg/drag.svg.js";
4
+ import { TtIcon as P } from "../../../tt-icon/index.js";
5
+ import { TtText as le } from "../../../tt-text/index.js";
6
6
  import "../../../tt-modal/index.js";
7
- import { TtButton as ie } from "../../../tt-button/index.js";
7
+ import { TtButton as te } from "../../../tt-button/index.js";
8
8
  import "../../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
9
- import { useDesign as de } from "../../../../packages/hooks/src/useDesign.js";
9
+ import { useDesign as oe } from "../../../../packages/hooks/src/useDesign.js";
10
10
  import "axios";
11
- import { ElScrollbar as I, ElCheckbox as R, ElCheckboxGroup as ce, ElTooltip as ae } from "element-plus";
11
+ import { ElScrollbar as B, ElCheckbox as N, ElCheckboxGroup as ne, ElTooltip as ie } from "element-plus";
12
12
  import "dayjs";
13
13
  import "xe-utils";
14
14
  import "dayjs/plugin/utc";
@@ -18,231 +18,204 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ae
18
18
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
19
19
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
20
20
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
21
- import { cloneDeep as re } from "lodash-es";
22
- import ue from "sortablejs";
23
- import { useModalRender as me } from "../../../tt-modal/src/hooks/useModalRender.js";
24
- const fe = { class: "flex-1" }, pe = { class: "cb flex items-center" }, he = { class: "text-[var(--el-text-color-primary)] font-bold" }, xe = { class: "flex flex-col w-[200px] shrink-0" }, Ce = { class: "flex items-center justify-between px-15px pt-12px pb-6px text-xs text-[var(--el-text-color-regular)]" }, be = { class: "flex items-center text-xs" }, ve = ["onClick"], ke = { class: "text-left" }, Le = /* @__PURE__ */ Y({
21
+ import "lodash-es";
22
+ import ae from "sortablejs";
23
+ import { useModalRender as se } from "../../../tt-modal/src/hooks/useModalRender.js";
24
+ const re = ["aria-label", "onClick"], Pe = /* @__PURE__ */ Q({
25
25
  __name: "TableColumnModal",
26
26
  props: {
27
27
  openColumn: { type: Function },
28
28
  openExport: { type: Function }
29
29
  },
30
30
  emits: ["on-submit"],
31
- setup(A, { expose: N, emit: j }) {
32
- const r = A, z = j, { prefixCls: u } = de("table-column-modal"), _ = S(), [D, x] = me(), k = S(!1), l = Z({
33
- allColumns: [],
34
- checkedFields: [],
35
- selectedColumns: [],
36
- disabledColumnField: []
37
- });
38
- let f = null, g = null;
39
- const p = C(() => l.allColumns.filter((e) => e.field)), O = C(() => p.value.filter((e) => !e.disabled)), P = C(() => {
40
- const e = O.value.length;
41
- return e === 0 ? !0 : l.checkedFields.filter((t) => !l.disabledColumnField.includes(t)).length === e;
42
- }), q = C(() => {
43
- const e = [.../* @__PURE__ */ new Set([...l.checkedFields, ...l.disabledColumnField])];
44
- return e.length > 0 && e.length < p.value.length;
45
- });
46
- function G(e) {
47
- const o = p.value;
48
- l.checkedFields = e ? o.map((t) => t.field) : o.filter((t) => l.disabledColumnField.includes(t.field)).map((t) => t.field);
31
+ setup(z, { expose: A, emit: I }) {
32
+ const m = z, D = I, { prefixCls: i } = oe("table-column-modal"), [L, g] = se(), u = x([]), n = x([]), y = x(!1);
33
+ let p = null;
34
+ const E = b(
35
+ () => n.value.map((t) => u.value.find((l) => l.field === t)).filter(Boolean)
36
+ ), R = b(() => u.value.filter((t) => !t.locked)), G = b(() => n.value.filter((t) => !M(t))), S = b(() => G.value.length === R.value.length), O = b(() => n.value.length > 0 && !S.value);
37
+ function M(t) {
38
+ return u.value.some((l) => l.field === t && l.locked);
49
39
  }
50
- function L(e) {
51
- l.checkedFields = l.checkedFields.filter((o) => o !== e);
40
+ function U(t) {
41
+ n.value = u.value.filter((l) => l.locked ? n.value.includes(l.field) : !!t).map((l) => l.field);
52
42
  }
53
- function U() {
54
- l.checkedFields = l.checkedFields.filter((e) => l.disabledColumnField.includes(e));
43
+ function j(t) {
44
+ n.value = n.value.filter((l) => l !== t);
55
45
  }
56
- const y = () => {
57
- z("on-submit", {
58
- checkedModel: [...l.selectedColumns.map((e) => e.field)],
59
- modalApi: x,
60
- isExport: k.value
46
+ function q() {
47
+ n.value = n.value.filter(M);
48
+ }
49
+ function _() {
50
+ D("on-submit", {
51
+ checkedModel: [...n.value],
52
+ modalApi: g,
53
+ isExport: y.value
61
54
  });
62
- };
63
- function H({ columns: e, displayFields: o = [], disabledColumnField: t, isExport: n }) {
64
- k.value = n ?? !1, x.openModal();
65
- const Q = re(e).filter((i) => i.field);
66
- l.disabledColumnField = t, l.allColumns = Q.map((i) => ({ ...i, disabled: t.includes(i.field) }));
67
- const W = new Set(l.allColumns.map((i) => i.field)), w = o.filter((i) => i && W.has(i));
68
- l.checkedFields = [...w], l.selectedColumns = w.map((i) => l.allColumns.find((X) => X.field === i)).filter(Boolean), g = setTimeout(J, 100);
69
55
  }
70
- function J() {
71
- var o;
72
- const e = (o = s(_)) == null ? void 0 : o.querySelector(`.${u}-move-box`);
73
- e && (f = ue.create(e, {
56
+ function H({ columns: t, displayFields: l = [], disabledColumnField: o, isExport: v }) {
57
+ y.value = v ?? !1, u.value = t.filter((d) => d.field).map((d) => ({ ...d, locked: o.includes(d.field) }));
58
+ const k = new Set(u.value.map((d) => d.field));
59
+ n.value = [...new Set(l.filter((d) => k.has(d)))], g.openModal();
60
+ }
61
+ function J(t) {
62
+ p == null || p.destroy(), p = null, t && (p = ae.create(t, {
74
63
  animation: 300,
75
- handle: `.${u}-item-move:not(.is-disabled)`,
76
- onStart: (t) => t.item.style.opacity = "0",
77
- onEnd(t) {
78
- if (t.oldIndex == null || t.newIndex == null) return;
79
- const [n] = l.selectedColumns.splice(t.oldIndex, 1);
80
- l.selectedColumns.splice(t.newIndex, 0, n), t.item.style.opacity = "1";
64
+ onStart: (l) => l.item.style.opacity = "0",
65
+ onEnd(l) {
66
+ l.item.style.opacity = "1";
67
+ const { oldIndex: o, newIndex: v } = l;
68
+ if (o == null || v == null) return;
69
+ const k = [...n.value];
70
+ k.splice(v, 0, ...k.splice(o, 1)), n.value = k;
81
71
  }
82
72
  }));
83
73
  }
84
- T(
85
- () => l.checkedFields,
86
- (e) => {
87
- const o = new Set(e);
88
- l.selectedColumns = l.selectedColumns.filter((n) => o.has(n.field || ""));
89
- const t = new Set(l.selectedColumns.map((n) => n.field || ""));
90
- l.selectedColumns.push(
91
- ...l.allColumns.filter((n) => o.has(n.field || "") && !t.has(n.field || ""))
92
- );
93
- },
94
- { deep: !0 }
95
- ), T(
96
- () => {
97
- var e;
98
- return (e = x.getVisible) == null ? void 0 : e.value;
99
- },
100
- (e) => {
101
- e || (g && clearTimeout(g), f == null || f.destroy(), f = null, Object.assign(l, { allColumns: [], checkedFields: [], selectedColumns: [] }));
102
- }
103
- );
104
74
  function K() {
105
- var e, o;
106
- k.value ? (e = r.openExport) == null || e.call(r, !0) : (o = r.openColumn) == null || o.call(r, !0);
75
+ var t, l;
76
+ y.value ? (t = m.openExport) == null || t.call(m, !0) : (l = m.openColumn) == null || l.call(m, !0);
107
77
  }
108
- return N({
109
- handleSubmit: y,
78
+ return A({
79
+ handleSubmit: _,
110
80
  openModal: H,
111
- setModalProps(e) {
112
- x.setModalProps(e);
81
+ setModalProps(t) {
82
+ g.setModalProps(t);
113
83
  }
114
- }), (e, o) => (m(), E(s(D), {
84
+ }), (t, l) => (f(), F(e(L), {
115
85
  width: "720",
116
- class: b(s(u)),
117
- onOk: y
118
- }, ee({
119
- beforeFooter: d(() => [
120
- c("div", ke, [
121
- a(s(ie), { onClick: K }, {
122
- default: d(() => [...o[1] || (o[1] = [
123
- F("重置", -1)
86
+ class: a(e(i)),
87
+ onOk: _
88
+ }, W({
89
+ beforeFooter: s(() => [
90
+ c("div", {
91
+ class: a(`${e(i)}-footer-left`)
92
+ }, [
93
+ r(e(te), { onClick: K }, {
94
+ default: s(() => [...l[1] || (l[1] = [
95
+ h("重置", -1)
124
96
  ])]),
125
97
  _: 1
126
98
  }),
127
- V(e.$slots, "beforeFooter")
128
- ])
99
+ V(t.$slots, "beforeFooter")
100
+ ], 2)
129
101
  ]),
130
- default: d(() => [
102
+ default: s(() => [
131
103
  c("div", {
132
- ref_key: "contentRef",
133
- ref: _,
134
- class: "flex h-[400px]"
104
+ class: a(`${e(i)}-body`)
135
105
  }, [
136
- c("div", fe, [
137
- a(s(I), { class: "h-full px-24px py-12px" }, {
138
- default: d(() => [
139
- c("div", pe, [
140
- a(s(R), {
141
- "model-value": P.value,
142
- class: "checkbox-all",
143
- indeterminate: q.value,
144
- onChange: G
106
+ r(e(B), {
107
+ class: a(`${e(i)}-source`)
108
+ }, {
109
+ default: s(() => [
110
+ r(e(N), {
111
+ class: a(`${e(i)}-all`),
112
+ "model-value": S.value,
113
+ indeterminate: O.value,
114
+ onChange: U
115
+ }, {
116
+ default: s(() => [
117
+ h(" 全部(" + $(n.value.length) + "/" + $(u.value.length) + ") ", 1)
118
+ ]),
119
+ _: 1
120
+ }, 8, ["class", "model-value", "indeterminate"]),
121
+ r(e(ne), {
122
+ modelValue: n.value,
123
+ "onUpdate:modelValue": l[0] || (l[0] = (o) => n.value = o),
124
+ class: a(`${e(i)}-group`)
125
+ }, {
126
+ default: s(() => [
127
+ (f(!0), C(w, null, T(u.value, (o) => (f(), F(e(N), {
128
+ key: o.field,
129
+ value: o.field,
130
+ disabled: o.locked
145
131
  }, {
146
- default: d(() => [
147
- c("span", he, " 全部(" + h(l.checkedFields.length) + "/" + h(p.value.length) + ") ", 1)
132
+ default: s(() => [
133
+ r(e(ie), {
134
+ content: o.title || "",
135
+ "show-after": 400,
136
+ placement: "top"
137
+ }, {
138
+ default: s(() => [
139
+ h($(o.title || ""), 1)
140
+ ]),
141
+ _: 2
142
+ }, 1032, ["content"])
148
143
  ]),
149
- _: 1
150
- }, 8, ["model-value", "indeterminate"])
144
+ _: 2
145
+ }, 1032, ["value", "disabled"]))), 128))
151
146
  ]),
152
- a(s(ce), {
153
- modelValue: l.checkedFields,
154
- "onUpdate:modelValue": o[0] || (o[0] = (t) => l.checkedFields = t),
155
- class: "mb-10px w-full"
156
- }, {
157
- default: d(() => [
158
- (m(!0), v(M, null, $(p.value, (t) => (m(), E(s(R), {
159
- key: t.field,
160
- value: t.field,
161
- disabled: t.disabled
162
- }, {
163
- default: d(() => [
164
- a(s(ae), {
165
- "show-after": 400,
166
- content: t.title || "",
167
- placement: "top"
168
- }, {
169
- default: d(() => [
170
- F(h(t.title || ""), 1)
171
- ]),
172
- _: 2
173
- }, 1032, ["content"])
174
- ]),
175
- _: 2
176
- }, 1032, ["value", "disabled"]))), 128))
177
- ]),
178
- _: 1
179
- }, 8, ["modelValue"])
180
- ]),
181
- _: 1
182
- })
183
- ]),
184
- c("div", xe, [
185
- c("div", Ce, [
186
- c("span", null, "已选 " + h(l.selectedColumns.length) + " 列", 1),
187
- c("span", {
188
- class: "cursor-pointer text-(--el-color-primary)",
189
- onClick: U
190
- }, "清空")
147
+ _: 1
148
+ }, 8, ["modelValue", "class"])
191
149
  ]),
192
- a(s(I), { class: "flex-1" }, {
193
- default: d(() => [
194
- c("div", {
195
- class: b([`${s(u)}-move-box`, "px-7px"])
150
+ _: 1
151
+ }, 8, ["class"]),
152
+ c("div", {
153
+ class: a(`${e(i)}-picked`)
154
+ }, [
155
+ c("header", {
156
+ class: a(`${e(i)}-picked-head`)
157
+ }, [
158
+ c("span", null, "已选 " + $(E.value.length) + " 列", 1),
159
+ c("span", {
160
+ class: a(`${e(i)}-clear`),
161
+ onClick: q
162
+ }, "清空", 2)
163
+ ], 2),
164
+ r(e(B), null, {
165
+ default: s(() => [
166
+ c("ul", {
167
+ ref: J,
168
+ class: a(`${e(i)}-list`)
196
169
  }, [
197
- (m(!0), v(M, null, $(l.selectedColumns, (t) => (m(), v("div", {
198
- key: t.field,
199
- class: b([
200
- `${s(u)}-item-move`,
201
- "flex h-36px items-center justify-between pr-12px py-2 cursor-pointer"
202
- ])
170
+ (f(!0), C(w, null, T(E.value, (o) => (f(), C("li", {
171
+ key: o.field,
172
+ class: a(`${e(i)}-item`)
203
173
  }, [
204
- c("div", be, [
205
- a(s(B), {
206
- class: "shrink-0 text-[var(--el-text-color-secondary)]",
174
+ c("span", {
175
+ class: a(`${e(i)}-item-main`)
176
+ }, [
177
+ r(e(P), {
178
+ class: a(`${e(i)}-item-drag`),
207
179
  size: 14,
208
- icon: s(se),
180
+ icon: e(ee),
209
181
  "is-custom-svg": ""
210
- }, null, 8, ["icon"]),
211
- a(s(ne), {
182
+ }, null, 8, ["class", "icon"]),
183
+ r(e(le), {
212
184
  "tool-tip": !1,
213
- class: "ml-1"
185
+ class: a(`${e(i)}-item-title`)
214
186
  }, {
215
- default: d(() => [
216
- F(h(t.title || ""), 1)
187
+ default: s(() => [
188
+ h($(o.title || ""), 1)
217
189
  ]),
218
190
  _: 2
219
- }, 1024)
220
- ]),
221
- l.disabledColumnField.includes(t.field) ? le("", !0) : (m(), v("span", {
191
+ }, 1032, ["class"])
192
+ ], 2),
193
+ o.locked ? X("", !0) : (f(), C("button", {
222
194
  key: 0,
223
- class: b(`${s(u)}-action-btn`),
224
- onClick: te((n) => L(t.field), ["stop"])
195
+ type: "button",
196
+ class: a(`${e(i)}-item-remove`),
197
+ "aria-label": `移除${o.title || ""}`,
198
+ onClick: Y((v) => j(o.field), ["stop"])
225
199
  }, [
226
- a(s(B), {
227
- class: "text-[var(--el-text-color-secondary)]",
200
+ r(e(P), {
228
201
  size: 12,
229
- "icon-font": s(oe)
202
+ "icon-font": e(Z)
230
203
  }, null, 8, ["icon-font"])
231
- ], 10, ve))
204
+ ], 10, re))
232
205
  ], 2))), 128))
233
206
  ], 2)
234
207
  ]),
235
208
  _: 1
236
209
  })
237
- ])
238
- ], 512)
210
+ ], 2)
211
+ ], 2)
239
212
  ]),
240
213
  _: 2
241
214
  }, [
242
- e.$slots.title ? {
215
+ t.$slots.title ? {
243
216
  name: "header",
244
- fn: d(() => [
245
- V(e.$slots, "title")
217
+ fn: s(() => [
218
+ V(t.$slots, "title")
246
219
  ]),
247
220
  key: "0"
248
221
  } : void 0
@@ -250,5 +223,5 @@ const fe = { class: "flex-1" }, pe = { class: "cb flex items-center" }, he = { c
250
223
  }
251
224
  });
252
225
  export {
253
- Le as default
226
+ Pe as default
254
227
  };
@@ -106,8 +106,7 @@ function no(r = {}, u = z) {
106
106
  function G(o) {
107
107
  const e = /* @__PURE__ */ new Map();
108
108
  return o.forEach((n) => {
109
- const t = n.purchaseInfo, l = t == null ? void 0 : t.supplierSubType;
110
- if (l == null) return;
109
+ const t = n.purchaseInfo, l = (t == null ? void 0 : t.supplierSubType) ?? "其他";
111
110
  let s = e.get(l);
112
111
  s || (s = {
113
112
  label: String(l),
@@ -152,8 +151,8 @@ function no(r = {}, u = z) {
152
151
  }
153
152
  function x(o, e, n, t, l) {
154
153
  const s = f(o), P = l ? t.filter((i) => {
155
- var d;
156
- return (d = e[s]) == null ? void 0 : d.includes(i.value);
154
+ var m;
155
+ return (m = e[s]) == null ? void 0 : m.includes(i.value);
157
156
  }) || [] : t.find((i) => i.value === e[s]);
158
157
  return {
159
158
  values: e,
@@ -165,7 +164,7 @@ function no(r = {}, u = z) {
165
164
  };
166
165
  }
167
166
  function k(o, e, n, t, l) {
168
- const s = g(o), P = oo(s.componentProps, e, n, t), i = F(o), { onChange: d, ...h } = P, m = q(s.customOptions) ? s.customOptions(e, t) : t, p = S(o) === "TtPanelSelect", a = p && o === "shopId" ? J(m) : p && o === "purchasePlaceId" ? G(m) : m, w = p ? D(a) : m;
167
+ const s = g(o), P = oo(s.componentProps, e, n, t), i = F(o), { onChange: m, ...h } = P, d = q(s.customOptions) ? s.customOptions(e, t) : t, p = S(o) === "TtPanelSelect", a = p && o === "shopId" ? J(d) : p && o === "purchasePlaceId" ? G(d) : d, w = p ? D(a) : d;
169
168
  return p ? {
170
169
  multiple: i,
171
170
  showAll: s.showAll ?? (o === "shopId" && c === "action" ? O(e[f("platformId")]).length > 0 : !0),
@@ -190,7 +189,7 @@ function no(r = {}, u = z) {
190
189
  showOriginMode: !1,
191
190
  showPinyinMode: !0,
192
191
  ...h,
193
- options: m,
192
+ options: d,
194
193
  onChange(R) {
195
194
  j(
196
195
  R,
@@ -211,11 +210,11 @@ function no(r = {}, u = z) {
211
210
  dependencies: _(o),
212
211
  componentProps: (n, t) => {
213
212
  var h;
214
- const l = N(o), s = f(o), P = F(o), i = b(o), d = ((h = n[s]) == null ? void 0 : h.at(-1)) !== i;
215
- return k(o, n, t, l, (m) => {
213
+ const l = N(o), s = f(o), P = F(o), i = b(o), m = ((h = n[s]) == null ? void 0 : h.at(-1)) !== i;
214
+ return k(o, n, t, l, (d) => {
216
215
  if (S(o) !== "TtPanelSelect") {
217
216
  const p = n[s];
218
- P && (d && O(m).at(-1) === i ? n[s] = [i] : n[s] = p == null ? void 0 : p.filter((a) => a !== i));
217
+ P && (m && O(d).at(-1) === i ? n[s] = [i] : n[s] = p == null ? void 0 : p.filter((a) => a !== i));
219
218
  }
220
219
  });
221
220
  }
@@ -229,12 +228,12 @@ function no(r = {}, u = z) {
229
228
  label: M("platformId"),
230
229
  rules: C("platformId"),
231
230
  componentProps: (o, e) => {
232
- var m;
233
- const n = "platformId", t = f(n), l = f("shopId"), s = F(n), P = F("shopId"), i = N(n), d = b(n), h = ((m = o[t]) == null ? void 0 : m.at(-1)) !== d;
231
+ var d;
232
+ const n = "platformId", t = f(n), l = f("shopId"), s = F(n), P = F("shopId"), i = N(n), m = b(n), h = ((d = o[t]) == null ? void 0 : d.at(-1)) !== m;
234
233
  return k(n, o, e, i, (p) => {
235
234
  if (S(n) !== "TtPanelSelect") {
236
235
  const a = o[t];
237
- s && (h && O(p).at(-1) === d ? o[t] = [d] : o[t] = a == null ? void 0 : a.filter((w) => w !== d));
236
+ s && (h && O(p).at(-1) === m ? o[t] = [m] : o[t] = a == null ? void 0 : a.filter((w) => w !== m));
238
237
  }
239
238
  o[l] = P ? [] : void 0;
240
239
  });
@@ -247,11 +246,11 @@ function no(r = {}, u = z) {
247
246
  label: M("shopId"),
248
247
  componentProps: (o, e) => {
249
248
  var h;
250
- const n = "shopId", t = f(n), l = o[f("platformId")], s = Q(l), P = F(n), i = b(n), d = ((h = o[t]) == null ? void 0 : h.at(-1)) !== i;
251
- return k(n, o, e, s, (m) => {
249
+ const n = "shopId", t = f(n), l = o[f("platformId")], s = Q(l), P = F(n), i = b(n), m = ((h = o[t]) == null ? void 0 : h.at(-1)) !== i;
250
+ return k(n, o, e, s, (d) => {
252
251
  if (S(n) !== "TtPanelSelect") {
253
252
  const p = o[t];
254
- P && (d && O(m).at(-1) === i ? o[t] = [i] : o[t] = p == null ? void 0 : p.filter((a) => a !== i));
253
+ P && (m && O(d).at(-1) === i ? o[t] = [i] : o[t] = p == null ? void 0 : p.filter((a) => a !== i));
255
254
  }
256
255
  });
257
256
  },