@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 CHANGED
@@ -1,21 +1,21 @@
1
1
  import "./style.css";
2
- import { ref as E, watch as Z, createElementBlock as f, openBlock as p, createVNode as n, unref as a, withCtx as r, createElementVNode as m, computed as ee, resolveComponent as k, createTextVNode as B, createCommentVNode as O, Fragment as T, renderList as G, createBlock as le, toDisplayString as I, withModifiers as K, nextTick as j, reactive as ae, provide as oe, onMounted as ie, normalizeClass as de } from "vue";
3
- import { Form as se, FormItem as q, TinyInput as R, TinyButton as z, TinyGrid as ue, TinyGridColumn as S, TinySelect as W, TinyOption as w, TinyCheckbox as X, CollapseItem as re, Collapse as ce, Button as pe, TinySearch as me, Modal as fe } from "@opentiny/vue";
4
- import { IconSearch as ve } from "@opentiny/vue-icon";
5
- import { ButtonGroup as ge, SvgButton as H, PluginSetting as _e, PluginPanel as ye, SearchEmpty as he } from "@opentiny/tiny-engine-common";
6
- import { getMetaApi as A, META_SERVICE as F, useLayout as te } from "@opentiny/tiny-engine-meta-register";
7
- const P = (c, g) => {
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 [i, v] of g)
10
- C[i] = v;
9
+ for (const [d, g] of v)
10
+ C[d] = g;
11
11
  return C;
12
- }, Ve = { class: "section" }, Ce = { class: "form-item" }, xe = { class: "form-item" }, Me = { class: "form-item" }, be = { class: "form-item" }, Ee = { class: "form-item" }, ke = {
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: g }) {
18
- const C = c, i = E({ modelUrl: "undefined/platform-center/api/model-data", ...C.model }), v = E(), y = E({
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 Z(
30
+ return le(
31
31
  () => C.model,
32
- (b) => {
33
- i.value = b;
32
+ (M) => {
33
+ d.value = M;
34
34
  },
35
35
  { deep: !0 }
36
- ), g({
37
- getLocalValue: () => i.value,
38
- validate: () => v.value.validate()
39
- }), (b, h) => (p(), f("div", Ve, [
40
- n(a(se), {
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: v,
43
- model: i.value,
44
- rules: y.value
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
- m("div", Ce, [
48
- n(a(q), {
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: i.value.nameCn,
55
- "onUpdate:modelValue": h[0] || (h[0] = (V) => i.value.nameCn = 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
- m("div", xe, [
63
- n(a(q), {
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: i.value.nameEn,
70
- "onUpdate:modelValue": h[1] || (h[1] = (V) => i.value.nameEn = 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
- m("div", Me, [
78
- n(a(q), {
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: i.value.version,
85
- "onUpdate:modelValue": h[2] || (h[2] = (V) => i.value.version = 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
- m("div", be, [
93
- n(a(q), {
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: i.value.modelUrl,
100
- "onUpdate:modelValue": h[3] || (h[3] = (V) => i.value.modelUrl = 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
- m("div", Ee, [
108
- n(a(q), {
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: i.value.description,
117
- "onUpdate:modelValue": h[4] || (h[4] = (V) => i.value.description = 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
- }, Re = /* @__PURE__ */ P(ke, [["__scopeId", "data-v-c29b7783"]]), Ue = { class: "section" }, $e = { class: "field-table" }, Se = {
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
- }, Ie = { class: "expand-section" }, Ne = { class: "enum-values" }, De = {
137
+ }, De = { class: "expand-section" }, Ie = { class: "enum-values" }, Ne = {
133
138
  key: 1,
134
139
  class: "expand-content"
135
- }, we = { class: "expand-section" }, Ae = { class: "model-ref-section" }, Fe = {
140
+ }, Ae = { class: "expand-section" }, Fe = { class: "model-ref-section" }, Le = {
136
141
  key: 0,
137
142
  class: "model-ref-info"
138
- }, Le = {
143
+ }, qe = {
139
144
  key: 0,
140
145
  class: "editing-cell"
141
- }, qe = {
146
+ }, Be = {
142
147
  key: 1,
143
148
  class: "readonly-cell"
144
149
  }, Te = {
145
150
  key: 0,
146
151
  class: "editing-cell"
147
- }, Be = {
152
+ }, Oe = {
148
153
  key: 1,
149
154
  class: "readonly-cell"
150
- }, Oe = {
155
+ }, Pe = {
151
156
  key: 0,
152
157
  class: "editing-cell"
153
- }, Pe = {
158
+ }, ze = {
154
159
  key: 1,
155
160
  class: "readonly-cell"
156
- }, ze = {
161
+ }, Ge = {
157
162
  key: 0,
158
163
  class: "editing-cell"
159
- }, Ge = {
164
+ }, Ke = {
160
165
  key: 1,
161
166
  class: "readonly-cell"
162
- }, Ke = {
167
+ }, je = {
163
168
  key: 0,
164
169
  class: "editing-cell"
165
- }, je = {
170
+ }, He = {
166
171
  key: 1,
167
172
  class: "readonly-cell"
168
- }, He = { class: "field-actions" }, Je = ["onClick"], Qe = ["onClick"], We = {
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: g }) {
177
- const C = c, i = E(null), v = E(C.model), y = ee(() => C.availableModels.filter((l) => l.id !== C.model.id)), x = () => {
178
- var l, o;
179
- return ((o = (l = i.value) == null ? void 0 : l.getData) == null ? void 0 : o.call(l)) || [];
180
- }, b = (l) => {
181
- const o = y.value.find((_) => _.id === l);
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 = (l) => {
184
- var o, _;
185
- if (l.type === "Enum" || l.type === "ModelRef")
186
- l.isExpanded = !0, l.type === "Enum" && (!Array.isArray(l.options) || l.options.length === 0) && (l.options = [{ value: "", label: "" }]), l.type === "ModelRef" && (l.isModel = !0, l.defaultValue = l.defaultValue || null), j(() => {
187
- var t, d;
188
- (((d = (t = i.value) == null ? void 0 : t.getGridData) == null ? void 0 : d.call(t)) || []).forEach((u) => {
189
- u.id === l.id && !expandConfig.value.expandRowKeys.includes(u._RID) && expandConfig.value.expandRowKeys.push(u._RID);
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
- l.isExpanded = !1;
194
- const t = (((_ = (o = i.value) == null ? void 0 : o.getGridData) == null ? void 0 : _.call(o)) || []).find((d) => d.id === l.id);
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 d = expandConfig.value.expandRowKeys.indexOf(t._RID);
197
- d > -1 && expandConfig.value.expandRowKeys.splice(d, 1);
201
+ const i = expandConfig.value.expandRowKeys.indexOf(t._RID);
202
+ i > -1 && expandConfig.value.expandRowKeys.splice(i, 1);
198
203
  }
199
204
  }
200
- j(() => {
201
- v.value && v.value.parameters && (v.value.parameters = [...v.value.parameters]);
205
+ H(() => {
206
+ g.value && g.value.parameters && (g.value.parameters = [...g.value.parameters]);
202
207
  });
203
- }, V = (l) => ({
208
+ }, V = (e) => ({
204
209
  String: "字符串",
205
210
  Number: "数字",
206
211
  Boolean: "布尔值",
207
212
  Date: "日期",
208
213
  Enum: "枚举值",
209
214
  ModelRef: "模型引用"
210
- })[l] || l, $ = (l) => {
215
+ })[e] || e, $ = (e) => {
211
216
  var o;
212
- l._editCache = { ...l }, l.isEditing = !0, (l.type === "Enum" || l.type === "ModelRef") && (l.isExpanded = !0, l.type === "Enum" && (!Array.isArray(l.options) || l.options.length === 0) && (l.options = [{ value: "", label: "" }]), l.type === "ModelRef" && (l.isModel = !0, l.defaultValue = l.defaultValue || null), (((o = i.value) == null ? void 0 : o.getGridData()) || []).forEach((e) => {
213
- e.id === l.id && !expandConfig.value.expandRowKeys.includes(e._RID) && expandConfig.value.expandRowKeys.push(e._RID);
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 = (l) => {
216
- l.isEditing = !1, l.isExpanded = !1, l._editCache && JSON.stringify(l._editCache) !== JSON.stringify(l) && (l._editCache = null), l.isNew && delete l.isNew;
217
- }, M = (l) => {
218
- var e, t;
219
- l.isEditing = !1, l.isExpanded = !1;
220
- const _ = (((t = (e = i.value) == null ? void 0 : e.getGridData) == null ? void 0 : t.call(e)) || []).find((d) => d.id === l.id);
221
- if (_) {
222
- const d = expandConfig.value.expandRowKeys.indexOf(_._RID);
223
- d > -1 && expandConfig.value.expandRowKeys.splice(d, 1);
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 (l._editCache && (Object.assign(l, l._editCache), l._editCache = null), l.isNew) {
226
- const d = v.value.parameters.findIndex((u) => u.id === l.id);
227
- d > -1 && v.value.parameters.splice(d, 1);
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
- }, N = (l) => {
230
- const o = v.value.parameters.findIndex((_) => _.prop === l.prop);
231
- o > -1 && v.value.parameters.splice(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 g({
234
- fieldGrid: i,
238
+ return v({
239
+ fieldGrid: d,
235
240
  getGridData: x
236
- }), (l, o) => {
237
- const _ = k("svg-icon");
238
- return p(), f("div", Ue, [
239
- n(a(z), {
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] = (e) => l.$emit("add-field"))
247
+ onClick: o[0] || (o[0] = (l) => e.$emit("add-field"))
243
248
  }, {
244
249
  default: r(() => [
245
- n(_, { name: "add" }),
246
- o[1] || (o[1] = B(" 添加字段 ", -1))
250
+ n(y, { name: "add" }),
251
+ o[1] || (o[1] = I(" 添加字段 ", -1))
247
252
  ]),
248
253
  _: 1
249
254
  }),
250
- m("div", $e, [
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: i,
262
+ ref: d,
258
263
  style: { height: "100%" }
259
264
  }, {
260
265
  default: r(() => [
261
- n(a(S), {
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: e }) => [
271
- e.type === "Enum" ? (p(), f("div", Se, [
272
- m("div", Ie, [
273
- o[4] || (o[4] = m("h4", null, "默认选项(下拉框)", -1)),
274
- m("div", Ne, [
275
- (p(!0), f(T, null, G(e.options || [], (t, d) => (p(), f("div", {
276
- key: d,
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(z), {
293
+ n(a(P), {
294
294
  type: "text",
295
295
  size: "small",
296
- onClick: (u) => l.$emit("insert-enum-after", e, d)
296
+ onClick: (u) => e.$emit("insert-enum-after", l, i)
297
297
  }, {
298
298
  default: r(() => [...o[2] || (o[2] = [
299
- B("新增", -1)
299
+ I("新增", -1)
300
300
  ])]),
301
301
  _: 1
302
302
  }, 8, ["onClick"]),
303
- n(a(z), {
303
+ n(a(P), {
304
304
  type: "text",
305
305
  size: "small",
306
- onClick: (u) => l.$emit("remove-enum", e, d)
306
+ onClick: (u) => e.$emit("remove-enum", l, i)
307
307
  }, {
308
308
  default: r(() => [...o[3] || (o[3] = [
309
- B("删除", -1)
309
+ I("删除", -1)
310
310
  ])]),
311
311
  _: 1
312
312
  }, 8, ["onClick"])
313
313
  ]))), 128))
314
314
  ])
315
315
  ])
316
- ])) : e.type === "ModelRef" ? (p(), f("div", De, [
317
- m("div", we, [
318
- o[5] || (o[5] = m("h4", null, "引用的模型", -1)),
319
- m("div", Ae, [
320
- n(a(W), {
321
- modelValue: e.defaultValue,
322
- "onUpdate:modelValue": (t) => e.defaultValue = 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), f(T, null, G(y.value, (t) => (p(), le(a(w), {
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
- e.defaultValue ? (p(), f("div", Fe, [
337
- m("p", null, "已选择模型:" + I(b(e.defaultValue)), 1)
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(S), {
345
+ n(a(w), {
346
346
  field: "prop",
347
347
  title: "字段名称",
348
- width: "120"
348
+ width: "100"
349
349
  }, {
350
- default: r(({ row: e }) => [
351
- e.isEditing ? (p(), f("div", Le, [
350
+ default: r(({ row: l }) => [
351
+ l.isEditing ? (p(), m("div", qe, [
352
352
  n(a(R), {
353
- modelValue: e.prop,
354
- "onUpdate:modelValue": (t) => e.prop = 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(), f("div", qe, I(e.prop || "点击编辑"), 1))
358
+ ])) : (p(), m("div", Be, A(l.prop || "点击编辑"), 1))
359
359
  ]),
360
360
  _: 1
361
361
  }),
362
- n(a(S), {
362
+ n(a(w), {
363
363
  field: "type",
364
364
  title: "类型",
365
- width: "110"
365
+ width: "80"
366
366
  }, {
367
- default: r(({ row: e }) => [
368
- e.isEditing ? (p(), f("div", Te, [
369
- n(a(W), {
370
- modelValue: e.type,
371
- "onUpdate:modelValue": (t) => e.type = 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(e)
373
+ onChange: (t) => h(l)
374
374
  }, {
375
375
  default: r(() => [
376
- n(a(w), {
376
+ n(a(D), {
377
377
  value: "String",
378
378
  label: "字符串"
379
379
  }),
380
- n(a(w), {
380
+ n(a(D), {
381
381
  value: "Number",
382
382
  label: "数字"
383
383
  }),
384
- n(a(w), {
384
+ n(a(D), {
385
385
  value: "Boolean",
386
386
  label: "布尔值"
387
387
  }),
388
- n(a(w), {
388
+ n(a(D), {
389
389
  value: "Date",
390
390
  label: "日期"
391
391
  }),
392
- n(a(w), {
392
+ n(a(D), {
393
393
  value: "Enum",
394
394
  label: "枚举值"
395
395
  }),
396
- n(a(w), {
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(), f("div", Be, I(V(e.type)), 1))
403
+ ])) : (p(), m("div", Oe, A(V(l.type)), 1))
404
404
  ]),
405
405
  _: 1
406
406
  }),
407
- n(a(S), {
407
+ n(a(w), {
408
408
  field: "defaultValue",
409
409
  title: "默认值",
410
- width: "120"
410
+ width: "100"
411
411
  }, {
412
- default: r(({ row: e }) => [
413
- e.isEditing ? (p(), f("div", Oe, [
412
+ default: r(({ row: l }) => [
413
+ l.isEditing ? (p(), m("div", Pe, [
414
414
  n(a(R), {
415
- modelValue: e.defaultValue,
416
- "onUpdate:modelValue": (t) => e.defaultValue = 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(), f("div", Pe, I(e.defaultValue), 1))
420
+ ])) : (p(), m("div", ze, A(l.defaultValue), 1))
421
421
  ]),
422
422
  _: 1
423
423
  }),
424
- n(a(S), {
424
+ n(a(w), {
425
425
  field: "required",
426
426
  title: "必填",
427
427
  width: "60"
428
428
  }, {
429
- default: r(({ row: e }) => [
430
- e.isEditing ? (p(), f("div", ze, [
431
- n(a(X), {
432
- modelValue: e.required,
433
- "onUpdate:modelValue": (t) => e.required = 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(), f("div", Ge, [
436
- n(a(X), {
437
- modelValue: e.required,
438
- "onUpdate:modelValue": (t) => e.required = 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(S), {
445
+ n(a(w), {
446
446
  field: "description",
447
447
  title: "描述",
448
- width: "120"
448
+ width: "100"
449
449
  }, {
450
- default: r(({ row: e }) => [
451
- e.isEditing ? (p(), f("div", Ke, [
450
+ default: r(({ row: l }) => [
451
+ l.isEditing ? (p(), m("div", je, [
452
452
  n(a(R), {
453
- modelValue: e.description,
454
- "onUpdate:modelValue": (t) => e.description = 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(), f("div", je, I(e.description || "点击编辑"), 1))
458
+ ])) : (p(), m("div", He, A(l.description || "点击编辑"), 1))
459
459
  ]),
460
460
  _: 1
461
461
  }),
462
- n(a(S), {
462
+ n(a(w), {
463
463
  field: "operation",
464
464
  title: "操作",
465
465
  width: "90"
466
466
  }, {
467
- default: r(({ row: e }) => [
468
- m("div", He, [
469
- e.isEditing ? (p(), f(T, { key: 0 }, [
470
- m("span", {
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(e)
474
- }, "保存", 8, Je),
475
- m("span", {
473
+ onClick: (t) => s(l)
474
+ }, "保存", 8, Qe),
475
+ f("span", {
476
476
  type: "text",
477
477
  size: "mini",
478
- onClick: (t) => M(e)
479
- }, "取消", 8, Qe)
480
- ], 64)) : (p(), f(T, { key: 1 }, [
481
- m("span", null, [
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: K((t) => $(e), ["stop"])
484
+ onClick: j((t) => $(l), ["stop"])
485
485
  }, null, 8, ["onClick"])
486
486
  ]),
487
- m("span", null, [
488
- n(_, {
487
+ f("span", null, [
488
+ n(y, {
489
489
  name: "delete",
490
- onClick: K((t) => N(e), ["stop"])
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
- }, Xe = /* @__PURE__ */ P(We, [["__scopeId", "data-v-1e39724d"]]), L = "/material-center/api/model";
506
- function Ye(c = {}) {
507
- return A(F.Http).get(`${L}/list`, { params: c });
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 Ze(c) {
510
- return A(F.Http).post(`${L}/create`, c);
509
+ function el(c) {
510
+ return F(L.Http).post(`${q}/create`, c);
511
511
  }
512
- function el(c, g) {
513
- return A(F.Http).put(`${L}/update/${c}`, g);
512
+ function ll(c, v) {
513
+ return F(L.Http).put(`${q}/update/${c}`, v);
514
514
  }
515
- function ll(c) {
516
- return A(F.Http).delete(`${L}/delete/${c}`);
515
+ function tl(c) {
516
+ return F(L.Http).delete(`${q}/delete/${c}`);
517
517
  }
518
- function tl() {
519
- return A(F.Http).get(`${L}/table/list`);
518
+ function nl() {
519
+ return F(L.Http).get(`${q}/table/list`);
520
520
  }
521
- function nl(c) {
522
- return A(F.Http).get(`${L}/table/${c}`);
521
+ function al(c) {
522
+ return F(L.Http).get(`${q}/table/${c}`);
523
523
  }
524
- const Q = E(!1), Y = () => {
525
- Q.value = !0;
526
- }, J = () => {
527
- Q.value = !1;
528
- }, al = {
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: H,
532
- ButtonGroup: ge,
533
- ModelBasicForm: Re,
534
- FieldManager: Xe,
535
- TinyButton: pe,
536
- TinyCollapse: ce,
537
- TinyCollapseItem: re
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: g }) {
551
- const { PLUGIN_NAME: C } = te(), i = E(["general", "fields"]), v = E(), y = E(), x = E({
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
- }), b = () => {
561
- if (!v.value) return;
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
- v.value.parameters.push(s), j(() => {
572
- const M = document.querySelectorAll(".editing-cell .tiny-input");
573
- M.length > 0 && M[M.length - 1].focus();
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, M) => {
576
- s.options || (s.options = []), s.options.splice(M + 1, 0, { value: "", label: "" });
577
- }, V = (s, M) => {
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(M, 1);
583
+ s.options.splice(b, 1);
584
584
  }
585
585
  }, $ = async () => {
586
- var M;
587
- const s = (M = y.value) == null ? void 0 : M.getLocalValue();
588
- y.value.validate().then(async (N) => {
589
- var l;
590
- if (N) {
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 _ = !0, e = "";
601
- if (((l = o.parameters) == null ? void 0 : l.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, _ = !!t.defaultValue, e = t.prop);
603
- }), !_) {
604
- Notify({
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: `字段${e}未关联模型引用`
606
+ message: `字段${l}未关联模型引用`
607
607
  });
608
608
  return;
609
609
  }
610
- s.id === null ? (delete o.id, await Ze(o)) : await el(o.id, o), g("editCallback"), Notify({
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
- }), v.value = null;
613
+ }), g.value = null;
614
614
  }
615
615
  });
616
616
  };
617
- return Z(
617
+ return le(
618
618
  () => c.model,
619
619
  (s) => {
620
- v.value = s;
620
+ g.value = s;
621
621
  },
622
622
  { deep: !0 }
623
623
  ), {
624
- isShow: Q,
624
+ isShow: W,
625
625
  PLUGIN_NAME: C,
626
- activeName: i,
627
- modelBasicFormRef: y,
626
+ activeName: d,
627
+ modelBasicFormRef: _,
628
628
  expandConfig: x,
629
- selectedModel: v,
630
- closeModelSettingPanel: J,
631
- handleAddField: b,
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 ol(c, g, C, i, v, y) {
639
- const x = k("tiny-button"), b = k("svg-button"), h = k("button-group"), V = k("model-basic-form"), $ = k("tiny-collapse-item"), s = k("field-manager"), M = k("tiny-collapse"), N = k("plugin-setting");
640
- return i.isShow ? (p(), le(N, {
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": i.PLUGIN_NAME.ModelManager,
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
- n(x, {
651
- onClick: g[0] || (g[0] = (l) => {
652
- var o;
653
- return c.$emit("exportModel", (o = i.selectedModel) == null ? void 0 : o.id);
654
- })
655
- }, {
656
- default: r(() => [...g[2] || (g[2] = [
657
- B("导出SQL", -1)
658
- ])]),
659
- _: 1
660
- }),
661
- n(x, {
662
- type: "primary",
663
- onClick: i.saveModel
664
- }, {
665
- default: r(() => [...g[3] || (g[3] = [
666
- B("保存", -1)
667
- ])]),
668
- _: 1
669
- }, 8, ["onClick"]),
670
- n(b, {
671
- name: "close",
672
- onClick: i.closeModelSettingPanel
673
- }, null, 8, ["onClick"])
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(M, {
680
- modelValue: i.activeName,
681
- "onUpdate:modelValue": g[1] || (g[1] = (l) => i.activeName = l),
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: i.selectedModel
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: i.selectedModel,
706
- "expand-config": i.expandConfig,
713
+ model: d.selectedModel,
714
+ "expand-config": d.expandConfig,
707
715
  "available-models": C.models,
708
- onAddField: i.handleAddField,
709
- onInsertEnumAfter: i.insertEnumValueAfter,
710
- onRemoveEnum: i.removeEnumValue
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__ */ P(al, [["render", ol], ["__scopeId", "data-v-6efda822"]]), dl = { class: "plugin-modelmanager" }, sl = {
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" }, rl = ["onClick"], cl = { class: "model-info" }, pl = { class: "model-name" }, ml = { class: "model-english-name" }, fl = { class: "model-desc" }, vl = { class: "model-actions" }, gl = {
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: g }) {
739
- const C = g, { PLUGIN_NAME: i } = te(), v = ve(), y = E(null), x = E([]), b = E(""), h = ae({
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
- oe("panelState", h);
743
- const V = ee(() => b.value ? x.value.filter(
744
- (e) => (e.nameCn || "").toLowerCase().includes(b.value.toLowerCase()) || (e.description || "").toLowerCase().includes(b.value.toLowerCase())
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"), J();
747
- }, s = (e) => {
754
+ C("close"), Q();
755
+ }, s = (l) => {
748
756
  var t;
749
- ((t = e.parameters) == null ? void 0 : t.length) > 0 && e.parameters.forEach((d) => {
750
- d.isModel = !1, d.type === "Enum" && (d.options = typeof d.options == "string" ? JSON.parse(d.options) : d.options || []), d.type === "ModelRef" && (d.isModel = !0, d.defaultValue = Number(d.defaultValue));
751
- }), y.value = e, Y();
752
- }, M = () => {
753
- y.value = {
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
- }, Y();
762
- }, N = async (e) => {
763
- var d;
764
- const t = e.nameCn || e.nameEn || e.id;
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 fe.confirm({
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 ll(e.id);
772
- const D = x.value.findIndex((ne) => ne.id === e.id);
773
- D > -1 && (x.value.splice(D, 1), ((d = y.value) == null ? void 0 : d.id) === e.id && (y.value = null));
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
- }, l = async () => {
777
- const e = await Ye({
784
+ }, e = async () => {
785
+ const l = await Ze({
778
786
  currentPage: 1,
779
787
  pageSize: 500
780
788
  });
781
- x.value = e.records || [];
782
- }, o = async (e) => {
783
- var D;
784
- const t = e ? await nl(e) : await tl(), d = new Blob([t], { type: "text/sql" }), u = URL.createObjectURL(d), U = document.createElement("a");
785
- U.href = u, U.download = `${e ? (D = y.value) == null ? void 0 : D.nameEn : "models"}.sql`, document.body.appendChild(U), U.click(), document.body.removeChild(U), URL.revokeObjectURL(u);
786
- }, _ = async () => {
787
- await l(), y.value = null, J();
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 l();
791
- }), (e, t) => {
792
- const d = k("svg-icon");
793
- return p(), f("div", dl, [
794
- n(a(ye), {
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(i).ModelManager,
804
+ "fixed-name": a(d).ModelManager,
797
805
  fixedPanels: c.fixedPanels,
798
806
  onClose: $
799
807
  }, {
800
808
  header: r(() => [
801
- n(a(H), {
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
- m("div", sl, [
818
- n(a(me), {
819
- modelValue: b.value,
820
- "onUpdate:modelValue": t[0] || (t[0] = (u) => b.value = u)
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(v))
834
+ n(a(g))
824
835
  ]),
825
836
  _: 1
826
837
  }, 8, ["modelValue"])
827
838
  ]),
828
- m("div", ul, [
829
- x.value.length ? (p(!0), f(T, { key: 0 }, G(V.value, (u) => {
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(), f("div", {
842
+ return p(), m("div", {
832
843
  key: u.id,
833
- class: de(["model-item", { active: ((U = y.value) == null ? void 0 : U.id) === u.id }]),
834
- onClick: (D) => s(u)
844
+ class: se(["model-item", { active: ((U = _.value) == null ? void 0 : U.id) === u.id }])
835
845
  }, [
836
- m("div", cl, [
837
- m("div", pl, I(u.nameCn), 1),
838
- m("div", ml, I(u.nameEn), 1),
839
- m("div", fl, I(u.description || "暂无描述"), 1)
840
- ]),
841
- m("div", vl, [
842
- n(d, {
843
- name: "delete",
844
- onClick: K((D) => N(u), ["stop"])
845
- }, null, 8, ["onClick"])
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
- ], 10, rl);
864
+ ], 2);
848
865
  }), 128)) : O("", !0),
849
- n(a(he), {
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: y.value,
874
+ model: _.value,
858
875
  models: x.value,
859
- onEditCallback: _,
876
+ onDeleteCallback: S,
877
+ onEditCallback: y,
860
878
  onExportModel: o
861
879
  }, null, 8, ["model", "models"])
862
880
  ]);
863
881
  };
864
882
  }
865
- }, _l = /* @__PURE__ */ P(gl, [["__scopeId", "data-v-0c5de79e"]]), yl = {
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
- }, El = {
872
- ...yl,
873
- entry: _l
889
+ }, bl = {
890
+ ...gl,
891
+ entry: vl
874
892
  };
875
893
  export {
876
- El as default
894
+ bl as default
877
895
  };
878
896
  //# sourceMappingURL=index.js.map