china-mobile-international-custom-components 0.0.55 → 0.0.57
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/es/AddOrEditSupplierDialog.mjs +86 -86
- package/es/ApplicationIcon.mjs +38 -37
- package/es/AuthSection.mjs +155 -156
- package/es/CodeView.mjs +170 -0
- package/es/CreateMcpForm.mjs +235 -225
- package/es/FileUploader.mjs +89 -84
- package/es/McpFormDialog.mjs +113 -114
- package/es/RadioGroup.mjs +59 -60
- package/es/assets/AuthSection.css +1 -1
- package/es/assets/CodeView.css +1 -0
- package/es/assets/CreateMcpForm.css +1 -1
- package/es/assets/McpFormDialog.css +1 -1
- package/es/assets/RadioGroup.css +1 -1
- package/es/chunks/mcp-tool.Nc4HT9IM.js +4 -0
- package/es/index.mjs +107 -104
- package/lib/AddOrEditSupplierDialog.js +1 -1
- package/lib/ApplicationIcon.js +1 -1
- package/lib/AuthSection.js +1 -1
- package/lib/CodeView.js +1 -0
- package/lib/CreateMcpForm.js +1 -1
- package/lib/FileUploader.js +1 -1
- package/lib/McpFormDialog.js +1 -1
- package/lib/RadioGroup.js +1 -1
- package/lib/assets/AuthSection.css +1 -1
- package/lib/assets/CodeView.css +1 -0
- package/lib/assets/CreateMcpForm.css +1 -1
- package/lib/assets/McpFormDialog.css +1 -1
- package/lib/assets/RadioGroup.css +1 -1
- package/lib/chunks/mcp-tool.fb1SS2wA.js +1 -0
- package/lib/index.js +1 -1
- package/package.json +9 -3
package/es/FileUploader.mjs
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
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
|
|
3
|
-
import { ElUpload as z, ElIcon as g,
|
|
4
|
-
import { g as
|
|
5
|
-
import { u as
|
|
6
|
-
import {
|
|
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 u, unref as o, withCtx as r, createElementVNode as f, createCommentVNode as T, renderSlot as h, resolveDynamicComponent as j, createVNode as O, createTextVNode as M, toDisplayString as m } from "vue";
|
|
3
|
+
import { ElUpload as z, ElIcon as g, ElImage as $, 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";
|
|
7
8
|
import './assets/FileUploader.css';const v = {
|
|
8
9
|
卡片: "Card",
|
|
9
10
|
按钮: "Button",
|
|
10
11
|
面板: "Panel",
|
|
11
12
|
自定义: "Custom"
|
|
12
|
-
},
|
|
13
|
-
const { $request: t, $env: e } =
|
|
13
|
+
}, se = () => {
|
|
14
|
+
const { $request: t, $env: e } = V();
|
|
14
15
|
return {
|
|
15
|
-
commonUpload: (
|
|
16
|
+
commonUpload: (s, l = "common") => t({
|
|
16
17
|
method: "post",
|
|
17
18
|
url: `${e.VITE_APP_AIBOX_BASE_URL}/api/v1/common/file/upload?type=${l}`,
|
|
18
|
-
data:
|
|
19
|
+
data: s,
|
|
19
20
|
dataType: "formData",
|
|
20
21
|
skipCamelToKebab: !0
|
|
21
22
|
})
|
|
22
23
|
};
|
|
23
|
-
}, ne = { class: "card-uploader__mask" },
|
|
24
|
+
}, ne = { 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
|
-
},
|
|
27
|
+
}, ue = { class: "panel-uploader__text--tip font-style" }, re = {
|
|
27
28
|
__name: "index",
|
|
28
29
|
props: {
|
|
29
30
|
uploadType: {
|
|
@@ -69,56 +70,55 @@ import './assets/FileUploader.css';const v = {
|
|
|
69
70
|
},
|
|
70
71
|
emits: ["on-success"],
|
|
71
72
|
setup(t, { emit: e }) {
|
|
72
|
-
const { t: a } =
|
|
73
|
-
const p = /\.([^.]+)$/, i =
|
|
73
|
+
const { t: a } = W(), s = S(!1), l = S(null), { commonUpload: x } = se(), d = t, U = e, b = (n) => {
|
|
74
|
+
const p = /\.([^.]+)$/, i = n.match(p);
|
|
74
75
|
return i ? i[1] : null;
|
|
75
|
-
},
|
|
76
|
+
}, k = (n, p, i) => {
|
|
76
77
|
let _ = !0;
|
|
77
|
-
const P =
|
|
78
|
-
if (console.log(
|
|
78
|
+
const P = n.name && n.name.toLowerCase();
|
|
79
|
+
if (console.log(n.name, P, "fileName"), p && p.indexOf(b(P)) === -1) {
|
|
79
80
|
const w = a("COMPONENTS.UPLOAD_TYPE_TIP", { type: p });
|
|
80
|
-
|
|
81
|
+
E({
|
|
81
82
|
type: "warning",
|
|
82
83
|
message: w
|
|
83
84
|
}), _ = !1;
|
|
84
85
|
}
|
|
85
|
-
if (
|
|
86
|
+
if (n.size > 1024 * 1024 * i) {
|
|
86
87
|
const w = a("COMPONENTS.UPLOAD_SIZE_TIP", { size: i });
|
|
87
|
-
|
|
88
|
+
E.warning(w), _ = !1;
|
|
88
89
|
}
|
|
89
90
|
return _;
|
|
90
|
-
},
|
|
91
|
-
plugin:
|
|
92
|
-
agent:
|
|
93
|
-
dialogue:
|
|
94
|
-
model:
|
|
95
|
-
workflow:
|
|
96
|
-
space:
|
|
97
|
-
"my-space":
|
|
98
|
-
mcp: V
|
|
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 ?
|
|
104
|
-
if (
|
|
103
|
+
})[d.uploadType]), y = R(() => d.defaultUploadIcon ? F[d.defaultUploadIcon] : ""), L = async (n) => {
|
|
104
|
+
if (k(n, d.acceptType, d.limitSize))
|
|
105
105
|
if (d.isMiio) {
|
|
106
|
-
|
|
106
|
+
s.value = !0;
|
|
107
107
|
const { data: i } = await x(
|
|
108
108
|
{
|
|
109
|
-
file:
|
|
109
|
+
file: n.raw
|
|
110
110
|
},
|
|
111
111
|
d.businessType
|
|
112
112
|
).finally(() => {
|
|
113
|
-
|
|
113
|
+
s.value = !1;
|
|
114
114
|
});
|
|
115
115
|
console.log(i, "data"), U("on-success", i);
|
|
116
116
|
} else
|
|
117
|
-
U("on-success",
|
|
117
|
+
U("on-success", n);
|
|
118
118
|
else
|
|
119
|
-
l.value.handleRemove(
|
|
119
|
+
l.value.handleRemove(n);
|
|
120
120
|
};
|
|
121
|
-
return (
|
|
121
|
+
return (n, p) => {
|
|
122
122
|
const i = B("loading");
|
|
123
123
|
return c(), C("div", {
|
|
124
124
|
class: I(["file-uploader", t.defaultUploadIcon]),
|
|
@@ -128,7 +128,7 @@ import './assets/FileUploader.css';const v = {
|
|
|
128
128
|
"background-image": y.value ? `url('${y.value}')` : "none"
|
|
129
129
|
})
|
|
130
130
|
}, [
|
|
131
|
-
D((c(),
|
|
131
|
+
D((c(), u(o(z), {
|
|
132
132
|
ref_key: "uploader",
|
|
133
133
|
ref: l,
|
|
134
134
|
class: I(A.value),
|
|
@@ -141,86 +141,91 @@ import './assets/FileUploader.css';const v = {
|
|
|
141
141
|
drag: t.uploadType === o(v).面板,
|
|
142
142
|
"on-change": L
|
|
143
143
|
}, {
|
|
144
|
-
default:
|
|
145
|
-
y.value ? (c(),
|
|
144
|
+
default: r(() => [
|
|
145
|
+
y.value ? (c(), u(o(g), {
|
|
146
146
|
key: 0,
|
|
147
147
|
size: "64",
|
|
148
148
|
class: "absolute"
|
|
149
149
|
}, {
|
|
150
|
-
default:
|
|
151
|
-
(c(),
|
|
150
|
+
default: r(() => [
|
|
151
|
+
(c(), u(j(y.value)))
|
|
152
152
|
]),
|
|
153
153
|
_: 1
|
|
154
|
-
})) :
|
|
155
|
-
|
|
154
|
+
})) : (c(), u(o($), {
|
|
155
|
+
key: 1,
|
|
156
|
+
style: { width: "64px", height: "64px" },
|
|
157
|
+
src: o(G),
|
|
158
|
+
class: "absolute"
|
|
159
|
+
}, null, 8, ["src"])),
|
|
160
|
+
f("div", ne, [
|
|
156
161
|
O(o(g), {
|
|
157
162
|
color: "#fff",
|
|
158
163
|
size: "16px"
|
|
159
164
|
}, {
|
|
160
|
-
default:
|
|
161
|
-
O(o(
|
|
165
|
+
default: r(() => [
|
|
166
|
+
O(o(te))
|
|
162
167
|
]),
|
|
163
168
|
_: 1
|
|
164
169
|
})
|
|
165
170
|
]),
|
|
166
|
-
t.uploadType === o(v).卡片 ? (c(),
|
|
167
|
-
key:
|
|
171
|
+
t.uploadType === o(v).卡片 ? (c(), u(o(g), {
|
|
172
|
+
key: 2,
|
|
168
173
|
class: "card-uploader__icon"
|
|
169
174
|
}, {
|
|
170
|
-
default:
|
|
171
|
-
t.defaultUploadIcon ?
|
|
172
|
-
|
|
175
|
+
default: r(() => [
|
|
176
|
+
t.defaultUploadIcon ? T("", !0) : (c(), u(o(le), { key: 0 })),
|
|
177
|
+
h(n.$slots, "text-slot")
|
|
173
178
|
]),
|
|
174
179
|
_: 3
|
|
175
|
-
})) :
|
|
176
|
-
t.uploadType === o(v).按钮 ? (c(),
|
|
177
|
-
key:
|
|
180
|
+
})) : T("", !0),
|
|
181
|
+
t.uploadType === o(v).按钮 ? (c(), u(o(X), {
|
|
182
|
+
key: 3,
|
|
178
183
|
type: "primary"
|
|
179
184
|
}, {
|
|
180
|
-
default:
|
|
185
|
+
default: r(() => [
|
|
181
186
|
O(o(g), { style: { "margin-right": "5px" } }, {
|
|
182
|
-
default:
|
|
183
|
-
O(o(
|
|
187
|
+
default: r(() => [
|
|
188
|
+
O(o(oe))
|
|
184
189
|
]),
|
|
185
190
|
_: 1
|
|
186
191
|
}),
|
|
187
|
-
M(" " +
|
|
192
|
+
M(" " + m(o(a)("COMMON_BUTTON.UPLOAD_TEXT")), 1)
|
|
188
193
|
]),
|
|
189
194
|
_: 1
|
|
190
|
-
})) :
|
|
191
|
-
t.uploadType === o(v).面板 ? (c(), C("div",
|
|
195
|
+
})) : T("", !0),
|
|
196
|
+
t.uploadType === o(v).面板 ? (c(), C("div", ie, [
|
|
192
197
|
O(o(g), { size: "48px" }, {
|
|
193
|
-
default:
|
|
194
|
-
O(o(
|
|
198
|
+
default: r(() => [
|
|
199
|
+
O(o(ae))
|
|
195
200
|
]),
|
|
196
201
|
_: 1
|
|
197
202
|
}),
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
M(" " +
|
|
202
|
-
|
|
203
|
-
M(" " +
|
|
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",
|
|
206
|
-
|
|
210
|
+
t.warnTips2 ? (c(), C("div", pe, m(t.warnTips2), 1)) : T("", !0),
|
|
211
|
+
f("div", ue, m(t.warnTips), 1)
|
|
207
212
|
])
|
|
208
|
-
])) :
|
|
209
|
-
t.uploadType === o(v).自定义 ?
|
|
213
|
+
])) : T("", !0),
|
|
214
|
+
t.uploadType === o(v).自定义 ? h(n.$slots, "upload-box", { key: 5 }) : T("", !0)
|
|
210
215
|
]),
|
|
211
216
|
_: 3
|
|
212
217
|
}, 8, ["class", "limit", "accept", "multiple", "drag"])), [
|
|
213
|
-
[i,
|
|
218
|
+
[i, s.value]
|
|
214
219
|
])
|
|
215
220
|
], 6);
|
|
216
221
|
};
|
|
217
222
|
}
|
|
218
|
-
},
|
|
219
|
-
const { t: e } =
|
|
220
|
-
let a = t.toLowerCase(),
|
|
223
|
+
}, xe = (t) => {
|
|
224
|
+
const { t: e } = W();
|
|
225
|
+
let a = t.toLowerCase(), s = "", l = "";
|
|
221
226
|
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",
|
|
223
|
-
},
|
|
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", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("image") ? (l = "jpg、jpeg、png、webp", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("doc") ? (l = "doc、docx", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("ppt") ? (l = "ppt、pptx", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("pdf") ? (l = "pdf", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("txt") ? (l = "txt", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("excel") ? (l = "xls、xlsx、csv", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("audio") ? (l = "mp3、wav、aac、flac、ogg", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("video") && (l = "mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })), s + x;
|
|
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
|
-
},
|
|
248
|
+
}, we = (t) => {
|
|
244
249
|
const e = t.match(/array(\w+)/);
|
|
245
250
|
return e && e[1] ? e[1].toLowerCase() : null;
|
|
246
|
-
},
|
|
251
|
+
}, Ce = N(re);
|
|
247
252
|
export {
|
|
248
|
-
|
|
253
|
+
Ce as FileUploader,
|
|
249
254
|
v as UploadTypesEnum,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
255
|
+
Ce as default,
|
|
256
|
+
we as extractAndLowerCaseArrayType,
|
|
257
|
+
_e as getAcceptType,
|
|
258
|
+
xe as getWarnTips
|
|
254
259
|
};
|
package/es/McpFormDialog.mjs
CHANGED
|
@@ -1,186 +1,185 @@
|
|
|
1
|
-
import { w as
|
|
2
|
-
import { ref as
|
|
3
|
-
import {
|
|
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
|
|
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: (
|
|
13
|
+
createMcp: (s) => _({
|
|
14
14
|
url: `${a.VITE_APP_AIBOX_BASE_URL}/api/v1/mcp/customize`,
|
|
15
15
|
method: "post",
|
|
16
|
-
data:
|
|
16
|
+
data: s
|
|
17
17
|
}),
|
|
18
|
-
getMcpDetail: (
|
|
19
|
-
url: `${a.VITE_APP_AIBOX_BASE_URL}/api/v1/mcp/customize/${
|
|
18
|
+
getMcpDetail: (s) => _({
|
|
19
|
+
url: `${a.VITE_APP_AIBOX_BASE_URL}/api/v1/mcp/customize/${s}`,
|
|
20
20
|
method: "get"
|
|
21
21
|
}),
|
|
22
|
-
updateMcp: (
|
|
23
|
-
url: `${a.VITE_APP_AIBOX_BASE_URL}/api/v1/mcp/customize/${
|
|
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 } = _,
|
|
31
|
-
const { getMcpDetail:
|
|
32
|
-
return { getMcpDetail:
|
|
33
|
-
},
|
|
34
|
-
if (!
|
|
35
|
-
|
|
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
|
|
39
|
-
e.value =
|
|
38
|
+
const o = r.bnid || r.id;
|
|
39
|
+
e.value = o, s.value = !0, t();
|
|
40
40
|
try {
|
|
41
|
-
const { getMcpDetail:
|
|
42
|
-
p.code === 0 && p.data ? (await
|
|
43
|
-
} catch (
|
|
44
|
-
console.error("获取MCP详情失败:",
|
|
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
|
-
},
|
|
47
|
-
|
|
46
|
+
}, d = (r) => {
|
|
47
|
+
r && r(), e.value = null, s.value = !0;
|
|
48
48
|
};
|
|
49
49
|
return {
|
|
50
50
|
// 状态
|
|
51
|
-
isEdit:
|
|
51
|
+
isEdit: s,
|
|
52
52
|
currentBnid: e,
|
|
53
|
-
btnLoading:
|
|
54
|
-
createFormRef:
|
|
53
|
+
btnLoading: m,
|
|
54
|
+
createFormRef: u,
|
|
55
55
|
// 方法
|
|
56
|
-
showEditDialog:
|
|
57
|
-
hideEditDialog:
|
|
58
|
-
submitForm: async (
|
|
59
|
-
if (
|
|
60
|
-
console.error("表单引用不存在"),
|
|
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
|
|
65
|
-
const
|
|
64
|
+
if (await u.value.validate()) {
|
|
65
|
+
const l = u.value.getFormData();
|
|
66
66
|
if (!e.value) {
|
|
67
|
-
|
|
67
|
+
n.error(a?.("MCPFORMDIALOG.MCP_ID_REQUIRED") || "缺少MCP ID,无法更新"), m.value = !1;
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
const { updateMcp: p } =
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
else if (
|
|
74
|
-
console.error("更新MCP失败,返回数据异常:",
|
|
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
|
|
77
|
-
|
|
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 (
|
|
81
|
-
console.error("表单提交错误:",
|
|
80
|
+
} catch (o) {
|
|
81
|
+
console.error("表单提交错误:", o), n.error(o.message || a?.("MCPFORMDIALOG.UPDATE_FAIL") || "更新MCP失败"), M && M(o);
|
|
82
82
|
} finally {
|
|
83
|
-
|
|
83
|
+
m.value = !1;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
const q = {
|
|
89
|
-
class: /* @__PURE__ */
|
|
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:
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
|
|
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(
|
|
100
|
-
c.code === 0 && c.data ? (await
|
|
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),
|
|
102
|
+
console.error("获取MCP详情失败:", c), I();
|
|
103
103
|
}
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
if (
|
|
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 (
|
|
115
|
-
if (!
|
|
116
|
-
|
|
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
|
|
120
|
-
|
|
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
|
|
123
|
-
if (console.log("创建MCP响应:",
|
|
124
|
-
const
|
|
125
|
-
|
|
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:
|
|
130
|
+
bnId: T
|
|
129
131
|
}
|
|
130
132
|
}) : console.warn("创建MCP成功,但未返回bnid,无法跳转");
|
|
131
133
|
} else
|
|
132
|
-
console.error("创建MCP失败,返回数据异常:",
|
|
134
|
+
console.error("创建MCP失败,返回数据异常:", i);
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
|
-
} catch (
|
|
136
|
-
console.error("表单提交错误:",
|
|
137
|
+
} catch (P) {
|
|
138
|
+
console.error("表单提交错误:", P);
|
|
137
139
|
} finally {
|
|
138
|
-
|
|
140
|
+
l.value = !1;
|
|
139
141
|
}
|
|
140
142
|
};
|
|
141
|
-
return a({ showCreateDialog: p, showEditDialog:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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-
|
|
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,
|