china-mobile-international-custom-components 0.0.55 → 0.0.56

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.
@@ -1,16 +1,17 @@
1
1
  import { w as N } from "./chunks/index.bCzIhWFw.js";
2
- import { ref as S, computed as R, resolveDirective as B, createElementBlock as C, openBlock as c, normalizeStyle as K, normalizeClass as I, withDirectives as D, createBlock as m, unref as o, withCtx as u, createCommentVNode as r, createElementVNode as T, renderSlot as E, resolveDynamicComponent as j, createVNode as O, createTextVNode as M, toDisplayString as f } from "vue";
3
- import { ElUpload as z, ElIcon as g, ElButton as $, ElMessage as W } from "element-plus";
4
- import { g as X } from "./chunks/request.24c3shPx.js";
5
- import { u as F } from "./chunks/i18n.Bd7hh14j.js";
6
- import { McpIcon as V, MySpace as G, Space as q, Workflow as Y, Model as Z, WorkflowIcon3 as H, WorkflowIcon1 as J, Plugin as Q, IconEdit2 as ee, IconAdd as te, IconUpload2 as le, File as oe } from "color-message-aibox-vue";
7
- import './assets/FileUploader.css';const v = {
2
+ import { ref as S, computed as R, resolveComponent as B, resolveDirective as K, createElementBlock as C, openBlock as c, normalizeStyle as D, normalizeClass as h, withDirectives as j, createBlock as u, unref as o, withCtx as r, createElementVNode as f, createCommentVNode as T, renderSlot as I, resolveDynamicComponent as z, createVNode as O, createTextVNode as M, toDisplayString as m } from "vue";
3
+ import { ElUpload as $, ElIcon as v, ElButton as X, ElMessage as E } from "element-plus";
4
+ import { g as V } from "./chunks/request.24c3shPx.js";
5
+ import { u as W } from "./chunks/i18n.Bd7hh14j.js";
6
+ import { m as G } from "./chunks/mcp-tool.Nc4HT9IM.js";
7
+ import { MySpace as q, Space as Y, Workflow as Z, Model as H, WorkflowIcon3 as J, WorkflowIcon1 as Q, Plugin as ee, IconEdit2 as te, IconAdd as le, IconUpload2 as oe, File as ae } from "color-message-aibox-vue";
8
+ import './assets/FileUploader.css';const y = {
8
9
  卡片: "Card",
9
10
  按钮: "Button",
10
11
  面板: "Panel",
11
12
  自定义: "Custom"
12
- }, ae = () => {
13
- const { $request: t, $env: e } = X();
13
+ }, ne = () => {
14
+ const { $request: t, $env: e } = V();
14
15
  return {
15
16
  commonUpload: (n, l = "common") => t({
16
17
  method: "post",
@@ -20,10 +21,10 @@ import './assets/FileUploader.css';const v = {
20
21
  skipCamelToKebab: !0
21
22
  })
22
23
  };
23
- }, ne = { class: "card-uploader__mask" }, se = { key: 3 }, ie = { class: "panel-uploader__text" }, ce = { class: "panel-uploader__text--tip" }, de = {
24
+ }, se = { class: "card-uploader__mask" }, ie = { key: 4 }, ce = { class: "panel-uploader__text" }, de = { class: "panel-uploader__text--tip" }, pe = {
24
25
  key: 0,
25
26
  class: "panel-uploader__text--tip font-style"
26
- }, pe = { class: "panel-uploader__text--tip font-style" }, ue = {
27
+ }, ue = { class: "panel-uploader__text--tip font-style" }, re = {
27
28
  __name: "index",
28
29
  props: {
29
30
  uploadType: {
@@ -69,42 +70,41 @@ import './assets/FileUploader.css';const v = {
69
70
  },
70
71
  emits: ["on-success"],
71
72
  setup(t, { emit: e }) {
72
- const { t: a } = F(), n = S(!1), l = S(null), { commonUpload: x } = ae(), d = t, U = e, b = (s) => {
73
+ const { t: a } = W(), n = S(!1), l = S(null), { commonUpload: _ } = ne(), d = t, U = e, b = (s) => {
73
74
  const p = /\.([^.]+)$/, i = s.match(p);
74
75
  return i ? i[1] : null;
75
- }, h = (s, p, i) => {
76
- let _ = !0;
76
+ }, k = (s, p, i) => {
77
+ let g = !0;
77
78
  const P = s.name && s.name.toLowerCase();
78
79
  if (console.log(s.name, P, "fileName"), p && p.indexOf(b(P)) === -1) {
79
80
  const w = a("COMPONENTS.UPLOAD_TYPE_TIP", { type: p });
80
- W({
81
+ E({
81
82
  type: "warning",
82
83
  message: w
83
- }), _ = !1;
84
+ }), g = !1;
84
85
  }
85
86
  if (s.size > 1024 * 1024 * i) {
86
87
  const w = a("COMPONENTS.UPLOAD_SIZE_TIP", { size: i });
87
- W.warning(w), _ = !1;
88
+ E.warning(w), g = !1;
88
89
  }
89
- return _;
90
- }, k = {
91
- plugin: Q,
92
- agent: J,
93
- dialogue: H,
94
- model: Z,
95
- workflow: Y,
96
- space: q,
97
- "my-space": G,
98
- mcp: V
90
+ return g;
91
+ }, F = {
92
+ plugin: ee,
93
+ agent: Q,
94
+ dialogue: J,
95
+ model: H,
96
+ workflow: Z,
97
+ space: Y,
98
+ "my-space": q
99
99
  }, A = R(() => ({
100
100
  Card: "card-uploader",
101
101
  Button: "button-uploader",
102
102
  Panel: "panel-uploader"
103
- })[d.uploadType]), y = R(() => d.defaultUploadIcon ? k[d.defaultUploadIcon] : ""), L = async (s) => {
104
- if (h(s, d.acceptType, d.limitSize))
103
+ })[d.uploadType]), x = R(() => d.defaultUploadIcon ? F[d.defaultUploadIcon] : ""), L = async (s) => {
104
+ if (k(s, d.acceptType, d.limitSize))
105
105
  if (d.isMiio) {
106
106
  n.value = !0;
107
- const { data: i } = await x(
107
+ const { data: i } = await _(
108
108
  {
109
109
  file: s.raw
110
110
  },
@@ -119,108 +119,113 @@ import './assets/FileUploader.css';const v = {
119
119
  l.value.handleRemove(s);
120
120
  };
121
121
  return (s, p) => {
122
- const i = B("loading");
122
+ const i = B("el-image"), g = K("loading");
123
123
  return c(), C("div", {
124
- class: I(["file-uploader", t.defaultUploadIcon]),
125
- style: K({
124
+ class: h(["file-uploader", t.defaultUploadIcon]),
125
+ style: D({
126
126
  border: !t.defaultUploadIcon && t.uploadType === "Card" ? "1px dashed var(--el-border-color)" : "none",
127
127
  "border-radius": !t.defaultUploadIcon && t.uploadType === "Card" ? "8px" : "0",
128
- "background-image": y.value ? `url('${y.value}')` : "none"
128
+ "background-image": x.value ? `url('${x.value}')` : "none"
129
129
  })
130
130
  }, [
131
- D((c(), m(o(z), {
131
+ j((c(), u(o($), {
132
132
  ref_key: "uploader",
133
133
  ref: l,
134
- class: I(A.value),
134
+ class: h(A.value),
135
135
  action: "",
136
136
  "auto-upload": !1,
137
137
  limit: t.limitCount,
138
138
  "show-file-list": !1,
139
139
  accept: t.acceptType,
140
140
  multiple: t.multiple,
141
- drag: t.uploadType === o(v).面板,
141
+ drag: t.uploadType === o(y).面板,
142
142
  "on-change": L
143
143
  }, {
144
- default: u(() => [
145
- y.value ? (c(), m(o(g), {
144
+ default: r(() => [
145
+ x.value ? (c(), u(o(v), {
146
146
  key: 0,
147
147
  size: "64",
148
148
  class: "absolute"
149
149
  }, {
150
- default: u(() => [
151
- (c(), m(j(y.value)))
150
+ default: r(() => [
151
+ (c(), u(z(x.value)))
152
152
  ]),
153
153
  _: 1
154
- })) : r("", !0),
155
- T("div", ne, [
156
- O(o(g), {
154
+ })) : (c(), u(i, {
155
+ key: 1,
156
+ style: { width: "64px", height: "64px" },
157
+ src: o(G),
158
+ class: "absolute"
159
+ }, null, 8, ["src"])),
160
+ f("div", se, [
161
+ O(o(v), {
157
162
  color: "#fff",
158
163
  size: "16px"
159
164
  }, {
160
- default: u(() => [
161
- O(o(ee))
165
+ default: r(() => [
166
+ O(o(te))
162
167
  ]),
163
168
  _: 1
164
169
  })
165
170
  ]),
166
- t.uploadType === o(v).卡片 ? (c(), m(o(g), {
167
- key: 1,
171
+ t.uploadType === o(y).卡片 ? (c(), u(o(v), {
172
+ key: 2,
168
173
  class: "card-uploader__icon"
169
174
  }, {
170
- default: u(() => [
171
- t.defaultUploadIcon ? r("", !0) : (c(), m(o(te), { key: 0 })),
172
- E(s.$slots, "text-slot")
175
+ default: r(() => [
176
+ t.defaultUploadIcon ? T("", !0) : (c(), u(o(le), { key: 0 })),
177
+ I(s.$slots, "text-slot")
173
178
  ]),
174
179
  _: 3
175
- })) : r("", !0),
176
- t.uploadType === o(v).按钮 ? (c(), m(o($), {
177
- key: 2,
180
+ })) : T("", !0),
181
+ t.uploadType === o(y).按钮 ? (c(), u(o(X), {
182
+ key: 3,
178
183
  type: "primary"
179
184
  }, {
180
- default: u(() => [
181
- O(o(g), { style: { "margin-right": "5px" } }, {
182
- default: u(() => [
183
- O(o(le))
185
+ default: r(() => [
186
+ O(o(v), { style: { "margin-right": "5px" } }, {
187
+ default: r(() => [
188
+ O(o(oe))
184
189
  ]),
185
190
  _: 1
186
191
  }),
187
- M(" " + f(o(a)("COMMON_BUTTON.UPLOAD_TEXT")), 1)
192
+ M(" " + m(o(a)("COMMON_BUTTON.UPLOAD_TEXT")), 1)
188
193
  ]),
189
194
  _: 1
190
- })) : r("", !0),
191
- t.uploadType === o(v).面板 ? (c(), C("div", se, [
192
- O(o(g), { size: "48px" }, {
193
- default: u(() => [
194
- O(o(oe))
195
+ })) : T("", !0),
196
+ t.uploadType === o(y).面板 ? (c(), C("div", ie, [
197
+ O(o(v), { size: "48px" }, {
198
+ default: r(() => [
199
+ O(o(ae))
195
200
  ]),
196
201
  _: 1
197
202
  }),
198
- T("div", ie, [
199
- T("div", ce, [
200
- T("span", null, f(o(a)("COMMON_BUTTON.CLICK_TEXT")), 1),
201
- M(" " + f(o(a)("COMMON_BUTTON.OR_TEXT")) + " ", 1),
202
- T("span", null, f(o(a)("COMMON_BUTTON.DRAG_TEXT")), 1),
203
- M(" " + f(o(a)("COMMON_BUTTON.FILE_UPLOAD_TEXT")), 1)
203
+ f("div", ce, [
204
+ f("div", de, [
205
+ f("span", null, m(o(a)("COMMON_BUTTON.CLICK_TEXT")), 1),
206
+ M(" " + m(o(a)("COMMON_BUTTON.OR_TEXT")) + " ", 1),
207
+ f("span", null, m(o(a)("COMMON_BUTTON.DRAG_TEXT")), 1),
208
+ M(" " + m(o(a)("COMMON_BUTTON.FILE_UPLOAD_TEXT")), 1)
204
209
  ]),
205
- t.warnTips2 ? (c(), C("div", de, f(t.warnTips2), 1)) : r("", !0),
206
- T("div", pe, f(t.warnTips), 1)
210
+ t.warnTips2 ? (c(), C("div", pe, m(t.warnTips2), 1)) : T("", !0),
211
+ f("div", ue, m(t.warnTips), 1)
207
212
  ])
208
- ])) : r("", !0),
209
- t.uploadType === o(v).自定义 ? E(s.$slots, "upload-box", { key: 4 }) : r("", !0)
213
+ ])) : T("", !0),
214
+ t.uploadType === o(y).自定义 ? I(s.$slots, "upload-box", { key: 5 }) : T("", !0)
210
215
  ]),
211
216
  _: 3
212
217
  }, 8, ["class", "limit", "accept", "multiple", "drag"])), [
213
- [i, n.value]
218
+ [g, n.value]
214
219
  ])
215
220
  ], 6);
216
221
  };
217
222
  }
218
- }, ve = (t) => {
219
- const { t: e } = F();
223
+ }, xe = (t) => {
224
+ const { t: e } = W();
220
225
  let a = t.toLowerCase(), n = "", l = "";
221
- const x = e("WORKFLOW_COM.TIP_TEXT_3");
222
- return a.includes("file") ? (l = "jpg、jpeg、png、webp、doc、docx、ppt、pptx、pdf、txt、xls、xlsx、csv、mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv、mp3、wav、aac、flac、ogg", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("image") ? (l = "jpg、jpeg、png、webp", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("doc") ? (l = "doc、docx", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("ppt") ? (l = "ppt、pptx", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("pdf") ? (l = "pdf", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("txt") ? (l = "txt", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("excel") ? (l = "xls、xlsx、csv", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("audio") ? (l = "mp3、wav、aac、flac、ogg", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("video") && (l = "mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })), n + x;
223
- }, ye = (t) => {
226
+ const _ = e("WORKFLOW_COM.TIP_TEXT_3");
227
+ return a.includes("file") ? (l = "jpg、jpeg、png、webp、doc、docx、ppt、pptx、pdf、txt、xls、xlsx、csv、mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv、mp3、wav、aac、flac、ogg", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("image") ? (l = "jpg、jpeg、png、webp", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("doc") ? (l = "doc、docx", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("ppt") ? (l = "ppt、pptx", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("pdf") ? (l = "pdf", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("txt") ? (l = "txt", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("excel") ? (l = "xls、xlsx、csv", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("audio") ? (l = "mp3、wav、aac、flac、ogg", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("video") && (l = "mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })), n + _;
228
+ }, _e = (t) => {
224
229
  let e = t.toLowerCase();
225
230
  if (e.includes("file"))
226
231
  return ".jpg,.jpeg,.png,.webp,.doc,.docx,.ppt,.pptx,.pdf,.txt,.xls,.xlsx,.csv,.mp4,.mkv,.webm,.ts,.avi,.mov,.flv,.3gp,.ogv,.mp3,.wav,.aac,.flac,.ogg";
@@ -240,15 +245,15 @@ import './assets/FileUploader.css';const v = {
240
245
  return ".mp3,.wav,.aac,.flac,.ogg";
241
246
  if (e.includes("video"))
242
247
  return ".mp4,.mkv,.webm,.ts,.avi,.mov,.flv,.3gp,.ogv";
243
- }, xe = (t) => {
248
+ }, we = (t) => {
244
249
  const e = t.match(/array(\w+)/);
245
250
  return e && e[1] ? e[1].toLowerCase() : null;
246
- }, _e = N(ue);
251
+ }, Ce = N(re);
247
252
  export {
248
- _e as FileUploader,
249
- v as UploadTypesEnum,
250
- _e as default,
251
- xe as extractAndLowerCaseArrayType,
252
- ye as getAcceptType,
253
- ve as getWarnTips
253
+ Ce as FileUploader,
254
+ y as UploadTypesEnum,
255
+ Ce as default,
256
+ we as extractAndLowerCaseArrayType,
257
+ _e as getAcceptType,
258
+ xe as getWarnTips
254
259
  };
@@ -1,186 +1,185 @@
1
- import { w as S } from "./chunks/index.bCzIhWFw.js";
2
- import { ref as u, nextTick as w, resolveComponent as B, createBlock as G, openBlock as N, unref as I, normalizeClass as U, withCtx as A, createVNode as F, createElementVNode as L, createTextVNode as h, toDisplayString as R } from "vue";
3
- import { useDialog as $, DialogContainer as x } from "./DialogContainer.mjs";
1
+ import { w as B } from "./chunks/index.bCzIhWFw.js";
2
+ import { ref as f, nextTick as U, createBlock as G, openBlock as N, unref as D, normalizeClass as b, withCtx as A, createVNode as O, createElementVNode as L, createTextVNode as h, toDisplayString as F } from "vue";
3
+ import { ElMessage as n, ElButton as w } from "element-plus";
4
+ import { useDialog as x, DialogContainer as $ } from "./DialogContainer.mjs";
4
5
  import { CreateMcpForm as k } from "./CreateMcpForm.mjs";
5
6
  import { u as V } from "./chunks/i18n.Bd7hh14j.js";
6
7
  import { useRouter as X } from "vue-router";
7
8
  import { g as z } from "./chunks/request.24c3shPx.js";
8
9
  import { _ as Q } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
9
- import { ElMessage as v } from "element-plus";
10
- import './assets/McpFormDialog.css';const b = () => {
10
+ import './assets/McpFormDialog.css';const y = () => {
11
11
  const { $request: _, $env: a } = z();
12
12
  return {
13
- createMcp: (l) => _({
13
+ createMcp: (s) => _({
14
14
  url: `${a.VITE_APP_AIBOX_BASE_URL}/api/v1/mcp/customize`,
15
15
  method: "post",
16
- data: l
16
+ data: s
17
17
  }),
18
- getMcpDetail: (l) => _({
19
- url: `${a.VITE_APP_AIBOX_BASE_URL}/api/v1/mcp/customize/${l}`,
18
+ getMcpDetail: (s) => _({
19
+ url: `${a.VITE_APP_AIBOX_BASE_URL}/api/v1/mcp/customize/${s}`,
20
20
  method: "get"
21
21
  }),
22
- updateMcp: (l, e) => _({
23
- url: `${a.VITE_APP_AIBOX_BASE_URL}/api/v1/mcp/customize/${l}`,
22
+ updateMcp: (s, e) => _({
23
+ url: `${a.VITE_APP_AIBOX_BASE_URL}/api/v1/mcp/customize/${s}`,
24
24
  method: "put",
25
25
  data: e
26
26
  })
27
27
  };
28
28
  };
29
29
  function ae(_ = {}) {
30
- const { t: a, onSuccess: g, onError: M } = _, P = () => {
31
- const { getMcpDetail: o, updateMcp: t, createMcp: r } = b();
32
- return { getMcpDetail: o, updateMcp: t, createMcp: r };
33
- }, l = u(!0), e = u(null), f = u(!1), i = u(null), E = async (o, t) => {
34
- if (!o || !o.bnid && !o.id) {
35
- v.error(a?.("MCPFORMDIALOG.MCP_ID_REQUIRED") || "缺少MCP ID,无法编辑");
30
+ const { t: a, onSuccess: g, onError: M } = _, E = () => {
31
+ const { getMcpDetail: r, updateMcp: t, createMcp: o } = y();
32
+ return { getMcpDetail: r, updateMcp: t, createMcp: o };
33
+ }, s = f(!0), e = f(null), m = f(!1), u = f(null), I = async (r, t) => {
34
+ if (!r || !r.bnid && !r.id) {
35
+ n.error(a?.("MCPFORMDIALOG.MCP_ID_REQUIRED") || "缺少MCP ID,无法编辑");
36
36
  return;
37
37
  }
38
- const r = o.bnid || o.id;
39
- e.value = r, l.value = !0, t();
38
+ const o = r.bnid || r.id;
39
+ e.value = o, s.value = !0, t();
40
40
  try {
41
- const { getMcpDetail: n } = P(), p = await n(r);
42
- p.code === 0 && p.data ? (await w(), i.value && i.value.setFormData(p.data)) : m();
43
- } catch (n) {
44
- console.error("获取MCP详情失败:", n), m();
41
+ const { getMcpDetail: l } = E(), p = await l(o);
42
+ p.code === 0 && p.data ? (await U(), u.value && u.value.setFormData(p.data)) : d();
43
+ } catch (l) {
44
+ console.error("获取MCP详情失败:", l), d();
45
45
  }
46
- }, m = (o) => {
47
- o && o(), e.value = null, l.value = !0;
46
+ }, d = (r) => {
47
+ r && r(), e.value = null, s.value = !0;
48
48
  };
49
49
  return {
50
50
  // 状态
51
- isEdit: l,
51
+ isEdit: s,
52
52
  currentBnid: e,
53
- btnLoading: f,
54
- createFormRef: i,
53
+ btnLoading: m,
54
+ createFormRef: u,
55
55
  // 方法
56
- showEditDialog: E,
57
- hideEditDialog: m,
58
- submitForm: async (o, t) => {
59
- if (f.value = !0, !i.value) {
60
- console.error("表单引用不存在"), f.value = !1;
56
+ showEditDialog: I,
57
+ hideEditDialog: d,
58
+ submitForm: async (r, t) => {
59
+ if (m.value = !0, !u.value) {
60
+ console.error("表单引用不存在"), m.value = !1;
61
61
  return;
62
62
  }
63
63
  try {
64
- if (await i.value.validate()) {
65
- const n = i.value.getFormData();
64
+ if (await u.value.validate()) {
65
+ const l = u.value.getFormData();
66
66
  if (!e.value) {
67
- v.error(a?.("MCPFORMDIALOG.MCP_ID_REQUIRED") || "缺少MCP ID,无法更新"), f.value = !1;
67
+ n.error(a?.("MCPFORMDIALOG.MCP_ID_REQUIRED") || "缺少MCP ID,无法更新"), m.value = !1;
68
68
  return;
69
69
  }
70
- const { updateMcp: p } = P(), d = await p(e.value, n);
71
- if (d.code === 0)
72
- v.success(a?.("MCPFORMDIALOG.UPDATE_SUCCESS") || "更新MCP成功"), m(o), g && g(n, e.value), t && t("refresh");
73
- else if (d.code === -1)
74
- console.error("更新MCP失败,返回数据异常:", d), v.error(d.msg || a?.("MCPFORMDIALOG.UPDATE_FAIL"));
70
+ const { updateMcp: p } = E(), C = await p(e.value, l);
71
+ if (C.code === 0)
72
+ n.success(a?.("MCPFORMDIALOG.UPDATE_SUCCESS") || "更新MCP成功"), d(r), g && g(l, e.value), t && t("refresh");
73
+ else if (C.code === -1)
74
+ console.error("更新MCP失败,返回数据异常:", C), n.error(C.msg || a?.("MCPFORMDIALOG.UPDATE_FAIL"));
75
75
  else {
76
- const C = d.msg || a?.("MCPFORMDIALOG.UPDATE_FAIL") || "更新MCP失败";
77
- v.error(C), M && M(new Error(C));
76
+ const v = C.msg || a?.("MCPFORMDIALOG.UPDATE_FAIL") || "更新MCP失败";
77
+ n.error(v), M && M(new Error(v));
78
78
  }
79
79
  }
80
- } catch (r) {
81
- console.error("表单提交错误:", r), v.error(r.message || a?.("MCPFORMDIALOG.UPDATE_FAIL") || "更新MCP失败"), M && M(r);
80
+ } catch (o) {
81
+ console.error("表单提交错误:", o), n.error(o.message || a?.("MCPFORMDIALOG.UPDATE_FAIL") || "更新MCP失败"), M && M(o);
82
82
  } finally {
83
- f.value = !1;
83
+ m.value = !1;
84
84
  }
85
85
  }
86
86
  };
87
87
  }
88
88
  const q = {
89
- class: /* @__PURE__ */ U("custom-mcp-dialog__footer")
89
+ class: /* @__PURE__ */ b("custom-mcp-dialog__footer")
90
90
  }, j = {
91
91
  __name: "McpFormDialog",
92
92
  emits: ["refresh"],
93
93
  setup(_, { expose: a, emit: g }) {
94
- const { getMcpDetail: M, updateMcp: P, createMcp: l } = b(), { t: e } = V(), { dialogRef: f, showDialog: i, hideDialog: E } = $(), m = g, T = X(), o = u(!1), t = u(null), r = u(null), n = u(!1), p = () => {
95
- o.value = !1, r.value = null, i();
96
- }, d = async (D) => {
97
- o.value = !0, r.value = D.bnid, i();
94
+ const { getMcpDetail: M, updateMcp: E, createMcp: s } = y(), { t: e } = V(), { dialogRef: m, showDialog: u, hideDialog: I } = x(), d = g, R = X(), r = f(!1), t = f(null), o = f(null), l = f(!1), p = () => {
95
+ r.value = !1, o.value = null, u();
96
+ }, C = async (P) => {
97
+ r.value = !0, o.value = P.bnid, u();
98
98
  try {
99
- const c = await M(D.bnid);
100
- c.code === 0 && c.data ? (await w(), t.value && t.value.setFormData(c.data)) : E();
99
+ const c = await M(P.bnid);
100
+ c.code === 0 && c.data ? (await U(), t.value && t.value.setFormData(c.data)) : I();
101
101
  } catch (c) {
102
- console.error("获取MCP详情失败:", c), E();
102
+ console.error("获取MCP详情失败:", c), I();
103
103
  }
104
- }, C = () => {
105
- E(), r.value = null;
106
- }, y = async () => {
107
- if (n.value = !0, !t.value) {
104
+ }, v = () => {
105
+ I(), o.value = null;
106
+ }, S = async () => {
107
+ if (l.value = !0, !t.value) {
108
108
  console.error("表单引用不存在");
109
109
  return;
110
110
  }
111
111
  try {
112
112
  if (await t.value.validate()) {
113
113
  const c = t.value.getFormData();
114
- if (o.value) {
115
- if (!r.value) {
116
- ElMessage.error(e("MCPFORMDIALOG.MCP_ID_REQUIRED") || "缺少MCP ID,无法更新");
114
+ if (r.value) {
115
+ if (!o.value) {
116
+ n.error(
117
+ e("MCPFORMDIALOG.MCP_ID_REQUIRED") || "缺少MCP ID,无法更新"
118
+ );
117
119
  return;
118
120
  }
119
- const s = await P(r.value, c);
120
- s.code === 0 ? (ElMessage.success(e("MCPFORMDIALOG.UPDATE_SUCCESS") || "更新MCP成功"), C(), m("refresh")) : s.code === -1 && (console.error("更新MCP失败,返回数据异常:", s), ElMessage.error(s.msg || e("MCPFORMDIALOG.UPDATE_FAIL")));
121
+ const i = await E(o.value, c);
122
+ i.code === 0 ? (n.success(e("MCPFORMDIALOG.UPDATE_SUCCESS") || "更新MCP成功"), v(), d("refresh")) : i.code === -1 && (console.error("更新MCP失败,返回数据异常:", i), n.error(i.msg || e("MCPFORMDIALOG.UPDATE_FAIL")));
121
123
  } else {
122
- const s = await l(c);
123
- if (console.log("创建MCP响应:", s), s.code === 0) {
124
- const O = s.data;
125
- ElMessage.success(e("MCPFORMDIALOG.CREATE_SUCCESS") || "创建MCP成功"), C(), m("refresh"), O ? T.push({
124
+ const i = await s(c);
125
+ if (console.log("创建MCP响应:", i), i.code === 0) {
126
+ const T = i.data;
127
+ n.success(e("MCPFORMDIALOG.CREATE_SUCCESS") || "创建MCP成功"), v(), d("refresh"), T ? R.push({
126
128
  name: "MCPTool",
127
129
  params: {
128
- bnId: O
130
+ bnId: T
129
131
  }
130
132
  }) : console.warn("创建MCP成功,但未返回bnid,无法跳转");
131
133
  } else
132
- console.error("创建MCP失败,返回数据异常:", s);
134
+ console.error("创建MCP失败,返回数据异常:", i);
133
135
  }
134
136
  }
135
- } catch (D) {
136
- console.error("表单提交错误:", D);
137
+ } catch (P) {
138
+ console.error("表单提交错误:", P);
137
139
  } finally {
138
- n.value = !1;
140
+ l.value = !1;
139
141
  }
140
142
  };
141
- return a({ showCreateDialog: p, showEditDialog: d }), (D, c) => {
142
- const s = B("el-button");
143
- return N(), G(I(x), {
144
- class: U("custom-mcp-dialog"),
145
- width: "520px",
146
- ref_key: "dialogRef",
147
- ref: f
148
- }, {
149
- title: A(() => [
150
- L("div", null, R(I(e)("MCPFORMDIALOG.TITLE")), 1)
151
- ]),
152
- footer: A(() => [
153
- L("div", q, [
154
- F(s, { onClick: C }, {
155
- default: A(() => [
156
- h(R(I(e)("COMMON_BUTTON.CANCEL_TEXT")), 1)
157
- ]),
158
- _: 1
159
- }),
160
- F(s, {
161
- color: "var(--el-color-primary)",
162
- type: "primary",
163
- onClick: c[0] || (c[0] = (O) => y()),
164
- loading: n.value
165
- }, {
166
- default: A(() => [
167
- h(R(I(e)("COMMON_BUTTON.CONFIRM_TEXT")), 1)
168
- ]),
169
- _: 1
170
- }, 8, ["loading"])
171
- ])
172
- ]),
173
- default: A(() => [
174
- F(I(k), {
175
- ref_key: "createFormRef",
176
- ref: t
177
- }, null, 512)
178
- ]),
179
- _: 1
180
- }, 512);
181
- };
143
+ return a({ showCreateDialog: p, showEditDialog: C }), (P, c) => (N(), G(D($), {
144
+ class: b("custom-mcp-dialog"),
145
+ width: "520px",
146
+ ref_key: "dialogRef",
147
+ ref: m
148
+ }, {
149
+ title: A(() => [
150
+ L("div", null, F(D(e)("MCPFORMDIALOG.TITLE")), 1)
151
+ ]),
152
+ footer: A(() => [
153
+ L("div", q, [
154
+ O(D(w), { onClick: v }, {
155
+ default: A(() => [
156
+ h(F(D(e)("COMMON_BUTTON.CANCEL_TEXT")), 1)
157
+ ]),
158
+ _: 1
159
+ }),
160
+ O(D(w), {
161
+ color: "var(--el-color-primary)",
162
+ type: "primary",
163
+ onClick: c[0] || (c[0] = (i) => S()),
164
+ loading: l.value
165
+ }, {
166
+ default: A(() => [
167
+ h(F(D(e)("COMMON_BUTTON.CONFIRM_TEXT")), 1)
168
+ ]),
169
+ _: 1
170
+ }, 8, ["loading"])
171
+ ])
172
+ ]),
173
+ default: A(() => [
174
+ O(D(k), {
175
+ ref_key: "createFormRef",
176
+ ref: t
177
+ }, null, 512)
178
+ ]),
179
+ _: 1
180
+ }, 512));
182
181
  }
183
- }, H = /* @__PURE__ */ Q(j, [["__scopeId", "data-v-69163ac9"]]), se = S(H);
182
+ }, H = /* @__PURE__ */ Q(j, [["__scopeId", "data-v-59311b3b"]]), se = B(H);
184
183
  export {
185
184
  se as McpFormDialog,
186
185
  se as default,