@opentiny/tiny-engine-plugin-model-manager 2.10.0-alpha.2 → 2.10.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 +407 -400
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import { ref as
|
|
3
|
-
import { Form as
|
|
4
|
-
import { IconSearch as
|
|
5
|
-
import { ButtonGroup as
|
|
6
|
-
import { getMetaApi as
|
|
7
|
-
const
|
|
8
|
-
const C =
|
|
9
|
-
for (const [
|
|
10
|
-
C[
|
|
2
|
+
import { ref as M, watch as ae, createElementBlock as v, openBlock as c, createVNode as t, unref as n, withCtx as r, createElementVNode as g, computed as ne, resolveComponent as S, createTextVNode as A, createCommentVNode as F, Fragment as P, renderList as H, createBlock as z, toDisplayString as L, withModifiers as Q, nextTick as W, reactive as se, provide as de, onMounted as ue, normalizeClass as re } from "vue";
|
|
3
|
+
import { Form as ce, FormItem as K, TinyInput as N, TinyButton as J, TinyGrid as pe, TinyGridColumn as I, TinySelect as Z, TinyOption as D, TinyCheckbox as ee, CollapseItem as me, Collapse as fe, Button as ve, Notify as le, TinySearch as ge, Modal as ye } from "@opentiny/vue";
|
|
4
|
+
import { IconSearch as _e } from "@opentiny/vue-icon";
|
|
5
|
+
import { ButtonGroup as he, SvgButton as X, PluginSetting as xe, PluginPanel as Ce, SearchEmpty as Ve } from "@opentiny/tiny-engine-common";
|
|
6
|
+
import { getMetaApi as q, META_SERVICE as B, useLayout as oe, useEnv as be } from "@opentiny/tiny-engine-meta-register";
|
|
7
|
+
const j = (p, y) => {
|
|
8
|
+
const C = p.__vccOpts || p;
|
|
9
|
+
for (const [s, m] of y)
|
|
10
|
+
C[s] = m;
|
|
11
11
|
return C;
|
|
12
|
-
},
|
|
12
|
+
}, Ee = { class: "section" }, Me = { class: "form-item" }, ke = { class: "form-item" }, Re = { class: "form-item" }, Se = { class: "form-item" }, Ue = {
|
|
13
13
|
__name: "ModelBasicForm",
|
|
14
14
|
props: {
|
|
15
15
|
model: { type: Object, required: !0 }
|
|
16
16
|
},
|
|
17
|
-
setup(
|
|
18
|
-
const C =
|
|
17
|
+
setup(p, { expose: y }) {
|
|
18
|
+
const C = p, s = M(C.model), m = M(), R = M({
|
|
19
19
|
nameCn: [
|
|
20
20
|
{ required: !0, message: "必填", trigger: "blur" },
|
|
21
21
|
{ min: 1, max: 32, message: "长度在1-32之间", trigger: "blur" }
|
|
@@ -24,24 +24,23 @@ const z = (c, v) => {
|
|
|
24
24
|
{ required: !0, message: "必填", trigger: "blur" },
|
|
25
25
|
{ min: 1, max: 32, message: "长度在1-32之间", trigger: "blur" }
|
|
26
26
|
],
|
|
27
|
-
version: [{ required: !0, message: "必填", trigger: "blur" }],
|
|
28
27
|
modelUrl: [{ min: 1, max: 200, message: "长度在1-200之间", trigger: "blur" }]
|
|
29
28
|
});
|
|
30
|
-
return
|
|
29
|
+
return ae(
|
|
31
30
|
() => C.model,
|
|
32
|
-
(
|
|
33
|
-
|
|
31
|
+
(h) => {
|
|
32
|
+
s.value = h;
|
|
34
33
|
},
|
|
35
34
|
{ deep: !0 }
|
|
36
|
-
),
|
|
37
|
-
getLocalValue: () =>
|
|
38
|
-
validate: () =>
|
|
39
|
-
}), (
|
|
40
|
-
n(
|
|
35
|
+
), y({
|
|
36
|
+
getLocalValue: () => s.value,
|
|
37
|
+
validate: () => m.value.validate()
|
|
38
|
+
}), (h, _) => (c(), v("div", Ee, [
|
|
39
|
+
t(n(ce), {
|
|
41
40
|
ref_key: "ruleFormRef",
|
|
42
|
-
ref:
|
|
43
|
-
model:
|
|
44
|
-
rules:
|
|
41
|
+
ref: m,
|
|
42
|
+
model: s.value,
|
|
43
|
+
rules: R.value,
|
|
45
44
|
"label-width": "120px",
|
|
46
45
|
"validate-type": "text",
|
|
47
46
|
"inline-message": !0,
|
|
@@ -49,77 +48,62 @@ const z = (c, v) => {
|
|
|
49
48
|
"label-position": "top"
|
|
50
49
|
}, {
|
|
51
50
|
default: r(() => [
|
|
52
|
-
|
|
53
|
-
n(
|
|
51
|
+
g("div", Me, [
|
|
52
|
+
t(n(K), {
|
|
54
53
|
label: "中文名称",
|
|
55
54
|
prop: "nameCn"
|
|
56
55
|
}, {
|
|
57
56
|
default: r(() => [
|
|
58
|
-
n(
|
|
59
|
-
modelValue:
|
|
60
|
-
"onUpdate:modelValue":
|
|
57
|
+
t(n(N), {
|
|
58
|
+
modelValue: s.value.nameCn,
|
|
59
|
+
"onUpdate:modelValue": _[0] || (_[0] = (E) => s.value.nameCn = E),
|
|
61
60
|
placeholder: "请输入模型中文名称"
|
|
62
61
|
}, null, 8, ["modelValue"])
|
|
63
62
|
]),
|
|
64
63
|
_: 1
|
|
65
64
|
})
|
|
66
65
|
]),
|
|
67
|
-
|
|
68
|
-
n(
|
|
66
|
+
g("div", ke, [
|
|
67
|
+
t(n(K), {
|
|
69
68
|
label: "英文名称",
|
|
70
69
|
prop: "nameEn"
|
|
71
70
|
}, {
|
|
72
71
|
default: r(() => [
|
|
73
|
-
n(
|
|
74
|
-
modelValue:
|
|
75
|
-
"onUpdate:modelValue":
|
|
72
|
+
t(n(N), {
|
|
73
|
+
modelValue: s.value.nameEn,
|
|
74
|
+
"onUpdate:modelValue": _[1] || (_[1] = (E) => s.value.nameEn = E),
|
|
76
75
|
placeholder: "请输入模型英文名称"
|
|
77
76
|
}, null, 8, ["modelValue"])
|
|
78
77
|
]),
|
|
79
78
|
_: 1
|
|
80
79
|
})
|
|
81
80
|
]),
|
|
82
|
-
|
|
83
|
-
n(
|
|
84
|
-
label: "版本号",
|
|
85
|
-
prop: "version"
|
|
86
|
-
}, {
|
|
87
|
-
default: r(() => [
|
|
88
|
-
n(a(R), {
|
|
89
|
-
modelValue: d.value.version,
|
|
90
|
-
"onUpdate:modelValue": h[2] || (h[2] = (V) => d.value.version = V),
|
|
91
|
-
placeholder: "1.0.0"
|
|
92
|
-
}, null, 8, ["modelValue"])
|
|
93
|
-
]),
|
|
94
|
-
_: 1
|
|
95
|
-
})
|
|
96
|
-
]),
|
|
97
|
-
f("div", Ee, [
|
|
98
|
-
n(a(B), {
|
|
81
|
+
g("div", Re, [
|
|
82
|
+
t(n(K), {
|
|
99
83
|
label: "模型地址",
|
|
100
84
|
prop: "modelUrl"
|
|
101
85
|
}, {
|
|
102
86
|
default: r(() => [
|
|
103
|
-
n(
|
|
104
|
-
modelValue:
|
|
105
|
-
"onUpdate:modelValue":
|
|
87
|
+
t(n(N), {
|
|
88
|
+
modelValue: s.value.modelUrl,
|
|
89
|
+
"onUpdate:modelValue": _[2] || (_[2] = (E) => s.value.modelUrl = E),
|
|
106
90
|
placeholder: "请输入模型地址,如:https://api.example.com/model"
|
|
107
91
|
}, null, 8, ["modelValue"])
|
|
108
92
|
]),
|
|
109
93
|
_: 1
|
|
110
94
|
})
|
|
111
95
|
]),
|
|
112
|
-
|
|
113
|
-
n(
|
|
96
|
+
g("div", Se, [
|
|
97
|
+
t(n(K), {
|
|
114
98
|
label: "描述",
|
|
115
99
|
prop: "description"
|
|
116
100
|
}, {
|
|
117
101
|
default: r(() => [
|
|
118
|
-
n(
|
|
102
|
+
t(n(N), {
|
|
119
103
|
type: "textarea",
|
|
120
104
|
rows: 3,
|
|
121
|
-
modelValue:
|
|
122
|
-
"onUpdate:modelValue":
|
|
105
|
+
modelValue: s.value.description,
|
|
106
|
+
"onUpdate:modelValue": _[3] || (_[3] = (E) => s.value.description = E),
|
|
123
107
|
placeholder: "请输入模型描述"
|
|
124
108
|
}, null, 8, ["modelValue"])
|
|
125
109
|
]),
|
|
@@ -131,25 +115,19 @@ const z = (c, v) => {
|
|
|
131
115
|
}, 8, ["model", "rules"])
|
|
132
116
|
]));
|
|
133
117
|
}
|
|
134
|
-
},
|
|
118
|
+
}, Ne = /* @__PURE__ */ j(Ue, [["__scopeId", "data-v-7966159f"]]), $e = { class: "section" }, we = { class: "field-table" }, Ie = {
|
|
135
119
|
key: 0,
|
|
136
120
|
class: "expand-content"
|
|
137
|
-
}, De = { class: "expand-section" },
|
|
121
|
+
}, De = { class: "expand-section" }, Ae = { class: "enum-values" }, Fe = {
|
|
138
122
|
key: 1,
|
|
139
123
|
class: "expand-content"
|
|
140
|
-
},
|
|
124
|
+
}, Oe = { class: "expand-section" }, Le = { class: "model-ref-section" }, qe = {
|
|
141
125
|
key: 0,
|
|
142
126
|
class: "model-ref-info"
|
|
143
|
-
}, qe = {
|
|
144
|
-
key: 0,
|
|
145
|
-
class: "editing-cell"
|
|
146
127
|
}, Be = {
|
|
147
|
-
key: 1,
|
|
148
|
-
class: "readonly-cell"
|
|
149
|
-
}, Te = {
|
|
150
128
|
key: 0,
|
|
151
129
|
class: "editing-cell"
|
|
152
|
-
},
|
|
130
|
+
}, Te = {
|
|
153
131
|
key: 1,
|
|
154
132
|
class: "readonly-cell"
|
|
155
133
|
}, Pe = {
|
|
@@ -164,13 +142,19 @@ const z = (c, v) => {
|
|
|
164
142
|
}, Ke = {
|
|
165
143
|
key: 1,
|
|
166
144
|
class: "readonly-cell"
|
|
167
|
-
},
|
|
145
|
+
}, Je = {
|
|
168
146
|
key: 0,
|
|
169
147
|
class: "editing-cell"
|
|
148
|
+
}, je = {
|
|
149
|
+
key: 1,
|
|
150
|
+
class: "readonly-cell"
|
|
170
151
|
}, He = {
|
|
152
|
+
key: 0,
|
|
153
|
+
class: "editing-cell"
|
|
154
|
+
}, Qe = {
|
|
171
155
|
key: 1,
|
|
172
156
|
class: "readonly-cell"
|
|
173
|
-
},
|
|
157
|
+
}, We = { class: "field-actions" }, Xe = ["onClick"], Ye = ["onClick"], Ze = {
|
|
174
158
|
__name: "FieldManager",
|
|
175
159
|
props: {
|
|
176
160
|
model: { type: Object, required: !0 },
|
|
@@ -178,316 +162,316 @@ const z = (c, v) => {
|
|
|
178
162
|
availableModels: { type: Array, default: () => [] }
|
|
179
163
|
},
|
|
180
164
|
emits: ["insert-enum-after", "remove-enum"],
|
|
181
|
-
setup(
|
|
182
|
-
const C =
|
|
165
|
+
setup(p, { expose: y }) {
|
|
166
|
+
const C = p, s = M(null), m = M(C.model), R = ne(() => C.availableModels.filter((e) => e.id !== C.model.id)), b = () => {
|
|
183
167
|
var e, o;
|
|
184
|
-
return ((o = (e =
|
|
185
|
-
}, M = (e) => {
|
|
186
|
-
const o = _.value.find((y) => y.id === e);
|
|
187
|
-
return o ? `${o.nameCn} (${o.nameEn})` : "未知模型";
|
|
168
|
+
return ((o = (e = s.value) == null ? void 0 : e.getData) == null ? void 0 : o.call(e)) || [];
|
|
188
169
|
}, h = (e) => {
|
|
189
|
-
|
|
170
|
+
const o = R.value.find((f) => f.id === e);
|
|
171
|
+
return o ? `${o.nameCn} (${o.nameEn})` : "未知模型";
|
|
172
|
+
}, _ = (e) => {
|
|
173
|
+
var o, f;
|
|
190
174
|
if (e.type === "Enum" || e.type === "ModelRef")
|
|
191
|
-
e.isExpanded = !0, e.type === "Enum" && (!Array.isArray(e.options) || e.options.length === 0) && (e.options = [{ value: "", label: "" }]), e.type === "ModelRef" && (e.isModel = !0, e.defaultValue = e.defaultValue || null),
|
|
192
|
-
var
|
|
193
|
-
(((i = (
|
|
194
|
-
|
|
175
|
+
e.isExpanded = !0, e.type === "Enum" && (!Array.isArray(e.options) || e.options.length === 0) && (e.options = [{ value: "", label: "" }]), e.type === "ModelRef" && (e.isModel = !0, e.defaultValue = e.defaultValue || null), W(() => {
|
|
176
|
+
var a, i;
|
|
177
|
+
(((i = (a = s.value) == null ? void 0 : a.getGridData) == null ? void 0 : i.call(a)) || []).forEach((d) => {
|
|
178
|
+
d.id === e.id && !expandConfig.value.expandRowKeys.includes(d._RID) && expandConfig.value.expandRowKeys.push(d._RID);
|
|
195
179
|
});
|
|
196
180
|
});
|
|
197
181
|
else {
|
|
198
182
|
e.isExpanded = !1;
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
201
|
-
const i = expandConfig.value.expandRowKeys.indexOf(
|
|
183
|
+
const a = (((f = (o = s.value) == null ? void 0 : o.getGridData) == null ? void 0 : f.call(o)) || []).find((i) => i.id === e.id);
|
|
184
|
+
if (a) {
|
|
185
|
+
const i = expandConfig.value.expandRowKeys.indexOf(a._RID);
|
|
202
186
|
i > -1 && expandConfig.value.expandRowKeys.splice(i, 1);
|
|
203
187
|
}
|
|
204
188
|
}
|
|
205
|
-
|
|
206
|
-
|
|
189
|
+
W(() => {
|
|
190
|
+
m.value && m.value.parameters && (m.value.parameters = [...m.value.parameters]);
|
|
207
191
|
});
|
|
208
|
-
},
|
|
192
|
+
}, E = (e) => ({
|
|
209
193
|
String: "字符串",
|
|
210
194
|
Number: "数字",
|
|
211
195
|
Boolean: "布尔值",
|
|
212
196
|
Date: "日期",
|
|
213
197
|
Enum: "枚举值",
|
|
214
198
|
ModelRef: "模型引用"
|
|
215
|
-
})[e] || e,
|
|
199
|
+
})[e] || e, k = (e) => {
|
|
216
200
|
var o;
|
|
217
|
-
e._editCache = { ...e }, e.isEditing = !0, (e.type === "Enum" || e.type === "ModelRef") && (e.isExpanded = !0, e.type === "Enum" && (!Array.isArray(e.options) || e.options.length === 0) && (e.options = [{ value: "", label: "" }]), e.type === "ModelRef" && (e.isModel = !0, e.defaultValue = e.defaultValue || null), (((o =
|
|
201
|
+
e._editCache = { ...e }, e.isEditing = !0, (e.type === "Enum" || e.type === "ModelRef") && (e.isExpanded = !0, e.type === "Enum" && (!Array.isArray(e.options) || e.options.length === 0) && (e.options = [{ value: "", label: "" }]), e.type === "ModelRef" && (e.isModel = !0, e.defaultValue = e.defaultValue || null), (((o = s.value) == null ? void 0 : o.getGridData()) || []).forEach((l) => {
|
|
218
202
|
l.id === e.id && !expandConfig.value.expandRowKeys.includes(l._RID) && expandConfig.value.expandRowKeys.push(l._RID);
|
|
219
203
|
}));
|
|
220
|
-
},
|
|
204
|
+
}, $ = (e) => {
|
|
221
205
|
e.isEditing = !1, e.isExpanded = !1, e._editCache && JSON.stringify(e._editCache) !== JSON.stringify(e) && (e._editCache = null), e.isNew && delete e.isNew;
|
|
222
|
-
},
|
|
223
|
-
var l,
|
|
206
|
+
}, w = (e) => {
|
|
207
|
+
var l, a;
|
|
224
208
|
e.isEditing = !1, e.isExpanded = !1;
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
227
|
-
const i = expandConfig.value.expandRowKeys.indexOf(
|
|
209
|
+
const f = (((a = (l = s.value) == null ? void 0 : l.getGridData) == null ? void 0 : a.call(l)) || []).find((i) => i.id === e.id);
|
|
210
|
+
if (f) {
|
|
211
|
+
const i = expandConfig.value.expandRowKeys.indexOf(f._RID);
|
|
228
212
|
i > -1 && expandConfig.value.expandRowKeys.splice(i, 1);
|
|
229
213
|
}
|
|
230
214
|
if (e._editCache && (Object.assign(e, e._editCache), e._editCache = null), e.isNew) {
|
|
231
|
-
const i =
|
|
232
|
-
i > -1 &&
|
|
215
|
+
const i = m.value.parameters.findIndex((d) => d.id === e.id);
|
|
216
|
+
i > -1 && m.value.parameters.splice(i, 1);
|
|
233
217
|
}
|
|
234
|
-
},
|
|
235
|
-
const o =
|
|
236
|
-
o > -1 &&
|
|
218
|
+
}, u = (e) => {
|
|
219
|
+
const o = m.value.parameters.findIndex((f) => f.prop === e.prop);
|
|
220
|
+
o > -1 && m.value.parameters.splice(o, 1);
|
|
237
221
|
};
|
|
238
|
-
return
|
|
239
|
-
fieldGrid:
|
|
240
|
-
getGridData:
|
|
222
|
+
return y({
|
|
223
|
+
fieldGrid: s,
|
|
224
|
+
getGridData: b
|
|
241
225
|
}), (e, o) => {
|
|
242
|
-
const
|
|
243
|
-
return
|
|
244
|
-
n(
|
|
226
|
+
const f = S("svg-icon");
|
|
227
|
+
return c(), v("div", $e, [
|
|
228
|
+
t(n(J), {
|
|
245
229
|
class: "add-field-btn",
|
|
246
230
|
size: "mini",
|
|
247
231
|
onClick: o[0] || (o[0] = (l) => e.$emit("add-field"))
|
|
248
232
|
}, {
|
|
249
233
|
default: r(() => [
|
|
250
|
-
|
|
251
|
-
o[1] || (o[1] =
|
|
234
|
+
t(f, { name: "add" }),
|
|
235
|
+
o[1] || (o[1] = A(" 添加字段 ", -1))
|
|
252
236
|
]),
|
|
253
237
|
_: 1
|
|
254
238
|
}),
|
|
255
|
-
|
|
256
|
-
n(
|
|
257
|
-
data:
|
|
239
|
+
g("div", we, [
|
|
240
|
+
t(n(pe), {
|
|
241
|
+
data: p.model.parameters,
|
|
258
242
|
"header-fixed": !0,
|
|
259
243
|
scrollable: { y: !0 },
|
|
260
|
-
"expand-config":
|
|
244
|
+
"expand-config": p.expandConfig,
|
|
261
245
|
ref_key: "fieldGrid",
|
|
262
|
-
ref:
|
|
246
|
+
ref: s,
|
|
263
247
|
style: { height: "100%" }
|
|
264
248
|
}, {
|
|
265
249
|
default: r(() => [
|
|
266
|
-
n(
|
|
250
|
+
t(n(I), {
|
|
267
251
|
type: "expand",
|
|
268
252
|
width: "20"
|
|
269
253
|
}, {
|
|
270
254
|
default: r(({ row: l }) => [
|
|
271
|
-
l.type === "Enum" ? (
|
|
272
|
-
|
|
273
|
-
o[4] || (o[4] =
|
|
274
|
-
|
|
275
|
-
(
|
|
255
|
+
l.type === "Enum" ? (c(), v("div", Ie, [
|
|
256
|
+
g("div", De, [
|
|
257
|
+
o[4] || (o[4] = g("h4", null, "默认选项(下拉框)", -1)),
|
|
258
|
+
g("div", Ae, [
|
|
259
|
+
(c(!0), v(P, null, H(l.options || [], (a, i) => (c(), v("div", {
|
|
276
260
|
key: i,
|
|
277
261
|
class: "enum-item"
|
|
278
262
|
}, [
|
|
279
|
-
n(
|
|
280
|
-
modelValue:
|
|
281
|
-
"onUpdate:modelValue": (
|
|
263
|
+
t(n(N), {
|
|
264
|
+
modelValue: a.value,
|
|
265
|
+
"onUpdate:modelValue": (d) => a.value = d,
|
|
282
266
|
placeholder: "值",
|
|
283
267
|
size: "small",
|
|
284
268
|
style: { width: "150px", "margin-right": "8px" }
|
|
285
269
|
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
286
|
-
n(
|
|
287
|
-
modelValue:
|
|
288
|
-
"onUpdate:modelValue": (
|
|
270
|
+
t(n(N), {
|
|
271
|
+
modelValue: a.label,
|
|
272
|
+
"onUpdate:modelValue": (d) => a.label = d,
|
|
289
273
|
placeholder: "显示标签",
|
|
290
274
|
size: "small",
|
|
291
275
|
style: { width: "200px", "margin-right": "8px" }
|
|
292
276
|
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
293
|
-
n(
|
|
277
|
+
t(n(J), {
|
|
294
278
|
type: "text",
|
|
295
279
|
size: "small",
|
|
296
|
-
onClick: (
|
|
280
|
+
onClick: (d) => e.$emit("insert-enum-after", l, i)
|
|
297
281
|
}, {
|
|
298
282
|
default: r(() => [...o[2] || (o[2] = [
|
|
299
|
-
|
|
283
|
+
A("新增", -1)
|
|
300
284
|
])]),
|
|
301
285
|
_: 1
|
|
302
286
|
}, 8, ["onClick"]),
|
|
303
|
-
n(
|
|
287
|
+
t(n(J), {
|
|
304
288
|
type: "text",
|
|
305
289
|
size: "small",
|
|
306
|
-
onClick: (
|
|
290
|
+
onClick: (d) => e.$emit("remove-enum", l, i)
|
|
307
291
|
}, {
|
|
308
292
|
default: r(() => [...o[3] || (o[3] = [
|
|
309
|
-
|
|
293
|
+
A("删除", -1)
|
|
310
294
|
])]),
|
|
311
295
|
_: 1
|
|
312
296
|
}, 8, ["onClick"])
|
|
313
297
|
]))), 128))
|
|
314
298
|
])
|
|
315
299
|
])
|
|
316
|
-
])) : l.type === "ModelRef" ? (
|
|
317
|
-
|
|
318
|
-
o[5] || (o[5] =
|
|
319
|
-
|
|
320
|
-
n(
|
|
300
|
+
])) : l.type === "ModelRef" ? (c(), v("div", Fe, [
|
|
301
|
+
g("div", Oe, [
|
|
302
|
+
o[5] || (o[5] = g("h4", null, "引用的模型", -1)),
|
|
303
|
+
g("div", Le, [
|
|
304
|
+
t(n(Z), {
|
|
321
305
|
modelValue: l.defaultValue,
|
|
322
|
-
"onUpdate:modelValue": (
|
|
306
|
+
"onUpdate:modelValue": (a) => l.defaultValue = a,
|
|
323
307
|
placeholder: "请选择要引用的模型",
|
|
324
308
|
size: "small",
|
|
325
309
|
style: { width: "100%" }
|
|
326
310
|
}, {
|
|
327
311
|
default: r(() => [
|
|
328
|
-
(
|
|
329
|
-
key:
|
|
330
|
-
value:
|
|
331
|
-
label: `${
|
|
312
|
+
(c(!0), v(P, null, H(R.value, (a) => (c(), z(n(D), {
|
|
313
|
+
key: a.id,
|
|
314
|
+
value: a.id,
|
|
315
|
+
label: `${a.nameCn} (${a.nameEn})`
|
|
332
316
|
}, null, 8, ["value", "label"]))), 128))
|
|
333
317
|
]),
|
|
334
318
|
_: 1
|
|
335
319
|
}, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
336
|
-
l.defaultValue ? (
|
|
337
|
-
|
|
338
|
-
])) :
|
|
320
|
+
l.defaultValue ? (c(), v("div", qe, [
|
|
321
|
+
g("p", null, "已选择模型:" + L(h(l.defaultValue)), 1)
|
|
322
|
+
])) : F("", !0)
|
|
339
323
|
])
|
|
340
324
|
])
|
|
341
|
-
])) :
|
|
325
|
+
])) : F("", !0)
|
|
342
326
|
]),
|
|
343
327
|
_: 1
|
|
344
328
|
}),
|
|
345
|
-
n(
|
|
329
|
+
t(n(I), {
|
|
346
330
|
field: "prop",
|
|
347
331
|
title: "字段名称",
|
|
348
332
|
width: "100"
|
|
349
333
|
}, {
|
|
350
334
|
default: r(({ row: l }) => [
|
|
351
|
-
l.isEditing ? (
|
|
352
|
-
n(
|
|
335
|
+
l.isEditing ? (c(), v("div", Be, [
|
|
336
|
+
t(n(N), {
|
|
353
337
|
modelValue: l.prop,
|
|
354
|
-
"onUpdate:modelValue": (
|
|
338
|
+
"onUpdate:modelValue": (a) => l.prop = a,
|
|
355
339
|
placeholder: "请输入字段名称",
|
|
356
340
|
size: "small"
|
|
357
341
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
358
|
-
])) : (
|
|
342
|
+
])) : (c(), v("div", Te, L(l.prop || "点击编辑"), 1))
|
|
359
343
|
]),
|
|
360
344
|
_: 1
|
|
361
345
|
}),
|
|
362
|
-
n(
|
|
346
|
+
t(n(I), {
|
|
363
347
|
field: "type",
|
|
364
348
|
title: "类型",
|
|
365
349
|
width: "80"
|
|
366
350
|
}, {
|
|
367
351
|
default: r(({ row: l }) => [
|
|
368
|
-
l.isEditing ? (
|
|
369
|
-
n(
|
|
352
|
+
l.isEditing ? (c(), v("div", Pe, [
|
|
353
|
+
t(n(Z), {
|
|
370
354
|
modelValue: l.type,
|
|
371
|
-
"onUpdate:modelValue": (
|
|
355
|
+
"onUpdate:modelValue": (a) => l.type = a,
|
|
372
356
|
size: "small",
|
|
373
|
-
onChange: (
|
|
357
|
+
onChange: (a) => _(l)
|
|
374
358
|
}, {
|
|
375
359
|
default: r(() => [
|
|
376
|
-
n(
|
|
360
|
+
t(n(D), {
|
|
377
361
|
value: "String",
|
|
378
362
|
label: "字符串"
|
|
379
363
|
}),
|
|
380
|
-
n(
|
|
364
|
+
t(n(D), {
|
|
381
365
|
value: "Number",
|
|
382
366
|
label: "数字"
|
|
383
367
|
}),
|
|
384
|
-
n(
|
|
368
|
+
t(n(D), {
|
|
385
369
|
value: "Boolean",
|
|
386
370
|
label: "布尔值"
|
|
387
371
|
}),
|
|
388
|
-
n(
|
|
372
|
+
t(n(D), {
|
|
389
373
|
value: "Date",
|
|
390
374
|
label: "日期"
|
|
391
375
|
}),
|
|
392
|
-
n(
|
|
376
|
+
t(n(D), {
|
|
393
377
|
value: "Enum",
|
|
394
378
|
label: "枚举值"
|
|
395
379
|
}),
|
|
396
|
-
n(
|
|
380
|
+
t(n(D), {
|
|
397
381
|
value: "ModelRef",
|
|
398
382
|
label: "模型引用"
|
|
399
383
|
})
|
|
400
384
|
]),
|
|
401
385
|
_: 1
|
|
402
386
|
}, 8, ["modelValue", "onUpdate:modelValue", "onChange"])
|
|
403
|
-
])) : (
|
|
387
|
+
])) : (c(), v("div", ze, L(E(l.type)), 1))
|
|
404
388
|
]),
|
|
405
389
|
_: 1
|
|
406
390
|
}),
|
|
407
|
-
n(
|
|
391
|
+
t(n(I), {
|
|
408
392
|
field: "defaultValue",
|
|
409
393
|
title: "默认值",
|
|
410
394
|
width: "100"
|
|
411
395
|
}, {
|
|
412
396
|
default: r(({ row: l }) => [
|
|
413
|
-
l.isEditing ? (
|
|
414
|
-
n(
|
|
397
|
+
l.isEditing ? (c(), v("div", Ge, [
|
|
398
|
+
t(n(N), {
|
|
415
399
|
modelValue: l.defaultValue,
|
|
416
|
-
"onUpdate:modelValue": (
|
|
400
|
+
"onUpdate:modelValue": (a) => l.defaultValue = a,
|
|
417
401
|
placeholder: "请输入默认值",
|
|
418
402
|
size: "small"
|
|
419
403
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
420
|
-
])) : (
|
|
404
|
+
])) : (c(), v("div", Ke, L(l.defaultValue), 1))
|
|
421
405
|
]),
|
|
422
406
|
_: 1
|
|
423
407
|
}),
|
|
424
|
-
n(
|
|
408
|
+
t(n(I), {
|
|
425
409
|
field: "required",
|
|
426
410
|
title: "必填",
|
|
427
411
|
width: "60"
|
|
428
412
|
}, {
|
|
429
413
|
default: r(({ row: l }) => [
|
|
430
|
-
l.isEditing ? (
|
|
431
|
-
n(
|
|
414
|
+
l.isEditing ? (c(), v("div", Je, [
|
|
415
|
+
t(n(ee), {
|
|
432
416
|
modelValue: l.required,
|
|
433
|
-
"onUpdate:modelValue": (
|
|
417
|
+
"onUpdate:modelValue": (a) => l.required = a
|
|
434
418
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
435
|
-
])) : (
|
|
436
|
-
n(
|
|
419
|
+
])) : (c(), v("div", je, [
|
|
420
|
+
t(n(ee), {
|
|
437
421
|
modelValue: l.required,
|
|
438
|
-
"onUpdate:modelValue": (
|
|
422
|
+
"onUpdate:modelValue": (a) => l.required = a,
|
|
439
423
|
disabled: ""
|
|
440
424
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
441
425
|
]))
|
|
442
426
|
]),
|
|
443
427
|
_: 1
|
|
444
428
|
}),
|
|
445
|
-
n(
|
|
429
|
+
t(n(I), {
|
|
446
430
|
field: "description",
|
|
447
431
|
title: "描述",
|
|
448
432
|
width: "100"
|
|
449
433
|
}, {
|
|
450
434
|
default: r(({ row: l }) => [
|
|
451
|
-
l.isEditing ? (
|
|
452
|
-
n(
|
|
435
|
+
l.isEditing ? (c(), v("div", He, [
|
|
436
|
+
t(n(N), {
|
|
453
437
|
modelValue: l.description,
|
|
454
|
-
"onUpdate:modelValue": (
|
|
438
|
+
"onUpdate:modelValue": (a) => l.description = a,
|
|
455
439
|
placeholder: "请输入字段描述",
|
|
456
440
|
size: "small"
|
|
457
441
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
458
|
-
])) : (
|
|
442
|
+
])) : (c(), v("div", Qe, L(l.description || "点击编辑"), 1))
|
|
459
443
|
]),
|
|
460
444
|
_: 1
|
|
461
445
|
}),
|
|
462
|
-
n(
|
|
446
|
+
t(n(I), {
|
|
463
447
|
field: "operation",
|
|
464
448
|
title: "操作",
|
|
465
449
|
width: "90"
|
|
466
450
|
}, {
|
|
467
451
|
default: r(({ row: l }) => [
|
|
468
|
-
|
|
469
|
-
l.isEditing ? (
|
|
470
|
-
|
|
452
|
+
g("div", We, [
|
|
453
|
+
l.isEditing ? (c(), v(P, { key: 0 }, [
|
|
454
|
+
g("span", {
|
|
471
455
|
type: "text",
|
|
472
456
|
size: "mini",
|
|
473
|
-
onClick: (
|
|
474
|
-
}, "保存", 8,
|
|
475
|
-
|
|
457
|
+
onClick: (a) => $(l)
|
|
458
|
+
}, "保存", 8, Xe),
|
|
459
|
+
g("span", {
|
|
476
460
|
type: "text",
|
|
477
461
|
size: "mini",
|
|
478
|
-
onClick: (
|
|
479
|
-
}, "取消", 8,
|
|
480
|
-
], 64)) : (
|
|
481
|
-
|
|
482
|
-
|
|
462
|
+
onClick: (a) => w(l)
|
|
463
|
+
}, "取消", 8, Ye)
|
|
464
|
+
], 64)) : (c(), v(P, { key: 1 }, [
|
|
465
|
+
g("span", null, [
|
|
466
|
+
t(f, {
|
|
483
467
|
name: "to-edit",
|
|
484
|
-
onClick:
|
|
468
|
+
onClick: Q((a) => k(l), ["stop"])
|
|
485
469
|
}, null, 8, ["onClick"])
|
|
486
470
|
]),
|
|
487
|
-
|
|
488
|
-
|
|
471
|
+
g("span", null, [
|
|
472
|
+
t(f, {
|
|
489
473
|
name: "delete",
|
|
490
|
-
onClick:
|
|
474
|
+
onClick: Q((a) => u(l), ["stop"])
|
|
491
475
|
}, null, 8, ["onClick"])
|
|
492
476
|
])
|
|
493
477
|
], 64))
|
|
@@ -502,39 +486,39 @@ const z = (c, v) => {
|
|
|
502
486
|
]);
|
|
503
487
|
};
|
|
504
488
|
}
|
|
505
|
-
},
|
|
506
|
-
function
|
|
507
|
-
return
|
|
489
|
+
}, el = /* @__PURE__ */ j(Ze, [["__scopeId", "data-v-d15af5f8"]]), T = "/material-center/api/model";
|
|
490
|
+
function ll(p = {}) {
|
|
491
|
+
return q(B.Http).get(`${T}/list`, { params: p });
|
|
508
492
|
}
|
|
509
|
-
function
|
|
510
|
-
return
|
|
493
|
+
function tl(p) {
|
|
494
|
+
return q(B.Http).post(`${T}/create`, p);
|
|
511
495
|
}
|
|
512
|
-
function
|
|
513
|
-
return
|
|
496
|
+
function al(p, y) {
|
|
497
|
+
return q(B.Http).put(`${T}/update/${p}`, y);
|
|
514
498
|
}
|
|
515
|
-
function
|
|
516
|
-
return
|
|
499
|
+
function nl(p) {
|
|
500
|
+
return q(B.Http).delete(`${T}/delete/${p}`);
|
|
517
501
|
}
|
|
518
|
-
function
|
|
519
|
-
return
|
|
502
|
+
function ol() {
|
|
503
|
+
return q(B.Http).get(`${T}/table/list`);
|
|
520
504
|
}
|
|
521
|
-
function
|
|
522
|
-
return
|
|
505
|
+
function il(p) {
|
|
506
|
+
return q(B.Http).get(`${T}/table/${p}`);
|
|
523
507
|
}
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
},
|
|
527
|
-
|
|
528
|
-
},
|
|
508
|
+
const Y = M(!1), te = () => {
|
|
509
|
+
Y.value = !0;
|
|
510
|
+
}, G = () => {
|
|
511
|
+
Y.value = !1;
|
|
512
|
+
}, sl = {
|
|
529
513
|
components: {
|
|
530
|
-
PluginSetting:
|
|
531
|
-
SvgButton:
|
|
532
|
-
ButtonGroup:
|
|
533
|
-
ModelBasicForm:
|
|
534
|
-
FieldManager:
|
|
535
|
-
TinyButton:
|
|
536
|
-
TinyCollapse:
|
|
537
|
-
TinyCollapseItem:
|
|
514
|
+
PluginSetting: xe,
|
|
515
|
+
SvgButton: X,
|
|
516
|
+
ButtonGroup: he,
|
|
517
|
+
ModelBasicForm: Ne,
|
|
518
|
+
FieldManager: el,
|
|
519
|
+
TinyButton: ve,
|
|
520
|
+
TinyCollapse: fe,
|
|
521
|
+
TinyCollapseItem: me
|
|
538
522
|
},
|
|
539
523
|
props: {
|
|
540
524
|
model: {
|
|
@@ -544,22 +528,26 @@ const W = E(!1), ee = () => {
|
|
|
544
528
|
models: {
|
|
545
529
|
type: Array,
|
|
546
530
|
default: () => []
|
|
531
|
+
},
|
|
532
|
+
showExport: {
|
|
533
|
+
type: Boolean,
|
|
534
|
+
default: !1
|
|
547
535
|
}
|
|
548
536
|
},
|
|
549
537
|
emits: ["editCallback", "exportModel", "deleteCallback"],
|
|
550
|
-
setup(
|
|
551
|
-
const { PLUGIN_NAME: C } =
|
|
538
|
+
setup(p, { emit: y }) {
|
|
539
|
+
const { PLUGIN_NAME: C } = oe(), s = M(["general", "fields"]), m = M(), R = M(), b = M({
|
|
552
540
|
expandAll: !1,
|
|
553
541
|
trigger: "row",
|
|
554
542
|
expandRowKeys: [],
|
|
555
543
|
accordion: !1,
|
|
556
|
-
activeMethod: (
|
|
544
|
+
activeMethod: (u) => u.type === "Enum" || u.type === "ModelRef",
|
|
557
545
|
// 枚举类型和模型引用类型都显示展开箭头
|
|
558
|
-
showIcon: (
|
|
546
|
+
showIcon: (u) => u.type === "Enum" || u.type === "ModelRef"
|
|
559
547
|
// 枚举类型和模型引用类型都显示展开箭头
|
|
560
|
-
}),
|
|
561
|
-
if (!
|
|
562
|
-
const
|
|
548
|
+
}), h = () => {
|
|
549
|
+
if (!m.value) return;
|
|
550
|
+
const u = {
|
|
563
551
|
prop: "",
|
|
564
552
|
type: "String",
|
|
565
553
|
required: !1,
|
|
@@ -568,115 +556,133 @@ const W = E(!1), ee = () => {
|
|
|
568
556
|
isNew: !0
|
|
569
557
|
// 新增字段标记
|
|
570
558
|
};
|
|
571
|
-
|
|
572
|
-
const
|
|
573
|
-
|
|
559
|
+
m.value.parameters.push(u), W(() => {
|
|
560
|
+
const e = document.querySelectorAll(".editing-cell .tiny-input");
|
|
561
|
+
e.length > 0 && e[e.length - 1].focus();
|
|
574
562
|
});
|
|
575
|
-
},
|
|
576
|
-
|
|
577
|
-
},
|
|
578
|
-
if (Array.isArray(
|
|
579
|
-
if (
|
|
580
|
-
|
|
563
|
+
}, _ = (u, e) => {
|
|
564
|
+
u.options || (u.options = []), u.options.splice(e + 1, 0, { value: "", label: "" });
|
|
565
|
+
}, E = (u, e) => {
|
|
566
|
+
if (Array.isArray(u.options)) {
|
|
567
|
+
if (u.options.length <= 1) {
|
|
568
|
+
u.options[0] = { value: "", label: "" };
|
|
581
569
|
return;
|
|
582
570
|
}
|
|
583
|
-
|
|
571
|
+
u.options.splice(e, 1);
|
|
584
572
|
}
|
|
585
|
-
}, $ = async () => {
|
|
586
|
-
var
|
|
587
|
-
const
|
|
588
|
-
|
|
589
|
-
var
|
|
590
|
-
if (
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
573
|
+
}, k = M(!1), $ = async () => {
|
|
574
|
+
var e;
|
|
575
|
+
const u = (e = R.value) == null ? void 0 : e.getLocalValue();
|
|
576
|
+
R.value.validate().then(async (o) => {
|
|
577
|
+
var f;
|
|
578
|
+
if (o) {
|
|
579
|
+
k.value = !0;
|
|
580
|
+
const l = {
|
|
581
|
+
description: u.description,
|
|
582
|
+
modelUrl: u.modelUrl,
|
|
583
|
+
nameCn: u.nameCn,
|
|
584
|
+
nameEn: u.nameEn,
|
|
585
|
+
version: u.version,
|
|
586
|
+
id: u.id,
|
|
587
|
+
parameters: JSON.parse(JSON.stringify(u.parameters.filter((d) => !!d.prop)))
|
|
599
588
|
};
|
|
600
|
-
let
|
|
601
|
-
if (((
|
|
602
|
-
|
|
603
|
-
}), !
|
|
604
|
-
|
|
589
|
+
let a = !0, i = "";
|
|
590
|
+
if (((f = l.parameters) == null ? void 0 : f.length) > 0 && l.parameters.forEach((d) => {
|
|
591
|
+
d.type === "Enum" && (d.options = JSON.stringify(d.options || [])), d.type === "ModelRef" && (d.isModel = !0, delete d.options, d.defaultValue = d.defaultValue || null, a = !!d.defaultValue, i = d.prop);
|
|
592
|
+
}), !a) {
|
|
593
|
+
le({
|
|
605
594
|
type: "error",
|
|
606
|
-
message: `字段${
|
|
607
|
-
});
|
|
595
|
+
message: `字段${i}未关联模型引用`
|
|
596
|
+
}), k.value = !1;
|
|
608
597
|
return;
|
|
609
598
|
}
|
|
610
|
-
|
|
599
|
+
u.id === null ? (delete l.id, await tl(l)) : await al(l.id, l), y("editCallback"), le({
|
|
611
600
|
type: "success",
|
|
612
601
|
message: "保存成功"
|
|
613
|
-
}),
|
|
602
|
+
}), G(), m.value = null, k.value = !1;
|
|
614
603
|
}
|
|
604
|
+
}).catch(() => {
|
|
605
|
+
k.value = !1;
|
|
615
606
|
});
|
|
607
|
+
}, w = () => {
|
|
608
|
+
y("deleteCallback", m.value), G();
|
|
616
609
|
};
|
|
617
|
-
return
|
|
618
|
-
() =>
|
|
619
|
-
(
|
|
620
|
-
|
|
610
|
+
return ae(
|
|
611
|
+
() => p.model,
|
|
612
|
+
(u) => {
|
|
613
|
+
if (!k.value && u) {
|
|
614
|
+
const e = JSON.parse(JSON.stringify(u));
|
|
615
|
+
e.parameters && e.parameters.forEach((o) => {
|
|
616
|
+
if (o.type === "Enum" && typeof o.options == "string")
|
|
617
|
+
try {
|
|
618
|
+
o.options = JSON.parse(o.options);
|
|
619
|
+
} catch {
|
|
620
|
+
o.options = [{ value: "", label: "" }];
|
|
621
|
+
}
|
|
622
|
+
}), m.value = e;
|
|
623
|
+
} else
|
|
624
|
+
m.value = u;
|
|
621
625
|
},
|
|
622
|
-
{ deep: !0 }
|
|
626
|
+
{ deep: !0, immediate: !0 }
|
|
623
627
|
), {
|
|
624
|
-
isShow:
|
|
628
|
+
isShow: Y,
|
|
625
629
|
PLUGIN_NAME: C,
|
|
626
|
-
activeName:
|
|
627
|
-
modelBasicFormRef:
|
|
628
|
-
expandConfig:
|
|
629
|
-
selectedModel:
|
|
630
|
-
closeModelSettingPanel:
|
|
631
|
-
handleAddField:
|
|
632
|
-
insertEnumValueAfter:
|
|
633
|
-
removeEnumValue:
|
|
634
|
-
saveModel:
|
|
630
|
+
activeName: s,
|
|
631
|
+
modelBasicFormRef: R,
|
|
632
|
+
expandConfig: b,
|
|
633
|
+
selectedModel: m,
|
|
634
|
+
closeModelSettingPanel: G,
|
|
635
|
+
handleAddField: h,
|
|
636
|
+
insertEnumValueAfter: _,
|
|
637
|
+
removeEnumValue: E,
|
|
638
|
+
saveModel: $,
|
|
639
|
+
deleteModel: w
|
|
635
640
|
};
|
|
636
641
|
}
|
|
637
642
|
};
|
|
638
|
-
function dl(
|
|
639
|
-
const
|
|
640
|
-
return
|
|
643
|
+
function dl(p, y, C, s, m, R) {
|
|
644
|
+
const b = S("tiny-button"), h = S("svg-button"), _ = S("button-group"), E = S("model-basic-form"), k = S("tiny-collapse-item"), $ = S("field-manager"), w = S("tiny-collapse"), u = S("plugin-setting");
|
|
645
|
+
return s.isShow ? (c(), z(u, {
|
|
641
646
|
key: 0,
|
|
642
|
-
"fixed-name":
|
|
643
|
-
align:
|
|
647
|
+
"fixed-name": s.PLUGIN_NAME.ModelManager,
|
|
648
|
+
align: p.align,
|
|
644
649
|
title: "模型设置",
|
|
645
650
|
class: "modelmanager-plugin-setting"
|
|
646
651
|
}, {
|
|
647
652
|
header: r(() => [
|
|
648
|
-
|
|
653
|
+
t(_, null, {
|
|
649
654
|
default: r(() => {
|
|
650
655
|
var e;
|
|
651
656
|
return [
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
657
|
+
C.showExport ? (c(), z(b, {
|
|
658
|
+
key: 0,
|
|
659
|
+
onClick: y[0] || (y[0] = (o) => {
|
|
660
|
+
var f;
|
|
661
|
+
return p.$emit("exportModel", (f = s.selectedModel) == null ? void 0 : f.id);
|
|
656
662
|
})
|
|
657
663
|
}, {
|
|
658
|
-
default: r(() => [...
|
|
659
|
-
|
|
664
|
+
default: r(() => [...y[2] || (y[2] = [
|
|
665
|
+
A("导出SQL", -1)
|
|
660
666
|
])]),
|
|
661
667
|
_: 1
|
|
662
|
-
}),
|
|
663
|
-
|
|
668
|
+
})) : F("", !0),
|
|
669
|
+
t(b, {
|
|
664
670
|
type: "primary",
|
|
665
|
-
onClick:
|
|
671
|
+
onClick: s.saveModel
|
|
666
672
|
}, {
|
|
667
|
-
default: r(() => [...
|
|
668
|
-
|
|
673
|
+
default: r(() => [...y[3] || (y[3] = [
|
|
674
|
+
A("保存", -1)
|
|
669
675
|
])]),
|
|
670
676
|
_: 1
|
|
671
677
|
}, 8, ["onClick"]),
|
|
672
|
-
(e =
|
|
673
|
-
key:
|
|
678
|
+
(e = s.selectedModel) != null && e.id ? (c(), z(h, {
|
|
679
|
+
key: 1,
|
|
674
680
|
name: "delete",
|
|
675
|
-
onClick:
|
|
676
|
-
})) :
|
|
677
|
-
|
|
681
|
+
onClick: s.deleteModel
|
|
682
|
+
}, null, 8, ["onClick"])) : F("", !0),
|
|
683
|
+
t(h, {
|
|
678
684
|
name: "close",
|
|
679
|
-
onClick:
|
|
685
|
+
onClick: s.closeModelSettingPanel
|
|
680
686
|
}, null, 8, ["onClick"])
|
|
681
687
|
];
|
|
682
688
|
}),
|
|
@@ -684,38 +690,38 @@ function dl(c, v, C, d, g, _) {
|
|
|
684
690
|
})
|
|
685
691
|
]),
|
|
686
692
|
content: r(() => [
|
|
687
|
-
|
|
688
|
-
modelValue:
|
|
689
|
-
"onUpdate:modelValue":
|
|
693
|
+
t(w, {
|
|
694
|
+
modelValue: s.activeName,
|
|
695
|
+
"onUpdate:modelValue": y[1] || (y[1] = (e) => s.activeName = e),
|
|
690
696
|
class: "page-setting-collapse"
|
|
691
697
|
}, {
|
|
692
698
|
default: r(() => [
|
|
693
|
-
|
|
699
|
+
t(k, {
|
|
694
700
|
title: "基本设置",
|
|
695
701
|
name: "general"
|
|
696
702
|
}, {
|
|
697
703
|
default: r(() => [
|
|
698
|
-
|
|
704
|
+
t(E, {
|
|
699
705
|
ref: "modelBasicFormRef",
|
|
700
|
-
model:
|
|
706
|
+
model: s.selectedModel
|
|
701
707
|
}, null, 8, ["model"])
|
|
702
708
|
]),
|
|
703
709
|
_: 1
|
|
704
710
|
}),
|
|
705
|
-
|
|
711
|
+
t(k, {
|
|
706
712
|
class: "base-setting",
|
|
707
713
|
title: "字段管理",
|
|
708
714
|
name: "fields"
|
|
709
715
|
}, {
|
|
710
716
|
default: r(() => [
|
|
711
|
-
|
|
717
|
+
t($, {
|
|
712
718
|
ref: "fieldManagerRef",
|
|
713
|
-
model:
|
|
714
|
-
"expand-config":
|
|
719
|
+
model: s.selectedModel,
|
|
720
|
+
"expand-config": s.expandConfig,
|
|
715
721
|
"available-models": C.models,
|
|
716
|
-
onAddField:
|
|
717
|
-
onInsertEnumAfter:
|
|
718
|
-
onRemoveEnum:
|
|
722
|
+
onAddField: s.handleAddField,
|
|
723
|
+
onInsertEnumAfter: s.insertEnumValueAfter,
|
|
724
|
+
onRemoveEnum: s.removeEnumValue
|
|
719
725
|
}, null, 8, ["model", "expand-config", "available-models", "onAddField", "onInsertEnumAfter", "onRemoveEnum"])
|
|
720
726
|
]),
|
|
721
727
|
_: 1
|
|
@@ -725,13 +731,13 @@ function dl(c, v, C, d, g, _) {
|
|
|
725
731
|
}, 8, ["modelValue"])
|
|
726
732
|
]),
|
|
727
733
|
_: 1
|
|
728
|
-
}, 8, ["fixed-name", "align"])) :
|
|
734
|
+
}, 8, ["fixed-name", "align"])) : F("", !0);
|
|
729
735
|
}
|
|
730
|
-
const
|
|
736
|
+
const ul = /* @__PURE__ */ j(sl, [["render", dl], ["__scopeId", "data-v-6c838220"]]), rl = { class: "plugin-modelmanager" }, cl = {
|
|
731
737
|
class: "model-manager-search",
|
|
732
738
|
clearable: "",
|
|
733
739
|
placeholder: "搜索"
|
|
734
|
-
},
|
|
740
|
+
}, pl = { class: "model-list" }, ml = { class: "item-label" }, fl = { class: "item-name" }, vl = { class: "item-handler" }, gl = {
|
|
735
741
|
__name: "Main",
|
|
736
742
|
props: {
|
|
737
743
|
title: {
|
|
@@ -743,154 +749,155 @@ const il = /* @__PURE__ */ z(ol, [["render", dl], ["__scopeId", "data-v-5a0998c5
|
|
|
743
749
|
}
|
|
744
750
|
},
|
|
745
751
|
emits: ["close"],
|
|
746
|
-
setup(
|
|
747
|
-
const C =
|
|
752
|
+
setup(p, { emit: y }) {
|
|
753
|
+
const C = y, { PLUGIN_NAME: s } = oe(), { VITE_ORIGIN: m } = be(), R = _e(), b = M(null), h = M([]), _ = M(""), E = M(!1), k = se({
|
|
748
754
|
emitEvent: C
|
|
749
755
|
});
|
|
750
|
-
de("panelState",
|
|
751
|
-
const
|
|
752
|
-
(
|
|
753
|
-
) :
|
|
754
|
-
C("close"),
|
|
755
|
-
},
|
|
756
|
-
var
|
|
757
|
-
((
|
|
758
|
-
|
|
759
|
-
}),
|
|
760
|
-
},
|
|
761
|
-
|
|
756
|
+
de("panelState", k);
|
|
757
|
+
const $ = ne(() => _.value ? h.value.filter(
|
|
758
|
+
(i) => (i.nameCn || "").toLowerCase().includes(_.value.toLowerCase()) || (i.description || "").toLowerCase().includes(_.value.toLowerCase())
|
|
759
|
+
) : h.value), w = () => {
|
|
760
|
+
C("close"), G();
|
|
761
|
+
}, u = (i) => {
|
|
762
|
+
var d;
|
|
763
|
+
((d = i.parameters) == null ? void 0 : d.length) > 0 && i.parameters.forEach((x) => {
|
|
764
|
+
x.isModel = !1, x.type === "Enum" && (x.options = typeof x.options == "string" ? JSON.parse(x.options) : x.options || []), x.type === "ModelRef" && (x.isModel = !0, x.defaultValue = Number(x.defaultValue));
|
|
765
|
+
}), b.value = i, te();
|
|
766
|
+
}, e = () => {
|
|
767
|
+
b.value = {
|
|
762
768
|
id: null,
|
|
763
769
|
nameCn: "",
|
|
764
770
|
nameEn: "",
|
|
765
|
-
|
|
766
|
-
modelUrl: "",
|
|
771
|
+
modelUrl: `${m}platform-center/api/model-data`,
|
|
767
772
|
description: "",
|
|
768
773
|
parameters: []
|
|
769
|
-
},
|
|
770
|
-
},
|
|
771
|
-
var
|
|
772
|
-
const
|
|
774
|
+
}, te();
|
|
775
|
+
}, o = async (i) => {
|
|
776
|
+
var x;
|
|
777
|
+
const d = i.nameCn || i.nameEn || i.id;
|
|
773
778
|
try {
|
|
774
|
-
const
|
|
779
|
+
const V = await ye.confirm({
|
|
775
780
|
title: "提示",
|
|
776
|
-
message: `确认删除模型「${
|
|
781
|
+
message: `确认删除模型「${d}」吗?该操作不可恢复。`
|
|
777
782
|
});
|
|
778
|
-
if (!(
|
|
779
|
-
await
|
|
780
|
-
const
|
|
781
|
-
|
|
783
|
+
if (!(V === "confirm" || (V == null ? void 0 : V.action) === "confirm" || V === !0 || V === void 0)) return;
|
|
784
|
+
await nl(i.id);
|
|
785
|
+
const O = h.value.findIndex((ie) => ie.id === i.id);
|
|
786
|
+
O > -1 && (h.value.splice(O, 1), ((x = b.value) == null ? void 0 : x.id) === i.id && (b.value = null));
|
|
782
787
|
} catch {
|
|
783
788
|
}
|
|
784
|
-
},
|
|
785
|
-
const
|
|
789
|
+
}, f = async () => {
|
|
790
|
+
const i = await ll({
|
|
786
791
|
currentPage: 1,
|
|
787
792
|
pageSize: 500
|
|
788
793
|
});
|
|
789
|
-
|
|
790
|
-
},
|
|
791
|
-
var
|
|
792
|
-
const
|
|
793
|
-
U.href =
|
|
794
|
-
},
|
|
795
|
-
await
|
|
794
|
+
h.value = i.records || [];
|
|
795
|
+
}, l = async (i) => {
|
|
796
|
+
var O;
|
|
797
|
+
const d = i ? await il(i) : await ol(), x = new Blob([d], { type: "text/sql" }), V = URL.createObjectURL(x), U = document.createElement("a");
|
|
798
|
+
U.href = V, U.download = `${i ? (O = b.value) == null ? void 0 : O.nameEn : "models"}.sql`, document.body.appendChild(U), U.click(), document.body.removeChild(U), URL.revokeObjectURL(V);
|
|
799
|
+
}, a = async () => {
|
|
800
|
+
await f(), b.value = null, G();
|
|
796
801
|
};
|
|
797
|
-
return
|
|
798
|
-
await
|
|
799
|
-
}), (
|
|
800
|
-
const
|
|
801
|
-
return
|
|
802
|
-
n(
|
|
803
|
-
title:
|
|
804
|
-
"fixed-name":
|
|
805
|
-
fixedPanels:
|
|
806
|
-
onClose:
|
|
802
|
+
return ue(async () => {
|
|
803
|
+
await f();
|
|
804
|
+
}), (i, d) => {
|
|
805
|
+
const x = S("svg-icon");
|
|
806
|
+
return c(), v("div", rl, [
|
|
807
|
+
t(n(Ce), {
|
|
808
|
+
title: p.title,
|
|
809
|
+
"fixed-name": n(s).ModelManager,
|
|
810
|
+
fixedPanels: p.fixedPanels,
|
|
811
|
+
onClose: w
|
|
807
812
|
}, {
|
|
808
813
|
header: r(() => [
|
|
809
|
-
|
|
814
|
+
E.value ? (c(), z(n(X), {
|
|
815
|
+
key: 0,
|
|
810
816
|
class: "flow-download-icon",
|
|
811
817
|
name: "flow-download",
|
|
812
818
|
placement: "bottom",
|
|
813
819
|
tips: "导出SQL",
|
|
814
|
-
onClick:
|
|
815
|
-
})
|
|
820
|
+
onClick: l
|
|
821
|
+
})) : F("", !0)
|
|
816
822
|
]),
|
|
817
823
|
content: r(() => [
|
|
818
|
-
n(
|
|
824
|
+
t(n(J), {
|
|
819
825
|
class: "add-model",
|
|
820
|
-
onClick:
|
|
826
|
+
onClick: e
|
|
821
827
|
}, {
|
|
822
828
|
default: r(() => [
|
|
823
|
-
|
|
824
|
-
|
|
829
|
+
t(x, { name: "add" }),
|
|
830
|
+
d[1] || (d[1] = A("新建模型 ", -1))
|
|
825
831
|
]),
|
|
826
832
|
_: 1
|
|
827
833
|
}),
|
|
828
|
-
|
|
829
|
-
n(
|
|
830
|
-
modelValue:
|
|
831
|
-
"onUpdate:modelValue":
|
|
834
|
+
g("div", cl, [
|
|
835
|
+
t(n(ge), {
|
|
836
|
+
modelValue: _.value,
|
|
837
|
+
"onUpdate:modelValue": d[0] || (d[0] = (V) => _.value = V)
|
|
832
838
|
}, {
|
|
833
839
|
prefix: r(() => [
|
|
834
|
-
n(
|
|
840
|
+
t(n(R))
|
|
835
841
|
]),
|
|
836
842
|
_: 1
|
|
837
843
|
}, 8, ["modelValue"])
|
|
838
844
|
]),
|
|
839
|
-
|
|
840
|
-
|
|
845
|
+
g("div", pl, [
|
|
846
|
+
h.value.length ? (c(!0), v(P, { key: 0 }, H($.value, (V) => {
|
|
841
847
|
var U;
|
|
842
|
-
return
|
|
843
|
-
key:
|
|
844
|
-
class:
|
|
848
|
+
return c(), v("div", {
|
|
849
|
+
key: V.id,
|
|
850
|
+
class: re(["model-item", { active: ((U = b.value) == null ? void 0 : U.id) === V.id }])
|
|
845
851
|
}, [
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
852
|
+
g("div", ml, [
|
|
853
|
+
g("div", fl, [
|
|
854
|
+
t(x, {
|
|
849
855
|
name: "plugin-icon-modelmanager",
|
|
850
856
|
class: "plugin-icon-modelmanager"
|
|
851
857
|
}),
|
|
852
|
-
|
|
858
|
+
A(" " + L(V.nameCn), 1)
|
|
853
859
|
]),
|
|
854
|
-
|
|
855
|
-
n(
|
|
860
|
+
g("div", vl, [
|
|
861
|
+
t(n(X), {
|
|
856
862
|
class: "set-page",
|
|
857
863
|
hoverBgColor: !1,
|
|
858
864
|
tips: "设置模型",
|
|
859
865
|
name: "setting",
|
|
860
|
-
onMousedown:
|
|
866
|
+
onMousedown: Q((O) => u(V), ["stop", "prevent"])
|
|
861
867
|
}, null, 8, ["onMousedown"])
|
|
862
868
|
])
|
|
863
869
|
])
|
|
864
870
|
], 2);
|
|
865
|
-
}), 128)) :
|
|
866
|
-
n(
|
|
867
|
-
isShow: !
|
|
871
|
+
}), 128)) : F("", !0),
|
|
872
|
+
t(n(Ve), {
|
|
873
|
+
isShow: !h.value.length
|
|
868
874
|
}, null, 8, ["isShow"])
|
|
869
875
|
])
|
|
870
876
|
]),
|
|
871
877
|
_: 1
|
|
872
878
|
}, 8, ["title", "fixed-name", "fixedPanels"]),
|
|
873
|
-
|
|
874
|
-
model:
|
|
875
|
-
models:
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
879
|
+
t(ul, {
|
|
880
|
+
model: b.value,
|
|
881
|
+
models: h.value,
|
|
882
|
+
showExport: E.value,
|
|
883
|
+
onDeleteCallback: o,
|
|
884
|
+
onEditCallback: a,
|
|
885
|
+
onExportModel: l
|
|
886
|
+
}, null, 8, ["model", "models", "showExport"])
|
|
880
887
|
]);
|
|
881
888
|
};
|
|
882
889
|
}
|
|
883
|
-
},
|
|
890
|
+
}, yl = /* @__PURE__ */ j(gl, [["__scopeId", "data-v-d102b73c"]]), _l = {
|
|
884
891
|
id: "engine.plugins.modelmanager",
|
|
885
892
|
title: "模型管理",
|
|
886
893
|
type: "plugins",
|
|
887
894
|
width: 280,
|
|
888
895
|
icon: "plugin-icon-modelmanager"
|
|
889
|
-
},
|
|
890
|
-
...
|
|
891
|
-
entry:
|
|
896
|
+
}, Ml = {
|
|
897
|
+
..._l,
|
|
898
|
+
entry: yl
|
|
892
899
|
};
|
|
893
900
|
export {
|
|
894
|
-
|
|
901
|
+
Ml as default
|
|
895
902
|
};
|
|
896
903
|
//# sourceMappingURL=index.js.map
|