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