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