@gis_victory/curd-form 0.0.1
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/README.md +5 -0
- package/dist/curd-form.css +1 -0
- package/dist/curd-form.es.js +1980 -0
- package/dist/curd-form.umd.js +2 -0
- package/dist/vite.svg +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,1980 @@
|
|
|
1
|
+
import { defineComponent as j, ref as M, watch as H, resolveComponent as k, openBlock as d, createBlock as C, unref as _, withCtx as h, createElementBlock as P, Fragment as R, renderList as K, onMounted as ne, toDisplayString as re, createElementVNode as Y, normalizeClass as te, createCommentVNode as N, reactive as J, onUnmounted as Pe, createVNode as b, renderSlot as q, createTextVNode as B, nextTick as se, normalizeStyle as Le, createSlots as Me } from "vue";
|
|
2
|
+
import { dayjs as oe, ElMessage as E, ElMessageBox as ue } from "element-plus";
|
|
3
|
+
import { GisMapView as Te, GisMapSwitch as Oe } from "@gis_victory/gismap";
|
|
4
|
+
const xe = {
|
|
5
|
+
name: "FormItem"
|
|
6
|
+
}, ce = /* @__PURE__ */ j({
|
|
7
|
+
...xe,
|
|
8
|
+
props: {
|
|
9
|
+
modelValue: {
|
|
10
|
+
type: [String, Number, Array],
|
|
11
|
+
default: () => ""
|
|
12
|
+
},
|
|
13
|
+
item: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: () => ({})
|
|
16
|
+
},
|
|
17
|
+
dropdownOptions: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default: () => []
|
|
20
|
+
},
|
|
21
|
+
currentOperationType: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "default"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
emits: ["update:modelValue"],
|
|
27
|
+
setup(r, { emit: t }) {
|
|
28
|
+
const e = r;
|
|
29
|
+
let o = e.modelValue;
|
|
30
|
+
const l = e.item.type === "multiple-select" || e.item.type === "checkbox" || e.item.searchFormType === "multiple-select" || e.item.searchFormType === "checkbox";
|
|
31
|
+
l && typeof o == "string" && o && (o = o.split(","));
|
|
32
|
+
const a = M(o), g = t, p = computed(() => {
|
|
33
|
+
switch (e.currentOperationType) {
|
|
34
|
+
case "default":
|
|
35
|
+
return !1;
|
|
36
|
+
case "details":
|
|
37
|
+
return !0;
|
|
38
|
+
case "add":
|
|
39
|
+
return e.item.createFormStatus == "disabled";
|
|
40
|
+
case "edit":
|
|
41
|
+
return e.item.updateFormStatus == "disabled";
|
|
42
|
+
}
|
|
43
|
+
return !1;
|
|
44
|
+
}), n = computed(() => {
|
|
45
|
+
switch (e.currentOperationType) {
|
|
46
|
+
case "default":
|
|
47
|
+
return !1;
|
|
48
|
+
case "details":
|
|
49
|
+
return !0;
|
|
50
|
+
case "add":
|
|
51
|
+
return e.item.createFormStatus == "disabled";
|
|
52
|
+
case "edit":
|
|
53
|
+
return e.item.updateFormStatus == "disabled";
|
|
54
|
+
}
|
|
55
|
+
return !1;
|
|
56
|
+
});
|
|
57
|
+
return H(a, (u) => {
|
|
58
|
+
let i = u;
|
|
59
|
+
l && Array.isArray(u) && (i = u.join(",")), g("update:modelValue", i);
|
|
60
|
+
}), H(() => e.modelValue, (u) => {
|
|
61
|
+
let i = u;
|
|
62
|
+
l && typeof u == "string" && u && (i = u.split(",")), a.value = i;
|
|
63
|
+
}), (u, i) => {
|
|
64
|
+
const s = k("el-option"), c = k("el-select"), V = k("el-date-picker"), F = k("el-checkbox"), T = k("el-checkbox-group"), I = k("el-radio"), S = k("el-radio-group"), O = k("el-input");
|
|
65
|
+
return r.item.searchFormType === "select" || r.item.type === "select" ? (d(), C(c, {
|
|
66
|
+
key: 0,
|
|
67
|
+
modelValue: a.value,
|
|
68
|
+
"onUpdate:modelValue": i[0] || (i[0] = (f) => a.value = f),
|
|
69
|
+
placeholder: r.item.placeholder || "请选择",
|
|
70
|
+
disabled: _(p),
|
|
71
|
+
readonly: _(n),
|
|
72
|
+
clearable: ""
|
|
73
|
+
}, {
|
|
74
|
+
default: h(() => [
|
|
75
|
+
(d(!0), P(R, null, K(r.dropdownOptions, (f) => (d(), C(s, {
|
|
76
|
+
key: f.id,
|
|
77
|
+
label: f.name,
|
|
78
|
+
value: f.id
|
|
79
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
80
|
+
]),
|
|
81
|
+
_: 1
|
|
82
|
+
}, 8, ["modelValue", "placeholder", "disabled", "readonly"])) : r.item.searchFormType === "multiple-select" || r.item.type === "multiple-select" ? (d(), C(c, {
|
|
83
|
+
key: 1,
|
|
84
|
+
modelValue: a.value,
|
|
85
|
+
"onUpdate:modelValue": i[1] || (i[1] = (f) => a.value = f),
|
|
86
|
+
placeholder: r.item.placeholder || "请选择",
|
|
87
|
+
multiple: "",
|
|
88
|
+
disabled: _(p),
|
|
89
|
+
readonly: _(n),
|
|
90
|
+
clearable: ""
|
|
91
|
+
}, {
|
|
92
|
+
default: h(() => [
|
|
93
|
+
(d(!0), P(R, null, K(r.dropdownOptions, (f) => (d(), C(s, {
|
|
94
|
+
key: f.id,
|
|
95
|
+
label: f.name,
|
|
96
|
+
value: f.id
|
|
97
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
98
|
+
]),
|
|
99
|
+
_: 1
|
|
100
|
+
}, 8, ["modelValue", "placeholder", "disabled", "readonly"])) : r.item.searchFormType === "date" || r.item.type === "date" ? (d(), C(V, {
|
|
101
|
+
key: 2,
|
|
102
|
+
modelValue: a.value,
|
|
103
|
+
"onUpdate:modelValue": i[2] || (i[2] = (f) => a.value = f),
|
|
104
|
+
type: "date",
|
|
105
|
+
"value-format": "YYYY-MM-DD",
|
|
106
|
+
placeholder: r.item.placeholder || "请选择日期",
|
|
107
|
+
disabled: _(p),
|
|
108
|
+
readonly: _(n),
|
|
109
|
+
clearable: "",
|
|
110
|
+
style: { width: "100%" }
|
|
111
|
+
}, null, 8, ["modelValue", "placeholder", "disabled", "readonly"])) : r.item.searchFormType === "daterange" || r.item.type === "daterange" ? (d(), C(V, {
|
|
112
|
+
key: 3,
|
|
113
|
+
modelValue: a.value,
|
|
114
|
+
"onUpdate:modelValue": i[3] || (i[3] = (f) => a.value = f),
|
|
115
|
+
type: "daterange",
|
|
116
|
+
"value-format": "yyyy-MM-dd",
|
|
117
|
+
placeholder: r.item.placeholder || "请选择日期范围",
|
|
118
|
+
disabled: _(p),
|
|
119
|
+
readonly: _(n),
|
|
120
|
+
clearable: ""
|
|
121
|
+
}, null, 8, ["modelValue", "placeholder", "disabled", "readonly"])) : r.item.searchFormType === "checkbox" || r.item.type === "checkbox" ? (d(), C(T, {
|
|
122
|
+
key: 4,
|
|
123
|
+
modelValue: a.value,
|
|
124
|
+
"onUpdate:modelValue": i[4] || (i[4] = (f) => a.value = f),
|
|
125
|
+
disabled: _(p),
|
|
126
|
+
readonly: _(n)
|
|
127
|
+
}, {
|
|
128
|
+
default: h(() => [
|
|
129
|
+
(d(!0), P(R, null, K(r.dropdownOptions, (f) => (d(), C(F, {
|
|
130
|
+
key: f.id,
|
|
131
|
+
label: f.name,
|
|
132
|
+
value: f.id
|
|
133
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
134
|
+
]),
|
|
135
|
+
_: 1
|
|
136
|
+
}, 8, ["modelValue", "disabled", "readonly"])) : r.item.searchFormType === "radio" || r.item.type === "radio" ? (d(), C(S, {
|
|
137
|
+
key: 5,
|
|
138
|
+
modelValue: a.value,
|
|
139
|
+
"onUpdate:modelValue": i[5] || (i[5] = (f) => a.value = f),
|
|
140
|
+
disabled: _(p),
|
|
141
|
+
readonly: _(n)
|
|
142
|
+
}, {
|
|
143
|
+
default: h(() => [
|
|
144
|
+
(d(!0), P(R, null, K(r.dropdownOptions, (f) => (d(), C(I, {
|
|
145
|
+
key: f.id,
|
|
146
|
+
label: f.name,
|
|
147
|
+
value: f.id
|
|
148
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
149
|
+
]),
|
|
150
|
+
_: 1
|
|
151
|
+
}, 8, ["modelValue", "disabled", "readonly"])) : r.item.searchFormType === "textarea" || r.item.type === "textarea" ? (d(), C(O, {
|
|
152
|
+
key: 6,
|
|
153
|
+
modelValue: a.value,
|
|
154
|
+
"onUpdate:modelValue": i[6] || (i[6] = (f) => a.value = f),
|
|
155
|
+
type: "textarea",
|
|
156
|
+
placeholder: r.item.placeholder || "请输入",
|
|
157
|
+
disabled: _(p),
|
|
158
|
+
readonly: _(n),
|
|
159
|
+
clearable: ""
|
|
160
|
+
}, null, 8, ["modelValue", "placeholder", "disabled", "readonly"])) : r.item.searchFormType === "input" || r.item.type === "input" ? (d(), C(O, {
|
|
161
|
+
key: 7,
|
|
162
|
+
modelValue: a.value,
|
|
163
|
+
"onUpdate:modelValue": i[7] || (i[7] = (f) => a.value = f),
|
|
164
|
+
placeholder: r.item.placeholder || "请输入",
|
|
165
|
+
disabled: _(p),
|
|
166
|
+
readonly: _(n),
|
|
167
|
+
clearable: ""
|
|
168
|
+
}, null, 8, ["modelValue", "placeholder", "disabled", "readonly"])) : (d(), C(O, {
|
|
169
|
+
key: 8,
|
|
170
|
+
modelValue: a.value,
|
|
171
|
+
"onUpdate:modelValue": i[8] || (i[8] = (f) => a.value = f),
|
|
172
|
+
placeholder: r.item.placeholder || "请输入",
|
|
173
|
+
disabled: _(p),
|
|
174
|
+
readonly: _(n),
|
|
175
|
+
clearable: ""
|
|
176
|
+
}, null, 8, ["modelValue", "placeholder", "disabled", "readonly"]));
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}), ze = {
|
|
180
|
+
name: "FormItemDetail"
|
|
181
|
+
}, Ie = /* @__PURE__ */ j({
|
|
182
|
+
...ze,
|
|
183
|
+
props: {
|
|
184
|
+
modelValue: {
|
|
185
|
+
type: [String, Number, Array, Object],
|
|
186
|
+
default: () => ""
|
|
187
|
+
},
|
|
188
|
+
item: {
|
|
189
|
+
type: Object,
|
|
190
|
+
default: () => ({})
|
|
191
|
+
},
|
|
192
|
+
dropdownOptions: {
|
|
193
|
+
type: Array,
|
|
194
|
+
default: () => []
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
setup(r) {
|
|
198
|
+
const t = r;
|
|
199
|
+
let e = t.modelValue;
|
|
200
|
+
const o = t.item.type === "multiple-select" || t.item.type === "checkbox" || t.item.searchFormType === "multiple-select" || t.item.searchFormType === "checkbox";
|
|
201
|
+
typeof e == "object" && e !== null && !Array.isArray(e) && (e = Object.values(e).join(",")), o && typeof e == "string" && e && (e = e.split(","));
|
|
202
|
+
const l = M(e);
|
|
203
|
+
return ne(() => {
|
|
204
|
+
switch (t.item.type) {
|
|
205
|
+
case "select":
|
|
206
|
+
case "radio":
|
|
207
|
+
const a = t.dropdownOptions.find((n) => n.id === t.modelValue);
|
|
208
|
+
l.value = a?.name || "";
|
|
209
|
+
break;
|
|
210
|
+
case "checkbox":
|
|
211
|
+
case "multiple-select":
|
|
212
|
+
const p = (Array.isArray(l.value) ? l.value : l.value?.split(",") || []).map((n) => t.dropdownOptions.find((i) => i.id === n)?.name || n).filter(Boolean);
|
|
213
|
+
l.value = p.join(",") || "";
|
|
214
|
+
break;
|
|
215
|
+
case "date":
|
|
216
|
+
l.value = t.modelValue ? oe(t.modelValue).format(t.item.formatter || "YYYY-MM-DD") : "";
|
|
217
|
+
break;
|
|
218
|
+
case "datetime":
|
|
219
|
+
l.value = t.modelValue ? oe(t.modelValue).format(t.item.formatter || "YYYY-MM-DD HH:mm:ss") : "";
|
|
220
|
+
break;
|
|
221
|
+
default:
|
|
222
|
+
l.value = t.modelValue;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
}), (a, g) => (d(), P("span", null, re(l.value), 1));
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
var Z = { exports: {} }, de;
|
|
229
|
+
function $e() {
|
|
230
|
+
if (de) return Z.exports;
|
|
231
|
+
de = 1, Z.exports = e, Z.exports.parse = e, Z.exports.stringify = o;
|
|
232
|
+
var r = /[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/, t = new RegExp("^" + r.source + "(\\s" + r.source + "){1,}");
|
|
233
|
+
function e(l) {
|
|
234
|
+
var a = l.split(";"), g = a.pop(), p = (a.shift() || "").split("=").pop(), n = 0;
|
|
235
|
+
function u(v) {
|
|
236
|
+
var D = g.substring(n).match(v);
|
|
237
|
+
return D ? (n += D[0].length, D[0]) : null;
|
|
238
|
+
}
|
|
239
|
+
function i(v) {
|
|
240
|
+
return v && p.match(/\d+/) && (v.crs = {
|
|
241
|
+
type: "name",
|
|
242
|
+
properties: {
|
|
243
|
+
name: "urn:ogc:def:crs:EPSG::" + p
|
|
244
|
+
}
|
|
245
|
+
}), v;
|
|
246
|
+
}
|
|
247
|
+
function s() {
|
|
248
|
+
u(/^\s*/);
|
|
249
|
+
}
|
|
250
|
+
function c() {
|
|
251
|
+
s();
|
|
252
|
+
for (var v = 0, D = [], x = [D], U = D, A; A = u(/^(\()/) || u(/^(\))/) || u(/^(,)/) || u(t); ) {
|
|
253
|
+
if (A === "(")
|
|
254
|
+
x.push(U), U = [], x[x.length - 1].push(U), v++;
|
|
255
|
+
else if (A === ")") {
|
|
256
|
+
if (U.length === 0 || (U = x.pop(), !U)) return null;
|
|
257
|
+
if (v--, v === 0) break;
|
|
258
|
+
} else if (A === ",")
|
|
259
|
+
U = [], x[x.length - 1].push(U);
|
|
260
|
+
else if (!A.split(/\s/g).some(isNaN))
|
|
261
|
+
Array.prototype.push.apply(U, A.split(/\s/g).map(parseFloat));
|
|
262
|
+
else
|
|
263
|
+
return null;
|
|
264
|
+
s();
|
|
265
|
+
}
|
|
266
|
+
return v !== 0 ? null : D;
|
|
267
|
+
}
|
|
268
|
+
function V() {
|
|
269
|
+
for (var v = [], D, x; x = u(t) || u(/^(,)/); )
|
|
270
|
+
x === "," ? (v.push(D), D = []) : x.split(/\s/g).some(isNaN) || (D || (D = []), Array.prototype.push.apply(D, x.split(/\s/g).map(parseFloat))), s();
|
|
271
|
+
if (D) v.push(D);
|
|
272
|
+
else return null;
|
|
273
|
+
return v.length ? v : null;
|
|
274
|
+
}
|
|
275
|
+
function F() {
|
|
276
|
+
if (!u(/^(point(\sz)?)/i) || (s(), !u(/^(\()/))) return null;
|
|
277
|
+
var v = V();
|
|
278
|
+
return !v || (s(), !u(/^(\))/)) ? null : {
|
|
279
|
+
type: "Point",
|
|
280
|
+
coordinates: v[0]
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function T() {
|
|
284
|
+
if (!u(/^(multipoint)/i)) return null;
|
|
285
|
+
s();
|
|
286
|
+
var v = g.substring(g.indexOf("(") + 1, g.length - 1).replace(/\(/g, "").replace(/\)/g, "");
|
|
287
|
+
g = "MULTIPOINT (" + v + ")";
|
|
288
|
+
var D = c();
|
|
289
|
+
return D ? (s(), {
|
|
290
|
+
type: "MultiPoint",
|
|
291
|
+
coordinates: D
|
|
292
|
+
}) : null;
|
|
293
|
+
}
|
|
294
|
+
function I() {
|
|
295
|
+
if (!u(/^(multilinestring)/i)) return null;
|
|
296
|
+
s();
|
|
297
|
+
var v = c();
|
|
298
|
+
return v ? (s(), {
|
|
299
|
+
type: "MultiLineString",
|
|
300
|
+
coordinates: v
|
|
301
|
+
}) : null;
|
|
302
|
+
}
|
|
303
|
+
function S() {
|
|
304
|
+
if (!u(/^(linestring(\sz)?)/i) || (s(), !u(/^(\()/))) return null;
|
|
305
|
+
var v = V();
|
|
306
|
+
return !v || !u(/^(\))/) ? null : {
|
|
307
|
+
type: "LineString",
|
|
308
|
+
coordinates: v
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function O() {
|
|
312
|
+
if (!u(/^(polygon(\sz)?)/i)) return null;
|
|
313
|
+
s();
|
|
314
|
+
var v = c();
|
|
315
|
+
return v ? {
|
|
316
|
+
type: "Polygon",
|
|
317
|
+
coordinates: v
|
|
318
|
+
} : null;
|
|
319
|
+
}
|
|
320
|
+
function f() {
|
|
321
|
+
if (!u(/^(multipolygon)/i)) return null;
|
|
322
|
+
s();
|
|
323
|
+
var v = c();
|
|
324
|
+
return v ? {
|
|
325
|
+
type: "MultiPolygon",
|
|
326
|
+
coordinates: v
|
|
327
|
+
} : null;
|
|
328
|
+
}
|
|
329
|
+
function L() {
|
|
330
|
+
var v = [], D;
|
|
331
|
+
if (!u(/^(geometrycollection)/i) || (s(), !u(/^(\()/))) return null;
|
|
332
|
+
for (; D = W(); )
|
|
333
|
+
v.push(D), s(), u(/^(,)/), s();
|
|
334
|
+
return u(/^(\))/) ? {
|
|
335
|
+
type: "GeometryCollection",
|
|
336
|
+
geometries: v
|
|
337
|
+
} : null;
|
|
338
|
+
}
|
|
339
|
+
function W() {
|
|
340
|
+
return F() || S() || O() || T() || I() || f() || L();
|
|
341
|
+
}
|
|
342
|
+
return i(W());
|
|
343
|
+
}
|
|
344
|
+
function o(l) {
|
|
345
|
+
l.type === "Feature" && (l = l.geometry);
|
|
346
|
+
function a(i) {
|
|
347
|
+
return i.join(" ");
|
|
348
|
+
}
|
|
349
|
+
function g(i) {
|
|
350
|
+
return i.map(a).join(", ");
|
|
351
|
+
}
|
|
352
|
+
function p(i) {
|
|
353
|
+
return i.map(g).map(u).join(", ");
|
|
354
|
+
}
|
|
355
|
+
function n(i) {
|
|
356
|
+
return i.map(p).map(u).join(", ");
|
|
357
|
+
}
|
|
358
|
+
function u(i) {
|
|
359
|
+
return "(" + i + ")";
|
|
360
|
+
}
|
|
361
|
+
switch (l.type) {
|
|
362
|
+
case "Point":
|
|
363
|
+
return "POINT (" + a(l.coordinates) + ")";
|
|
364
|
+
case "LineString":
|
|
365
|
+
return "LINESTRING (" + g(l.coordinates) + ")";
|
|
366
|
+
case "Polygon":
|
|
367
|
+
return "POLYGON (" + p(l.coordinates) + ")";
|
|
368
|
+
case "MultiPoint":
|
|
369
|
+
return "MULTIPOINT (" + g(l.coordinates) + ")";
|
|
370
|
+
case "MultiPolygon":
|
|
371
|
+
return "MULTIPOLYGON (" + n(l.coordinates) + ")";
|
|
372
|
+
case "MultiLineString":
|
|
373
|
+
return "MULTILINESTRING (" + p(l.coordinates) + ")";
|
|
374
|
+
case "GeometryCollection":
|
|
375
|
+
return "GEOMETRYCOLLECTION (" + l.geometries.map(o).join(", ") + ")";
|
|
376
|
+
default:
|
|
377
|
+
throw new Error("stringify requires a valid GeoJSON Feature or geometry object as input");
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return Z.exports;
|
|
381
|
+
}
|
|
382
|
+
var le = $e();
|
|
383
|
+
function Ee(r, t, e = {}) {
|
|
384
|
+
const o = { type: "Feature" };
|
|
385
|
+
return (e.id === 0 || e.id) && (o.id = e.id), e.bbox && (o.bbox = e.bbox), o.properties = t || {}, o.geometry = r, o;
|
|
386
|
+
}
|
|
387
|
+
function Ne(r, t, e = {}) {
|
|
388
|
+
if (!r)
|
|
389
|
+
throw new Error("coordinates is required");
|
|
390
|
+
if (!Array.isArray(r))
|
|
391
|
+
throw new Error("coordinates must be an Array");
|
|
392
|
+
if (r.length < 2)
|
|
393
|
+
throw new Error("coordinates must be at least 2 numbers long");
|
|
394
|
+
if (!pe(r[0]) || !pe(r[1]))
|
|
395
|
+
throw new Error("coordinates must contain numbers");
|
|
396
|
+
return Ee({
|
|
397
|
+
type: "Point",
|
|
398
|
+
coordinates: r
|
|
399
|
+
}, t, e);
|
|
400
|
+
}
|
|
401
|
+
function pe(r) {
|
|
402
|
+
return !isNaN(r) && r !== null && !Array.isArray(r);
|
|
403
|
+
}
|
|
404
|
+
function me(r, t, e) {
|
|
405
|
+
if (r !== null)
|
|
406
|
+
for (var o, l, a, g, p, n, u, i = 0, s = 0, c, V = r.type, F = V === "FeatureCollection", T = V === "Feature", I = F ? r.features.length : 1, S = 0; S < I; S++) {
|
|
407
|
+
u = F ? (
|
|
408
|
+
// @ts-expect-error: Known type conflict
|
|
409
|
+
r.features[S].geometry
|
|
410
|
+
) : T ? (
|
|
411
|
+
// @ts-expect-error: Known type conflict
|
|
412
|
+
r.geometry
|
|
413
|
+
) : r, c = u ? u.type === "GeometryCollection" : !1, p = c ? u.geometries.length : 1;
|
|
414
|
+
for (var O = 0; O < p; O++) {
|
|
415
|
+
var f = 0, L = 0;
|
|
416
|
+
if (g = c ? u.geometries[O] : u, g !== null) {
|
|
417
|
+
n = g.coordinates;
|
|
418
|
+
var W = g.type;
|
|
419
|
+
switch (i = W === "Polygon" || W === "MultiPolygon" ? 1 : 0, W) {
|
|
420
|
+
case null:
|
|
421
|
+
break;
|
|
422
|
+
case "Point":
|
|
423
|
+
if (
|
|
424
|
+
// @ts-expect-error: Known type conflict
|
|
425
|
+
t(
|
|
426
|
+
n,
|
|
427
|
+
s,
|
|
428
|
+
S,
|
|
429
|
+
f,
|
|
430
|
+
L
|
|
431
|
+
) === !1
|
|
432
|
+
)
|
|
433
|
+
return !1;
|
|
434
|
+
s++, f++;
|
|
435
|
+
break;
|
|
436
|
+
case "LineString":
|
|
437
|
+
case "MultiPoint":
|
|
438
|
+
for (o = 0; o < n.length; o++) {
|
|
439
|
+
if (
|
|
440
|
+
// @ts-expect-error: Known type conflict
|
|
441
|
+
t(
|
|
442
|
+
n[o],
|
|
443
|
+
s,
|
|
444
|
+
S,
|
|
445
|
+
f,
|
|
446
|
+
L
|
|
447
|
+
) === !1
|
|
448
|
+
)
|
|
449
|
+
return !1;
|
|
450
|
+
s++, W === "MultiPoint" && f++;
|
|
451
|
+
}
|
|
452
|
+
W === "LineString" && f++;
|
|
453
|
+
break;
|
|
454
|
+
case "Polygon":
|
|
455
|
+
case "MultiLineString":
|
|
456
|
+
for (o = 0; o < n.length; o++) {
|
|
457
|
+
for (l = 0; l < n[o].length - i; l++) {
|
|
458
|
+
if (
|
|
459
|
+
// @ts-expect-error: Known type conflict
|
|
460
|
+
t(
|
|
461
|
+
n[o][l],
|
|
462
|
+
s,
|
|
463
|
+
S,
|
|
464
|
+
f,
|
|
465
|
+
L
|
|
466
|
+
) === !1
|
|
467
|
+
)
|
|
468
|
+
return !1;
|
|
469
|
+
s++;
|
|
470
|
+
}
|
|
471
|
+
W === "MultiLineString" && f++, W === "Polygon" && L++;
|
|
472
|
+
}
|
|
473
|
+
W === "Polygon" && f++;
|
|
474
|
+
break;
|
|
475
|
+
case "MultiPolygon":
|
|
476
|
+
for (o = 0; o < n.length; o++) {
|
|
477
|
+
for (L = 0, l = 0; l < n[o].length; l++) {
|
|
478
|
+
for (a = 0; a < n[o][l].length - i; a++) {
|
|
479
|
+
if (
|
|
480
|
+
// @ts-expect-error: Known type conflict
|
|
481
|
+
t(
|
|
482
|
+
n[o][l][a],
|
|
483
|
+
s,
|
|
484
|
+
S,
|
|
485
|
+
f,
|
|
486
|
+
L
|
|
487
|
+
) === !1
|
|
488
|
+
)
|
|
489
|
+
return !1;
|
|
490
|
+
s++;
|
|
491
|
+
}
|
|
492
|
+
L++;
|
|
493
|
+
}
|
|
494
|
+
f++;
|
|
495
|
+
}
|
|
496
|
+
break;
|
|
497
|
+
case "GeometryCollection":
|
|
498
|
+
for (o = 0; o < g.geometries.length; o++)
|
|
499
|
+
if (
|
|
500
|
+
// @ts-expect-error: Known type conflict
|
|
501
|
+
me(g.geometries[o], t) === !1
|
|
502
|
+
)
|
|
503
|
+
return !1;
|
|
504
|
+
break;
|
|
505
|
+
default:
|
|
506
|
+
throw new Error("Unknown Geometry Type");
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
function Ae(r, t = {}) {
|
|
513
|
+
let e = 0, o = 0, l = 0;
|
|
514
|
+
return me(
|
|
515
|
+
r,
|
|
516
|
+
function(a) {
|
|
517
|
+
e += a[0], o += a[1], l++;
|
|
518
|
+
}
|
|
519
|
+
), Ne([e / l, o / l], t.properties);
|
|
520
|
+
}
|
|
521
|
+
class We {
|
|
522
|
+
map;
|
|
523
|
+
sourceId = "curd-map-source";
|
|
524
|
+
layerId = "curd-map-layer";
|
|
525
|
+
featureCollection = {
|
|
526
|
+
type: "FeatureCollection",
|
|
527
|
+
features: []
|
|
528
|
+
};
|
|
529
|
+
constructor(t) {
|
|
530
|
+
this.map = t, this.setSource();
|
|
531
|
+
}
|
|
532
|
+
setSource() {
|
|
533
|
+
this.map.addSource(this.sourceId, {
|
|
534
|
+
type: "geojson",
|
|
535
|
+
data: this.featureCollection
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
setLayer(t) {
|
|
539
|
+
if (!this.map.getLayer(this.layerId))
|
|
540
|
+
switch (t.toLowerCase()) {
|
|
541
|
+
case "polygon":
|
|
542
|
+
case "multipolygon":
|
|
543
|
+
this.map.addLayer({
|
|
544
|
+
id: this.layerId,
|
|
545
|
+
type: "fill",
|
|
546
|
+
source: this.sourceId,
|
|
547
|
+
paint: {
|
|
548
|
+
//设置为蓝色
|
|
549
|
+
"fill-color": "#ff0000",
|
|
550
|
+
"fill-opacity": 0.5
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
break;
|
|
554
|
+
case "linestring":
|
|
555
|
+
case "multilinestring":
|
|
556
|
+
this.map.addLayer({
|
|
557
|
+
id: this.layerId,
|
|
558
|
+
type: "line",
|
|
559
|
+
source: this.sourceId,
|
|
560
|
+
paint: {
|
|
561
|
+
//设置为红色
|
|
562
|
+
"line-color": "#ff0000",
|
|
563
|
+
"line-opacity": 0.8,
|
|
564
|
+
"line-width": 3
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
break;
|
|
568
|
+
case "point":
|
|
569
|
+
this.map.addLayer({
|
|
570
|
+
id: this.layerId,
|
|
571
|
+
type: "circle",
|
|
572
|
+
source: this.sourceId,
|
|
573
|
+
paint: {
|
|
574
|
+
"circle-color": "#ff0000",
|
|
575
|
+
"circle-opacity": 0.8,
|
|
576
|
+
"circle-radius": 5,
|
|
577
|
+
"circle-stroke-color": "#fff",
|
|
578
|
+
"circle-stroke-width": 2,
|
|
579
|
+
"circle-stroke-opacity": 1
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
setData(t) {
|
|
586
|
+
if (!t)
|
|
587
|
+
return;
|
|
588
|
+
const e = {
|
|
589
|
+
type: "Feature",
|
|
590
|
+
geometry: t
|
|
591
|
+
}, o = this.map.getSource(this.sourceId);
|
|
592
|
+
o && (this.featureCollection.features = [e], o?.setData(this.featureCollection));
|
|
593
|
+
}
|
|
594
|
+
flyTo() {
|
|
595
|
+
if (this.featureCollection.features.length !== 0)
|
|
596
|
+
try {
|
|
597
|
+
let t = this.featureCollection.features[0];
|
|
598
|
+
if (!t)
|
|
599
|
+
return;
|
|
600
|
+
let e = null;
|
|
601
|
+
if (t.geometry.type.toLowerCase() === "point" ? e = t.geometry.coordinates : e = Ae(this.featureCollection)?.geometry?.coordinates || null, !e)
|
|
602
|
+
return;
|
|
603
|
+
this.map.flyTo({
|
|
604
|
+
center: e,
|
|
605
|
+
zoom: 16
|
|
606
|
+
});
|
|
607
|
+
} catch (t) {
|
|
608
|
+
console.error("计算外包边框中心点失败:", t);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
formatWktToGeoJson(t) {
|
|
612
|
+
if (!t)
|
|
613
|
+
return null;
|
|
614
|
+
try {
|
|
615
|
+
return le.parse(t);
|
|
616
|
+
} catch (e) {
|
|
617
|
+
return console.error("WKT 转换为 GeoJSON 失败:", e), null;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
formatGeoJsonToWkt(t) {
|
|
621
|
+
if (!t)
|
|
622
|
+
return "";
|
|
623
|
+
try {
|
|
624
|
+
return le.stringify(t);
|
|
625
|
+
} catch (e) {
|
|
626
|
+
return console.error("GeoJSON 转换为 WKT 失败:", e), "";
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
clear() {
|
|
630
|
+
this.map.removeLayer(this.layerId), this.map.removeSource(this.sourceId);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
class Ue {
|
|
634
|
+
map;
|
|
635
|
+
drawSourceId = "curd-map-draw-source";
|
|
636
|
+
drawLayerId = "curd-map-draw-layer";
|
|
637
|
+
drawLineLayerId = "curd-map-draw-line-layer";
|
|
638
|
+
drawPointLayerId = "curd-map-draw-point-layer";
|
|
639
|
+
drawFeatureCollection = {
|
|
640
|
+
type: "FeatureCollection",
|
|
641
|
+
features: []
|
|
642
|
+
};
|
|
643
|
+
drawType = "none";
|
|
644
|
+
drawCoordinates = [];
|
|
645
|
+
drawCallback = null;
|
|
646
|
+
constructor(t) {
|
|
647
|
+
this.map = t, this.initDrawSource();
|
|
648
|
+
}
|
|
649
|
+
initDrawSource() {
|
|
650
|
+
this.map.getSource(this.drawSourceId) || this.map.addSource(this.drawSourceId, {
|
|
651
|
+
type: "geojson",
|
|
652
|
+
data: this.drawFeatureCollection
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
// 开始绘制
|
|
656
|
+
startDraw(t, e) {
|
|
657
|
+
this.clearDraw(), this.drawType = t, this.drawCallback = e, this.drawCoordinates = [], this.setupDrawLayers(), this.setupDrawEvents(), this.map.getCanvas().style.cursor = "crosshair";
|
|
658
|
+
}
|
|
659
|
+
// 停止绘制
|
|
660
|
+
stopDraw() {
|
|
661
|
+
this.drawType = "none", this.drawCallback = null, this.clearDraw(), this.removeDrawEvents(), this.map.getCanvas().style.cursor = "";
|
|
662
|
+
}
|
|
663
|
+
// 清除绘制
|
|
664
|
+
clearDraw() {
|
|
665
|
+
this.drawCoordinates = [], this.drawFeatureCollection.features = [];
|
|
666
|
+
const t = this.map.getSource(this.drawSourceId);
|
|
667
|
+
t && t.setData(this.drawFeatureCollection), [this.drawLayerId, this.drawLineLayerId, this.drawPointLayerId, `${this.drawLayerId}-outline`].forEach((e) => {
|
|
668
|
+
this.map.getLayer(e) && this.map.removeLayer(e);
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
// 设置绘制图层
|
|
672
|
+
setupDrawLayers() {
|
|
673
|
+
[this.drawLayerId, this.drawLineLayerId, this.drawPointLayerId, `${this.drawLayerId}-outline`].forEach((e) => {
|
|
674
|
+
this.map.getLayer(e) && this.map.removeLayer(e);
|
|
675
|
+
});
|
|
676
|
+
const t = "#ff0000";
|
|
677
|
+
this.drawType === "point" && this.map.addLayer({
|
|
678
|
+
id: this.drawLayerId,
|
|
679
|
+
type: "circle",
|
|
680
|
+
source: this.drawSourceId,
|
|
681
|
+
paint: {
|
|
682
|
+
"circle-color": t,
|
|
683
|
+
"circle-opacity": 0.8,
|
|
684
|
+
"circle-radius": 6,
|
|
685
|
+
"circle-stroke-color": "#fff",
|
|
686
|
+
"circle-stroke-width": 2,
|
|
687
|
+
"circle-stroke-opacity": 1
|
|
688
|
+
}
|
|
689
|
+
}), (this.drawType === "line" || this.drawType === "polygon") && (this.map.addLayer({
|
|
690
|
+
id: this.drawLineLayerId,
|
|
691
|
+
type: "line",
|
|
692
|
+
source: this.drawSourceId,
|
|
693
|
+
paint: {
|
|
694
|
+
"line-color": t,
|
|
695
|
+
"line-opacity": 0.8,
|
|
696
|
+
"line-width": 3
|
|
697
|
+
}
|
|
698
|
+
}), this.map.addLayer({
|
|
699
|
+
id: this.drawPointLayerId,
|
|
700
|
+
type: "circle",
|
|
701
|
+
source: this.drawSourceId,
|
|
702
|
+
paint: {
|
|
703
|
+
"circle-color": t,
|
|
704
|
+
"circle-opacity": 0.8,
|
|
705
|
+
"circle-radius": 4,
|
|
706
|
+
"circle-stroke-color": "#fff",
|
|
707
|
+
"circle-stroke-width": 2,
|
|
708
|
+
"circle-stroke-opacity": 1
|
|
709
|
+
}
|
|
710
|
+
})), this.drawType === "polygon" && (this.map.addLayer({
|
|
711
|
+
id: this.drawLayerId,
|
|
712
|
+
type: "fill",
|
|
713
|
+
source: this.drawSourceId,
|
|
714
|
+
paint: {
|
|
715
|
+
"fill-color": t,
|
|
716
|
+
"fill-opacity": 0.3
|
|
717
|
+
}
|
|
718
|
+
}), this.map.addLayer({
|
|
719
|
+
id: `${this.drawLayerId}-outline`,
|
|
720
|
+
type: "line",
|
|
721
|
+
source: this.drawSourceId,
|
|
722
|
+
paint: {
|
|
723
|
+
"line-color": t,
|
|
724
|
+
"line-opacity": 0.8,
|
|
725
|
+
"line-width": 2
|
|
726
|
+
}
|
|
727
|
+
}));
|
|
728
|
+
}
|
|
729
|
+
// 设置绘制事件
|
|
730
|
+
setupDrawEvents() {
|
|
731
|
+
this.map.on("click", this.handleMapClick.bind(this)), this.map.on("mousemove", this.handleMapMouseMove.bind(this)), this.map.on("dblclick", this.handleMapDoubleClick.bind(this)), this.map.doubleClickZoom.disable();
|
|
732
|
+
}
|
|
733
|
+
// 移除绘制事件
|
|
734
|
+
removeDrawEvents() {
|
|
735
|
+
this.map.off("click", this.handleMapClick.bind(this)), this.map.off("mousemove", this.handleMapMouseMove.bind(this)), this.map.off("dblclick", this.handleMapDoubleClick.bind(this)), this.map.doubleClickZoom.enable();
|
|
736
|
+
}
|
|
737
|
+
// 处理地图点击事件
|
|
738
|
+
handleMapClick(t) {
|
|
739
|
+
const e = t.lngLat.toArray();
|
|
740
|
+
this.drawCoordinates.push(e), this.updateDrawFeature(), this.drawType === "point" && this.finishDraw();
|
|
741
|
+
}
|
|
742
|
+
// 处理地图鼠标移动事件
|
|
743
|
+
handleMapMouseMove(t) {
|
|
744
|
+
if (this.drawType === "none" || this.drawCoordinates.length === 0)
|
|
745
|
+
return;
|
|
746
|
+
const e = t.lngLat.toArray(), o = [...this.drawCoordinates, e];
|
|
747
|
+
this.updateDrawFeature(o);
|
|
748
|
+
}
|
|
749
|
+
// 处理地图双击事件
|
|
750
|
+
handleMapDoubleClick() {
|
|
751
|
+
(this.drawType === "line" || this.drawType === "polygon") && this.finishDraw();
|
|
752
|
+
}
|
|
753
|
+
// 更新绘制要素
|
|
754
|
+
updateDrawFeature(t) {
|
|
755
|
+
const e = t || this.drawCoordinates;
|
|
756
|
+
if (e.length === 0)
|
|
757
|
+
return;
|
|
758
|
+
let o = null;
|
|
759
|
+
switch (this.drawType) {
|
|
760
|
+
case "point":
|
|
761
|
+
o = {
|
|
762
|
+
type: "Point",
|
|
763
|
+
coordinates: e[0]
|
|
764
|
+
};
|
|
765
|
+
break;
|
|
766
|
+
case "line":
|
|
767
|
+
o = {
|
|
768
|
+
type: "LineString",
|
|
769
|
+
coordinates: e
|
|
770
|
+
};
|
|
771
|
+
break;
|
|
772
|
+
case "polygon":
|
|
773
|
+
o = {
|
|
774
|
+
type: "Polygon",
|
|
775
|
+
coordinates: [e]
|
|
776
|
+
};
|
|
777
|
+
break;
|
|
778
|
+
}
|
|
779
|
+
if (o) {
|
|
780
|
+
this.drawFeatureCollection.features = [{
|
|
781
|
+
type: "Feature",
|
|
782
|
+
geometry: o
|
|
783
|
+
}];
|
|
784
|
+
const l = this.map.getSource(this.drawSourceId);
|
|
785
|
+
l && l.setData(this.drawFeatureCollection);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
// 完成绘制
|
|
789
|
+
finishDraw() {
|
|
790
|
+
if (this.drawCoordinates.length === 0)
|
|
791
|
+
return;
|
|
792
|
+
let t = null;
|
|
793
|
+
switch (this.drawType) {
|
|
794
|
+
case "point":
|
|
795
|
+
t = {
|
|
796
|
+
type: "Point",
|
|
797
|
+
coordinates: this.drawCoordinates[0]
|
|
798
|
+
};
|
|
799
|
+
break;
|
|
800
|
+
case "line":
|
|
801
|
+
if (this.drawCoordinates.length < 2) {
|
|
802
|
+
this.clearDraw();
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
t = {
|
|
806
|
+
type: "LineString",
|
|
807
|
+
coordinates: this.drawCoordinates
|
|
808
|
+
};
|
|
809
|
+
break;
|
|
810
|
+
case "polygon":
|
|
811
|
+
if (this.drawCoordinates.length < 3) {
|
|
812
|
+
this.clearDraw();
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
t = {
|
|
816
|
+
type: "Polygon",
|
|
817
|
+
coordinates: [[...this.drawCoordinates, this.drawCoordinates[0]]]
|
|
818
|
+
};
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
if (t && this.drawCallback) {
|
|
822
|
+
const e = le.stringify(t);
|
|
823
|
+
this.drawCallback(this.drawType, t, e), this.map.getCanvas().style.cursor = "", this.drawType = "none", this.map.off("click", this.handleMapClick.bind(this)), this.map.off("mousemove", this.handleMapMouseMove.bind(this)), this.map.off("dblclick", this.handleMapDoubleClick.bind(this)), setTimeout(() => {
|
|
824
|
+
this.map.doubleClickZoom.enable();
|
|
825
|
+
}, 0);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
// 销毁绘制对象
|
|
829
|
+
destroy() {
|
|
830
|
+
this.stopDraw(), this.map.getSource(this.drawSourceId) && this.map.removeSource(this.drawSourceId);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
var Be = /* @__PURE__ */ j({
|
|
834
|
+
name: "CircleClose",
|
|
835
|
+
__name: "circle-close",
|
|
836
|
+
setup(r) {
|
|
837
|
+
return (t, e) => (d(), P("svg", {
|
|
838
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
839
|
+
viewBox: "0 0 1024 1024"
|
|
840
|
+
}, [
|
|
841
|
+
Y("path", {
|
|
842
|
+
fill: "currentColor",
|
|
843
|
+
d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
|
|
844
|
+
}),
|
|
845
|
+
Y("path", {
|
|
846
|
+
fill: "currentColor",
|
|
847
|
+
d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
|
|
848
|
+
})
|
|
849
|
+
]));
|
|
850
|
+
}
|
|
851
|
+
}), Re = Be, Ge = /* @__PURE__ */ j({
|
|
852
|
+
name: "EditPen",
|
|
853
|
+
__name: "edit-pen",
|
|
854
|
+
setup(r) {
|
|
855
|
+
return (t, e) => (d(), P("svg", {
|
|
856
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
857
|
+
viewBox: "0 0 1024 1024"
|
|
858
|
+
}, [
|
|
859
|
+
Y("path", {
|
|
860
|
+
fill: "currentColor",
|
|
861
|
+
d: "m199.04 672.64 193.984 112 224-387.968-193.92-112-224 388.032zm-23.872 60.16 32.896 148.288 144.896-45.696zM455.04 229.248l193.92 112 56.704-98.112-193.984-112zM104.32 708.8l384-665.024 304.768 175.936L409.152 884.8h.064l-248.448 78.336zm384 254.272v-64h448v64z"
|
|
862
|
+
})
|
|
863
|
+
]));
|
|
864
|
+
}
|
|
865
|
+
}), Ye = Ge, je = /* @__PURE__ */ j({
|
|
866
|
+
name: "MoreFilled",
|
|
867
|
+
__name: "more-filled",
|
|
868
|
+
setup(r) {
|
|
869
|
+
return (t, e) => (d(), P("svg", {
|
|
870
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
871
|
+
viewBox: "0 0 1024 1024"
|
|
872
|
+
}, [
|
|
873
|
+
Y("path", {
|
|
874
|
+
fill: "currentColor",
|
|
875
|
+
d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224"
|
|
876
|
+
})
|
|
877
|
+
]));
|
|
878
|
+
}
|
|
879
|
+
}), Je = je;
|
|
880
|
+
const Ke = { class: "map-draw-container" }, qe = {
|
|
881
|
+
name: "FormItemMapDraw"
|
|
882
|
+
}, He = /* @__PURE__ */ j({
|
|
883
|
+
...qe,
|
|
884
|
+
props: {
|
|
885
|
+
geomType: {
|
|
886
|
+
type: String,
|
|
887
|
+
default: "point"
|
|
888
|
+
}
|
|
889
|
+
},
|
|
890
|
+
emits: ["draw-start", "draw-end", "draw-cancel"],
|
|
891
|
+
setup(r, { emit: t }) {
|
|
892
|
+
const e = t, o = M("none");
|
|
893
|
+
M(!1), M(null);
|
|
894
|
+
const l = Re, a = Ye, g = Je, p = (n) => {
|
|
895
|
+
o.value = n, n === "none" ? e("draw-cancel") : e("draw-start", n);
|
|
896
|
+
};
|
|
897
|
+
return (n, u) => {
|
|
898
|
+
const i = k("el-button");
|
|
899
|
+
return d(), P("div", Ke, [
|
|
900
|
+
r.geomType === "point" ? (d(), C(i, {
|
|
901
|
+
key: 0,
|
|
902
|
+
type: "primary",
|
|
903
|
+
size: "small",
|
|
904
|
+
circle: "",
|
|
905
|
+
onClick: u[0] || (u[0] = (s) => p("point")),
|
|
906
|
+
icon: _(l),
|
|
907
|
+
class: te({ active: o.value === "point" })
|
|
908
|
+
}, null, 8, ["icon", "class"])) : N("", !0),
|
|
909
|
+
r.geomType === "linestring" ? (d(), C(i, {
|
|
910
|
+
key: 1,
|
|
911
|
+
type: "primary",
|
|
912
|
+
size: "small",
|
|
913
|
+
circle: "",
|
|
914
|
+
onClick: u[1] || (u[1] = (s) => p("line")),
|
|
915
|
+
icon: _(a),
|
|
916
|
+
class: te({ active: o.value === "line" })
|
|
917
|
+
}, null, 8, ["icon", "class"])) : N("", !0),
|
|
918
|
+
r.geomType === "polygon" ? (d(), C(i, {
|
|
919
|
+
key: 2,
|
|
920
|
+
type: "primary",
|
|
921
|
+
size: "small",
|
|
922
|
+
circle: "",
|
|
923
|
+
onClick: u[2] || (u[2] = (s) => p("polygon")),
|
|
924
|
+
icon: _(g),
|
|
925
|
+
class: te({ active: o.value === "polygon" })
|
|
926
|
+
}, null, 8, ["icon", "class"])) : N("", !0)
|
|
927
|
+
]);
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
}), Q = (r, t) => {
|
|
931
|
+
const e = r.__vccOpts || r;
|
|
932
|
+
for (const [o, l] of t)
|
|
933
|
+
e[o] = l;
|
|
934
|
+
return e;
|
|
935
|
+
}, Ze = /* @__PURE__ */ Q(He, [["__scopeId", "data-v-fa667d3f"]]), Qe = { class: "curd-map" }, Xe = {
|
|
936
|
+
name: "FormItemMap"
|
|
937
|
+
}, et = /* @__PURE__ */ j({
|
|
938
|
+
...Xe,
|
|
939
|
+
props: {
|
|
940
|
+
modelValue: {
|
|
941
|
+
type: String || void 0,
|
|
942
|
+
default: () => ""
|
|
943
|
+
},
|
|
944
|
+
glyphs: {
|
|
945
|
+
type: String || void 0,
|
|
946
|
+
default: () => ""
|
|
947
|
+
},
|
|
948
|
+
mapViewData: {
|
|
949
|
+
type: Object || void 0,
|
|
950
|
+
default: () => ({})
|
|
951
|
+
},
|
|
952
|
+
currentOperationType: {
|
|
953
|
+
type: String,
|
|
954
|
+
default: () => "details"
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
emits: ["update:modelValue"],
|
|
958
|
+
setup(r, { emit: t }) {
|
|
959
|
+
const e = r, o = M(e.modelValue);
|
|
960
|
+
let l, a;
|
|
961
|
+
const g = J({
|
|
962
|
+
mapViewData: {
|
|
963
|
+
zoom: e.mapViewData.zoom || 13,
|
|
964
|
+
center: e.mapViewData.center || [120.656774, 29.8],
|
|
965
|
+
maxPitch: e.mapViewData.maxPitch || 0,
|
|
966
|
+
dragRotate: e.mapViewData.dragRotate || !1,
|
|
967
|
+
style: {
|
|
968
|
+
glyphs: e.glyphs
|
|
969
|
+
},
|
|
970
|
+
...e.mapViewData
|
|
971
|
+
},
|
|
972
|
+
switchData: {
|
|
973
|
+
layers: [{
|
|
974
|
+
name: "tdt-vec",
|
|
975
|
+
label: "地图",
|
|
976
|
+
iconName: "vector",
|
|
977
|
+
checked: !0
|
|
978
|
+
}, {
|
|
979
|
+
name: "tdt-img",
|
|
980
|
+
label: "影像",
|
|
981
|
+
iconName: "satellite",
|
|
982
|
+
checked: !1
|
|
983
|
+
}],
|
|
984
|
+
extensions: [
|
|
985
|
+
{
|
|
986
|
+
name: "tdt-cia",
|
|
987
|
+
label: "注记",
|
|
988
|
+
checked: !0
|
|
989
|
+
}
|
|
990
|
+
]
|
|
991
|
+
}
|
|
992
|
+
}), p = t;
|
|
993
|
+
H(o, (s) => {
|
|
994
|
+
p("update:modelValue", s);
|
|
995
|
+
}), H(() => e.modelValue, (s) => {
|
|
996
|
+
o.value = s;
|
|
997
|
+
});
|
|
998
|
+
const n = (s) => {
|
|
999
|
+
l = new We(s), a = new Ue(s);
|
|
1000
|
+
const c = l.formatWktToGeoJson(o.value);
|
|
1001
|
+
c && (l.setLayer(c.type), l.setData(c), l.flyTo());
|
|
1002
|
+
}, u = (s) => {
|
|
1003
|
+
a && a.startDraw(s, (c, V, F) => {
|
|
1004
|
+
o.value = F;
|
|
1005
|
+
});
|
|
1006
|
+
}, i = () => {
|
|
1007
|
+
a && a.stopDraw();
|
|
1008
|
+
};
|
|
1009
|
+
return Pe(() => {
|
|
1010
|
+
a && (a.destroy(), a = void 0);
|
|
1011
|
+
}), (s, c) => (d(), P("div", Qe, [
|
|
1012
|
+
b(_(Te), {
|
|
1013
|
+
options: g.mapViewData,
|
|
1014
|
+
onLoad: n
|
|
1015
|
+
}, {
|
|
1016
|
+
"top-left": h(() => [
|
|
1017
|
+
r.currentOperationType !== "details" ? (d(), C(Ze, {
|
|
1018
|
+
key: 0,
|
|
1019
|
+
onDrawStart: u,
|
|
1020
|
+
onDrawCancel: i
|
|
1021
|
+
})) : N("", !0)
|
|
1022
|
+
]),
|
|
1023
|
+
"bottom-right": h(() => [
|
|
1024
|
+
b(_(Oe), {
|
|
1025
|
+
data: g.switchData
|
|
1026
|
+
}, null, 8, ["data"])
|
|
1027
|
+
]),
|
|
1028
|
+
default: h(() => [
|
|
1029
|
+
q(s.$slots, "default", {}, void 0, !0)
|
|
1030
|
+
]),
|
|
1031
|
+
_: 3
|
|
1032
|
+
}, 8, ["options"])
|
|
1033
|
+
]));
|
|
1034
|
+
}
|
|
1035
|
+
}), tt = /* @__PURE__ */ Q(et, [["__scopeId", "data-v-e1f42b56"]]), ot = { class: "field-select-container" }, rt = {
|
|
1036
|
+
name: "ExportButton"
|
|
1037
|
+
}, at = /* @__PURE__ */ j({
|
|
1038
|
+
...rt,
|
|
1039
|
+
props: {
|
|
1040
|
+
columns: {
|
|
1041
|
+
type: Array,
|
|
1042
|
+
default: () => []
|
|
1043
|
+
},
|
|
1044
|
+
data: {
|
|
1045
|
+
type: Array,
|
|
1046
|
+
default: () => []
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
setup(r) {
|
|
1050
|
+
const t = r, e = M(!1), o = J({
|
|
1051
|
+
filename: "",
|
|
1052
|
+
dataType: "current",
|
|
1053
|
+
// current: 当前页数据, selected: 选择中数据
|
|
1054
|
+
selectedFields: []
|
|
1055
|
+
});
|
|
1056
|
+
ne(() => {
|
|
1057
|
+
o.selectedFields = t.columns.map((g) => g.columnProperty);
|
|
1058
|
+
});
|
|
1059
|
+
const l = () => {
|
|
1060
|
+
let g = [...t.data];
|
|
1061
|
+
if (g.length === 0) {
|
|
1062
|
+
E.warning("没有数据可导出");
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
const p = g.map((V) => {
|
|
1066
|
+
const F = {};
|
|
1067
|
+
return o.selectedFields.forEach((T) => {
|
|
1068
|
+
F[T] = V[T];
|
|
1069
|
+
}), F;
|
|
1070
|
+
}), n = o.filename || `导出数据_${(/* @__PURE__ */ new Date()).getTime()}`, u = a(p), i = new Blob([u], { type: "text/csv;charset=utf-8;" }), s = document.createElement("a"), c = URL.createObjectURL(i);
|
|
1071
|
+
s.setAttribute("href", c), s.setAttribute("download", `${n}.csv`), s.style.visibility = "hidden", document.body.appendChild(s), s.click(), document.body.removeChild(s), e.value = !1, E.success("导出成功");
|
|
1072
|
+
}, a = (g) => {
|
|
1073
|
+
if (g.length === 0) return "";
|
|
1074
|
+
const p = Object.keys(g[0]) || [], n = [];
|
|
1075
|
+
n.push(p.join(","));
|
|
1076
|
+
for (const u of g) {
|
|
1077
|
+
const i = p.map((s) => {
|
|
1078
|
+
const c = u[s];
|
|
1079
|
+
return typeof c == "string" ? `"${c.replace(/"/g, '""')}"` : c;
|
|
1080
|
+
});
|
|
1081
|
+
n.push(i.join(","));
|
|
1082
|
+
}
|
|
1083
|
+
return n.join(`
|
|
1084
|
+
`);
|
|
1085
|
+
};
|
|
1086
|
+
return (g, p) => {
|
|
1087
|
+
const n = k("el-icon-download"), u = k("el-icon"), i = k("el-button"), s = k("el-input"), c = k("el-form-item"), V = k("el-checkbox"), F = k("el-checkbox-group"), T = k("el-form"), I = k("el-dialog");
|
|
1088
|
+
return d(), P("div", null, [
|
|
1089
|
+
b(i, {
|
|
1090
|
+
type: "default",
|
|
1091
|
+
round: "",
|
|
1092
|
+
onClick: p[0] || (p[0] = (S) => e.value = !0)
|
|
1093
|
+
}, {
|
|
1094
|
+
default: h(() => [
|
|
1095
|
+
b(u, null, {
|
|
1096
|
+
default: h(() => [
|
|
1097
|
+
b(n)
|
|
1098
|
+
]),
|
|
1099
|
+
_: 1
|
|
1100
|
+
})
|
|
1101
|
+
]),
|
|
1102
|
+
_: 1
|
|
1103
|
+
}),
|
|
1104
|
+
b(I, {
|
|
1105
|
+
modelValue: e.value,
|
|
1106
|
+
"onUpdate:modelValue": p[4] || (p[4] = (S) => e.value = S),
|
|
1107
|
+
title: "导出数据",
|
|
1108
|
+
width: "400px",
|
|
1109
|
+
"close-on-click-modal": !1
|
|
1110
|
+
}, {
|
|
1111
|
+
footer: h(() => [
|
|
1112
|
+
b(i, {
|
|
1113
|
+
onClick: p[3] || (p[3] = (S) => e.value = !1)
|
|
1114
|
+
}, {
|
|
1115
|
+
default: h(() => [...p[5] || (p[5] = [
|
|
1116
|
+
B("取消", -1)
|
|
1117
|
+
])]),
|
|
1118
|
+
_: 1
|
|
1119
|
+
}),
|
|
1120
|
+
b(i, {
|
|
1121
|
+
type: "primary",
|
|
1122
|
+
onClick: l
|
|
1123
|
+
}, {
|
|
1124
|
+
default: h(() => [...p[6] || (p[6] = [
|
|
1125
|
+
B("导出", -1)
|
|
1126
|
+
])]),
|
|
1127
|
+
_: 1
|
|
1128
|
+
})
|
|
1129
|
+
]),
|
|
1130
|
+
default: h(() => [
|
|
1131
|
+
b(T, {
|
|
1132
|
+
model: o,
|
|
1133
|
+
"label-width": "100px"
|
|
1134
|
+
}, {
|
|
1135
|
+
default: h(() => [
|
|
1136
|
+
b(c, { label: "文件名称" }, {
|
|
1137
|
+
default: h(() => [
|
|
1138
|
+
b(s, {
|
|
1139
|
+
modelValue: o.filename,
|
|
1140
|
+
"onUpdate:modelValue": p[1] || (p[1] = (S) => o.filename = S),
|
|
1141
|
+
placeholder: "请输入文件名称"
|
|
1142
|
+
}, null, 8, ["modelValue"])
|
|
1143
|
+
]),
|
|
1144
|
+
_: 1
|
|
1145
|
+
}),
|
|
1146
|
+
b(c, { label: "选择字段" }, {
|
|
1147
|
+
default: h(() => [
|
|
1148
|
+
Y("div", ot, [
|
|
1149
|
+
b(F, {
|
|
1150
|
+
modelValue: o.selectedFields,
|
|
1151
|
+
"onUpdate:modelValue": p[2] || (p[2] = (S) => o.selectedFields = S)
|
|
1152
|
+
}, {
|
|
1153
|
+
default: h(() => [
|
|
1154
|
+
(d(!0), P(R, null, K(r.columns, (S) => (d(), P("div", {
|
|
1155
|
+
key: S.columnProperty,
|
|
1156
|
+
class: "column-item"
|
|
1157
|
+
}, [
|
|
1158
|
+
b(V, {
|
|
1159
|
+
value: S.columnProperty
|
|
1160
|
+
}, {
|
|
1161
|
+
default: h(() => [
|
|
1162
|
+
B(re(S.columnLabel), 1)
|
|
1163
|
+
]),
|
|
1164
|
+
_: 2
|
|
1165
|
+
}, 1032, ["value"])
|
|
1166
|
+
]))), 128))
|
|
1167
|
+
]),
|
|
1168
|
+
_: 1
|
|
1169
|
+
}, 8, ["modelValue"])
|
|
1170
|
+
])
|
|
1171
|
+
]),
|
|
1172
|
+
_: 1
|
|
1173
|
+
})
|
|
1174
|
+
]),
|
|
1175
|
+
_: 1
|
|
1176
|
+
}, 8, ["model"])
|
|
1177
|
+
]),
|
|
1178
|
+
_: 1
|
|
1179
|
+
}, 8, ["modelValue"])
|
|
1180
|
+
]);
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
}), lt = /* @__PURE__ */ Q(at, [["__scopeId", "data-v-a28ea63e"]]), nt = { class: "column-manager" }, it = {
|
|
1184
|
+
name: "ColumnManager"
|
|
1185
|
+
}, st = /* @__PURE__ */ j({
|
|
1186
|
+
...it,
|
|
1187
|
+
props: {
|
|
1188
|
+
tableColumns: {
|
|
1189
|
+
type: Array,
|
|
1190
|
+
default: () => ({
|
|
1191
|
+
columns: []
|
|
1192
|
+
})
|
|
1193
|
+
},
|
|
1194
|
+
visibleColumns: {
|
|
1195
|
+
type: Array,
|
|
1196
|
+
default: () => []
|
|
1197
|
+
}
|
|
1198
|
+
},
|
|
1199
|
+
emits: ["update:visibleColumns", "update:columns"],
|
|
1200
|
+
setup(r, { emit: t }) {
|
|
1201
|
+
const e = r, o = t, l = M(!1), a = M([...e.visibleColumns]), g = (p, n) => {
|
|
1202
|
+
n ? a.value.push(p) : a.value = a.value.filter((u) => u !== p), o("update:visibleColumns", a.value);
|
|
1203
|
+
};
|
|
1204
|
+
return H(
|
|
1205
|
+
() => e.visibleColumns,
|
|
1206
|
+
(p) => {
|
|
1207
|
+
a.value = [...p];
|
|
1208
|
+
},
|
|
1209
|
+
{ deep: !0 }
|
|
1210
|
+
), (p, n) => {
|
|
1211
|
+
const u = k("el-icon-menu"), i = k("el-icon"), s = k("el-button"), c = k("el-checkbox"), V = k("el-popover");
|
|
1212
|
+
return d(), P("div", null, [
|
|
1213
|
+
b(V, {
|
|
1214
|
+
visible: l.value,
|
|
1215
|
+
"onUpdate:visible": n[0] || (n[0] = (F) => l.value = F),
|
|
1216
|
+
placement: "bottom-end",
|
|
1217
|
+
width: 220,
|
|
1218
|
+
trigger: "click",
|
|
1219
|
+
"popper-class": "column-manager-popover"
|
|
1220
|
+
}, {
|
|
1221
|
+
reference: h(() => [
|
|
1222
|
+
b(s, {
|
|
1223
|
+
type: "default",
|
|
1224
|
+
round: ""
|
|
1225
|
+
}, {
|
|
1226
|
+
default: h(() => [
|
|
1227
|
+
b(i, null, {
|
|
1228
|
+
default: h(() => [
|
|
1229
|
+
b(u)
|
|
1230
|
+
]),
|
|
1231
|
+
_: 1
|
|
1232
|
+
})
|
|
1233
|
+
]),
|
|
1234
|
+
_: 1
|
|
1235
|
+
})
|
|
1236
|
+
]),
|
|
1237
|
+
default: h(() => [
|
|
1238
|
+
Y("div", nt, [
|
|
1239
|
+
(d(!0), P(R, null, K(r.tableColumns, (F) => (d(), P("div", {
|
|
1240
|
+
class: "column-item",
|
|
1241
|
+
key: F.columnProperty
|
|
1242
|
+
}, [
|
|
1243
|
+
b(c, {
|
|
1244
|
+
modelValue: a.value.includes(F.columnProperty),
|
|
1245
|
+
onChange: (T) => g(F.columnProperty, T)
|
|
1246
|
+
}, {
|
|
1247
|
+
default: h(() => [
|
|
1248
|
+
B(re(F.columnLabel || F.columnProperty), 1)
|
|
1249
|
+
]),
|
|
1250
|
+
_: 2
|
|
1251
|
+
}, 1032, ["modelValue", "onChange"])
|
|
1252
|
+
]))), 128))
|
|
1253
|
+
])
|
|
1254
|
+
]),
|
|
1255
|
+
_: 1
|
|
1256
|
+
}, 8, ["visible"])
|
|
1257
|
+
]);
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
}), ut = /* @__PURE__ */ Q(st, [["__scopeId", "data-v-ef5ba627"]]);
|
|
1261
|
+
class ct {
|
|
1262
|
+
serverConfig;
|
|
1263
|
+
curdConfig = {};
|
|
1264
|
+
searchConfig = {};
|
|
1265
|
+
tableConfig = {};
|
|
1266
|
+
editorConfig = {};
|
|
1267
|
+
searchFormMap = /* @__PURE__ */ new Map();
|
|
1268
|
+
cloneSearchForm = "{}";
|
|
1269
|
+
cloneFormData = "{}";
|
|
1270
|
+
dictionaryMap = /* @__PURE__ */ new Map();
|
|
1271
|
+
constructor({ serverConfig: t }) {
|
|
1272
|
+
this.serverConfig = t;
|
|
1273
|
+
}
|
|
1274
|
+
setConfig({ curdConfig: t, searchConfig: e, tableConfig: o, editorConfig: l }) {
|
|
1275
|
+
this.curdConfig = t || this.curdConfig, this.searchConfig = e || this.searchConfig, this.tableConfig = o || this.tableConfig, this.editorConfig = l || this.editorConfig;
|
|
1276
|
+
}
|
|
1277
|
+
//加载字典数据,确保全部加载完成后返回结果
|
|
1278
|
+
async loadDictionary() {
|
|
1279
|
+
if (!this.tableConfig?.columns)
|
|
1280
|
+
return this.dictionaryMap;
|
|
1281
|
+
const t = this.tableConfig.columns.filter((e) => ["code", "table"].includes(e.dictType || "") && e.dictService).map((e) => {
|
|
1282
|
+
let o = e.fieldType || "String";
|
|
1283
|
+
return o === "integer" && (o = "Integer"), (e.dictType === "code" ? this.serverConfig?.dict({ dictCode: e.dictService, itemIdType: o }) : this.serverConfig?.dictServer(e.dictService, {})).then((a) => {
|
|
1284
|
+
a && e.dictService && this.dictionaryMap.set(e.dictService, a || []);
|
|
1285
|
+
}).catch((a) => {
|
|
1286
|
+
console.error(`加载字典 ${e.dictService} 失败:`, a);
|
|
1287
|
+
});
|
|
1288
|
+
});
|
|
1289
|
+
return await Promise.all(t), this.dictionaryMap;
|
|
1290
|
+
}
|
|
1291
|
+
//直接根据字典名字查询
|
|
1292
|
+
getDictOptionsByCode(t) {
|
|
1293
|
+
return t ? this.dictionaryMap.get(t) || [] : [];
|
|
1294
|
+
}
|
|
1295
|
+
//根据editor中的字段名查询table配置中的属性
|
|
1296
|
+
getDictOptionsByColumnProperty(t) {
|
|
1297
|
+
if (!t)
|
|
1298
|
+
return [];
|
|
1299
|
+
const e = this.tableConfig?.columns?.find((o) => o.columnProperty === t)?.dictService;
|
|
1300
|
+
return this.getDictOptionsByCode(e || void 0);
|
|
1301
|
+
}
|
|
1302
|
+
//格式化
|
|
1303
|
+
formatColumnValue(t, e) {
|
|
1304
|
+
if (!e || e === "")
|
|
1305
|
+
return e;
|
|
1306
|
+
if (t.dictType && t.dictService) {
|
|
1307
|
+
const o = this.dictionaryMap.get(t.dictService) || [];
|
|
1308
|
+
if (!o || o.length === 0)
|
|
1309
|
+
return e;
|
|
1310
|
+
const l = o.find((a) => a.id === e);
|
|
1311
|
+
return l ? l.name : e;
|
|
1312
|
+
}
|
|
1313
|
+
if (!t.formatter || t.formatter === "")
|
|
1314
|
+
return e;
|
|
1315
|
+
switch (t.fieldType) {
|
|
1316
|
+
case "date":
|
|
1317
|
+
return e ? oe(e).format(t.formatter || "YYYY-MM-DD") : "";
|
|
1318
|
+
case "datetime":
|
|
1319
|
+
return e ? oe(e).format(t.formatter || "YYYY-MM-DD HH:mm:ss") : "";
|
|
1320
|
+
default:
|
|
1321
|
+
return e;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
//格式化表单规则
|
|
1325
|
+
formatFormRules() {
|
|
1326
|
+
const t = {};
|
|
1327
|
+
return (this.editorConfig?.columns || []).forEach((e) => {
|
|
1328
|
+
t[e.columnProperty] = [], e.isRequired && t[e.columnProperty].push({ required: !0, message: "请输入" + e.columnLabel, trigger: "blur" });
|
|
1329
|
+
}), t;
|
|
1330
|
+
}
|
|
1331
|
+
formatSearchConfigForm() {
|
|
1332
|
+
this.searchConfig.columns = this.tableConfig?.columns?.filter((e) => e.searchable != "no") || [], this.searchConfig?.columns.forEach((e) => {
|
|
1333
|
+
this.searchFormMap.set(e.columnProperty, e);
|
|
1334
|
+
});
|
|
1335
|
+
const t = {};
|
|
1336
|
+
return this.searchConfig?.columns.forEach((e) => {
|
|
1337
|
+
t[e.columnProperty] = e.searchDefaultValue;
|
|
1338
|
+
}), this.cloneSearchForm = JSON.stringify(t), t;
|
|
1339
|
+
}
|
|
1340
|
+
formatFormConfigData() {
|
|
1341
|
+
const t = {};
|
|
1342
|
+
return (this.editorConfig?.columns || []).filter((o) => o.columnProperty === this.curdConfig?.priKey ? !0 : o.type !== "hidden").forEach((o) => {
|
|
1343
|
+
t[o.columnProperty] = o.defaultValue;
|
|
1344
|
+
}), this.cloneFormData = JSON.stringify(t), t;
|
|
1345
|
+
}
|
|
1346
|
+
//拼接查询条件
|
|
1347
|
+
formatSearchForm(t) {
|
|
1348
|
+
const e = {};
|
|
1349
|
+
return this.searchFormMap.forEach((o, l) => {
|
|
1350
|
+
const a = t[l];
|
|
1351
|
+
if (a != null && a !== "") {
|
|
1352
|
+
let g = "";
|
|
1353
|
+
switch (o.searchable) {
|
|
1354
|
+
case "=":
|
|
1355
|
+
g = `= '${a}'`;
|
|
1356
|
+
break;
|
|
1357
|
+
case "like":
|
|
1358
|
+
g = `like '%${a}%'`;
|
|
1359
|
+
break;
|
|
1360
|
+
case "in":
|
|
1361
|
+
g = `in (${a})`;
|
|
1362
|
+
break;
|
|
1363
|
+
}
|
|
1364
|
+
e[l] = g;
|
|
1365
|
+
}
|
|
1366
|
+
}), e;
|
|
1367
|
+
}
|
|
1368
|
+
//根据table 中的字段类型,格式化formData中的值
|
|
1369
|
+
formatFormData(t) {
|
|
1370
|
+
if (!t || Object.keys(t).length === 0)
|
|
1371
|
+
return {};
|
|
1372
|
+
let e = {};
|
|
1373
|
+
return (this.tableConfig?.columns || []).forEach((o) => {
|
|
1374
|
+
o?.fieldType === "integer" ? e[o.columnProperty] = Number(t[o.columnProperty]) : e[o.columnProperty] = t[o.columnProperty];
|
|
1375
|
+
}), t.wktstr && (e.wktstr = t.wktstr), e;
|
|
1376
|
+
}
|
|
1377
|
+
//可见列
|
|
1378
|
+
initVisibleColumns() {
|
|
1379
|
+
return (this.tableConfig?.columns || []).filter((t) => t.showMethod != "hidden").map((t) => t.columnProperty);
|
|
1380
|
+
}
|
|
1381
|
+
//表单编辑框
|
|
1382
|
+
getFormItems(t = "") {
|
|
1383
|
+
let e = [];
|
|
1384
|
+
switch (t) {
|
|
1385
|
+
case "details":
|
|
1386
|
+
e = (this.editorConfig?.columns || []).filter((o) => o.type !== "hidden" && o.updateFormStatus !== "hidden" && o.type !== "shape");
|
|
1387
|
+
break;
|
|
1388
|
+
case "add":
|
|
1389
|
+
e = (this.editorConfig?.columns || []).filter((o) => o.type !== "hidden" && o.createFormStatus !== "hidden" && o.type !== "shape");
|
|
1390
|
+
break;
|
|
1391
|
+
case "update":
|
|
1392
|
+
e = (this.editorConfig?.columns || []).filter((o) => o.type !== "hidden" && o.updateFormStatus !== "hidden" && o.type !== "shape");
|
|
1393
|
+
break;
|
|
1394
|
+
}
|
|
1395
|
+
return e;
|
|
1396
|
+
}
|
|
1397
|
+
//判断是否有地图字段,是否存在空间组件,wktStr
|
|
1398
|
+
hasGeometryField() {
|
|
1399
|
+
return (this.editorConfig?.columns || []).find((e) => e.type === "shape") || void 0;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
const dt = { class: "curd-container" }, pt = { class: "curd-search" }, mt = {
|
|
1403
|
+
key: 0,
|
|
1404
|
+
class: "table-actions"
|
|
1405
|
+
}, ft = { class: "table-actions-left" }, ht = { class: "table-actions-right" }, yt = { class: "curd-table" }, gt = {
|
|
1406
|
+
key: 1,
|
|
1407
|
+
class: "curd-pagination"
|
|
1408
|
+
}, vt = {
|
|
1409
|
+
name: "CurdForm"
|
|
1410
|
+
}, wt = /* @__PURE__ */ j({
|
|
1411
|
+
...vt,
|
|
1412
|
+
props: {
|
|
1413
|
+
size: {
|
|
1414
|
+
type: String,
|
|
1415
|
+
default: "default"
|
|
1416
|
+
},
|
|
1417
|
+
title: {
|
|
1418
|
+
type: String,
|
|
1419
|
+
default: "信息管理"
|
|
1420
|
+
},
|
|
1421
|
+
//外部权限控制
|
|
1422
|
+
permissions: {
|
|
1423
|
+
type: Object,
|
|
1424
|
+
default: () => ({
|
|
1425
|
+
add: !1,
|
|
1426
|
+
edit: !1,
|
|
1427
|
+
delete: !1,
|
|
1428
|
+
deleteBatch: !1,
|
|
1429
|
+
export: !1
|
|
1430
|
+
})
|
|
1431
|
+
},
|
|
1432
|
+
serverConfig: {
|
|
1433
|
+
type: Object,
|
|
1434
|
+
default: () => ({
|
|
1435
|
+
init: Function,
|
|
1436
|
+
list: Function,
|
|
1437
|
+
view: Function,
|
|
1438
|
+
add: Function,
|
|
1439
|
+
delete: Function,
|
|
1440
|
+
deleteBatch: Function,
|
|
1441
|
+
update: Function,
|
|
1442
|
+
dict: Function,
|
|
1443
|
+
dictServer: Function
|
|
1444
|
+
})
|
|
1445
|
+
},
|
|
1446
|
+
mapViewData: {
|
|
1447
|
+
type: Object,
|
|
1448
|
+
default: () => ({})
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
emits: ["loadDataSuccess"],
|
|
1452
|
+
setup(r, { expose: t, emit: e }) {
|
|
1453
|
+
const o = r, l = M(!1), a = M(null), g = e, p = M(), n = new ct({ serverConfig: o.serverConfig }), u = M(""), i = M("details"), s = J({
|
|
1454
|
+
priKey: "id",
|
|
1455
|
+
priKeyType: "string",
|
|
1456
|
+
sortField: "id",
|
|
1457
|
+
sortOrder: 0,
|
|
1458
|
+
geomType: "point",
|
|
1459
|
+
webFunction: [],
|
|
1460
|
+
dataExt: "{}"
|
|
1461
|
+
}), c = J({
|
|
1462
|
+
showIndex: !0,
|
|
1463
|
+
indexWidth: 50,
|
|
1464
|
+
showCheckbox: !0,
|
|
1465
|
+
showOperation: !0,
|
|
1466
|
+
operationWidth: 120,
|
|
1467
|
+
operationLocation: "right",
|
|
1468
|
+
operationButtons: [],
|
|
1469
|
+
visibleOperationButtons: [],
|
|
1470
|
+
operationAlign: "center",
|
|
1471
|
+
showPagination: !0,
|
|
1472
|
+
defaultPageSize: 10,
|
|
1473
|
+
pageUISize: "default",
|
|
1474
|
+
showExpand: !1,
|
|
1475
|
+
columns: []
|
|
1476
|
+
}), V = J({
|
|
1477
|
+
total: 0,
|
|
1478
|
+
pageSize: c.defaultPageSize,
|
|
1479
|
+
currentPage: 1
|
|
1480
|
+
}), F = J({
|
|
1481
|
+
title: "弹框表单",
|
|
1482
|
+
formDialogWidth: "800px",
|
|
1483
|
+
labelWidth: "120px"
|
|
1484
|
+
}), T = J({
|
|
1485
|
+
columns: [],
|
|
1486
|
+
formColumns: []
|
|
1487
|
+
}), I = J({
|
|
1488
|
+
searchLabelWidth: "80",
|
|
1489
|
+
searchFormWidth: "290",
|
|
1490
|
+
columns: []
|
|
1491
|
+
}), S = M({}), O = M(!1), f = M([]), L = J({
|
|
1492
|
+
data: {}
|
|
1493
|
+
}), W = M({}), v = M(!1), D = M(!1), x = M(), U = M([]), A = async () => {
|
|
1494
|
+
if (o.serverConfig?.list)
|
|
1495
|
+
try {
|
|
1496
|
+
l.value = !0;
|
|
1497
|
+
const w = await o.serverConfig?.list({
|
|
1498
|
+
whereClause: n.formatSearchForm(S.value),
|
|
1499
|
+
orderParam: [
|
|
1500
|
+
{
|
|
1501
|
+
fieldName: s.sortField,
|
|
1502
|
+
asc: s.sortOrder === 0
|
|
1503
|
+
}
|
|
1504
|
+
],
|
|
1505
|
+
pageParam: {
|
|
1506
|
+
pageNum: V.currentPage,
|
|
1507
|
+
pageSize: V.pageSize
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
if (w) {
|
|
1511
|
+
const y = w.data;
|
|
1512
|
+
f.value = y.dataList || [], V.total = y.totalCount, g("loadDataSuccess", f.value);
|
|
1513
|
+
}
|
|
1514
|
+
} catch {
|
|
1515
|
+
} finally {
|
|
1516
|
+
l.value = !1;
|
|
1517
|
+
}
|
|
1518
|
+
}, fe = () => {
|
|
1519
|
+
S.value = JSON.parse(n.cloneSearchForm), A();
|
|
1520
|
+
}, he = async () => {
|
|
1521
|
+
o.serverConfig?.add && (i.value = "add", T.formColumns = n.getFormItems("add"), F.title = "新增信息", O.value = !0, L.data = JSON.parse(n.cloneFormData));
|
|
1522
|
+
}, ye = async () => {
|
|
1523
|
+
if (o.serverConfig?.deleteBatch && a?.value) {
|
|
1524
|
+
const w = a.value.getSelectionRows();
|
|
1525
|
+
if (w.length === 0) {
|
|
1526
|
+
E.warning("请选择要删除的项");
|
|
1527
|
+
return;
|
|
1528
|
+
}
|
|
1529
|
+
const y = w.map((z) => z[s.priKey || "id"]);
|
|
1530
|
+
y.length > 0 && ue.confirm("确定删除选中项吗?", "提示", {
|
|
1531
|
+
confirmButtonText: "确定",
|
|
1532
|
+
cancelButtonText: "取消",
|
|
1533
|
+
type: "warning"
|
|
1534
|
+
}).then(async () => {
|
|
1535
|
+
await o.serverConfig?.deleteBatch?.(y.join(",")) ? E.success("删除成功") : E.error("删除失败"), A();
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
}, ge = (w) => {
|
|
1539
|
+
V.pageSize = Number(w), A();
|
|
1540
|
+
}, ve = (w) => {
|
|
1541
|
+
V.currentPage = w, A();
|
|
1542
|
+
}, we = async (w) => {
|
|
1543
|
+
if (o.serverConfig?.view) {
|
|
1544
|
+
i.value = "details", T.formColumns = n.getFormItems("details"), F.title = "查看详情";
|
|
1545
|
+
try {
|
|
1546
|
+
const y = w[s.priKey || "id"];
|
|
1547
|
+
if (!y) {
|
|
1548
|
+
E.error("查看失败,未获取到主键值");
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1551
|
+
const z = await o.serverConfig?.view?.({
|
|
1552
|
+
key: y
|
|
1553
|
+
});
|
|
1554
|
+
z.success && z.data ? (L.data = { ...z.data }, O.value = !0) : E.error("查询失败");
|
|
1555
|
+
} catch {
|
|
1556
|
+
E.error("查询失败");
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}, be = async (w) => {
|
|
1560
|
+
o.serverConfig?.update && (i.value = "update", T.formColumns = n.getFormItems("update"), F.title = "编辑信息", O.value = !0, L.data = { ...w });
|
|
1561
|
+
}, Ce = (w) => {
|
|
1562
|
+
o.serverConfig?.delete && ue.confirm("确定删除选中项吗?", "提示", {
|
|
1563
|
+
confirmButtonText: "确定",
|
|
1564
|
+
cancelButtonText: "取消",
|
|
1565
|
+
type: "warning"
|
|
1566
|
+
}).then(async () => {
|
|
1567
|
+
const y = w[s.priKey || "id"];
|
|
1568
|
+
if (!y) {
|
|
1569
|
+
E.error("删除失败,未获取到主键值");
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
await o.serverConfig?.delete?.(y) ? (E.success("删除成功"), A()) : E.error("删除失败");
|
|
1573
|
+
});
|
|
1574
|
+
}, ke = () => {
|
|
1575
|
+
v.value = !0, p.value?.validate(async (w, y) => {
|
|
1576
|
+
if (w) {
|
|
1577
|
+
let z = i.value === "add" ? o.serverConfig?.add : o.serverConfig?.update;
|
|
1578
|
+
if (z)
|
|
1579
|
+
try {
|
|
1580
|
+
const $ = await z({
|
|
1581
|
+
params: {
|
|
1582
|
+
...n.formatFormData(L.data)
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
$.success ? (E.success(i.value === "add" ? "新增成功" : "编辑成功"), O.value = !1, A()) : E.error("保存失败" + $.msg);
|
|
1586
|
+
} catch ($) {
|
|
1587
|
+
E.error("保存失败" + $.message);
|
|
1588
|
+
} finally {
|
|
1589
|
+
v.value = !1;
|
|
1590
|
+
}
|
|
1591
|
+
} else
|
|
1592
|
+
v.value = !1;
|
|
1593
|
+
});
|
|
1594
|
+
};
|
|
1595
|
+
ne(async () => {
|
|
1596
|
+
if (o.serverConfig?.init) {
|
|
1597
|
+
const w = await o.serverConfig.init();
|
|
1598
|
+
if (w.success && w.data) {
|
|
1599
|
+
const y = w.data || {}, z = y.dataExt ? JSON.parse(y.dataExt) : {};
|
|
1600
|
+
Object.assign(s, y || {}), Object.assign(c, z?.tableConfig || {}), Object.assign(F, z?.dialogConfig || {}), Object.assign(T?.columns || [], z?.editorConfig || {}), V.pageSize = c.defaultPageSize || V.pageSize, c.visibleOperationButtons = (c.operationButtons || []).map(($) => $.type), console.log("curdConfig", s), console.log("tableConfig", c), console.log("dialogConfig", F), console.log("editorConfig", T), I.searchFormWidth = c.searchFormWidth && c.searchFormWidth !== "" ? c.searchFormWidth : I.searchFormWidth, I.searchLabelWidth = c.searchLabelWidth && c.searchLabelWidth !== "" ? c.searchLabelWidth : I.searchLabelWidth, n.setConfig({ curdConfig: s, searchConfig: I, tableConfig: c, editorConfig: T }), U.value = n.initVisibleColumns(), S.value = n.formatSearchConfigForm(), L.data = n.formatFormConfigData(), W.value = n.formatFormRules(), x.value = n.hasGeometryField(), await n.loadDictionary(), A(), se(() => {
|
|
1601
|
+
u.value = "100%";
|
|
1602
|
+
});
|
|
1603
|
+
} else
|
|
1604
|
+
E.error("未查询到有效配置");
|
|
1605
|
+
} else
|
|
1606
|
+
E.error("请配置init方法");
|
|
1607
|
+
}), H(O, (w) => {
|
|
1608
|
+
w ? se(() => {
|
|
1609
|
+
D.value = !0;
|
|
1610
|
+
}) : D.value = !1;
|
|
1611
|
+
});
|
|
1612
|
+
const Se = (w) => {
|
|
1613
|
+
f.value = w;
|
|
1614
|
+
}, Fe = (w) => {
|
|
1615
|
+
c.columns = w;
|
|
1616
|
+
};
|
|
1617
|
+
return t({
|
|
1618
|
+
// 设置表单数据
|
|
1619
|
+
setTableData: Se,
|
|
1620
|
+
getTableData: () => f.value
|
|
1621
|
+
}), (w, y) => {
|
|
1622
|
+
const z = k("el-form-item"), $ = k("el-button"), ie = k("el-form"), X = k("el-table-column"), Ve = k("el-table"), _e = k("el-pagination"), ee = k("el-col"), ae = k("el-row"), De = k("el-dialog");
|
|
1623
|
+
return d(), P(R, null, [
|
|
1624
|
+
Y("div", dt, [
|
|
1625
|
+
Y("div", pt, [
|
|
1626
|
+
b(ie, {
|
|
1627
|
+
inline: !0,
|
|
1628
|
+
class: "form-inline",
|
|
1629
|
+
"label-width": I.searchLabelWidth
|
|
1630
|
+
}, {
|
|
1631
|
+
default: h(() => [
|
|
1632
|
+
(d(!0), P(R, null, K(I.columns, (m) => (d(), C(z, {
|
|
1633
|
+
key: m.columnProperty,
|
|
1634
|
+
label: m.searchFormLabel || m.columnLabel,
|
|
1635
|
+
style: Le(`width: ${I.searchFormWidth}px;`)
|
|
1636
|
+
}, {
|
|
1637
|
+
default: h(() => [
|
|
1638
|
+
m.showMethod === "slot" ? q(w.$slots, "search-" + m.columnProperty, {
|
|
1639
|
+
key: 0,
|
|
1640
|
+
scope: { ...w.scope, searchForm: S.value, data: S.value[m.columnProperty] }
|
|
1641
|
+
}, void 0, !0) : (d(), C(ce, {
|
|
1642
|
+
key: 1,
|
|
1643
|
+
modelValue: S.value[m.columnProperty],
|
|
1644
|
+
"onUpdate:modelValue": (G) => S.value[m.columnProperty] = G,
|
|
1645
|
+
item: m,
|
|
1646
|
+
dropdownOptions: _(n).getDictOptionsByCode(m.dictService)
|
|
1647
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "item", "dropdownOptions"]))
|
|
1648
|
+
]),
|
|
1649
|
+
_: 2
|
|
1650
|
+
}, 1032, ["label", "style"]))), 128)),
|
|
1651
|
+
b(z, { style: { "margin-left": "10px" } }, {
|
|
1652
|
+
default: h(() => [
|
|
1653
|
+
b($, {
|
|
1654
|
+
type: "primary",
|
|
1655
|
+
size: r.size,
|
|
1656
|
+
icon: "Search",
|
|
1657
|
+
onClick: A
|
|
1658
|
+
}, {
|
|
1659
|
+
default: h(() => [...y[6] || (y[6] = [
|
|
1660
|
+
B("查询", -1)
|
|
1661
|
+
])]),
|
|
1662
|
+
_: 1
|
|
1663
|
+
}, 8, ["size"]),
|
|
1664
|
+
b($, {
|
|
1665
|
+
type: "default",
|
|
1666
|
+
size: r.size,
|
|
1667
|
+
icon: "Refresh",
|
|
1668
|
+
onClick: fe
|
|
1669
|
+
}, {
|
|
1670
|
+
default: h(() => [...y[7] || (y[7] = [
|
|
1671
|
+
B("重置", -1)
|
|
1672
|
+
])]),
|
|
1673
|
+
_: 1
|
|
1674
|
+
}, 8, ["size"])
|
|
1675
|
+
]),
|
|
1676
|
+
_: 1
|
|
1677
|
+
})
|
|
1678
|
+
]),
|
|
1679
|
+
_: 3
|
|
1680
|
+
}, 8, ["label-width"])
|
|
1681
|
+
]),
|
|
1682
|
+
s.webFunction.length > 0 ? (d(), P("div", mt, [
|
|
1683
|
+
Y("div", ft, [
|
|
1684
|
+
r.permissions.add && s.webFunction.includes("add") ? (d(), C($, {
|
|
1685
|
+
key: 0,
|
|
1686
|
+
type: "primary",
|
|
1687
|
+
size: r.size,
|
|
1688
|
+
icon: "CirclePlus",
|
|
1689
|
+
onClick: he
|
|
1690
|
+
}, {
|
|
1691
|
+
default: h(() => [...y[8] || (y[8] = [
|
|
1692
|
+
B("新增", -1)
|
|
1693
|
+
])]),
|
|
1694
|
+
_: 1
|
|
1695
|
+
}, 8, ["size"])) : N("", !0),
|
|
1696
|
+
r.permissions.delete && s.webFunction.includes("batchDelete") ? (d(), C($, {
|
|
1697
|
+
key: 1,
|
|
1698
|
+
type: "danger",
|
|
1699
|
+
size: r.size,
|
|
1700
|
+
icon: "Delete",
|
|
1701
|
+
onClick: ye
|
|
1702
|
+
}, {
|
|
1703
|
+
default: h(() => [...y[9] || (y[9] = [
|
|
1704
|
+
B("批量删除", -1)
|
|
1705
|
+
])]),
|
|
1706
|
+
_: 1
|
|
1707
|
+
}, 8, ["size"])) : N("", !0),
|
|
1708
|
+
q(w.$slots, "table-actions", {}, void 0, !0)
|
|
1709
|
+
]),
|
|
1710
|
+
Y("div", ht, [
|
|
1711
|
+
q(w.$slots, "table-actions-right", {}, void 0, !0),
|
|
1712
|
+
b(lt, {
|
|
1713
|
+
columns: c.columns,
|
|
1714
|
+
data: f.value
|
|
1715
|
+
}, null, 8, ["columns", "data"]),
|
|
1716
|
+
b(ut, {
|
|
1717
|
+
"table-columns": c.columns,
|
|
1718
|
+
"visible-columns": U.value,
|
|
1719
|
+
"onUpdate:visibleColumns": y[0] || (y[0] = (m) => U.value = m),
|
|
1720
|
+
"onUpdate:columns": Fe
|
|
1721
|
+
}, null, 8, ["table-columns", "visible-columns"])
|
|
1722
|
+
])
|
|
1723
|
+
])) : N("", !0),
|
|
1724
|
+
Y("div", yt, [
|
|
1725
|
+
b(Ve, {
|
|
1726
|
+
ref_key: "tableRef",
|
|
1727
|
+
ref: a,
|
|
1728
|
+
data: f.value,
|
|
1729
|
+
border: "",
|
|
1730
|
+
stripe: "",
|
|
1731
|
+
size: r.size,
|
|
1732
|
+
height: u.value,
|
|
1733
|
+
"header-cell-style": { background: "#F5F7FA" }
|
|
1734
|
+
}, {
|
|
1735
|
+
default: h(() => [
|
|
1736
|
+
c.showIndex ? (d(), C(X, {
|
|
1737
|
+
key: 0,
|
|
1738
|
+
type: "index",
|
|
1739
|
+
width: c.indexWidth,
|
|
1740
|
+
label: "#",
|
|
1741
|
+
align: "center"
|
|
1742
|
+
}, null, 8, ["width"])) : N("", !0),
|
|
1743
|
+
r.permissions.delete && s.webFunction.includes("batchDelete") ? (d(), C(X, {
|
|
1744
|
+
key: 1,
|
|
1745
|
+
type: "selection",
|
|
1746
|
+
width: "55",
|
|
1747
|
+
align: "center"
|
|
1748
|
+
})) : N("", !0),
|
|
1749
|
+
(d(!0), P(R, null, K(c.columns, (m) => (d(), P(R, {
|
|
1750
|
+
key: m.prop
|
|
1751
|
+
}, [
|
|
1752
|
+
U.value.includes(m.columnProperty) ? (d(), C(X, {
|
|
1753
|
+
key: 0,
|
|
1754
|
+
label: m.columnLabel,
|
|
1755
|
+
width: (m.width || "") + "px",
|
|
1756
|
+
fixed: m.fixed,
|
|
1757
|
+
"show-overflow-tooltip": !m.noWrap,
|
|
1758
|
+
align: m.align,
|
|
1759
|
+
"header-align": m.headerAlign
|
|
1760
|
+
}, {
|
|
1761
|
+
default: h((G) => [
|
|
1762
|
+
w.$slots["table-column-" + m.columnProperty] ? q(w.$slots, "table-column-" + m.columnProperty, {
|
|
1763
|
+
key: 0,
|
|
1764
|
+
scope: G
|
|
1765
|
+
}, void 0, !0) : (d(), P(R, { key: 1 }, [
|
|
1766
|
+
B(re(_(n).formatColumnValue(m, G.row[m.columnProperty])), 1)
|
|
1767
|
+
], 64))
|
|
1768
|
+
]),
|
|
1769
|
+
_: 2
|
|
1770
|
+
}, 1032, ["label", "width", "fixed", "show-overflow-tooltip", "align", "header-align"])) : N("", !0)
|
|
1771
|
+
], 64))), 128)),
|
|
1772
|
+
b(X, {
|
|
1773
|
+
align: c.operationAlign,
|
|
1774
|
+
fixed: "right",
|
|
1775
|
+
width: c.operationWidth,
|
|
1776
|
+
label: "操作"
|
|
1777
|
+
}, {
|
|
1778
|
+
default: h((m) => [
|
|
1779
|
+
c.visibleOperationButtons.includes("detail") ? (d(), C($, {
|
|
1780
|
+
key: 0,
|
|
1781
|
+
type: "primary",
|
|
1782
|
+
plain: "",
|
|
1783
|
+
size: c.operationSize,
|
|
1784
|
+
onClick: (G) => we(m.row)
|
|
1785
|
+
}, {
|
|
1786
|
+
default: h(() => [...y[10] || (y[10] = [
|
|
1787
|
+
B("详情", -1)
|
|
1788
|
+
])]),
|
|
1789
|
+
_: 1
|
|
1790
|
+
}, 8, ["size", "onClick"])) : N("", !0),
|
|
1791
|
+
c.visibleOperationButtons.includes("edit") && r.permissions.edit ? (d(), C($, {
|
|
1792
|
+
key: 1,
|
|
1793
|
+
type: "success",
|
|
1794
|
+
plain: "",
|
|
1795
|
+
size: c.operationSize,
|
|
1796
|
+
onClick: (G) => be(m.row)
|
|
1797
|
+
}, {
|
|
1798
|
+
default: h(() => [...y[11] || (y[11] = [
|
|
1799
|
+
B("编辑", -1)
|
|
1800
|
+
])]),
|
|
1801
|
+
_: 1
|
|
1802
|
+
}, 8, ["size", "onClick"])) : N("", !0),
|
|
1803
|
+
c.visibleOperationButtons.includes("delete") && r.permissions.delete ? (d(), C($, {
|
|
1804
|
+
key: 2,
|
|
1805
|
+
type: "danger",
|
|
1806
|
+
plain: "",
|
|
1807
|
+
size: c.operationSize,
|
|
1808
|
+
onClick: (G) => Ce(m.row)
|
|
1809
|
+
}, {
|
|
1810
|
+
default: h(() => [...y[12] || (y[12] = [
|
|
1811
|
+
B("删除", -1)
|
|
1812
|
+
])]),
|
|
1813
|
+
_: 1
|
|
1814
|
+
}, 8, ["size", "onClick"])) : N("", !0),
|
|
1815
|
+
q(w.$slots, "table-column-action", { scope: m }, void 0, !0)
|
|
1816
|
+
]),
|
|
1817
|
+
_: 3
|
|
1818
|
+
}, 8, ["align", "width"])
|
|
1819
|
+
]),
|
|
1820
|
+
_: 3
|
|
1821
|
+
}, 8, ["data", "size", "height"])
|
|
1822
|
+
]),
|
|
1823
|
+
c.showPagination ? (d(), P("div", gt, [
|
|
1824
|
+
b(_e, {
|
|
1825
|
+
"current-page": V.currentPage,
|
|
1826
|
+
"onUpdate:currentPage": y[1] || (y[1] = (m) => V.currentPage = m),
|
|
1827
|
+
"page-size": V.pageSize,
|
|
1828
|
+
"onUpdate:pageSize": y[2] || (y[2] = (m) => V.pageSize = m),
|
|
1829
|
+
total: V.total,
|
|
1830
|
+
layout: "total, sizes, prev, pager, next",
|
|
1831
|
+
background: "",
|
|
1832
|
+
size: r.size,
|
|
1833
|
+
onSizeChange: ge,
|
|
1834
|
+
onCurrentChange: ve
|
|
1835
|
+
}, null, 8, ["current-page", "page-size", "total", "size"])
|
|
1836
|
+
])) : N("", !0)
|
|
1837
|
+
]),
|
|
1838
|
+
b(De, {
|
|
1839
|
+
title: F.title,
|
|
1840
|
+
"close-on-click-modal": !1,
|
|
1841
|
+
"close-on-press-escape": !1,
|
|
1842
|
+
width: F.formDialogWidth,
|
|
1843
|
+
modelValue: O.value,
|
|
1844
|
+
"onUpdate:modelValue": y[5] || (y[5] = (m) => O.value = m),
|
|
1845
|
+
"destroy-on-close": !0,
|
|
1846
|
+
draggable: "",
|
|
1847
|
+
"append-to-body": !0,
|
|
1848
|
+
"align-center": ""
|
|
1849
|
+
}, Me({
|
|
1850
|
+
default: h(() => [
|
|
1851
|
+
b(ae, null, {
|
|
1852
|
+
default: h(() => [
|
|
1853
|
+
b(ee, {
|
|
1854
|
+
span: x.value ? 24 - x.value.span : 24
|
|
1855
|
+
}, {
|
|
1856
|
+
default: h(() => [
|
|
1857
|
+
b(ie, {
|
|
1858
|
+
ref_key: "formRef",
|
|
1859
|
+
ref: p,
|
|
1860
|
+
model: L.data,
|
|
1861
|
+
rules: W.value,
|
|
1862
|
+
size: "default",
|
|
1863
|
+
"label-width": F.labelWidth,
|
|
1864
|
+
"label-suffix": ":",
|
|
1865
|
+
class: te({ "curd-form-details": i.value === "details" })
|
|
1866
|
+
}, {
|
|
1867
|
+
default: h(() => [
|
|
1868
|
+
b(ae, null, {
|
|
1869
|
+
default: h(() => [
|
|
1870
|
+
b(ee, { span: 24 }, {
|
|
1871
|
+
default: h(() => [
|
|
1872
|
+
b(ae, null, {
|
|
1873
|
+
default: h(() => [
|
|
1874
|
+
(d(!0), P(R, null, K(T.formColumns, (m) => (d(), C(ee, {
|
|
1875
|
+
key: m.columnProperty,
|
|
1876
|
+
span: m.span || 12
|
|
1877
|
+
}, {
|
|
1878
|
+
default: h(() => [
|
|
1879
|
+
b(z, {
|
|
1880
|
+
label: m.columnLabel,
|
|
1881
|
+
prop: m.columnProperty
|
|
1882
|
+
}, {
|
|
1883
|
+
default: h(() => [
|
|
1884
|
+
i.value === "details" ? (d(), C(Ie, {
|
|
1885
|
+
key: 0,
|
|
1886
|
+
item: m,
|
|
1887
|
+
modelValue: L.data[m.columnProperty],
|
|
1888
|
+
"onUpdate:modelValue": (G) => L.data[m.columnProperty] = G,
|
|
1889
|
+
dropdownOptions: _(n).getDictOptionsByColumnProperty(m.columnProperty)
|
|
1890
|
+
}, null, 8, ["item", "modelValue", "onUpdate:modelValue", "dropdownOptions"])) : (d(), P(R, { key: 1 }, [
|
|
1891
|
+
m.showMethod === "slot" ? q(w.$slots, "form-" + m.columnProperty, {
|
|
1892
|
+
key: 0,
|
|
1893
|
+
item: m,
|
|
1894
|
+
scope: { ...w.scope, formData: L.data, data: L.data[m.columnProperty] }
|
|
1895
|
+
}, void 0, !0) : (d(), C(ce, {
|
|
1896
|
+
key: 1,
|
|
1897
|
+
item: m,
|
|
1898
|
+
modelValue: L.data[m.columnProperty],
|
|
1899
|
+
"onUpdate:modelValue": (G) => L.data[m.columnProperty] = G,
|
|
1900
|
+
dropdownOptions: _(n).getDictOptionsByColumnProperty(m.columnProperty),
|
|
1901
|
+
currentOperationType: i.value
|
|
1902
|
+
}, null, 8, ["item", "modelValue", "onUpdate:modelValue", "dropdownOptions", "currentOperationType"]))
|
|
1903
|
+
], 64))
|
|
1904
|
+
]),
|
|
1905
|
+
_: 2
|
|
1906
|
+
}, 1032, ["label", "prop"])
|
|
1907
|
+
]),
|
|
1908
|
+
_: 2
|
|
1909
|
+
}, 1032, ["span"]))), 128))
|
|
1910
|
+
]),
|
|
1911
|
+
_: 3
|
|
1912
|
+
})
|
|
1913
|
+
]),
|
|
1914
|
+
_: 3
|
|
1915
|
+
})
|
|
1916
|
+
]),
|
|
1917
|
+
_: 3
|
|
1918
|
+
})
|
|
1919
|
+
]),
|
|
1920
|
+
_: 3
|
|
1921
|
+
}, 8, ["model", "rules", "label-width", "class"])
|
|
1922
|
+
]),
|
|
1923
|
+
_: 3
|
|
1924
|
+
}, 8, ["span"]),
|
|
1925
|
+
x.value ? (d(), C(ee, {
|
|
1926
|
+
key: 0,
|
|
1927
|
+
span: x.value ? x.value.span : 0,
|
|
1928
|
+
style: { padding: "0 10px" }
|
|
1929
|
+
}, {
|
|
1930
|
+
default: h(() => [
|
|
1931
|
+
D.value ? (d(), C(tt, {
|
|
1932
|
+
key: 0,
|
|
1933
|
+
modelValue: L.data.wktstr,
|
|
1934
|
+
"onUpdate:modelValue": y[3] || (y[3] = (m) => L.data.wktstr = m),
|
|
1935
|
+
currentOperationType: i.value,
|
|
1936
|
+
mapViewData: r.mapViewData,
|
|
1937
|
+
geomType: w.geomType
|
|
1938
|
+
}, null, 8, ["modelValue", "currentOperationType", "mapViewData", "geomType"])) : N("", !0)
|
|
1939
|
+
]),
|
|
1940
|
+
_: 1
|
|
1941
|
+
}, 8, ["span"])) : N("", !0)
|
|
1942
|
+
]),
|
|
1943
|
+
_: 3
|
|
1944
|
+
})
|
|
1945
|
+
]),
|
|
1946
|
+
_: 2
|
|
1947
|
+
}, [
|
|
1948
|
+
i.value !== "details" ? {
|
|
1949
|
+
name: "footer",
|
|
1950
|
+
fn: h(() => [
|
|
1951
|
+
b($, {
|
|
1952
|
+
type: "primary",
|
|
1953
|
+
onClick: ke,
|
|
1954
|
+
loading: v.value
|
|
1955
|
+
}, {
|
|
1956
|
+
default: h(() => [...y[13] || (y[13] = [
|
|
1957
|
+
B("确定", -1)
|
|
1958
|
+
])]),
|
|
1959
|
+
_: 1
|
|
1960
|
+
}, 8, ["loading"]),
|
|
1961
|
+
b($, {
|
|
1962
|
+
onClick: y[4] || (y[4] = (m) => O.value = !1)
|
|
1963
|
+
}, {
|
|
1964
|
+
default: h(() => [...y[14] || (y[14] = [
|
|
1965
|
+
B("取消", -1)
|
|
1966
|
+
])]),
|
|
1967
|
+
_: 1
|
|
1968
|
+
})
|
|
1969
|
+
]),
|
|
1970
|
+
key: "0"
|
|
1971
|
+
} : void 0
|
|
1972
|
+
]), 1032, ["title", "width", "modelValue"])
|
|
1973
|
+
], 64);
|
|
1974
|
+
};
|
|
1975
|
+
}
|
|
1976
|
+
}), St = /* @__PURE__ */ Q(wt, [["__scopeId", "data-v-844ae082"]]);
|
|
1977
|
+
export {
|
|
1978
|
+
St as CurdForm,
|
|
1979
|
+
St as default
|
|
1980
|
+
};
|