vue-quokit 0.1.0

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/index.js ADDED
@@ -0,0 +1,2538 @@
1
+ import { computed as X, openBlock as u, createElementBlock as c, createElementVNode as t, Fragment as S, renderList as R, normalizeStyle as H, toDisplayString as q, createTextVNode as D, createCommentVNode as M, normalizeClass as Y, ref as K, reactive as pt, onMounted as Vt, onUnmounted as St, unref as j, withDirectives as _, vModelText as x, createStaticVNode as bt, vModelSelect as B, vModelCheckbox as tt, watch as rt, withModifiers as ut, onBeforeUnmount as At, createVNode as st } from "vue";
2
+ import Tt from "exceljs";
3
+ function at(a, o) {
4
+ if (!a) return 0;
5
+ const s = String(a).replace(/\s+/g, "");
6
+ if (!s) return 0;
7
+ let f = 0;
8
+ function b() {
9
+ return s[f];
10
+ }
11
+ function m() {
12
+ return s[f++];
13
+ }
14
+ function h(e) {
15
+ if (b() !== e) throw new Error("公式解析错误: 期望 " + e + " at " + f);
16
+ f++;
17
+ }
18
+ function C() {
19
+ const e = b();
20
+ if (e === "(") {
21
+ m();
22
+ const n = i();
23
+ return h(")"), n;
24
+ }
25
+ if (e === "-")
26
+ return m(), -C();
27
+ if (e === "+")
28
+ return m(), C();
29
+ if (e >= "0" && e <= "9" || e === ".") {
30
+ let n = "";
31
+ for (; f < s.length && (s[f] >= "0" && s[f] <= "9" || s[f] === "."); )
32
+ n += s[f++];
33
+ return parseFloat(n);
34
+ }
35
+ if (e >= "a" && e <= "z" || e >= "A" && e <= "Z" || e === "_") {
36
+ let n = "";
37
+ for (; f < s.length && (s[f] >= "a" && s[f] <= "z" || s[f] >= "A" && s[f] <= "Z" || s[f] === "_" || s[f] >= "0" && s[f] <= "9"); )
38
+ n += s[f++];
39
+ return Number(o[n] || 0);
40
+ }
41
+ throw new Error('公式解析错误: 非法字符 "' + e + '" at ' + f);
42
+ }
43
+ function T() {
44
+ let e = C();
45
+ for (; f < s.length && (b() === "*" || b() === "/"); ) {
46
+ const n = m(), v = C();
47
+ e = n === "*" ? e * v : v === 0 ? 0 : e / v;
48
+ }
49
+ return e;
50
+ }
51
+ function i() {
52
+ let e = T();
53
+ for (; f < s.length && (b() === "+" || b() === "-"); ) {
54
+ const n = m(), v = T();
55
+ e = n === "+" ? e + v : e - v;
56
+ }
57
+ return e;
58
+ }
59
+ try {
60
+ const e = i();
61
+ return Math.round(e * 100) / 100;
62
+ } catch {
63
+ return 0;
64
+ }
65
+ }
66
+ function J(a) {
67
+ let o = "";
68
+ for (; a >= 0; )
69
+ o = String.fromCharCode(65 + a % 26) + o, a = Math.floor(a / 26) - 1;
70
+ return o;
71
+ }
72
+ function yt(a) {
73
+ return typeof a == "string" ? parseFloat(a) / 100 : 0;
74
+ }
75
+ const dt = { style: "thin", color: { argb: "FFDCDFE6" } }, qt = { top: dt, left: dt, right: dt, bottom: dt }, it = { style: "medium", color: { argb: "FF606266" } }, Et = 11;
76
+ function wt(a) {
77
+ if (a == null) return 0;
78
+ if (typeof a == "number") return String(a).length;
79
+ const o = String(a);
80
+ let s = 0;
81
+ for (const f of o)
82
+ f !== `
83
+ ` && (/[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef\u2e80-\u2fdf\u31c0-\u31ef]/.test(f) ? s += 2 : s += 1);
84
+ return s;
85
+ }
86
+ function _t(a, o = 11) {
87
+ let s = 1;
88
+ for (const f of a) {
89
+ const b = String(f ?? ""), m = b.split(`
90
+ `).length, h = wt(b), T = b.length === 0 ? 1 : Math.ceil(h / 12);
91
+ s = Math.max(s, m, T);
92
+ }
93
+ return Math.max(28, s * (o + 4) + 6);
94
+ }
95
+ function ht(a, o, s, f, b) {
96
+ for (let m = o; m <= s; m++)
97
+ for (let h = f; h <= b; h++) {
98
+ const C = a.getCell(m, h);
99
+ C.border = qt;
100
+ }
101
+ }
102
+ function gt(a, o, s, f, b) {
103
+ for (let m = f; m <= b; m++)
104
+ a.getCell(o, m).border = { ...a.getCell(o, m).border || {}, top: it }, a.getCell(s, m).border = { ...a.getCell(s, m).border || {}, bottom: it };
105
+ for (let m = o; m <= s; m++)
106
+ a.getCell(m, f).border = { ...a.getCell(m, f).border || {}, left: it }, a.getCell(m, b).border = { ...a.getCell(m, b).border || {}, right: it };
107
+ }
108
+ async function zt(a, o, s = {}) {
109
+ var k;
110
+ const f = s.layout || "auto-wrap", b = f === "auto-wrap", m = new Tt.Workbook(), h = m.addWorksheet("报价单"), C = a.columns.length, T = J(C - 1);
111
+ let i = 1;
112
+ const e = () => (a.columns || []).find((p) => p.editor === "AUTO_CALC"), n = (p) => {
113
+ const r = e(), y = (r == null ? void 0 : r.formula) || "quantity * unit_price";
114
+ return at(y, p);
115
+ };
116
+ if (a.header_sections) {
117
+ for (const p of a.header_sections)
118
+ if (p.type === "title") {
119
+ h.mergeCells(`A${i}:${T}${i}`);
120
+ const r = h.getCell(`A${i}`);
121
+ r.value = p.text;
122
+ const y = p.style || {}, $ = y.fontSize || 18;
123
+ if (r.font = { size: $, bold: y.bold !== !1, italic: y.italic === !0, name: "微软雅黑" }, y.color) {
124
+ const g = y.color.replace("#", "").toUpperCase();
125
+ r.font.color = { argb: g.length === 6 ? "FF" + g : g };
126
+ }
127
+ r.alignment = { horizontal: y.align || "center", vertical: "middle" }, h.getRow(i).height = $ * 2 + 10, i++;
128
+ } else if (p.type === "divider")
129
+ i++;
130
+ else if (p.type === "text") {
131
+ h.mergeCells(`A${i}:${T}${i}`);
132
+ const r = h.getCell(`A${i}`);
133
+ r.value = p.text;
134
+ const y = p.style || {}, $ = y.fontSize || 13;
135
+ if (r.font = {
136
+ size: $,
137
+ bold: y.bold === !0,
138
+ italic: y.italic === !0,
139
+ name: "微软雅黑"
140
+ }, y.color) {
141
+ const g = y.color.replace("#", "").toUpperCase();
142
+ r.font.color = { argb: g.length === 6 ? "FF" + g : g };
143
+ }
144
+ r.alignment = { horizontal: y.align || p.align || "left", vertical: "middle" }, h.getRow(i).height = $ * 2 + 10, i++;
145
+ } else if (p.type === "row" && p.cells) {
146
+ const r = p.cells.map((g) => {
147
+ var U;
148
+ return yt((U = g.style) == null ? void 0 : U.width) || 1 / p.cells.length;
149
+ });
150
+ let y = 0;
151
+ const $ = r.map((g) => {
152
+ const U = Math.round(y * C);
153
+ y += g;
154
+ const z = Math.round(y * C) - 1;
155
+ return { start: U, end: Math.max(z, U) };
156
+ });
157
+ for (let g = 0; g < p.cells.length; g++) {
158
+ const U = p.cells[g], z = $[g], O = `${J(z.start)}${i}`, I = `${J(z.end)}${i}`;
159
+ O !== I && h.mergeCells(`${O}:${I}`);
160
+ const N = h.getCell(O);
161
+ N.value = U.type === "field" ? `${U.label}:${U.value ?? ""}` : U.text;
162
+ const A = U.style || {}, P = A.fontSize || 11;
163
+ if (N.font = {
164
+ size: P,
165
+ bold: A.bold === !0,
166
+ italic: A.italic === !0,
167
+ name: "微软雅黑"
168
+ }, A.color) {
169
+ const Q = A.color.replace("#", "").toUpperCase();
170
+ N.font.color = { argb: Q.length === 6 ? "FF" + Q : Q };
171
+ }
172
+ N.alignment = { horizontal: A.align || "left", vertical: "middle" };
173
+ }
174
+ h.getRow(i).height = 22, i++;
175
+ }
176
+ }
177
+ const v = i, l = h.getRow(i);
178
+ l.values = a.columns.map((p) => p.title), l.font = { bold: !0, name: "微软雅黑", size: 12 }, l.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "FFE0E0E0" } }, l.alignment = { horizontal: "center", vertical: "middle", wrapText: b }, l.height = b ? 32 : 28, i++;
179
+ const E = a.group_rules, d = E == null ? void 0 : E.merge_field, F = a.columns;
180
+ if (d) {
181
+ let p = 0, r = 0;
182
+ for (; p < o.length; ) {
183
+ const y = [];
184
+ let $ = p;
185
+ for (; $ < o.length && o[$][d] === o[p][d]; )
186
+ y.push(o[$]), $++;
187
+ const g = i;
188
+ for (let O = 0; O < y.length; O++) {
189
+ r++;
190
+ const I = y[O], N = F.map((P) => P.editor === "AUTO_SEQ" ? r : P.editor === "AUTO_CALC" ? n(I) : I[P.field] ?? ""), A = h.getRow(i);
191
+ A.values = N, A.font = { name: "微软雅黑", size: 11 }, A.alignment = { horizontal: "center", vertical: "middle", wrapText: b, indent: 1 }, A.height = b ? _t(N, 11) : 28, i++;
192
+ }
193
+ const U = i - 1;
194
+ for (let O = 0; O < F.length; O++) {
195
+ const I = F[O];
196
+ if (I.merge_on_group !== !0) continue;
197
+ let N = g;
198
+ for (let A = 1; A < y.length; A++)
199
+ y[A][I.field] !== y[A - 1][I.field] && (g + A - 1 > N && h.mergeCells(`${J(O)}${N}:${J(O)}${g + A - 1}`), N = g + A);
200
+ U > N && h.mergeCells(`${J(O)}${N}:${J(O)}${U}`);
201
+ }
202
+ if (E.show_detail_subtotal !== !1 && o[p][d] !== void 0 && o[p][d] !== null && o[p][d] !== "") {
203
+ const O = y.reduce((Q, Z) => Q + Number(n(Z) || 0), 0), I = J(Math.max(0, C - 2));
204
+ h.mergeCells(`A${i}:${I}${i}`);
205
+ const N = h.getCell(`A${i}`);
206
+ N.value = `小计(${o[p][d]})`, N.alignment = { horizontal: "right", vertical: "middle" }, N.font = { bold: !0, italic: !0, color: { argb: "FF409EFF" }, name: "微软雅黑", size: 11 };
207
+ const A = h.getCell(`${T}${i}`);
208
+ A.value = O, A.numFmt = "#,##0.00", A.alignment = { horizontal: "right", vertical: "middle" }, A.font = { bold: !0, italic: !0, color: { argb: "FF409EFF" }, name: "微软雅黑", size: 11 };
209
+ const P = h.getRow(i);
210
+ P.fill = { type: "pattern", pattern: "solid", fgColor: { argb: "FFF0F9FF" } }, P.alignment = { horizontal: "right", vertical: "middle", wrapText: !0 }, P.height = 26, i++;
211
+ }
212
+ p = $;
213
+ }
214
+ } else
215
+ for (let p = 0; p < o.length; p++) {
216
+ const r = o[p], y = F.map((g) => g.editor === "AUTO_SEQ" ? p + 1 : g.editor === "AUTO_CALC" ? n(r) : r[g.field] ?? ""), $ = h.getRow(i);
217
+ $.values = y, $.font = { name: "微软雅黑", size: 11 }, $.alignment = { horizontal: "center", vertical: "middle", wrapText: b, indent: 1 }, $.height = b ? _t(y, 11) : 28, i++;
218
+ }
219
+ const V = i - 1;
220
+ if (a.summary_fields) {
221
+ i += 1;
222
+ const p = J(Math.max(0, C - 2)), r = J(C - 1), y = o.reduce((U, z) => U + Number(n(z) || 0), 0), $ = {
223
+ group_total: y,
224
+ quantity_sum: o.reduce((U, z) => U + Number(z.quantity || 0), 0)
225
+ };
226
+ for (const U of a.summary_fields)
227
+ U.type === "MANUAL_INPUT" && ($[U.field] = Number(U.default ?? 0));
228
+ $.grand_total = y + a.summary_fields.filter((U) => U.type === "MANUAL_INPUT").reduce((U, z) => U + $[z.field], 0);
229
+ for (const U of a.summary_fields)
230
+ U.type === "AUTO_CALC" && ($[U.field] = at(U.formula || "group_total", $));
231
+ for (const U of a.summary_fields) {
232
+ let z;
233
+ U.type === "AUTO_CALC" ? z = at(U.formula || "group_total", $) : U.type === "PLAIN_TEXT" ? z = U.text || "" : z = Number(U.default ?? 0);
234
+ const O = ((k = U.style) == null ? void 0 : k.fontSize) || Et, I = h.getCell(`${p}${i}`), N = h.getCell(`${r}${i}`);
235
+ I.value = U.label, I.alignment = { horizontal: "right", vertical: "middle" };
236
+ const A = U.style || {}, P = () => {
237
+ const Q = { name: "微软雅黑", size: O, bold: !!A.bold, italic: !!A.italic };
238
+ if (A.color) {
239
+ const Z = A.color.replace("#", "").toUpperCase();
240
+ Q.color = { argb: Z.length === 6 ? "FF" + Z : Z };
241
+ }
242
+ return Q;
243
+ };
244
+ I.font = P(), N.value = z, N.alignment = { horizontal: "right", vertical: "middle" }, N.font = P(), typeof z == "number" && (N.numFmt = "#,##0.00"), h.getRow(i).height = Math.max(22, O * 2 + 6), i++;
245
+ }
246
+ const g = i - 1;
247
+ ht(h, v, g, 1, C), gt(h, v, g, 1, C);
248
+ } else
249
+ ht(h, v, V, 1, C), gt(h, v, V, 1, C);
250
+ if (a.footer_sections) {
251
+ i += 1;
252
+ for (const p of a.footer_sections)
253
+ if (p.type === "divider")
254
+ i++;
255
+ else if (p.type === "text") {
256
+ h.mergeCells(`A${i}:${T}${i}`);
257
+ const r = h.getCell(`A${i}`);
258
+ r.value = p.text;
259
+ const y = p.style || {}, $ = y.fontSize || 13;
260
+ if (r.font = {
261
+ size: $,
262
+ bold: y.bold === !0,
263
+ italic: y.italic === !0,
264
+ name: "微软雅黑"
265
+ }, y.color) {
266
+ const g = y.color.replace("#", "").toUpperCase();
267
+ r.font.color = { argb: g.length === 6 ? "FF" + g : g };
268
+ }
269
+ r.alignment = { horizontal: y.align || p.align || "left", vertical: "middle" }, h.getRow(i).height = $ * 2 + 10, i++;
270
+ } else if (p.type === "row" && p.cells) {
271
+ const r = p.cells.map((g) => {
272
+ var U;
273
+ return yt((U = g.style) == null ? void 0 : U.width) || 1 / p.cells.length;
274
+ });
275
+ let y = 0;
276
+ const $ = r.map((g) => {
277
+ const U = Math.round(y * C);
278
+ y += g;
279
+ const z = Math.round(y * C) - 1;
280
+ return { start: U, end: Math.max(z, U) };
281
+ });
282
+ for (let g = 0; g < p.cells.length; g++) {
283
+ const U = p.cells[g], z = $[g], O = `${J(z.start)}${i}`, I = `${J(z.end)}${i}`;
284
+ O !== I && h.mergeCells(`${O}:${I}`);
285
+ const N = h.getCell(O);
286
+ N.value = U.text;
287
+ const A = U.style || {};
288
+ N.alignment = { horizontal: A.align || "left", vertical: "middle" };
289
+ const P = {
290
+ name: "微软雅黑",
291
+ size: A.fontSize || 11,
292
+ bold: A.bold === !0,
293
+ italic: A.italic === !0
294
+ };
295
+ if (A.color) {
296
+ const Q = A.color.replace("#", "").toUpperCase();
297
+ P.color = { argb: Q.length === 6 ? "FF" + Q : Q };
298
+ }
299
+ N.font = P;
300
+ }
301
+ h.getRow(i).height = 22, i++;
302
+ }
303
+ }
304
+ const w = 50, L = 6;
305
+ for (let p = 0; p < C; p++) {
306
+ const r = a.columns[p], y = p + 1;
307
+ if (f === "auto-wrap")
308
+ h.getColumn(y).width = r.width ? Math.max(r.width / 7, 8) : 12;
309
+ else {
310
+ let $ = 0;
311
+ for (let z = 1; z < i; z++)
312
+ $ = Math.max($, wt(h.getCell(z, y).value));
313
+ const g = r.width ? Math.max(r.width / 7, 10) : 12, U = Math.min(Math.max($ + 2, L), w);
314
+ h.getColumn(y).width = Math.max(U, g);
315
+ }
316
+ }
317
+ const G = await m.xlsx.writeBuffer();
318
+ return new Blob([G], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
319
+ }
320
+ const lt = (a, o) => {
321
+ const s = a.__vccOpts || a;
322
+ for (const [f, b] of o)
323
+ s[f] = b;
324
+ return s;
325
+ }, Nt = { class: "quote-sheet" }, Lt = {
326
+ key: 1,
327
+ class: "q-divider"
328
+ }, Mt = {
329
+ key: 3,
330
+ class: "q-row"
331
+ }, Ot = { class: "q-label" }, Ft = { class: "q-value" }, Rt = {
332
+ key: 0,
333
+ class: "q-table-wrap"
334
+ }, It = { class: "q-table" }, Dt = {
335
+ key: 0,
336
+ class: "subtotal-row"
337
+ }, Pt = ["colspan"], jt = { class: "subtotal-value" }, Bt = { key: 1 }, Wt = ["rowspan"], Qt = {
338
+ key: 0,
339
+ class: "empty-row"
340
+ }, Ht = ["colspan"], Xt = {
341
+ key: 1,
342
+ class: "q-summary"
343
+ }, Gt = { class: "q-summary-label" }, Zt = {
344
+ key: 0,
345
+ class: "q-divider"
346
+ }, Jt = {
347
+ key: 2,
348
+ class: "q-row"
349
+ }, Yt = {
350
+ __name: "QuokitSheet",
351
+ props: {
352
+ tpl: { type: Object, required: !0 },
353
+ data: { type: Array, default: () => [] },
354
+ placeholder: { type: String, default: "-" }
355
+ },
356
+ setup(a, { expose: o }) {
357
+ function s(k) {
358
+ const p = (k.header_sections || []).flatMap((r) => r.cells || []).find((r) => r.type === "field" && r.value);
359
+ return (p == null ? void 0 : p.value) || "untitled";
360
+ }
361
+ const f = a, b = X(() => f.data);
362
+ function m(k) {
363
+ const p = k.style || {}, r = { width: p.width || "auto" };
364
+ r.textAlign = p.align || "left", p.color && (r.color = p.color), p.fontSize && (r.fontSize = p.fontSize + "px"), p.bold && (r.fontWeight = "bold"), p.italic && (r.fontStyle = "italic");
365
+ const y = p.border;
366
+ if (y)
367
+ for (const $ of ["top", "bottom", "left", "right"]) {
368
+ const g = y[$];
369
+ g && g.style && g.width > 0 && (r["border-" + $] = `${g.width}px ${g.style} ${g.color || "#dcdfe6"}`);
370
+ }
371
+ return r;
372
+ }
373
+ function h(k) {
374
+ return "¥ " + (Number(k) || 0).toFixed(2);
375
+ }
376
+ const C = X(() => (f.tpl.columns || []).find((k) => k.editor === "AUTO_CALC"));
377
+ function T(k) {
378
+ var r;
379
+ const p = ((r = C.value) == null ? void 0 : r.formula) || "quantity * unit_price";
380
+ return at(p, k);
381
+ }
382
+ const i = X(() => b.value.reduce((k, p) => k + Number(T(p) || 0), 0)), e = X(() => b.value.reduce((k, p) => k + Number(p.quantity || 0), 0));
383
+ function n() {
384
+ let k = i.value;
385
+ if (f.tpl.summary_fields)
386
+ for (const p of f.tpl.summary_fields)
387
+ p.type === "MANUAL_INPUT" && (k += E(p));
388
+ return k;
389
+ }
390
+ function v(k) {
391
+ const p = {}, r = k.style || {};
392
+ return r.color && (p.color = r.color), r.fontSize && (p.fontSize = r.fontSize + "px"), r.bold && (p.fontWeight = "bold"), r.italic && (p.fontStyle = "italic"), p;
393
+ }
394
+ function l(k) {
395
+ const p = {}, r = k.style || {};
396
+ return r.color && (p.color = r.color), r.fontSize && (p.fontSize = r.fontSize + "px"), r.bold && (p.fontWeight = "bold"), r.italic && (p.fontStyle = "italic"), r.align ? p.textAlign = r.align : k.align && (p.textAlign = k.align), p;
397
+ }
398
+ function E(k) {
399
+ return Number(k.default ?? 0);
400
+ }
401
+ function d() {
402
+ const k = {
403
+ group_total: i.value,
404
+ quantity_sum: e.value
405
+ };
406
+ if (f.tpl.summary_fields) {
407
+ for (const p of f.tpl.summary_fields)
408
+ p.type === "MANUAL_INPUT" && (k[p.field] = E(p));
409
+ for (const p of f.tpl.summary_fields)
410
+ p.type === "AUTO_CALC" && (k[p.field] = at(p.formula || "group_total", k));
411
+ }
412
+ return k.grand_total = n(), k;
413
+ }
414
+ function F(k) {
415
+ if (k.type === "PLAIN_TEXT") return k.text || "";
416
+ if (k.type === "AUTO_CALC") {
417
+ const p = d();
418
+ return p[k.field] ?? at(k.formula || "group_total", p);
419
+ }
420
+ return E(k);
421
+ }
422
+ const V = X(() => {
423
+ var g;
424
+ const k = b.value.map((U) => ({ ...U })), p = (g = f.tpl) == null ? void 0 : g.group_rules;
425
+ if (!(p != null && p.merge_field)) return k;
426
+ const r = [], y = p.merge_field;
427
+ let $ = 0;
428
+ for (; $ < k.length; ) {
429
+ const U = [k[$]];
430
+ let z = $ + 1;
431
+ for (; z < k.length && k[z][y] === k[$][y]; ) U.push(k[z]), z++;
432
+ if (r.push(...U), (p.show_detail_subtotal ?? !0) && k[$][y] !== void 0 && k[$][y] !== null && k[$][y] !== "") {
433
+ const I = U.reduce((N, A) => N + Number(T(A) || 0), 0);
434
+ r.push({ __is_subtotal: !0, __group_key: k[$][y], __group_sum: I });
435
+ }
436
+ $ = z;
437
+ }
438
+ return r;
439
+ });
440
+ function w(k, p) {
441
+ var N, A, P, Q;
442
+ const r = V.value, y = r[k];
443
+ if (!y || y.__is_subtotal) return 1;
444
+ const $ = (N = f.tpl) == null ? void 0 : N.group_rules, g = $ == null ? void 0 : $.merge_field, U = f.tpl.columns.find((Z) => Z.field === p), z = g && p === g, O = (U == null ? void 0 : U.merge_on_group) === !0;
445
+ if (!z && !O) return 1;
446
+ const I = (() => {
447
+ var W, mt;
448
+ if (!g) return r.length;
449
+ const Z = y[g];
450
+ let ot = k + 1;
451
+ for (; ot < r.length && ((W = r[ot]) == null ? void 0 : W[g]) === Z && !((mt = r[ot]) != null && mt.__is_subtotal); ) ot++;
452
+ return ot;
453
+ })();
454
+ if (z)
455
+ return k > 0 && ((A = r[k - 1]) == null ? void 0 : A[g]) === y[g] && !((P = r[k - 1]) != null && P.__is_subtotal) ? 0 : I - k;
456
+ if (O) {
457
+ const Z = y[p];
458
+ if (k > 0) {
459
+ const W = r[k - 1];
460
+ if ((!g || (W == null ? void 0 : W[g]) === y[g] && !(W != null && W.__is_subtotal)) && (W == null ? void 0 : W[p]) === Z) return 0;
461
+ }
462
+ let ot = 1;
463
+ for (let W = k + 1; W < I && ((Q = r[W]) == null ? void 0 : Q[p]) === Z; W++)
464
+ ot++;
465
+ return ot;
466
+ }
467
+ return 1;
468
+ }
469
+ async function L(k = !1) {
470
+ const p = await zt(f.tpl, f.data, k ? { layout: "auto-width" } : void 0), r = URL.createObjectURL(p), y = document.createElement("a");
471
+ y.href = r, y.download = `报价单_${s(f.tpl)}_${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.xlsx`, y.click(), URL.revokeObjectURL(r);
472
+ }
473
+ function G(k = !1) {
474
+ const p = document.querySelector(".quote-sheet");
475
+ if (!p) return;
476
+ const r = k !== !0, y = window.open("", "_blank", r ? "width=1200,height=900" : "width=900,height=1200");
477
+ if (!y) return;
478
+ const $ = Array.from(document.styleSheets).map((U) => {
479
+ try {
480
+ return Array.from(U.cssRules).map((z) => z.cssText).join(`
481
+ `);
482
+ } catch {
483
+ return "";
484
+ }
485
+ }).join(`
486
+ `), g = p.outerHTML;
487
+ y.document.write(`<!doctype html>
488
+ <html><head><meta charset="utf-8"><title>报价单打印</title>
489
+ <style>${$}
490
+ @page { size: ${r ? "landscape" : "portrait"}; margin: 15mm; }
491
+ body { margin: 0; padding: 20px; background: #fff; }
492
+ @media print { body { padding: 0; } }
493
+ </style></head><body>${g}</body></html>`), y.document.close(), y.onload = () => {
494
+ y.print();
495
+ };
496
+ }
497
+ return o({ print: G, exportExcel: L }), (k, p) => (u(), c("div", null, [
498
+ t("div", Nt, [
499
+ (u(!0), c(S, null, R(a.tpl.header_sections, (r, y) => (u(), c(S, {
500
+ key: "h" + y
501
+ }, [
502
+ r.type === "title" ? (u(), c("h1", {
503
+ key: 0,
504
+ class: "q-title",
505
+ style: H(l(r))
506
+ }, q(r.text), 5)) : r.type === "divider" ? (u(), c("div", Lt)) : r.type === "text" ? (u(), c("div", {
507
+ key: 2,
508
+ class: "q-text",
509
+ style: H(l(r))
510
+ }, q(r.text), 5)) : r.type === "row" ? (u(), c("div", Mt, [
511
+ (u(!0), c(S, null, R(r.cells, ($, g) => (u(), c("div", {
512
+ key: g,
513
+ class: "q-cell",
514
+ style: H(m($))
515
+ }, [
516
+ $.type === "field" ? (u(), c(S, { key: 0 }, [
517
+ t("span", Ot, q($.label) + ":", 1),
518
+ t("span", Ft, q($.value ?? a.placeholder), 1)
519
+ ], 64)) : (u(), c(S, { key: 1 }, [
520
+ D(q($.text), 1)
521
+ ], 64))
522
+ ], 4))), 128))
523
+ ])) : M("", !0)
524
+ ], 64))), 128)),
525
+ a.tpl.columns && a.tpl.columns.length > 0 ? (u(), c("div", Rt, [
526
+ t("table", It, [
527
+ t("thead", null, [
528
+ t("tr", null, [
529
+ (u(!0), c(S, null, R(a.tpl.columns, (r) => (u(), c("th", {
530
+ key: r.field,
531
+ style: H({ width: r.width + "px" })
532
+ }, q(r.title), 5))), 128))
533
+ ])
534
+ ]),
535
+ t("tbody", null, [
536
+ (u(!0), c(S, null, R(V.value, (r, y) => (u(), c(S, { key: y }, [
537
+ r.__is_subtotal ? (u(), c("tr", Dt, [
538
+ t("td", {
539
+ colspan: a.tpl.columns.length - 1,
540
+ class: "subtotal-label"
541
+ }, "小计(" + q(r.__group_key) + ")", 9, Pt),
542
+ t("td", jt, q(h(r.__group_sum)), 1)
543
+ ])) : (u(), c("tr", Bt, [
544
+ (u(!0), c(S, null, R(a.tpl.columns, ($, g) => (u(), c(S, {
545
+ key: $.field
546
+ }, [
547
+ w(V.value.indexOf(r), $.field) > 0 ? (u(), c("td", {
548
+ key: 0,
549
+ rowspan: w(V.value.indexOf(r), $.field),
550
+ class: Y({ "merged-cell": w(V.value.indexOf(r), $.field) > 1 })
551
+ }, [
552
+ $.editor === "AUTO_SEQ" ? (u(), c(S, { key: 0 }, [
553
+ D(q(y + 1), 1)
554
+ ], 64)) : $.editor === "AUTO_CALC" ? (u(), c(S, { key: 1 }, [
555
+ D(q(h(T(r))), 1)
556
+ ], 64)) : (u(), c(S, { key: 2 }, [
557
+ D(q(r[$.field] ?? ""), 1)
558
+ ], 64))
559
+ ], 10, Wt)) : M("", !0)
560
+ ], 64))), 128))
561
+ ]))
562
+ ], 64))), 128)),
563
+ V.value.length === 0 ? (u(), c("tr", Qt, [
564
+ t("td", {
565
+ colspan: a.tpl.columns.length,
566
+ class: "q-empty"
567
+ }, "(暂无数据)", 8, Ht)
568
+ ])) : M("", !0)
569
+ ])
570
+ ])
571
+ ])) : M("", !0),
572
+ a.tpl.summary_fields && a.tpl.summary_fields.length > 0 ? (u(), c("div", Xt, [
573
+ (u(!0), c(S, null, R(a.tpl.summary_fields, (r) => (u(), c("div", {
574
+ key: r.field,
575
+ class: "q-summary-row"
576
+ }, [
577
+ t("span", Gt, q(r.label), 1),
578
+ t("span", {
579
+ class: "q-summary-value",
580
+ style: H(v(r))
581
+ }, q(r.type === "PLAIN_TEXT" ? r.text : h(F(r))), 5)
582
+ ]))), 128))
583
+ ])) : M("", !0),
584
+ (u(!0), c(S, null, R(a.tpl.footer_sections, (r, y) => (u(), c(S, {
585
+ key: "f" + y
586
+ }, [
587
+ r.type === "divider" ? (u(), c("div", Zt)) : r.type === "text" ? (u(), c("div", {
588
+ key: 1,
589
+ class: "q-text",
590
+ style: H(l(r))
591
+ }, q(r.text), 5)) : r.type === "row" ? (u(), c("div", Jt, [
592
+ (u(!0), c(S, null, R(r.cells, ($, g) => (u(), c("div", {
593
+ key: g,
594
+ class: "q-cell",
595
+ style: H(m($))
596
+ }, q($.text), 5))), 128))
597
+ ])) : M("", !0)
598
+ ], 64))), 128))
599
+ ])
600
+ ]));
601
+ }
602
+ }, Kt = /* @__PURE__ */ lt(Yt, [["__scopeId", "data-v-b623c085"]]);
603
+ function et(a) {
604
+ return JSON.parse(JSON.stringify(a));
605
+ }
606
+ function te(a, o) {
607
+ let s = null;
608
+ const f = function(...b) {
609
+ clearTimeout(s), s = setTimeout(() => a.apply(this, b), o);
610
+ };
611
+ return f.cancel = () => {
612
+ clearTimeout(s), s = null;
613
+ }, Object.defineProperty(f, "timer", {
614
+ get() {
615
+ return s;
616
+ },
617
+ configurable: !0
618
+ }), f;
619
+ }
620
+ function $t(a = []) {
621
+ return Array.isArray(a) ? a.map((o) => {
622
+ const s = Array.isArray(o.dict) ? o.dict : [];
623
+ return {
624
+ ...o,
625
+ field: o.field || "",
626
+ title: o.title || "",
627
+ editor: o.editor || "INPUT",
628
+ width: o.width ?? 130,
629
+ dictStr: s.length ? s.join(",") : o.dictStr || "",
630
+ formula: o.formula || "",
631
+ merge_on_group: o.merge_on_group ?? !1
632
+ };
633
+ }) : [];
634
+ }
635
+ function ee(a) {
636
+ return a.map((o) => {
637
+ const s = { field: o.field, title: o.title, editor: o.editor, width: o.width };
638
+ return o.editor === "SELECT_DICT" && (s.dict = (o.dictStr || "").split(",").map((f) => f.trim()).filter(Boolean)), o.editor === "AUTO_CALC" && (s.formula = o.formula || ""), o.editor !== "AUTO_SEQ" && o.editor !== "AUTO_CALC" && (s.merge_on_group = !!o.merge_on_group), s;
639
+ });
640
+ }
641
+ function le(a, o, s) {
642
+ const f = { INPUT: "文本", NUMBER: "数值", SELECT_DICT: "选项", TEXTAREA: "说明", AUTO_CALC: "计算值", AUTO_SEQ: "序号" }, b = { INPUT: 130, NUMBER: 100, SELECT_DICT: 130, TEXTAREA: 200, AUTO_CALC: 120, AUTO_SEQ: 60 };
643
+ return {
644
+ field: o,
645
+ title: f[a] || s || "新列",
646
+ editor: a,
647
+ width: b[a] || 120,
648
+ dictStr: "",
649
+ formula: "",
650
+ merge_on_group: !1
651
+ };
652
+ }
653
+ function oe(a = [], o = {}) {
654
+ const s = K($t(et(a))), f = K({
655
+ merge_field: o.merge_field || "",
656
+ show_detail_subtotal: o.show_detail_subtotal ?? !0
657
+ }), b = X(() => ({
658
+ columns: ee(s.value),
659
+ group_rules: (() => {
660
+ const C = f.value.merge_field;
661
+ return C ? { merge_field: C, show_detail_subtotal: f.value.show_detail_subtotal ?? !0 } : null;
662
+ })()
663
+ }));
664
+ function m(C) {
665
+ s.value = $t(et(C || []));
666
+ }
667
+ function h(C) {
668
+ f.value = {
669
+ merge_field: C.merge_field || "",
670
+ show_detail_subtotal: C.show_detail_subtotal ?? !0
671
+ };
672
+ }
673
+ return pt({ columns: s, groupRules: f, tpl: b, setColumns: m, setGroupRules: h });
674
+ }
675
+ function Ct() {
676
+ return {
677
+ top: { style: "", width: 1, color: "#dcdfe6" },
678
+ bottom: { style: "", width: 1, color: "#dcdfe6" },
679
+ left: { style: "", width: 1, color: "#dcdfe6" },
680
+ right: { style: "", width: 1, color: "#dcdfe6" }
681
+ };
682
+ }
683
+ function nt(a = "auto") {
684
+ return {
685
+ width: a,
686
+ color: "#303133",
687
+ fontSize: 13,
688
+ bold: !1,
689
+ italic: !1,
690
+ align: "left",
691
+ border: Ct()
692
+ };
693
+ }
694
+ function ct(a, o) {
695
+ a.style || (a.style = nt());
696
+ const s = o === "none" ? { style: "", width: 0, color: "#dcdfe6" } : { style: "solid", width: 1, color: "#dcdfe6" };
697
+ a.style.border = { top: { ...s }, bottom: { ...s }, left: { ...s }, right: { ...s } };
698
+ }
699
+ function xt(a) {
700
+ const o = a.style || {}, s = { width: o.width || "auto" };
701
+ s.textAlign = o.align || "left", o.color && (s.color = o.color), o.fontSize && (s.fontSize = o.fontSize + "px"), o.bold && (s.fontWeight = "bold"), o.italic && (s.fontStyle = "italic");
702
+ const f = o.border;
703
+ if (f)
704
+ for (const b of ["top", "bottom", "left", "right"]) {
705
+ const m = f[b];
706
+ m && m.style && m.width > 0 && (s["border-" + b] = `${m.width}px ${m.style} ${m.color || "#dcdfe6"}`);
707
+ }
708
+ return s;
709
+ }
710
+ function ne(a = []) {
711
+ for (const o of a)
712
+ o.type === "title" && (o.type = "text", o.style = o.style || { color: "#303133", fontSize: 18, bold: !0, italic: !1, align: "center" }, o.align && !o.style.align && (o.style.align = o.align, delete o.align)), o.type === "text" && (o.style = o.style || {}, o.align && !o.style.align && (o.style.align = o.align, delete o.align), o.style.color === void 0 && (o.style.color = "#303133"), o.style.fontSize === void 0 && (o.style.fontSize = 14), o.style.bold === void 0 && (o.style.bold = !1), o.style.italic === void 0 && (o.style.italic = !1), o.style.align === void 0 && (o.style.align = "left"));
713
+ }
714
+ function se(a = []) {
715
+ for (const o of a)
716
+ if (o.type === "row" && o.cells)
717
+ for (const s of o.cells)
718
+ s.style || (s.style = nt()), s.style.width === void 0 && (s.style.width = "auto"), s.style.color === void 0 && (s.style.color = "#303133"), s.style.fontSize === void 0 && (s.style.fontSize = 13), s.style.bold === void 0 && (s.style.bold = !1), s.style.italic === void 0 && (s.style.italic = !1), s.style.align === void 0 && (s.style.align = "left"), s.style.border === void 0 && (s.style.border = Ct());
719
+ }
720
+ function ae() {
721
+ return [
722
+ { type: "text", text: "报 价 单", style: { color: "#303133", fontSize: 22, bold: !0, italic: !1, align: "center" } },
723
+ { type: "divider" },
724
+ { type: "row", cells: [
725
+ { type: "field", label: "项目名称", bind: "projectName", style: nt("50%") },
726
+ { type: "field", label: "日期", bind: "quotationDate", style: nt("50%") }
727
+ ] }
728
+ ];
729
+ }
730
+ function kt(a, o = !1) {
731
+ if (!a || a.length === 0)
732
+ if (o) a = ae();
733
+ else return [];
734
+ return ne(a), se(a), a;
735
+ }
736
+ function Ut(a = [], o = {}) {
737
+ const { isHeader: s = !1 } = o, f = K(et(kt(a, s)));
738
+ function b(h) {
739
+ f.value = et(kt(h || [], s));
740
+ }
741
+ function m() {
742
+ return et(f.value);
743
+ }
744
+ return pt({ sections: f, setSections: b, toTpl: m });
745
+ }
746
+ function vt(a = []) {
747
+ let o = 0;
748
+ for (const s of a)
749
+ if (s.field) {
750
+ const f = /^field_(\d+)$/.exec(s.field);
751
+ f && (o = Math.max(o, parseInt(f[1], 10)));
752
+ }
753
+ for (const s of a)
754
+ s.field || (s.field = "field_" + String(++o).padStart(4, "0")), s.type === "AUTO_CALC" && !s.formula && (s.formula = "group_total"), s.style === void 0 && (s.style = { color: "#606266", fontSize: 13, bold: !1, italic: !1 }), s.style.color === void 0 && (s.style.color = "#606266"), s.style.fontSize === void 0 && (s.style.fontSize = 13), s.style.bold === void 0 && (s.style.bold = !1), s.style.italic === void 0 && (s.style.italic = !1);
755
+ }
756
+ function de(a = []) {
757
+ const o = K(et(a || []));
758
+ vt(o.value);
759
+ const s = X(() => et(o.value));
760
+ function f(m) {
761
+ o.value = et(m || []), vt(o.value);
762
+ }
763
+ function b() {
764
+ return vt(o.value), et(o.value);
765
+ }
766
+ return pt({ fields: o, tpl: s, setFields: f, toTpl: b });
767
+ }
768
+ const ie = ["XXXX", "YYYY", "ZZZZ", "WWWW"];
769
+ function re(a, o = 3) {
770
+ const s = [], f = ie;
771
+ for (let b = 0; b < o; b++) {
772
+ const m = {};
773
+ for (const h of a)
774
+ if (!(h.editor === "AUTO_SEQ" || h.editor === "AUTO_CALC"))
775
+ if (h.editor === "NUMBER")
776
+ m[h.field] = Math.floor(Math.random() * 900 + 100);
777
+ else if (h.editor === "SELECT_DICT") {
778
+ const C = (h.dictStr || (h.dict ? h.dict.join(",") : "")).split(",").map((T) => T.trim()).filter(Boolean);
779
+ m[h.field] = C[b % Math.max(C.length, 1)] || f[b % f.length];
780
+ } else
781
+ m[h.field] = f[b % f.length];
782
+ s.push(m);
783
+ }
784
+ return s;
785
+ }
786
+ function ft(a = 1100) {
787
+ const o = K(!1);
788
+ function s() {
789
+ o.value = window.innerWidth <= a;
790
+ }
791
+ return Vt(() => {
792
+ s(), window.addEventListener("resize", s);
793
+ }), St(() => {
794
+ window.removeEventListener("resize", s);
795
+ }), { isNarrow: o };
796
+ }
797
+ const ue = { class: "toolbar" }, ce = { class: "btn-group-inline" }, pe = { class: "design-table" }, fe = { class: "idx" }, me = ["onUpdate:modelValue"], ve = ["onUpdate:modelValue"], be = ["onUpdate:modelValue"], ye = ["onUpdate:modelValue"], _e = ["onUpdate:modelValue"], he = ["onUpdate:modelValue"], ge = {
798
+ key: 2,
799
+ class: "muted"
800
+ }, $e = {
801
+ key: 3,
802
+ class: "muted"
803
+ }, ke = { class: "col-merge" }, Ue = { key: 0 }, we = ["onUpdate:modelValue"], Ce = {
804
+ key: 1,
805
+ class: "muted"
806
+ }, xe = ["disabled", "onClick"], Ve = ["disabled", "onClick"], Se = ["onClick"], Ae = {
807
+ __name: "DesignCols",
808
+ props: {
809
+ columns: { type: Array, required: !0 },
810
+ groupRules: { type: Object, default: () => ({}) },
811
+ breakpoint: { type: Number, default: 1100 }
812
+ },
813
+ emits: ["help", "open-group"],
814
+ setup(a) {
815
+ const o = a, { isNarrow: s } = ft(o.breakpoint), f = X(() => !!o.groupRules.merge_field);
816
+ function b(i, e) {
817
+ let n = i, v = 2;
818
+ for (; e.has(n); ) n = i + "_" + v++;
819
+ return n;
820
+ }
821
+ function m() {
822
+ let i = 0;
823
+ for (const e of o.columns) {
824
+ const n = /^custom_(\d+)$/.exec(e.field);
825
+ n && (i = Math.max(i, parseInt(n[1], 10)));
826
+ }
827
+ return i + 1;
828
+ }
829
+ function h(i) {
830
+ const e = /* @__PURE__ */ new Set([...o.columns.map((l) => l.field)]), n = "custom_" + String(m()).padStart(4, "0"), v = le(i, b(n, e));
831
+ o.columns.push(v);
832
+ }
833
+ function C(i) {
834
+ o.columns.splice(i, 1);
835
+ }
836
+ function T(i, e) {
837
+ const n = i + e;
838
+ n < 0 || n >= o.columns.length || ([o.columns[i], o.columns[n]] = [o.columns[n], o.columns[i]]);
839
+ }
840
+ return (i, e) => (u(), c("div", null, [
841
+ t("div", ue, [
842
+ e[3] || (e[3] = t("span", { class: "tip" }, [
843
+ D("拖动或点 ↑↓ 调整顺序;支持自动序号和公式计算列,公式里可直接引用其他字段名,如 "),
844
+ t("code", null, "quantity * unit_price * 0.9")
845
+ ], -1)),
846
+ t("div", ce, [
847
+ t("button", {
848
+ class: Y(["btn", { "btn-primary": f.value }]),
849
+ onClick: e[0] || (e[0] = (n) => i.$emit("open-group"))
850
+ }, "分组 & 小计" + q(f.value ? " ✓" : ""), 3),
851
+ t("button", {
852
+ class: "btn btn-primary",
853
+ onClick: e[1] || (e[1] = (n) => h("INPUT"))
854
+ }, "+ 添加字段"),
855
+ t("button", {
856
+ class: "btn",
857
+ onClick: e[2] || (e[2] = (n) => i.$emit("help"))
858
+ }, "帮助")
859
+ ])
860
+ ]),
861
+ t("div", {
862
+ class: Y(["table-wrap", { "is-narrow": j(s) }])
863
+ }, [
864
+ t("table", pe, [
865
+ e[6] || (e[6] = t("thead", null, [
866
+ t("tr", null, [
867
+ t("th", { width: "50" }, "#"),
868
+ t("th", { width: "150" }, "字段名"),
869
+ t("th", { width: "150" }, "列标题"),
870
+ t("th", { width: "160" }, "类型"),
871
+ t("th", { width: "100" }, "宽度"),
872
+ t("th", null, "专属配置"),
873
+ t("th", { width: "130" }, "分组时合并"),
874
+ t("th", { width: "140" }, "操作")
875
+ ])
876
+ ], -1)),
877
+ t("tbody", null, [
878
+ (u(!0), c(S, null, R(a.columns, (n, v) => (u(), c("tr", { key: v }, [
879
+ t("td", fe, q(v + 1), 1),
880
+ t("td", null, [
881
+ _(t("input", {
882
+ class: "cell-input",
883
+ "onUpdate:modelValue": (l) => n.field = l
884
+ }, null, 8, me), [
885
+ [x, n.field]
886
+ ])
887
+ ]),
888
+ t("td", null, [
889
+ _(t("input", {
890
+ class: "cell-input",
891
+ "onUpdate:modelValue": (l) => n.title = l
892
+ }, null, 8, ve), [
893
+ [x, n.title]
894
+ ])
895
+ ]),
896
+ t("td", null, [
897
+ _(t("select", {
898
+ class: "cell-input",
899
+ "onUpdate:modelValue": (l) => n.editor = l
900
+ }, [...e[4] || (e[4] = [
901
+ bt('<option value="AUTO_SEQ" data-v-e3cbb539>自动序号</option><option value="AUTO_CALC" data-v-e3cbb539>自动计算(公式)</option><option value="INPUT" data-v-e3cbb539>文本输入</option><option value="NUMBER" data-v-e3cbb539>数字输入</option><option value="TEXTAREA" data-v-e3cbb539>多行文本</option><option value="SELECT_DICT" data-v-e3cbb539>下拉选择</option>', 6)
902
+ ])], 8, be), [
903
+ [B, n.editor]
904
+ ])
905
+ ]),
906
+ t("td", null, [
907
+ _(t("input", {
908
+ class: "cell-input",
909
+ type: "number",
910
+ min: "50",
911
+ max: "500",
912
+ "onUpdate:modelValue": (l) => n.width = l
913
+ }, null, 8, ye), [
914
+ [
915
+ x,
916
+ n.width,
917
+ void 0,
918
+ { number: !0 }
919
+ ]
920
+ ])
921
+ ]),
922
+ t("td", null, [
923
+ n.editor === "SELECT_DICT" ? _((u(), c("input", {
924
+ key: 0,
925
+ class: "cell-input",
926
+ "onUpdate:modelValue": (l) => n.dictStr = l,
927
+ placeholder: "下拉选项,逗号分隔 如:设备,材料,安装"
928
+ }, null, 8, _e)), [
929
+ [x, n.dictStr]
930
+ ]) : n.editor === "AUTO_CALC" ? _((u(), c("input", {
931
+ key: 1,
932
+ class: "cell-input",
933
+ "onUpdate:modelValue": (l) => n.formula = l,
934
+ placeholder: "公式,如 quantity * unit_price + tax"
935
+ }, null, 8, he)), [
936
+ [x, n.formula]
937
+ ]) : n.editor === "AUTO_SEQ" ? (u(), c("span", ge, "自动生成序号,无需配置")) : (u(), c("span", $e, "-"))
938
+ ]),
939
+ t("td", ke, [
940
+ n.editor !== "AUTO_SEQ" && n.editor !== "AUTO_CALC" ? (u(), c("label", Ue, [
941
+ _(t("input", {
942
+ type: "checkbox",
943
+ "onUpdate:modelValue": (l) => n.merge_on_group = l
944
+ }, null, 8, we), [
945
+ [tt, n.merge_on_group]
946
+ ]),
947
+ e[5] || (e[5] = t("span", null, "相同值合并", -1))
948
+ ])) : (u(), c("span", Ce, "—"))
949
+ ]),
950
+ t("td", null, [
951
+ t("button", {
952
+ class: "mini-btn",
953
+ disabled: v === 0,
954
+ onClick: (l) => T(v, -1)
955
+ }, "↑", 8, xe),
956
+ t("button", {
957
+ class: "mini-btn",
958
+ disabled: v >= a.columns.length - 1,
959
+ onClick: (l) => T(v, 1)
960
+ }, "↓", 8, Ve),
961
+ t("button", {
962
+ class: "mini-btn danger",
963
+ onClick: (l) => C(v)
964
+ }, "删", 8, Se)
965
+ ])
966
+ ]))), 128))
967
+ ])
968
+ ])
969
+ ], 2)
970
+ ]));
971
+ }
972
+ }, Te = /* @__PURE__ */ lt(Ae, [["__scopeId", "data-v-e3cbb539"]]), qe = { class: "gr-dialog" }, Ee = { class: "gr-header" }, ze = { class: "gr-content" }, Ne = { class: "gr-form" }, Le = { class: "gr-form-row" }, Me = ["value", "disabled"], Oe = { class: "gr-form-row" }, Fe = {
973
+ class: "gr-checkbox",
974
+ style: { flex: "1" }
975
+ }, Re = { class: "gr-footer" }, Ie = {
976
+ __name: "GroupDialog",
977
+ props: {
978
+ visible: { type: Boolean, default: !1 },
979
+ columns: { type: Array, default: () => [] },
980
+ groupRules: { type: Object, required: !0 }
981
+ },
982
+ setup(a) {
983
+ const o = a, s = pt({ merge_field: o.groupRules.merge_field || "", show_detail_subtotal: o.groupRules.show_detail_subtotal ?? !0 });
984
+ return rt(() => o.groupRules, (f) => {
985
+ Object.assign(s, { merge_field: f.merge_field || "", show_detail_subtotal: f.show_detail_subtotal ?? !0 });
986
+ }, { deep: !0 }), rt(s, () => {
987
+ Object.assign(o.groupRules, { merge_field: s.merge_field, show_detail_subtotal: s.show_detail_subtotal });
988
+ }, { deep: !0 }), (f, b) => a.visible ? (u(), c("div", {
989
+ key: 0,
990
+ class: "gr-mask",
991
+ onClick: b[4] || (b[4] = ut((m) => f.$emit("close"), ["self"]))
992
+ }, [
993
+ t("div", qe, [
994
+ t("div", Ee, [
995
+ b[5] || (b[5] = t("span", null, "分组规则 & 小计配置", -1)),
996
+ t("button", {
997
+ class: "gr-close",
998
+ onClick: b[0] || (b[0] = (m) => f.$emit("close"))
999
+ }, "✕")
1000
+ ]),
1001
+ t("div", ze, [
1002
+ b[10] || (b[10] = t("div", { class: "gr-tips" }, [
1003
+ t("p", null, [
1004
+ t("b", null, "分组是什么?"),
1005
+ D(" 选择某一列后,相同值的行会自动合并单元格(比如按「系统名称」分组,同系统的多条明细会合并成一个单元格)。每组末尾自动显示一行小计。")
1006
+ ])
1007
+ ], -1)),
1008
+ t("div", Ne, [
1009
+ t("div", Le, [
1010
+ b[7] || (b[7] = t("label", { class: "gr-form-label" }, "按哪一列分组", -1)),
1011
+ _(t("select", {
1012
+ class: "cell-input",
1013
+ "onUpdate:modelValue": b[1] || (b[1] = (m) => a.groupRules.merge_field = m),
1014
+ style: { flex: "1" }
1015
+ }, [
1016
+ b[6] || (b[6] = t("option", { value: "" }, "— 不分组 —", -1)),
1017
+ (u(!0), c(S, null, R(a.columns, (m) => (u(), c("option", {
1018
+ key: m.field,
1019
+ value: m.field,
1020
+ disabled: m.editor === "AUTO_SEQ" || m.editor === "AUTO_CALC"
1021
+ }, q(m.title) + "(" + q(m.field) + ")", 9, Me))), 128))
1022
+ ], 512), [
1023
+ [B, a.groupRules.merge_field]
1024
+ ])
1025
+ ]),
1026
+ t("div", Oe, [
1027
+ b[9] || (b[9] = t("label", { class: "gr-form-label" }, "明细小计", -1)),
1028
+ t("label", Fe, [
1029
+ _(t("input", {
1030
+ type: "checkbox",
1031
+ "onUpdate:modelValue": b[2] || (b[2] = (m) => a.groupRules.show_detail_subtotal = m)
1032
+ }, null, 512), [
1033
+ [tt, a.groupRules.show_detail_subtotal]
1034
+ ]),
1035
+ b[8] || (b[8] = t("span", null, "分组末尾显示小计行", -1))
1036
+ ])
1037
+ ])
1038
+ ])
1039
+ ]),
1040
+ t("div", Re, [
1041
+ t("button", {
1042
+ class: "btn",
1043
+ onClick: b[3] || (b[3] = (m) => f.$emit("close"))
1044
+ }, "关闭")
1045
+ ])
1046
+ ])
1047
+ ])) : M("", !0);
1048
+ }
1049
+ }, De = /* @__PURE__ */ lt(Ie, [["__scopeId", "data-v-bd77a67d"]]), Pe = { class: "toolbar" }, je = { class: "col-left" }, Be = { class: "sec-header" }, We = { class: "sec-type" }, Qe = { class: "sec-actions" }, He = ["disabled", "onClick"], Xe = ["disabled", "onClick"], Ge = ["onClick"], Ze = { class: "sec-row" }, Je = ["onUpdate:modelValue"], Ye = { class: "sec-row" }, Ke = ["onUpdate:modelValue"], tl = ["onUpdate:modelValue"], el = { class: "chk-label" }, ll = ["onUpdate:modelValue"], ol = { class: "chk-label" }, nl = ["onUpdate:modelValue"], sl = { class: "sec-row" }, al = ["onUpdate:modelValue"], dl = { class: "cells-list" }, il = { class: "cell-toolbar" }, rl = ["onClick"], ul = { class: "sec-row" }, cl = ["onUpdate:modelValue"], pl = {
1050
+ key: 0,
1051
+ class: "sec-row"
1052
+ }, fl = ["onUpdate:modelValue"], ml = {
1053
+ key: 1,
1054
+ class: "sec-row"
1055
+ }, vl = ["onUpdate:modelValue"], bl = {
1056
+ key: 2,
1057
+ class: "sec-row"
1058
+ }, yl = ["onUpdate:modelValue"], _l = {
1059
+ key: 3,
1060
+ class: "sec-row"
1061
+ }, hl = ["onUpdate:modelValue"], gl = { class: "sec-row" }, $l = ["onUpdate:modelValue"], kl = { class: "inline-group" }, Ul = ["onUpdate:modelValue"], wl = { class: "sec-row" }, Cl = ["onUpdate:modelValue"], xl = ["onUpdate:modelValue"], Vl = { class: "chk-label" }, Sl = ["onUpdate:modelValue"], Al = { class: "chk-label" }, Tl = ["onUpdate:modelValue"], ql = { class: "sec-row border-config" }, El = { class: "border-group" }, zl = { class: "border-item" }, Nl = ["onUpdate:modelValue"], Ll = ["onUpdate:modelValue"], Ml = ["onUpdate:modelValue"], Ol = { class: "border-item" }, Fl = ["onUpdate:modelValue"], Rl = ["onUpdate:modelValue"], Il = ["onUpdate:modelValue"], Dl = { class: "border-item" }, Pl = ["onUpdate:modelValue"], jl = ["onUpdate:modelValue"], Bl = ["onUpdate:modelValue"], Wl = { class: "border-item" }, Ql = ["onUpdate:modelValue"], Hl = ["onUpdate:modelValue"], Xl = ["onUpdate:modelValue"], Gl = ["onClick"], Zl = ["onClick"], Jl = ["onClick"], Yl = { class: "col-right" }, Kl = { class: "preview-box" }, to = { class: "preview-inner" }, eo = {
1062
+ key: 1,
1063
+ class: "p-divider"
1064
+ }, lo = {
1065
+ key: 3,
1066
+ class: "p-row"
1067
+ }, oo = { class: "p-label" }, no = { class: "p-value" }, so = {
1068
+ __name: "DesignHeader",
1069
+ props: {
1070
+ sections: { type: Array, required: !0 },
1071
+ breakpoint: { type: Number, default: 1100 }
1072
+ },
1073
+ setup(a) {
1074
+ const o = a, { isNarrow: s } = ft(o.breakpoint);
1075
+ function f(i) {
1076
+ i === "divider" ? o.sections.push({ type: i }) : i === "text" ? o.sections.push({ type: i, text: "纯文本内容", style: { color: "#303133", fontSize: 14, bold: !1, italic: !1, align: "left" } }) : i === "row" && o.sections.push({ type: i, cells: [{ type: "field", label: "字段", bind: "field1", style: nt("50%") }] });
1077
+ }
1078
+ function b(i) {
1079
+ o.sections.splice(i, 1);
1080
+ }
1081
+ function m(i, e) {
1082
+ const n = i + e;
1083
+ n < 0 || n >= o.sections.length || ([o.sections[i], o.sections[n]] = [o.sections[n], o.sections[i]]);
1084
+ }
1085
+ function h(i) {
1086
+ i.cells || (i.cells = []), i.cells.push({ type: "field", label: "新字段", bind: "newField", style: nt("33%") });
1087
+ }
1088
+ function C(i, e) {
1089
+ i.cells.splice(e, 1);
1090
+ }
1091
+ function T(i) {
1092
+ const e = {}, n = i.style || {};
1093
+ return n.color && (e.color = n.color), n.fontSize && (e.fontSize = n.fontSize + "px"), n.bold && (e.fontWeight = "bold"), n.italic && (e.fontStyle = "italic"), n.align && (e.textAlign = n.align), e;
1094
+ }
1095
+ return (i, e) => (u(), c("div", null, [
1096
+ t("div", Pe, [
1097
+ e[3] || (e[3] = t("span", { class: "tip" }, "这里定义报价单的大标题、项目信息行等,左侧是设计器,右侧实时预览", -1)),
1098
+ t("button", {
1099
+ class: "btn",
1100
+ onClick: e[0] || (e[0] = (n) => f("row"))
1101
+ }, "+ 字段行"),
1102
+ t("button", {
1103
+ class: "btn",
1104
+ onClick: e[1] || (e[1] = (n) => f("divider"))
1105
+ }, "+ 分隔线"),
1106
+ t("button", {
1107
+ class: "btn",
1108
+ onClick: e[2] || (e[2] = (n) => f("text"))
1109
+ }, "+ 纯文本")
1110
+ ]),
1111
+ t("div", {
1112
+ class: Y(["two-col", { "is-narrow": j(s) }])
1113
+ }, [
1114
+ t("div", je, [
1115
+ (u(!0), c(S, null, R(a.sections, (n, v) => (u(), c("div", {
1116
+ key: v,
1117
+ class: "sec-block"
1118
+ }, [
1119
+ t("div", Be, [
1120
+ t("span", We, q(n.type === "row" ? "字段行" : n.type === "divider" ? "分隔线" : "纯文本"), 1),
1121
+ t("div", Qe, [
1122
+ t("button", {
1123
+ class: "mini-btn",
1124
+ disabled: v === 0,
1125
+ onClick: (l) => m(v, -1)
1126
+ }, "↑", 8, He),
1127
+ t("button", {
1128
+ class: "mini-btn",
1129
+ disabled: v >= a.sections.length - 1,
1130
+ onClick: (l) => m(v, 1)
1131
+ }, "↓", 8, Xe),
1132
+ t("button", {
1133
+ class: "mini-btn danger",
1134
+ onClick: (l) => b(v)
1135
+ }, "删", 8, Ge)
1136
+ ])
1137
+ ]),
1138
+ n.type === "text" ? (u(), c(S, { key: 0 }, [
1139
+ t("div", Ze, [
1140
+ e[4] || (e[4] = t("label", null, "文字", -1)),
1141
+ _(t("input", {
1142
+ "onUpdate:modelValue": (l) => n.text = l,
1143
+ class: "cell-input"
1144
+ }, null, 8, Je), [
1145
+ [x, n.text]
1146
+ ])
1147
+ ]),
1148
+ t("div", Ye, [
1149
+ e[7] || (e[7] = t("label", null, "颜色", -1)),
1150
+ _(t("input", {
1151
+ type: "color",
1152
+ "onUpdate:modelValue": (l) => n.style.color = l,
1153
+ class: "color-input"
1154
+ }, null, 8, Ke), [
1155
+ [x, n.style.color]
1156
+ ]),
1157
+ e[8] || (e[8] = t("label", null, "字号", -1)),
1158
+ _(t("input", {
1159
+ "onUpdate:modelValue": (l) => n.style.fontSize = l,
1160
+ type: "number",
1161
+ class: "cell-input tiny",
1162
+ min: "10",
1163
+ max: "48"
1164
+ }, null, 8, tl), [
1165
+ [
1166
+ x,
1167
+ n.style.fontSize,
1168
+ void 0,
1169
+ { number: !0 }
1170
+ ]
1171
+ ]),
1172
+ t("label", el, [
1173
+ _(t("input", {
1174
+ type: "checkbox",
1175
+ "onUpdate:modelValue": (l) => n.style.bold = l
1176
+ }, null, 8, ll), [
1177
+ [tt, n.style.bold]
1178
+ ]),
1179
+ e[5] || (e[5] = D(" 加粗 ", -1))
1180
+ ]),
1181
+ t("label", ol, [
1182
+ _(t("input", {
1183
+ type: "checkbox",
1184
+ "onUpdate:modelValue": (l) => n.style.italic = l
1185
+ }, null, 8, nl), [
1186
+ [tt, n.style.italic]
1187
+ ]),
1188
+ e[6] || (e[6] = D(" 斜体 ", -1))
1189
+ ])
1190
+ ]),
1191
+ t("div", sl, [
1192
+ e[10] || (e[10] = t("label", null, "对齐", -1)),
1193
+ _(t("select", {
1194
+ "onUpdate:modelValue": (l) => n.style.align = l,
1195
+ class: "cell-input small"
1196
+ }, [...e[9] || (e[9] = [
1197
+ t("option", { value: "left" }, "左", -1),
1198
+ t("option", { value: "center" }, "中", -1),
1199
+ t("option", { value: "right" }, "右", -1)
1200
+ ])], 8, al), [
1201
+ [B, n.style.align]
1202
+ ])
1203
+ ])
1204
+ ], 64)) : n.type === "row" ? (u(), c(S, { key: 1 }, [
1205
+ t("div", dl, [
1206
+ (u(!0), c(S, null, R(n.cells, (l, E) => (u(), c("div", {
1207
+ key: E,
1208
+ class: "cell-block"
1209
+ }, [
1210
+ t("div", il, [
1211
+ t("strong", null, q(E + 1), 1),
1212
+ t("button", {
1213
+ class: "mini-btn danger",
1214
+ onClick: (d) => C(n, E)
1215
+ }, "×", 8, rl)
1216
+ ]),
1217
+ t("div", ul, [
1218
+ e[12] || (e[12] = t("label", null, "类型", -1)),
1219
+ _(t("select", {
1220
+ "onUpdate:modelValue": (d) => l.type = d,
1221
+ class: "cell-input small"
1222
+ }, [...e[11] || (e[11] = [
1223
+ t("option", { value: "field" }, "字段(可编辑)", -1),
1224
+ t("option", { value: "text" }, "纯文本", -1)
1225
+ ])], 8, cl), [
1226
+ [B, l.type]
1227
+ ])
1228
+ ]),
1229
+ l.type === "field" ? (u(), c("div", pl, [
1230
+ e[13] || (e[13] = t("label", null, "标签", -1)),
1231
+ _(t("input", {
1232
+ "onUpdate:modelValue": (d) => l.label = d,
1233
+ class: "cell-input"
1234
+ }, null, 8, fl), [
1235
+ [x, l.label]
1236
+ ])
1237
+ ])) : M("", !0),
1238
+ l.type === "field" ? (u(), c("div", ml, [
1239
+ e[14] || (e[14] = t("label", null, "值", -1)),
1240
+ _(t("input", {
1241
+ "onUpdate:modelValue": (d) => l.value = d,
1242
+ class: "cell-input",
1243
+ placeholder: "字段的值"
1244
+ }, null, 8, vl), [
1245
+ [x, l.value]
1246
+ ])
1247
+ ])) : M("", !0),
1248
+ l.type === "field" ? (u(), c("div", bl, [
1249
+ e[15] || (e[15] = t("label", null, "绑定字段", -1)),
1250
+ _(t("input", {
1251
+ "onUpdate:modelValue": (d) => l.bind = d,
1252
+ class: "cell-input",
1253
+ placeholder: "如 projectName"
1254
+ }, null, 8, yl), [
1255
+ [x, l.bind]
1256
+ ])
1257
+ ])) : M("", !0),
1258
+ l.type === "text" ? (u(), c("div", _l, [
1259
+ e[16] || (e[16] = t("label", null, "文字", -1)),
1260
+ _(t("input", {
1261
+ "onUpdate:modelValue": (d) => l.text = d,
1262
+ class: "cell-input"
1263
+ }, null, 8, hl), [
1264
+ [x, l.text]
1265
+ ])
1266
+ ])) : M("", !0),
1267
+ t("div", gl, [
1268
+ e[19] || (e[19] = t("label", null, "宽度", -1)),
1269
+ _(t("input", {
1270
+ "onUpdate:modelValue": (d) => l.style.width = d,
1271
+ class: "cell-input small",
1272
+ placeholder: "如 33%"
1273
+ }, null, 8, $l), [
1274
+ [x, l.style.width]
1275
+ ]),
1276
+ t("div", kl, [
1277
+ e[18] || (e[18] = t("label", { class: "muted" }, "对齐", -1)),
1278
+ _(t("select", {
1279
+ "onUpdate:modelValue": (d) => l.style.align = d,
1280
+ class: "cell-input small"
1281
+ }, [...e[17] || (e[17] = [
1282
+ t("option", { value: "left" }, "左", -1),
1283
+ t("option", { value: "center" }, "中", -1),
1284
+ t("option", { value: "right" }, "右", -1)
1285
+ ])], 8, Ul), [
1286
+ [B, l.style.align]
1287
+ ])
1288
+ ])
1289
+ ]),
1290
+ t("div", wl, [
1291
+ e[22] || (e[22] = t("label", null, "颜色", -1)),
1292
+ _(t("input", {
1293
+ type: "color",
1294
+ "onUpdate:modelValue": (d) => l.style.color = d,
1295
+ class: "color-input"
1296
+ }, null, 8, Cl), [
1297
+ [x, l.style.color]
1298
+ ]),
1299
+ e[23] || (e[23] = t("label", null, "字号", -1)),
1300
+ _(t("input", {
1301
+ "onUpdate:modelValue": (d) => l.style.fontSize = d,
1302
+ type: "number",
1303
+ class: "cell-input tiny",
1304
+ min: "10",
1305
+ max: "48"
1306
+ }, null, 8, xl), [
1307
+ [
1308
+ x,
1309
+ l.style.fontSize,
1310
+ void 0,
1311
+ { number: !0 }
1312
+ ]
1313
+ ]),
1314
+ t("label", Vl, [
1315
+ _(t("input", {
1316
+ type: "checkbox",
1317
+ "onUpdate:modelValue": (d) => l.style.bold = d
1318
+ }, null, 8, Sl), [
1319
+ [tt, l.style.bold]
1320
+ ]),
1321
+ e[20] || (e[20] = D(" 加粗 ", -1))
1322
+ ]),
1323
+ t("label", Al, [
1324
+ _(t("input", {
1325
+ type: "checkbox",
1326
+ "onUpdate:modelValue": (d) => l.style.italic = d
1327
+ }, null, 8, Tl), [
1328
+ [tt, l.style.italic]
1329
+ ]),
1330
+ e[21] || (e[21] = D(" 斜体 ", -1))
1331
+ ])
1332
+ ]),
1333
+ t("div", ql, [
1334
+ e[32] || (e[32] = t("label", null, "边框", -1)),
1335
+ t("div", El, [
1336
+ t("div", zl, [
1337
+ e[25] || (e[25] = t("span", null, "上", -1)),
1338
+ _(t("select", {
1339
+ "onUpdate:modelValue": (d) => l.style.border.top.style = d,
1340
+ class: "cell-input tiny"
1341
+ }, [...e[24] || (e[24] = [
1342
+ t("option", { value: "" }, "无", -1),
1343
+ t("option", { value: "solid" }, "实线", -1),
1344
+ t("option", { value: "dashed" }, "虚线", -1),
1345
+ t("option", { value: "dotted" }, "点线", -1)
1346
+ ])], 8, Nl), [
1347
+ [B, l.style.border.top.style]
1348
+ ]),
1349
+ _(t("input", {
1350
+ type: "number",
1351
+ "onUpdate:modelValue": (d) => l.style.border.top.width = d,
1352
+ class: "cell-input tiny",
1353
+ min: "0",
1354
+ max: "20",
1355
+ step: "1"
1356
+ }, null, 8, Ll), [
1357
+ [
1358
+ x,
1359
+ l.style.border.top.width,
1360
+ void 0,
1361
+ { number: !0 }
1362
+ ]
1363
+ ]),
1364
+ _(t("input", {
1365
+ type: "color",
1366
+ "onUpdate:modelValue": (d) => l.style.border.top.color = d,
1367
+ class: "color-input"
1368
+ }, null, 8, Ml), [
1369
+ [x, l.style.border.top.color]
1370
+ ])
1371
+ ]),
1372
+ t("div", Ol, [
1373
+ e[27] || (e[27] = t("span", null, "下", -1)),
1374
+ _(t("select", {
1375
+ "onUpdate:modelValue": (d) => l.style.border.bottom.style = d,
1376
+ class: "cell-input tiny"
1377
+ }, [...e[26] || (e[26] = [
1378
+ t("option", { value: "" }, "无", -1),
1379
+ t("option", { value: "solid" }, "实线", -1),
1380
+ t("option", { value: "dashed" }, "虚线", -1),
1381
+ t("option", { value: "dotted" }, "点线", -1)
1382
+ ])], 8, Fl), [
1383
+ [B, l.style.border.bottom.style]
1384
+ ]),
1385
+ _(t("input", {
1386
+ type: "number",
1387
+ "onUpdate:modelValue": (d) => l.style.border.bottom.width = d,
1388
+ class: "cell-input tiny",
1389
+ min: "0",
1390
+ max: "20",
1391
+ step: "1"
1392
+ }, null, 8, Rl), [
1393
+ [
1394
+ x,
1395
+ l.style.border.bottom.width,
1396
+ void 0,
1397
+ { number: !0 }
1398
+ ]
1399
+ ]),
1400
+ _(t("input", {
1401
+ type: "color",
1402
+ "onUpdate:modelValue": (d) => l.style.border.bottom.color = d,
1403
+ class: "color-input"
1404
+ }, null, 8, Il), [
1405
+ [x, l.style.border.bottom.color]
1406
+ ])
1407
+ ]),
1408
+ t("div", Dl, [
1409
+ e[29] || (e[29] = t("span", null, "左", -1)),
1410
+ _(t("select", {
1411
+ "onUpdate:modelValue": (d) => l.style.border.left.style = d,
1412
+ class: "cell-input tiny"
1413
+ }, [...e[28] || (e[28] = [
1414
+ t("option", { value: "" }, "无", -1),
1415
+ t("option", { value: "solid" }, "实线", -1),
1416
+ t("option", { value: "dashed" }, "虚线", -1),
1417
+ t("option", { value: "dotted" }, "点线", -1)
1418
+ ])], 8, Pl), [
1419
+ [B, l.style.border.left.style]
1420
+ ]),
1421
+ _(t("input", {
1422
+ type: "number",
1423
+ "onUpdate:modelValue": (d) => l.style.border.left.width = d,
1424
+ class: "cell-input tiny",
1425
+ min: "0",
1426
+ max: "20",
1427
+ step: "1"
1428
+ }, null, 8, jl), [
1429
+ [
1430
+ x,
1431
+ l.style.border.left.width,
1432
+ void 0,
1433
+ { number: !0 }
1434
+ ]
1435
+ ]),
1436
+ _(t("input", {
1437
+ type: "color",
1438
+ "onUpdate:modelValue": (d) => l.style.border.left.color = d,
1439
+ class: "color-input"
1440
+ }, null, 8, Bl), [
1441
+ [x, l.style.border.left.color]
1442
+ ])
1443
+ ]),
1444
+ t("div", Wl, [
1445
+ e[31] || (e[31] = t("span", null, "右", -1)),
1446
+ _(t("select", {
1447
+ "onUpdate:modelValue": (d) => l.style.border.right.style = d,
1448
+ class: "cell-input tiny"
1449
+ }, [...e[30] || (e[30] = [
1450
+ t("option", { value: "" }, "无", -1),
1451
+ t("option", { value: "solid" }, "实线", -1),
1452
+ t("option", { value: "dashed" }, "虚线", -1),
1453
+ t("option", { value: "dotted" }, "点线", -1)
1454
+ ])], 8, Ql), [
1455
+ [B, l.style.border.right.style]
1456
+ ]),
1457
+ _(t("input", {
1458
+ type: "number",
1459
+ "onUpdate:modelValue": (d) => l.style.border.right.width = d,
1460
+ class: "cell-input tiny",
1461
+ min: "0",
1462
+ max: "20",
1463
+ step: "1"
1464
+ }, null, 8, Hl), [
1465
+ [
1466
+ x,
1467
+ l.style.border.right.width,
1468
+ void 0,
1469
+ { number: !0 }
1470
+ ]
1471
+ ]),
1472
+ _(t("input", {
1473
+ type: "color",
1474
+ "onUpdate:modelValue": (d) => l.style.border.right.color = d,
1475
+ class: "color-input"
1476
+ }, null, 8, Xl), [
1477
+ [x, l.style.border.right.color]
1478
+ ])
1479
+ ])
1480
+ ]),
1481
+ t("button", {
1482
+ class: "mini-btn",
1483
+ onClick: (d) => j(ct)(l, "all")
1484
+ }, "全", 8, Gl),
1485
+ t("button", {
1486
+ class: "mini-btn",
1487
+ onClick: (d) => j(ct)(l, "none")
1488
+ }, "无", 8, Zl)
1489
+ ])
1490
+ ]))), 128))
1491
+ ]),
1492
+ t("button", {
1493
+ class: "btn btn-ghost",
1494
+ onClick: (l) => h(n)
1495
+ }, "+ 添加一个单元格", 8, Jl)
1496
+ ], 64)) : M("", !0)
1497
+ ]))), 128))
1498
+ ]),
1499
+ t("div", Yl, [
1500
+ t("div", Kl, [
1501
+ e[33] || (e[33] = t("div", { class: "preview-label" }, "实时预览", -1)),
1502
+ t("div", to, [
1503
+ (u(!0), c(S, null, R(a.sections, (n, v) => (u(), c(S, { key: v }, [
1504
+ n.type === "title" ? (u(), c("div", {
1505
+ key: 0,
1506
+ class: "p-title",
1507
+ style: H(T(n))
1508
+ }, q(n.text || "大标题"), 5)) : n.type === "divider" ? (u(), c("div", eo)) : n.type === "text" ? (u(), c("div", {
1509
+ key: 2,
1510
+ class: "p-text",
1511
+ style: H(T(n))
1512
+ }, q(n.text || "纯文本"), 5)) : n.type === "row" ? (u(), c("div", lo, [
1513
+ (u(!0), c(S, null, R(n.cells, (l, E) => (u(), c("div", {
1514
+ key: E,
1515
+ class: "p-cell",
1516
+ style: H(j(xt)(l))
1517
+ }, [
1518
+ l.type === "field" ? (u(), c(S, { key: 0 }, [
1519
+ t("span", oo, q(l.label) + ":", 1),
1520
+ t("span", no, q(l.value || "字段值"), 1)
1521
+ ], 64)) : (u(), c(S, { key: 1 }, [
1522
+ D(q(l.text || "纯文本"), 1)
1523
+ ], 64))
1524
+ ], 4))), 128))
1525
+ ])) : M("", !0)
1526
+ ], 64))), 128))
1527
+ ])
1528
+ ])
1529
+ ])
1530
+ ], 2)
1531
+ ]));
1532
+ }
1533
+ }, ao = /* @__PURE__ */ lt(so, [["__scopeId", "data-v-197b51e4"]]), io = { class: "toolbar" }, ro = { class: "col-left" }, uo = { class: "sec-header" }, co = { class: "sec-type" }, po = { class: "sec-actions" }, fo = ["disabled", "onClick"], mo = ["disabled", "onClick"], vo = ["onClick"], bo = { class: "cells-list" }, yo = { class: "cell-toolbar" }, _o = ["onClick"], ho = { class: "sec-row" }, go = ["onUpdate:modelValue"], $o = { class: "sec-row" }, ko = ["onUpdate:modelValue"], Uo = { class: "sec-row" }, wo = ["onUpdate:modelValue"], Co = { class: "inline-group" }, xo = ["onUpdate:modelValue"], Vo = { class: "sec-row" }, So = ["onUpdate:modelValue"], Ao = ["onUpdate:modelValue"], To = { class: "chk-label" }, qo = ["onUpdate:modelValue"], Eo = { class: "chk-label" }, zo = ["onUpdate:modelValue"], No = { class: "sec-row border-config" }, Lo = { class: "border-group" }, Mo = { class: "border-item" }, Oo = ["onUpdate:modelValue"], Fo = ["onUpdate:modelValue"], Ro = ["onUpdate:modelValue"], Io = { class: "border-item" }, Do = ["onUpdate:modelValue"], Po = ["onUpdate:modelValue"], jo = ["onUpdate:modelValue"], Bo = { class: "border-item" }, Wo = ["onUpdate:modelValue"], Qo = ["onUpdate:modelValue"], Ho = ["onUpdate:modelValue"], Xo = { class: "border-item" }, Go = ["onUpdate:modelValue"], Zo = ["onUpdate:modelValue"], Jo = ["onUpdate:modelValue"], Yo = ["onClick"], Ko = ["onClick"], tn = ["onClick"], en = { class: "sec-row" }, ln = ["onUpdate:modelValue"], on = { class: "sec-row" }, nn = ["onUpdate:modelValue"], sn = ["onUpdate:modelValue"], an = { class: "chk-label" }, dn = ["onUpdate:modelValue"], rn = { class: "chk-label" }, un = ["onUpdate:modelValue"], cn = { class: "sec-row" }, pn = ["onUpdate:modelValue"], fn = { class: "col-right" }, mn = { class: "preview-box" }, vn = { class: "preview-inner" }, bn = {
1534
+ key: 0,
1535
+ class: "p-divider"
1536
+ }, yn = {
1537
+ key: 2,
1538
+ class: "p-row"
1539
+ }, _n = {
1540
+ __name: "DesignFooter",
1541
+ props: {
1542
+ sections: { type: Array, required: !0 },
1543
+ breakpoint: { type: Number, default: 1100 }
1544
+ },
1545
+ setup(a) {
1546
+ const o = a, { isNarrow: s } = ft(o.breakpoint);
1547
+ function f(i) {
1548
+ i === "divider" ? o.sections.push({ type: i }) : i === "text" ? o.sections.push({ type: i, text: "纯文本", style: { color: "#303133", fontSize: 14, bold: !1, italic: !1, align: "left" } }) : i === "row" && o.sections.push({ type: i, cells: [{ type: "text", text: "客户签字:", style: nt("50%") }] });
1549
+ }
1550
+ function b(i) {
1551
+ o.sections.splice(i, 1);
1552
+ }
1553
+ function m(i, e) {
1554
+ const n = i + e;
1555
+ n < 0 || n >= o.sections.length || ([o.sections[i], o.sections[n]] = [o.sections[n], o.sections[i]]);
1556
+ }
1557
+ function h(i) {
1558
+ i.cells || (i.cells = []), i.cells.push({ type: "text", text: "签字:", style: nt("50%") });
1559
+ }
1560
+ function C(i, e) {
1561
+ i.cells.splice(e, 1);
1562
+ }
1563
+ function T(i) {
1564
+ const e = {}, n = i.style || {};
1565
+ return n.color && (e.color = n.color), n.fontSize && (e.fontSize = n.fontSize + "px"), n.bold && (e.fontWeight = "bold"), n.italic && (e.fontStyle = "italic"), n.align && (e.textAlign = n.align), e;
1566
+ }
1567
+ return (i, e) => (u(), c("div", null, [
1568
+ t("div", io, [
1569
+ e[3] || (e[3] = t("span", { class: "tip" }, "💡 页面底部显示签字栏、盖章区等,结构和页面头部一样", -1)),
1570
+ t("button", {
1571
+ class: "btn",
1572
+ onClick: e[0] || (e[0] = (n) => f("divider"))
1573
+ }, "+ 分隔线"),
1574
+ t("button", {
1575
+ class: "btn",
1576
+ onClick: e[1] || (e[1] = (n) => f("row"))
1577
+ }, "+ 字段行"),
1578
+ t("button", {
1579
+ class: "btn",
1580
+ onClick: e[2] || (e[2] = (n) => f("text"))
1581
+ }, "+ 纯文本")
1582
+ ]),
1583
+ t("div", {
1584
+ class: Y(["two-col", { "is-narrow": j(s) }])
1585
+ }, [
1586
+ t("div", ro, [
1587
+ (u(!0), c(S, null, R(a.sections, (n, v) => (u(), c("div", {
1588
+ key: v,
1589
+ class: "sec-block"
1590
+ }, [
1591
+ t("div", uo, [
1592
+ t("span", co, q(n.type === "row" ? "字段行" : n.type === "divider" ? "分隔线" : "纯文本"), 1),
1593
+ t("div", po, [
1594
+ t("button", {
1595
+ class: "mini-btn",
1596
+ disabled: v === 0,
1597
+ onClick: (l) => m(v, -1)
1598
+ }, "↑", 8, fo),
1599
+ t("button", {
1600
+ class: "mini-btn",
1601
+ disabled: v >= a.sections.length - 1,
1602
+ onClick: (l) => m(v, 1)
1603
+ }, "↓", 8, mo),
1604
+ t("button", {
1605
+ class: "mini-btn danger",
1606
+ onClick: (l) => b(v)
1607
+ }, "删", 8, vo)
1608
+ ])
1609
+ ]),
1610
+ n.type === "row" ? (u(), c(S, { key: 0 }, [
1611
+ t("div", bo, [
1612
+ (u(!0), c(S, null, R(n.cells, (l, E) => (u(), c("div", {
1613
+ key: E,
1614
+ class: "cell-block"
1615
+ }, [
1616
+ t("div", yo, [
1617
+ t("strong", null, q(E + 1), 1),
1618
+ t("button", {
1619
+ class: "mini-btn danger",
1620
+ onClick: (d) => C(n, E)
1621
+ }, "×", 8, _o)
1622
+ ]),
1623
+ t("div", ho, [
1624
+ e[5] || (e[5] = t("label", null, "类型", -1)),
1625
+ _(t("select", {
1626
+ "onUpdate:modelValue": (d) => l.type = d,
1627
+ class: "cell-input small"
1628
+ }, [...e[4] || (e[4] = [
1629
+ t("option", { value: "text" }, "纯文本", -1)
1630
+ ])], 8, go), [
1631
+ [B, l.type]
1632
+ ])
1633
+ ]),
1634
+ t("div", $o, [
1635
+ e[6] || (e[6] = t("label", null, "文字", -1)),
1636
+ _(t("input", {
1637
+ "onUpdate:modelValue": (d) => l.text = d,
1638
+ class: "cell-input"
1639
+ }, null, 8, ko), [
1640
+ [x, l.text]
1641
+ ])
1642
+ ]),
1643
+ t("div", Uo, [
1644
+ e[9] || (e[9] = t("label", null, "宽度", -1)),
1645
+ _(t("input", {
1646
+ "onUpdate:modelValue": (d) => l.style.width = d,
1647
+ class: "cell-input small",
1648
+ placeholder: "如 50%"
1649
+ }, null, 8, wo), [
1650
+ [x, l.style.width]
1651
+ ]),
1652
+ t("div", Co, [
1653
+ e[8] || (e[8] = t("label", { class: "muted" }, "对齐", -1)),
1654
+ _(t("select", {
1655
+ "onUpdate:modelValue": (d) => l.style.align = d,
1656
+ class: "cell-input small"
1657
+ }, [...e[7] || (e[7] = [
1658
+ t("option", { value: "left" }, "左", -1),
1659
+ t("option", { value: "center" }, "中", -1),
1660
+ t("option", { value: "right" }, "右", -1)
1661
+ ])], 8, xo), [
1662
+ [B, l.style.align]
1663
+ ])
1664
+ ])
1665
+ ]),
1666
+ t("div", Vo, [
1667
+ e[12] || (e[12] = t("label", null, "颜色", -1)),
1668
+ _(t("input", {
1669
+ type: "color",
1670
+ "onUpdate:modelValue": (d) => l.style.color = d,
1671
+ class: "color-input"
1672
+ }, null, 8, So), [
1673
+ [x, l.style.color]
1674
+ ]),
1675
+ e[13] || (e[13] = t("label", null, "字号", -1)),
1676
+ _(t("input", {
1677
+ "onUpdate:modelValue": (d) => l.style.fontSize = d,
1678
+ type: "number",
1679
+ class: "cell-input tiny",
1680
+ min: "10",
1681
+ max: "48"
1682
+ }, null, 8, Ao), [
1683
+ [
1684
+ x,
1685
+ l.style.fontSize,
1686
+ void 0,
1687
+ { number: !0 }
1688
+ ]
1689
+ ]),
1690
+ t("label", To, [
1691
+ _(t("input", {
1692
+ type: "checkbox",
1693
+ "onUpdate:modelValue": (d) => l.style.bold = d
1694
+ }, null, 8, qo), [
1695
+ [tt, l.style.bold]
1696
+ ]),
1697
+ e[10] || (e[10] = D(" 加粗 ", -1))
1698
+ ]),
1699
+ t("label", Eo, [
1700
+ _(t("input", {
1701
+ type: "checkbox",
1702
+ "onUpdate:modelValue": (d) => l.style.italic = d
1703
+ }, null, 8, zo), [
1704
+ [tt, l.style.italic]
1705
+ ]),
1706
+ e[11] || (e[11] = D(" 斜体 ", -1))
1707
+ ])
1708
+ ]),
1709
+ t("div", No, [
1710
+ e[22] || (e[22] = t("label", null, "边框", -1)),
1711
+ t("div", Lo, [
1712
+ t("div", Mo, [
1713
+ e[15] || (e[15] = t("span", null, "上", -1)),
1714
+ _(t("select", {
1715
+ "onUpdate:modelValue": (d) => l.style.border.top.style = d,
1716
+ class: "cell-input tiny"
1717
+ }, [...e[14] || (e[14] = [
1718
+ t("option", { value: "" }, "无", -1),
1719
+ t("option", { value: "solid" }, "实线", -1),
1720
+ t("option", { value: "dashed" }, "虚线", -1),
1721
+ t("option", { value: "dotted" }, "点线", -1)
1722
+ ])], 8, Oo), [
1723
+ [B, l.style.border.top.style]
1724
+ ]),
1725
+ _(t("input", {
1726
+ type: "number",
1727
+ "onUpdate:modelValue": (d) => l.style.border.top.width = d,
1728
+ class: "cell-input tiny",
1729
+ min: "0",
1730
+ max: "20",
1731
+ step: "1"
1732
+ }, null, 8, Fo), [
1733
+ [
1734
+ x,
1735
+ l.style.border.top.width,
1736
+ void 0,
1737
+ { number: !0 }
1738
+ ]
1739
+ ]),
1740
+ _(t("input", {
1741
+ type: "color",
1742
+ "onUpdate:modelValue": (d) => l.style.border.top.color = d,
1743
+ class: "color-input"
1744
+ }, null, 8, Ro), [
1745
+ [x, l.style.border.top.color]
1746
+ ])
1747
+ ]),
1748
+ t("div", Io, [
1749
+ e[17] || (e[17] = t("span", null, "下", -1)),
1750
+ _(t("select", {
1751
+ "onUpdate:modelValue": (d) => l.style.border.bottom.style = d,
1752
+ class: "cell-input tiny"
1753
+ }, [...e[16] || (e[16] = [
1754
+ t("option", { value: "" }, "无", -1),
1755
+ t("option", { value: "solid" }, "实线", -1),
1756
+ t("option", { value: "dashed" }, "虚线", -1),
1757
+ t("option", { value: "dotted" }, "点线", -1)
1758
+ ])], 8, Do), [
1759
+ [B, l.style.border.bottom.style]
1760
+ ]),
1761
+ _(t("input", {
1762
+ type: "number",
1763
+ "onUpdate:modelValue": (d) => l.style.border.bottom.width = d,
1764
+ class: "cell-input tiny",
1765
+ min: "0",
1766
+ max: "20",
1767
+ step: "1"
1768
+ }, null, 8, Po), [
1769
+ [
1770
+ x,
1771
+ l.style.border.bottom.width,
1772
+ void 0,
1773
+ { number: !0 }
1774
+ ]
1775
+ ]),
1776
+ _(t("input", {
1777
+ type: "color",
1778
+ "onUpdate:modelValue": (d) => l.style.border.bottom.color = d,
1779
+ class: "color-input"
1780
+ }, null, 8, jo), [
1781
+ [x, l.style.border.bottom.color]
1782
+ ])
1783
+ ]),
1784
+ t("div", Bo, [
1785
+ e[19] || (e[19] = t("span", null, "左", -1)),
1786
+ _(t("select", {
1787
+ "onUpdate:modelValue": (d) => l.style.border.left.style = d,
1788
+ class: "cell-input tiny"
1789
+ }, [...e[18] || (e[18] = [
1790
+ t("option", { value: "" }, "无", -1),
1791
+ t("option", { value: "solid" }, "实线", -1),
1792
+ t("option", { value: "dashed" }, "虚线", -1),
1793
+ t("option", { value: "dotted" }, "点线", -1)
1794
+ ])], 8, Wo), [
1795
+ [B, l.style.border.left.style]
1796
+ ]),
1797
+ _(t("input", {
1798
+ type: "number",
1799
+ "onUpdate:modelValue": (d) => l.style.border.left.width = d,
1800
+ class: "cell-input tiny",
1801
+ min: "0",
1802
+ max: "20",
1803
+ step: "1"
1804
+ }, null, 8, Qo), [
1805
+ [
1806
+ x,
1807
+ l.style.border.left.width,
1808
+ void 0,
1809
+ { number: !0 }
1810
+ ]
1811
+ ]),
1812
+ _(t("input", {
1813
+ type: "color",
1814
+ "onUpdate:modelValue": (d) => l.style.border.left.color = d,
1815
+ class: "color-input"
1816
+ }, null, 8, Ho), [
1817
+ [x, l.style.border.left.color]
1818
+ ])
1819
+ ]),
1820
+ t("div", Xo, [
1821
+ e[21] || (e[21] = t("span", null, "右", -1)),
1822
+ _(t("select", {
1823
+ "onUpdate:modelValue": (d) => l.style.border.right.style = d,
1824
+ class: "cell-input tiny"
1825
+ }, [...e[20] || (e[20] = [
1826
+ t("option", { value: "" }, "无", -1),
1827
+ t("option", { value: "solid" }, "实线", -1),
1828
+ t("option", { value: "dashed" }, "虚线", -1),
1829
+ t("option", { value: "dotted" }, "点线", -1)
1830
+ ])], 8, Go), [
1831
+ [B, l.style.border.right.style]
1832
+ ]),
1833
+ _(t("input", {
1834
+ type: "number",
1835
+ "onUpdate:modelValue": (d) => l.style.border.right.width = d,
1836
+ class: "cell-input tiny",
1837
+ min: "0",
1838
+ max: "20",
1839
+ step: "1"
1840
+ }, null, 8, Zo), [
1841
+ [
1842
+ x,
1843
+ l.style.border.right.width,
1844
+ void 0,
1845
+ { number: !0 }
1846
+ ]
1847
+ ]),
1848
+ _(t("input", {
1849
+ type: "color",
1850
+ "onUpdate:modelValue": (d) => l.style.border.right.color = d,
1851
+ class: "color-input"
1852
+ }, null, 8, Jo), [
1853
+ [x, l.style.border.right.color]
1854
+ ])
1855
+ ])
1856
+ ]),
1857
+ t("button", {
1858
+ class: "mini-btn",
1859
+ onClick: (d) => j(ct)(l, "all")
1860
+ }, "全", 8, Yo),
1861
+ t("button", {
1862
+ class: "mini-btn",
1863
+ onClick: (d) => j(ct)(l, "none")
1864
+ }, "无", 8, Ko)
1865
+ ])
1866
+ ]))), 128))
1867
+ ]),
1868
+ t("button", {
1869
+ class: "btn btn-ghost",
1870
+ onClick: (l) => h(n)
1871
+ }, "+ 添加一个单元格", 8, tn)
1872
+ ], 64)) : n.type === "text" ? (u(), c(S, { key: 1 }, [
1873
+ t("div", en, [
1874
+ e[23] || (e[23] = t("label", null, "文字", -1)),
1875
+ _(t("input", {
1876
+ "onUpdate:modelValue": (l) => n.text = l,
1877
+ class: "cell-input"
1878
+ }, null, 8, ln), [
1879
+ [x, n.text]
1880
+ ])
1881
+ ]),
1882
+ t("div", on, [
1883
+ e[26] || (e[26] = t("label", null, "颜色", -1)),
1884
+ _(t("input", {
1885
+ type: "color",
1886
+ "onUpdate:modelValue": (l) => n.style.color = l,
1887
+ class: "color-input"
1888
+ }, null, 8, nn), [
1889
+ [x, n.style.color]
1890
+ ]),
1891
+ e[27] || (e[27] = t("label", null, "字号", -1)),
1892
+ _(t("input", {
1893
+ "onUpdate:modelValue": (l) => n.style.fontSize = l,
1894
+ type: "number",
1895
+ class: "cell-input tiny",
1896
+ min: "10",
1897
+ max: "48"
1898
+ }, null, 8, sn), [
1899
+ [
1900
+ x,
1901
+ n.style.fontSize,
1902
+ void 0,
1903
+ { number: !0 }
1904
+ ]
1905
+ ]),
1906
+ t("label", an, [
1907
+ _(t("input", {
1908
+ type: "checkbox",
1909
+ "onUpdate:modelValue": (l) => n.style.bold = l
1910
+ }, null, 8, dn), [
1911
+ [tt, n.style.bold]
1912
+ ]),
1913
+ e[24] || (e[24] = D(" 加粗 ", -1))
1914
+ ]),
1915
+ t("label", rn, [
1916
+ _(t("input", {
1917
+ type: "checkbox",
1918
+ "onUpdate:modelValue": (l) => n.style.italic = l
1919
+ }, null, 8, un), [
1920
+ [tt, n.style.italic]
1921
+ ]),
1922
+ e[25] || (e[25] = D(" 斜体 ", -1))
1923
+ ])
1924
+ ]),
1925
+ t("div", cn, [
1926
+ e[29] || (e[29] = t("label", null, "对齐", -1)),
1927
+ _(t("select", {
1928
+ "onUpdate:modelValue": (l) => n.style.align = l,
1929
+ class: "cell-input small"
1930
+ }, [...e[28] || (e[28] = [
1931
+ t("option", { value: "left" }, "左", -1),
1932
+ t("option", { value: "center" }, "中", -1),
1933
+ t("option", { value: "right" }, "右", -1)
1934
+ ])], 8, pn), [
1935
+ [B, n.style.align]
1936
+ ])
1937
+ ])
1938
+ ], 64)) : M("", !0)
1939
+ ]))), 128))
1940
+ ]),
1941
+ t("div", fn, [
1942
+ t("div", mn, [
1943
+ e[30] || (e[30] = t("div", { class: "preview-label" }, "底部预览", -1)),
1944
+ t("div", vn, [
1945
+ (u(!0), c(S, null, R(a.sections, (n, v) => (u(), c(S, { key: v }, [
1946
+ n.type === "divider" ? (u(), c("div", bn)) : n.type === "text" ? (u(), c("div", {
1947
+ key: 1,
1948
+ class: "p-text",
1949
+ style: H(T(n))
1950
+ }, q(n.text || "纯文本"), 5)) : n.type === "row" ? (u(), c("div", yn, [
1951
+ (u(!0), c(S, null, R(n.cells, (l, E) => (u(), c("div", {
1952
+ key: E,
1953
+ class: "p-cell",
1954
+ style: H(j(xt)(l))
1955
+ }, q(l.text), 5))), 128))
1956
+ ])) : M("", !0)
1957
+ ], 64))), 128))
1958
+ ])
1959
+ ])
1960
+ ])
1961
+ ], 2)
1962
+ ]));
1963
+ }
1964
+ }, hn = /* @__PURE__ */ lt(_n, [["__scopeId", "data-v-3b5d8a7a"]]), gn = { class: "col-left" }, $n = { class: "sec-header" }, kn = { class: "sec-type" }, Un = { class: "sec-actions" }, wn = ["disabled", "onClick"], Cn = ["disabled", "onClick"], xn = ["onClick"], Vn = { class: "sec-row" }, Sn = ["onUpdate:modelValue"], An = ["onUpdate:modelValue"], Tn = { class: "sec-row" }, qn = ["onUpdate:modelValue"], En = {
1965
+ key: 0,
1966
+ class: "sec-row"
1967
+ }, zn = ["onUpdate:modelValue"], Nn = {
1968
+ key: 1,
1969
+ class: "sec-row"
1970
+ }, Ln = ["onUpdate:modelValue"], Mn = {
1971
+ key: 2,
1972
+ class: "sec-row"
1973
+ }, On = ["onUpdate:modelValue"], Fn = { class: "sec-row" }, Rn = ["onUpdate:modelValue"], In = ["onUpdate:modelValue"], Dn = { class: "chk-label" }, Pn = ["onUpdate:modelValue"], jn = { class: "chk-label" }, Bn = ["onUpdate:modelValue"], Wn = {
1974
+ key: 0,
1975
+ class: "empty-hint"
1976
+ }, Qn = { class: "col-right" }, Hn = { class: "summary-preview" }, Xn = { class: "sp-label" }, Gn = {
1977
+ key: 0,
1978
+ class: "empty-hint"
1979
+ }, Zn = {
1980
+ __name: "DesignSummary",
1981
+ props: {
1982
+ fields: { type: Array, required: !0 },
1983
+ breakpoint: { type: Number, default: 1100 }
1984
+ },
1985
+ setup(a) {
1986
+ const o = a, { isNarrow: s } = ft(o.breakpoint);
1987
+ function f(n) {
1988
+ return n === "MANUAL_INPUT" ? "手动输入" : n === "AUTO_CALC" ? "自动计算" : "纯文本";
1989
+ }
1990
+ function b(n, v) {
1991
+ let l = n, E = 2;
1992
+ for (; v.has(l); ) l = n + "_" + E++;
1993
+ return l;
1994
+ }
1995
+ function m() {
1996
+ let n = 0;
1997
+ for (const v of o.fields) {
1998
+ const l = /^field_(\d+)$/.exec(v.field);
1999
+ l && (n = Math.max(n, parseInt(l[1], 10)));
2000
+ }
2001
+ return n + 1;
2002
+ }
2003
+ function h() {
2004
+ const n = /* @__PURE__ */ new Set([...o.fields.map((l) => l.field)]), v = "field_" + String(m()).padStart(4, "0");
2005
+ o.fields.push({
2006
+ field: b(v, n),
2007
+ label: "新款项",
2008
+ type: "MANUAL_INPUT",
2009
+ default: 0,
2010
+ formula: "",
2011
+ style: { color: "#606266", fontSize: 13, bold: !1, italic: !1 }
2012
+ });
2013
+ }
2014
+ function C(n) {
2015
+ o.fields.splice(n, 1);
2016
+ }
2017
+ function T(n, v) {
2018
+ const l = n + v;
2019
+ l < 0 || l >= o.fields.length || ([o.fields[n], o.fields[l]] = [o.fields[l], o.fields[n]]);
2020
+ }
2021
+ function i(n) {
2022
+ const v = {}, l = n.style || {};
2023
+ return l.color && (v.color = l.color), l.fontSize && (v.fontSize = l.fontSize + "px"), l.bold && (v.fontWeight = "bold"), l.italic && (v.fontStyle = "italic"), v;
2024
+ }
2025
+ function e(n) {
2026
+ return n.type === "AUTO_CALC" ? n.formula || "group_total" : n.type === "PLAIN_TEXT" ? n.text || "(未填写文字)" : n.default ?? 0;
2027
+ }
2028
+ return (n, v) => (u(), c("div", null, [
2029
+ t("div", { class: "toolbar" }, [
2030
+ v[0] || (v[0] = t("span", { class: "tip" }, "💡 汇总区域显示在表格底部,支持手动输入、公式自动计算和纯文本展示", -1)),
2031
+ t("button", {
2032
+ class: "btn",
2033
+ onClick: h
2034
+ }, "+ 添加字段")
2035
+ ]),
2036
+ t("div", {
2037
+ class: Y(["two-col", { "is-narrow": j(s) }])
2038
+ }, [
2039
+ t("div", gn, [
2040
+ (u(!0), c(S, null, R(a.fields, (l, E) => (u(), c("div", {
2041
+ key: E,
2042
+ class: "sec-block"
2043
+ }, [
2044
+ t("div", $n, [
2045
+ t("span", kn, q(f(l.type)), 1),
2046
+ t("div", Un, [
2047
+ t("button", {
2048
+ class: "mini-btn",
2049
+ disabled: E === 0,
2050
+ onClick: (d) => T(E, -1)
2051
+ }, "↑", 8, wn),
2052
+ t("button", {
2053
+ class: "mini-btn",
2054
+ disabled: E >= a.fields.length - 1,
2055
+ onClick: (d) => T(E, 1)
2056
+ }, "↓", 8, Cn),
2057
+ t("button", {
2058
+ class: "mini-btn danger",
2059
+ onClick: (d) => C(E)
2060
+ }, "删", 8, xn)
2061
+ ])
2062
+ ]),
2063
+ t("div", Vn, [
2064
+ v[1] || (v[1] = t("label", null, "字段名", -1)),
2065
+ _(t("input", {
2066
+ class: "cell-input",
2067
+ "onUpdate:modelValue": (d) => l.field = d
2068
+ }, null, 8, Sn), [
2069
+ [x, l.field]
2070
+ ]),
2071
+ v[2] || (v[2] = t("label", null, "显示标签", -1)),
2072
+ _(t("input", {
2073
+ class: "cell-input",
2074
+ "onUpdate:modelValue": (d) => l.label = d
2075
+ }, null, 8, An), [
2076
+ [x, l.label]
2077
+ ])
2078
+ ]),
2079
+ t("div", Tn, [
2080
+ v[4] || (v[4] = t("label", null, "类型", -1)),
2081
+ _(t("select", {
2082
+ class: "cell-input",
2083
+ "onUpdate:modelValue": (d) => l.type = d
2084
+ }, [...v[3] || (v[3] = [
2085
+ t("option", { value: "MANUAL_INPUT" }, "手动输入(自定义金额)", -1),
2086
+ t("option", { value: "AUTO_CALC" }, "自动计算(公式)", -1),
2087
+ t("option", { value: "PLAIN_TEXT" }, "纯文本(固定文字)", -1)
2088
+ ])], 8, qn), [
2089
+ [B, l.type]
2090
+ ])
2091
+ ]),
2092
+ l.type === "MANUAL_INPUT" ? (u(), c("div", En, [
2093
+ v[5] || (v[5] = t("label", null, "默认值", -1)),
2094
+ _(t("input", {
2095
+ class: "cell-input",
2096
+ type: "number",
2097
+ "onUpdate:modelValue": (d) => l.default = d,
2098
+ placeholder: "可选,切换模板时自动填充"
2099
+ }, null, 8, zn), [
2100
+ [
2101
+ x,
2102
+ l.default,
2103
+ void 0,
2104
+ { number: !0 }
2105
+ ]
2106
+ ])
2107
+ ])) : M("", !0),
2108
+ l.type === "AUTO_CALC" ? (u(), c("div", Nn, [
2109
+ v[6] || (v[6] = t("label", null, "公式", -1)),
2110
+ _(t("input", {
2111
+ class: "cell-input",
2112
+ "onUpdate:modelValue": (d) => l.formula = d,
2113
+ placeholder: "如 group_total + service_fee 或 group_total * 0.06"
2114
+ }, null, 8, Ln), [
2115
+ [x, l.formula]
2116
+ ])
2117
+ ])) : M("", !0),
2118
+ l.type === "PLAIN_TEXT" ? (u(), c("div", Mn, [
2119
+ v[7] || (v[7] = t("label", null, "文字内容", -1)),
2120
+ _(t("input", {
2121
+ class: "cell-input",
2122
+ "onUpdate:modelValue": (d) => l.text = d,
2123
+ placeholder: "如:税率 1%"
2124
+ }, null, 8, On), [
2125
+ [x, l.text]
2126
+ ])
2127
+ ])) : M("", !0),
2128
+ t("div", Fn, [
2129
+ v[10] || (v[10] = t("label", null, "颜色", -1)),
2130
+ _(t("input", {
2131
+ type: "color",
2132
+ "onUpdate:modelValue": (d) => l.style.color = d,
2133
+ class: "color-input"
2134
+ }, null, 8, Rn), [
2135
+ [x, l.style.color]
2136
+ ]),
2137
+ v[11] || (v[11] = t("label", null, "字号", -1)),
2138
+ _(t("input", {
2139
+ class: "cell-input tiny",
2140
+ type: "number",
2141
+ "onUpdate:modelValue": (d) => l.style.fontSize = d,
2142
+ min: "10",
2143
+ max: "48",
2144
+ placeholder: "14"
2145
+ }, null, 8, In), [
2146
+ [
2147
+ x,
2148
+ l.style.fontSize,
2149
+ void 0,
2150
+ { number: !0 }
2151
+ ]
2152
+ ]),
2153
+ t("label", Dn, [
2154
+ _(t("input", {
2155
+ type: "checkbox",
2156
+ "onUpdate:modelValue": (d) => l.style.bold = d
2157
+ }, null, 8, Pn), [
2158
+ [tt, l.style.bold]
2159
+ ]),
2160
+ v[8] || (v[8] = D(" 加粗 ", -1))
2161
+ ]),
2162
+ t("label", jn, [
2163
+ _(t("input", {
2164
+ type: "checkbox",
2165
+ "onUpdate:modelValue": (d) => l.style.italic = d
2166
+ }, null, 8, Bn), [
2167
+ [tt, l.style.italic]
2168
+ ]),
2169
+ v[9] || (v[9] = D(" 斜体 ", -1))
2170
+ ])
2171
+ ])
2172
+ ]))), 128)),
2173
+ a.fields.length === 0 ? (u(), c("div", Wn, "还没有汇总项,点右上角按钮添加")) : M("", !0)
2174
+ ]),
2175
+ t("div", Qn, [
2176
+ v[12] || (v[12] = t("h4", { class: "preview-title" }, "实时预览", -1)),
2177
+ t("div", Hn, [
2178
+ (u(!0), c(S, null, R(a.fields, (l, E) => (u(), c("div", {
2179
+ class: "sp-row",
2180
+ key: E
2181
+ }, [
2182
+ t("span", Xn, q(l.label || "标签"), 1),
2183
+ t("span", {
2184
+ class: "sp-value",
2185
+ style: H(i(l))
2186
+ }, q(e(l)), 5)
2187
+ ]))), 128)),
2188
+ a.fields.length === 0 ? (u(), c("div", Gn, "暂无汇总项")) : M("", !0)
2189
+ ]),
2190
+ v[13] || (v[13] = bt('<div class="preview-help" data-v-8464c396><p data-v-8464c396><b data-v-8464c396>可用变量:</b></p><p data-v-8464c396><code data-v-8464c396>group_total</code> 明细小计合计</p><p data-v-8464c396><code data-v-8464c396>quantity_sum</code> 数量总和(需字段名为 quantity)</p><p data-v-8464c396><code data-v-8464c396>grand_total</code> 报价总额</p><p data-v-8464c396><code data-v-8464c396>各手动输入项字段名</code> 互相引用</p><p style="margin-top:6px;color:#909399;font-size:12px;" data-v-8464c396>完整列表请看使用教程</p></div>', 1))
2191
+ ])
2192
+ ], 2)
2193
+ ]));
2194
+ }
2195
+ }, Jn = /* @__PURE__ */ lt(Zn, [["__scopeId", "data-v-8464c396"]]), Yn = { class: "help-dialog" }, Kn = { class: "help-header" }, ts = {
2196
+ __name: "HelpModal",
2197
+ props: { visible: { type: Boolean, default: !1 } },
2198
+ emits: ["close"],
2199
+ setup(a) {
2200
+ return (o, s) => a.visible ? (u(), c("div", {
2201
+ key: 0,
2202
+ class: "help-modal",
2203
+ onClick: s[1] || (s[1] = ut((f) => o.$emit("close"), ["self"]))
2204
+ }, [
2205
+ t("div", Yn, [
2206
+ t("div", Kn, [
2207
+ s[2] || (s[2] = t("h3", null, "📖 报价单生成器 — 使用教程", -1)),
2208
+ t("button", {
2209
+ class: "close-btn",
2210
+ onClick: s[0] || (s[0] = (f) => o.$emit("close"))
2211
+ }, "✕")
2212
+ ]),
2213
+ s[3] || (s[3] = bt(`<div class="help-body" data-v-9af33ede><section class="help-section" data-v-9af33ede><h4 data-v-9af33ede>🔁 整体三步流程</h4><p data-v-9af33ede>顶部导航栏有三个步骤,按顺序操作即可生成一份完整报价单:</p><ol class="steps" data-v-9af33ede><li data-v-9af33ede><b data-v-9af33ede>① 设计模板</b> — 定义表头列、页面头部信息、汇总区域、底部签字栏等</li><li data-v-9af33ede><b data-v-9af33ede>② 填写数据</b> — 根据模板录入每条明细,自动分组、自动算小计</li><li data-v-9af33ede><b data-v-9af33ede>③ 预览导出</b> — 查看最终效果,一键导出 Excel 或打印</li></ol><p class="tip-box" data-v-9af33ede>💡 也可以从第 ② 步开始,系统已内置 3 个示例模板可直接使用</p></section><section class="help-section" data-v-9af33ede><h4 data-v-9af33ede>① 表头列 — 定义表格里有哪些列</h4><p data-v-9af33ede>点击顶部工具栏的 <b data-v-9af33ede>+ 添加字段</b> 按钮可以新增一列,然后在表格中把「类型」改成你想要的:</p><table class="help-table" data-v-9af33ede><thead data-v-9af33ede><tr data-v-9af33ede><th data-v-9af33ede>按钮</th><th data-v-9af33ede>字段类型</th><th data-v-9af33ede>说明</th></tr></thead><tbody data-v-9af33ede><tr data-v-9af33ede><td data-v-9af33ede>文本列</td><td data-v-9af33ede>INPUT</td><td data-v-9af33ede>普通文字输入,用于名称、描述等</td></tr><tr data-v-9af33ede><td data-v-9af33ede>数字列</td><td data-v-9af33ede>NUMBER</td><td data-v-9af33ede>只能填数字,用于数量、单价等</td></tr><tr data-v-9af33ede><td data-v-9af33ede>下拉列</td><td data-v-9af33ede>SELECT_DICT</td><td data-v-9af33ede>固定选项,点击列中的&quot;下拉选项&quot;输入选项,用逗号分隔,如 <code data-v-9af33ede>设备,材料,安装</code></td></tr><tr data-v-9af33ede><td data-v-9af33ede>多行文本列</td><td data-v-9af33ede>TEXTAREA</td><td data-v-9af33ede>可输入较长文字,用于备注、说明等</td></tr></tbody></table><p data-v-9af33ede><b data-v-9af33ede>特殊类型列:</b></p><ul data-v-9af33ede><li data-v-9af33ede><b data-v-9af33ede>自动序号</b> — 自动从 1 开始递增,字段名随便改(建议叫 <code data-v-9af33ede>seq</code>)</li><li data-v-9af33ede><b data-v-9af33ede>自动计算(公式)</b> — 用任意公式算值,公式里可引用<b data-v-9af33ede>同一行其他列的字段名</b>,如 <code data-v-9af33ede>quantity * unit_price</code>。字段名必须和你在表头里设置的一致,比如数量列叫 <code data-v-9af33ede>qty</code> 就要写 <code data-v-9af33ede>qty * unit_price</code></li></ul><p data-v-9af33ede><b data-v-9af33ede>列顺序:</b>点行末的 ↑ ↓ 按钮上下移动,或拖动行来调整</p><p data-v-9af33ede><b data-v-9af33ede>列宽度:</b>单位是像素(px),在&quot;宽度&quot;列填数字</p><p class="tip-box" data-v-9af33ede>💡 下拉列的选项是写在逗号分隔的输入框里,保存后切换到「填写数据」页面时会变成下拉选择框</p></section><section class="help-section" data-v-9af33ede><h4 data-v-9af33ede>② 页面头部 — 报价单的标题和项目信息</h4><p data-v-9af33ede>头部由多个&quot;段落&quot;顺序组成,每个段落可以是以下 4 种类型:</p><table class="help-table" data-v-9af33ede><thead data-v-9af33ede><tr data-v-9af33ede><th data-v-9af33ede>类型</th><th data-v-9af33ede>说明</th><th data-v-9af33ede>配置项</th></tr></thead><tbody data-v-9af33ede><tr data-v-9af33ede><td data-v-9af33ede><b data-v-9af33ede>大标题</b></td><td data-v-9af33ede>最顶部的报价单标题</td><td data-v-9af33ede>文字、字号、粗体、对齐方式</td></tr><tr data-v-9af33ede><td data-v-9af33ede><b data-v-9af33ede>字段行</b></td><td data-v-9af33ede>一行可以放多个单元格,每个单元格要么是可编辑字段,要么是固定文字</td><td data-v-9af33ede>每个单元格单独配置</td></tr><tr data-v-9af33ede><td data-v-9af33ede><b data-v-9af33ede>分隔线</b></td><td data-v-9af33ede>画一条灰色横线</td><td data-v-9af33ede>无配置</td></tr><tr data-v-9af33ede><td data-v-9af33ede><b data-v-9af33ede>纯文本</b></td><td data-v-9af33ede>一段固定文字,如&quot;此报价单有效期30天&quot;</td><td data-v-9af33ede>文字内容、对齐方式</td></tr></tbody></table><p data-v-9af33ede><b data-v-9af33ede>字段行详解:</b></p><ul data-v-9af33ede><li data-v-9af33ede>点&quot;➕ 添加一个单元格&quot;来增加这一行里的格子数量</li><li data-v-9af33ede>每个格子选&quot;类型&quot;:<b data-v-9af33ede>字段(可编辑)</b> 或 <b data-v-9af33ede>纯文本</b></li><li data-v-9af33ede>字段类型要填 <b data-v-9af33ede>标签</b>(如&quot;项目名称&quot;)和 <b data-v-9af33ede>绑定字段</b>(如 <code data-v-9af33ede>projectName</code>)</li><li data-v-9af33ede>绑定字段是关键!同一个绑定字段名在整个模板中要保持一致,后续数据填写和导出都靠它</li><li data-v-9af33ede>宽度用百分比,如 <code data-v-9af33ede>50%</code>、<code data-v-9af33ede>33%</code>,一行所有格子宽度加起来建议 = 100%</li></ul><p class="tip-box" data-v-9af33ede>💡 右侧&quot;实时预览&quot;区域会随着你的编辑即时变化,所见即所得</p></section><section class="help-section" data-v-9af33ede><h4 data-v-9af33ede>③ 汇总区域 — 表格底部的费用合计</h4><p data-v-9af33ede>汇总项显示在明细表格的下方(导出 Excel 时会自动排在表格右侧底部)。</p><table class="help-table" data-v-9af33ede><thead data-v-9af33ede><tr data-v-9af33ede><th data-v-9af33ede>类型</th><th data-v-9af33ede>说明</th></tr></thead><tbody data-v-9af33ede><tr data-v-9af33ede><td data-v-9af33ede><b data-v-9af33ede>手动输入(自定义金额)</b></td><td data-v-9af33ede>任意需要手工填写的金额项:人工费、服务费、运费、税费、折扣、其他费用等。可以在&quot;默认值&quot;里预设一个初始值</td></tr><tr data-v-9af33ede><td data-v-9af33ede><b data-v-9af33ede>自动计算(公式)</b></td><td data-v-9af33ede>系统自动算好的值,需要写公式。<code data-v-9af33ede>grand_total</code> 会自动把所有手动输入项加进去</td></tr></tbody></table><p data-v-9af33ede><b data-v-9af33ede>自动计算公式里的可用变量(固定):</b></p><table class="help-table" data-v-9af33ede><thead data-v-9af33ede><tr data-v-9af33ede><th data-v-9af33ede>变量名</th><th data-v-9af33ede>含义</th><th data-v-9af33ede>说明</th></tr></thead><tbody data-v-9af33ede><tr data-v-9af33ede><td data-v-9af33ede><code data-v-9af33ede>group_total</code></td><td data-v-9af33ede>明细小计合计</td><td data-v-9af33ede>所有行的自动计算列(小计列)求和</td></tr><tr data-v-9af33ede><td data-v-9af33ede><code data-v-9af33ede>grand_total</code></td><td data-v-9af33ede>报价总额</td><td data-v-9af33ede>group_total + 所有手动输入项之和</td></tr><tr data-v-9af33ede><td data-v-9af33ede><code data-v-9af33ede>quantity_sum</code></td><td data-v-9af33ede>数量总和</td><td data-v-9af33ede>所有行 <b data-v-9af33ede>字段名为 quantity</b> 的列求和。如果表头数量列不叫 quantity,这个值就是 0</td></tr></tbody></table><p data-v-9af33ede><b data-v-9af33ede>动态可用变量(随你的模板定义):</b></p><p data-v-9af33ede>你在汇总区域里定义的<b data-v-9af33ede>每一个手动输入项的字段名</b>,都会自动成为可用变量,它们之间也能互相引用。</p><p data-v-9af33ede>举个例子:如果你定义了 <code data-v-9af33ede>labor_cost</code>、<code data-v-9af33ede>service_fee</code>、<code data-v-9af33ede>discount</code> 三个手动项,那么自动计算公式里可以写:</p><pre class="code" data-v-9af33ede>group_total + labor_cost + service_fee - discount</pre><p data-v-9af33ede><b data-v-9af33ede>字段名命名建议:</b></p><ul data-v-9af33ede><li data-v-9af33ede><code data-v-9af33ede>grand_total</code> — 报价总额(特殊字段,系统会把所有手动项加进去)</li><li data-v-9af33ede><code data-v-9af33ede>group_total</code> — 明细小计(建议不要手动改成别的,公式里会用到)</li><li data-v-9af33ede><code data-v-9af33ede>quantity</code> — 表头里的数量列字段名(如果想用 <code data-v-9af33ede>quantity_sum</code> 变量,必须叫这个)</li><li data-v-9af33ede>其他手动项随意,如 <code data-v-9af33ede>service_fee</code>、<code data-v-9af33ede>freight</code>、<code data-v-9af33ede>tax_amount</code>、<code data-v-9af33ede>discount</code> 等</li></ul></section><section class="help-section" data-v-9af33ede><h4 data-v-9af33ede>④ 页面底部 — 签字栏、盖章区</h4><p data-v-9af33ede>结构和&quot;页面头部&quot;完全一样,支持:分隔线、字段行、纯文本。</p><p data-v-9af33ede>常见用法:</p><ul data-v-9af33ede><li data-v-9af33ede>分隔线 → 分隔表格和签字区</li><li data-v-9af33ede>字段行 → 左边&quot;客户签字:________&quot;,右边&quot;业务员签字:________&quot;</li><li data-v-9af33ede>纯文本 → 居中写&quot;公司盖章:&quot;</li></ul></section><section class="help-section" data-v-9af33ede><h4 data-v-9af33ede>💾 保存与模板管理</h4><ul data-v-9af33ede><li data-v-9af33ede><b data-v-9af33ede>💾 保存修改</b> — 直接更新当前选中的模板</li><li data-v-9af33ede><b data-v-9af33ede>➕ 另存为新模板</b> — 输入一个新名字,基于当前模板复制出一个全新的模板</li><li data-v-9af33ede>顶部的下拉框可以在已有的模板之间切换,切换后下方所有配置会自动加载</li></ul><p class="tip-box" data-v-9af33ede>⚠️ 目前模板数据保存在浏览器内存中(刷新后会恢复默认),如果要持久化存储,需要把模板同步到后端接口</p></section><section class="help-section" data-v-9af33ede><h4 data-v-9af33ede>🔢 分组与计算规则(高级)</h4><p data-v-9af33ede>在「表头列」tab 的列表下方,有一个<b data-v-9af33ede>分组规则</b>配置框:</p><ul data-v-9af33ede><li data-v-9af33ede><b data-v-9af33ede>按哪一列分组</b> — 选择一列后,相同值的行会自动合并单元格,每组末尾自动生成小计行。选「不分组」则不分组、不显示小计,但列上勾选了「相同值合并」的列仍然会对相邻相同值做合并</li></ul><p data-v-9af33ede>对应模板数据结构:</p><pre class="code" data-v-9af33ede>{
2214
+ group_rules: { merge_field: &#39;system_name&#39; },
2215
+ // 不分组时 group_rules 为 null 或 { merge_field: &#39;&#39; }
2216
+ }</pre><p data-v-9af33ede>例如模板 TPL-001 按 <code data-v-9af33ede>system_name</code>(系统名称)分组,相同系统名称的多条明细会自动合并成一个单元格,每组末尾自动生成小计行。</p></section><section class="help-section" data-v-9af33ede><h4 data-v-9af33ede>📝 切换到「填写数据」</h4><p data-v-9af33ede>模板设计好后,点顶部的&quot;下一步&quot;进入填写数据页面,注意:</p><ul data-v-9af33ede><li data-v-9af33ede>点 ➕ 添加新条目,会弹出表单,表单字段完全根据你的模板表头列生成</li><li data-v-9af33ede>分组字段(如 <code data-v-9af33ede>system_name</code>)会自动继承上一行的值,让同组合并不间断</li><li data-v-9af33ede>右侧&quot;实时汇总&quot;卡片会根据汇总区域配置动态显示</li></ul></section><section class="help-section tip-box final-tip" data-v-9af33ede> 🎯 <b data-v-9af33ede>推荐操作顺序:</b>选一个最接近的示例模板 → 点&quot;另存为新模板&quot;复制一份 → 按需要改表头列 / 头部信息 / 汇总项 → 保存 → 下一步填写数据 → 导出 Excel </section></div>`, 1))
2217
+ ])
2218
+ ])) : M("", !0);
2219
+ }
2220
+ }, es = /* @__PURE__ */ lt(ts, [["__scopeId", "data-v-9af33ede"]]), ls = { class: "designer" }, os = { class: "tabs" }, ns = {
2221
+ key: 0,
2222
+ class: "tab-content"
2223
+ }, ss = {
2224
+ key: 1,
2225
+ class: "tab-content"
2226
+ }, as = {
2227
+ key: 2,
2228
+ class: "tab-content"
2229
+ }, ds = {
2230
+ key: 3,
2231
+ class: "tab-content"
2232
+ }, is = {
2233
+ key: 4,
2234
+ class: "tab-content tab-content-preview"
2235
+ }, rs = {
2236
+ __name: "QuokitTemplate",
2237
+ props: {
2238
+ tpl: { type: Object, required: !0 },
2239
+ breakpoint: { type: Number, default: 1100 }
2240
+ },
2241
+ emits: ["update:tpl"],
2242
+ setup(a, { expose: o, emit: s }) {
2243
+ const f = a, b = s, m = K("cols"), h = K(!1), C = K(!1), T = oe([], {}), i = Ut([], { isHeader: !0 }), e = Ut([], { isHeader: !1 }), n = de([]);
2244
+ let v = !1;
2245
+ rt(() => f.tpl, () => {
2246
+ if (v) return;
2247
+ v = !0;
2248
+ const V = f.tpl || {};
2249
+ T.setColumns(V.columns || []), T.setGroupRules(V.group_rules || {}), i.setSections(V.header_sections || []), e.setSections(V.footer_sections || []), n.setFields(V.summary_fields || []);
2250
+ }, { immediate: !0 });
2251
+ const l = te((V) => {
2252
+ b("update:tpl", V);
2253
+ }, 200), E = X(() => ({
2254
+ ...T.tpl,
2255
+ header_sections: i.toTpl(),
2256
+ footer_sections: e.toTpl(),
2257
+ summary_fields: n.toTpl()
2258
+ }));
2259
+ rt(E, () => {
2260
+ if (v) {
2261
+ v = !1;
2262
+ return;
2263
+ }
2264
+ l(E.value);
2265
+ }, { deep: !0 }), At(() => {
2266
+ l.cancel();
2267
+ });
2268
+ const d = X(() => E.value), F = X(() => re(T.tpl.columns, 3));
2269
+ return o({
2270
+ getTemplateJSON() {
2271
+ return E.value;
2272
+ },
2273
+ showHelp() {
2274
+ h.value = !0;
2275
+ }
2276
+ }), (V, w) => (u(), c("div", ls, [
2277
+ t("div", os, [
2278
+ t("div", {
2279
+ class: Y(["tab", { active: m.value === "cols" }]),
2280
+ onClick: w[0] || (w[0] = (L) => m.value = "cols")
2281
+ }, "① 表头列", 2),
2282
+ t("div", {
2283
+ class: Y(["tab", { active: m.value === "header" }]),
2284
+ onClick: w[1] || (w[1] = (L) => m.value = "header")
2285
+ }, "② 页面头部", 2),
2286
+ t("div", {
2287
+ class: Y(["tab", { active: m.value === "summary" }]),
2288
+ onClick: w[2] || (w[2] = (L) => m.value = "summary")
2289
+ }, "③ 汇总区域", 2),
2290
+ t("div", {
2291
+ class: Y(["tab", { active: m.value === "footer" }]),
2292
+ onClick: w[3] || (w[3] = (L) => m.value = "footer")
2293
+ }, "④ 页面底部", 2),
2294
+ t("div", {
2295
+ class: Y(["tab", { active: m.value === "preview" }]),
2296
+ onClick: w[4] || (w[4] = (L) => m.value = "preview")
2297
+ }, "⑤ 总体预览", 2)
2298
+ ]),
2299
+ m.value === "cols" ? (u(), c("div", ns, [
2300
+ st(Te, {
2301
+ columns: j(T).columns,
2302
+ "group-rules": j(T).groupRules,
2303
+ breakpoint: a.breakpoint,
2304
+ onHelp: w[5] || (w[5] = (L) => h.value = !0),
2305
+ onOpenGroup: w[6] || (w[6] = (L) => C.value = !0)
2306
+ }, null, 8, ["columns", "group-rules", "breakpoint"])
2307
+ ])) : M("", !0),
2308
+ m.value === "header" ? (u(), c("div", ss, [
2309
+ st(ao, {
2310
+ sections: j(i).sections,
2311
+ breakpoint: a.breakpoint
2312
+ }, null, 8, ["sections", "breakpoint"])
2313
+ ])) : M("", !0),
2314
+ m.value === "summary" ? (u(), c("div", as, [
2315
+ st(Jn, {
2316
+ fields: j(n).fields,
2317
+ breakpoint: a.breakpoint
2318
+ }, null, 8, ["fields", "breakpoint"])
2319
+ ])) : M("", !0),
2320
+ m.value === "footer" ? (u(), c("div", ds, [
2321
+ st(hn, {
2322
+ sections: j(e).sections,
2323
+ breakpoint: a.breakpoint
2324
+ }, null, 8, ["sections", "breakpoint"])
2325
+ ])) : M("", !0),
2326
+ m.value === "preview" ? (u(), c("div", is, [
2327
+ st(Kt, {
2328
+ tpl: d.value,
2329
+ data: F.value
2330
+ }, null, 8, ["tpl", "data"])
2331
+ ])) : M("", !0),
2332
+ st(es, {
2333
+ visible: h.value,
2334
+ onClose: w[7] || (w[7] = (L) => h.value = !1)
2335
+ }, null, 8, ["visible"]),
2336
+ st(De, {
2337
+ visible: C.value,
2338
+ columns: j(T).columns,
2339
+ "group-rules": j(T).groupRules,
2340
+ onClose: w[8] || (w[8] = (L) => C.value = !1)
2341
+ }, null, 8, ["visible", "columns", "group-rules"])
2342
+ ]));
2343
+ }
2344
+ }, Es = /* @__PURE__ */ lt(rs, [["__scopeId", "data-v-88fcba25"]]), us = { class: "page" }, cs = {
2345
+ key: 0,
2346
+ class: "empty-tip"
2347
+ }, ps = {
2348
+ key: 1,
2349
+ class: "data-table"
2350
+ }, fs = { class: "main-table" }, ms = ["onClick"], vs = {
2351
+ key: 1,
2352
+ class: "subtotal"
2353
+ }, bs = ["onClick"], ys = ["onClick"], _s = { class: "de-dialog" }, hs = { class: "de-header" }, gs = { class: "de-content" }, $s = { class: "form-grid" }, ks = { class: "form-cell-label" }, Us = ["onUpdate:modelValue", "placeholder"], ws = ["step", "min", "max", "onUpdate:modelValue"], Cs = ["onUpdate:modelValue", "placeholder"], xs = ["onUpdate:modelValue"], Vs = ["value"], Ss = { class: "de-footer" }, As = {
2354
+ __name: "QuokitData",
2355
+ props: {
2356
+ tpl: { type: Object, required: !0 },
2357
+ data: { type: Array, default: () => [] }
2358
+ },
2359
+ emits: ["update:data"],
2360
+ setup(a, { emit: o }) {
2361
+ const s = a, f = o, b = X(() => s.data), m = X(() => {
2362
+ var F;
2363
+ return ((F = s.tpl) == null ? void 0 : F.columns) || [];
2364
+ }), h = X(
2365
+ () => m.value.filter((F) => F.editor !== "AUTO_SEQ" && F.editor !== "AUTO_CALC")
2366
+ ), C = K(!1), T = K("add"), i = K(-1), e = K({});
2367
+ function n() {
2368
+ const F = {};
2369
+ for (const V of h.value)
2370
+ V.editor === "NUMBER" ? F[V.field] = V.default ?? V.min ?? 0 : F[V.field] = V.default ?? "";
2371
+ return F;
2372
+ }
2373
+ function v() {
2374
+ T.value = "add", i.value = -1, e.value = n(), C.value = !0;
2375
+ }
2376
+ function l(F) {
2377
+ T.value = "edit", i.value = F, e.value = { ...b.value[F] }, C.value = !0;
2378
+ }
2379
+ function E(F) {
2380
+ if (!confirm("确定删除这条明细?")) return;
2381
+ const V = [...b.value];
2382
+ V.splice(F, 1), f("update:data", V);
2383
+ }
2384
+ function d() {
2385
+ if (T.value === "edit") {
2386
+ const F = [...b.value];
2387
+ F[i.value] = { ...e.value }, f("update:data", F);
2388
+ } else
2389
+ f("update:data", [...b.value, { ...e.value }]);
2390
+ C.value = !1;
2391
+ }
2392
+ return (F, V) => (u(), c("div", us, [
2393
+ t("div", { class: "toolbar" }, [
2394
+ V[4] || (V[4] = t("span", { class: "tip" }, "点击行可快速编辑,预估总价会自动计算", -1)),
2395
+ t("div", { class: "btn-group-inline" }, [
2396
+ t("button", {
2397
+ class: "btn",
2398
+ onClick: v
2399
+ }, "+ 添加新条目")
2400
+ ])
2401
+ ]),
2402
+ b.value.length === 0 ? (u(), c("div", cs, [...V[5] || (V[5] = [
2403
+ t("div", { class: "empty-icon" }, "📋", -1),
2404
+ t("div", { class: "empty-text" }, "暂无数据,点击下方按钮添加第一条明细", -1)
2405
+ ])])) : M("", !0),
2406
+ b.value.length > 0 ? (u(), c("div", ps, [
2407
+ t("table", fs, [
2408
+ t("thead", null, [
2409
+ t("tr", null, [
2410
+ (u(!0), c(S, null, R(m.value, (w) => (u(), c("th", {
2411
+ key: w.field,
2412
+ style: H({ width: w.width + "px" })
2413
+ }, q(w.title), 5))), 128)),
2414
+ V[6] || (V[6] = t("th", { width: "140" }, "操作", -1))
2415
+ ])
2416
+ ]),
2417
+ t("tbody", null, [
2418
+ (u(!0), c(S, null, R(b.value, (w, L) => (u(), c("tr", {
2419
+ key: L,
2420
+ onClick: (G) => l(L)
2421
+ }, [
2422
+ (u(!0), c(S, null, R(m.value, (G) => (u(), c("td", {
2423
+ key: G.field
2424
+ }, [
2425
+ G.editor === "AUTO_SEQ" ? (u(), c(S, { key: 0 }, [
2426
+ D(q(L + 1), 1)
2427
+ ], 64)) : G.editor === "AUTO_CALC" ? (u(), c("span", vs, "¥ " + q(j(at)(G.formula || "0", w).toFixed(2)), 1)) : (u(), c(S, { key: 2 }, [
2428
+ D(q(w[G.field]), 1)
2429
+ ], 64))
2430
+ ]))), 128)),
2431
+ t("td", {
2432
+ class: "op-cell",
2433
+ onClick: V[0] || (V[0] = ut(() => {
2434
+ }, ["stop"]))
2435
+ }, [
2436
+ t("button", {
2437
+ class: "row-btn",
2438
+ onClick: (G) => l(L)
2439
+ }, "编辑", 8, bs),
2440
+ t("button", {
2441
+ class: "row-btn danger",
2442
+ onClick: (G) => E(L)
2443
+ }, "删除", 8, ys)
2444
+ ])
2445
+ ], 8, ms))), 128))
2446
+ ])
2447
+ ])
2448
+ ])) : M("", !0),
2449
+ C.value ? (u(), c("div", {
2450
+ key: 2,
2451
+ class: "de-mask",
2452
+ onClick: V[3] || (V[3] = ut((w) => C.value = !1, ["self"]))
2453
+ }, [
2454
+ t("div", _s, [
2455
+ t("div", hs, [
2456
+ t("span", null, q(T.value === "edit" ? "编辑明细" : "添加明细"), 1),
2457
+ t("button", {
2458
+ class: "de-close",
2459
+ onClick: V[1] || (V[1] = (w) => C.value = !1)
2460
+ }, "✕")
2461
+ ]),
2462
+ t("div", gs, [
2463
+ t("div", $s, [
2464
+ (u(!0), c(S, null, R(h.value, (w) => (u(), c("div", {
2465
+ key: w.field,
2466
+ class: Y(["form-cell", { full: w.editor === "TEXTAREA" }])
2467
+ }, [
2468
+ t("label", ks, q(w.title), 1),
2469
+ w.editor === "INPUT" || w.editor === void 0 ? _((u(), c("input", {
2470
+ key: 0,
2471
+ class: "cell-input",
2472
+ "onUpdate:modelValue": (L) => e.value[w.field] = L,
2473
+ placeholder: w.title
2474
+ }, null, 8, Us)), [
2475
+ [x, e.value[w.field]]
2476
+ ]) : w.editor === "NUMBER" ? _((u(), c("input", {
2477
+ key: 1,
2478
+ class: "cell-input",
2479
+ type: "number",
2480
+ step: w.step ?? (w.min ?? 0) < 1 ? "0.01" : "1",
2481
+ min: w.min,
2482
+ max: w.max,
2483
+ "onUpdate:modelValue": (L) => e.value[w.field] = L
2484
+ }, null, 8, ws)), [
2485
+ [
2486
+ x,
2487
+ e.value[w.field],
2488
+ void 0,
2489
+ { number: !0 }
2490
+ ]
2491
+ ]) : w.editor === "TEXTAREA" ? _((u(), c("textarea", {
2492
+ key: 2,
2493
+ class: "cell-input",
2494
+ rows: "3",
2495
+ "onUpdate:modelValue": (L) => e.value[w.field] = L,
2496
+ placeholder: w.title
2497
+ }, null, 8, Cs)), [
2498
+ [x, e.value[w.field]]
2499
+ ]) : w.editor === "SELECT_DICT" ? _((u(), c("select", {
2500
+ key: 3,
2501
+ class: "cell-input",
2502
+ "onUpdate:modelValue": (L) => e.value[w.field] = L
2503
+ }, [
2504
+ V[7] || (V[7] = t("option", { value: "" }, "-- 请选择 --", -1)),
2505
+ (u(!0), c(S, null, R(w.dict || [], (L) => (u(), c("option", {
2506
+ key: L,
2507
+ value: L
2508
+ }, q(L), 9, Vs))), 128))
2509
+ ], 8, xs)), [
2510
+ [B, e.value[w.field]]
2511
+ ]) : M("", !0)
2512
+ ], 2))), 128))
2513
+ ])
2514
+ ]),
2515
+ t("div", Ss, [
2516
+ t("button", {
2517
+ class: "btn",
2518
+ onClick: V[2] || (V[2] = (w) => C.value = !1)
2519
+ }, "取消"),
2520
+ t("button", {
2521
+ class: "btn btn-primary",
2522
+ onClick: d
2523
+ }, "确定")
2524
+ ])
2525
+ ])
2526
+ ])) : M("", !0)
2527
+ ]));
2528
+ }
2529
+ }, zs = /* @__PURE__ */ lt(As, [["__scopeId", "data-v-554cd100"]]);
2530
+ export {
2531
+ zs as QuokitData,
2532
+ Kt as QuokitSheet,
2533
+ Es as QuokitTemplate,
2534
+ re as generateMockRows,
2535
+ oe as useColumns,
2536
+ Ut as useSections,
2537
+ de as useSummary
2538
+ };