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