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