diff --git a/src/components/JsonViewDlg/index.vue b/src/components/JsonViewDlg/index.vue new file mode 100644 index 0000000..a6d8f21 --- /dev/null +++ b/src/components/JsonViewDlg/index.vue @@ -0,0 +1,30 @@ + + \ No newline at end of file diff --git a/src/typings/components.d.ts b/src/typings/components.d.ts index e0a7633..c83be3a 100644 --- a/src/typings/components.d.ts +++ b/src/typings/components.d.ts @@ -98,6 +98,7 @@ declare module "vue" { SingleUpload: (typeof import("./../components/Upload/SingleUpload.vue"))["default"]; SizeSelect: (typeof import("./../components/SizeSelect/index.vue"))["default"]; SvgIcon: (typeof import("./../components/SvgIcon/index.vue"))["default"]; + JsonViewDlg: (typeof import("./../components/JsonViewDlg/index.vue"))["default"]; TableSelect: (typeof import("./../components/TableSelect/index.vue"))["default"]; TagsView: (typeof import("./../layout/components/TagsView/index.vue"))["default"]; ThemeColorPicker: (typeof import("./../layout/components/Settings/components/ThemeColorPicker.vue"))["default"]; diff --git a/src/views/connection/edit.vue b/src/views/connection/edit.vue index 4f52e26..033bc54 100644 --- a/src/views/connection/edit.vue +++ b/src/views/connection/edit.vue @@ -128,12 +128,14 @@ import nodePanel from './nodePanel.vue' import editFlow from './editFlow.vue' import ConnApi from '@/api/connection' +import ModelApi from '@/api/models' import EditParamDlg from './editParamDlg.vue' import paramShow from './paramShow.vue' const router = useRouter(); const editForm = ref(ElForm) const route = useRoute() const upForm = reactive({ + model_id: '', model_name: '', model_version: '', connection_name: '', @@ -152,6 +154,7 @@ const info = reactive({ connInfo: null, nodes: [], editObj: null, + type: '', }) const selNode = reactive({ info: null, @@ -327,6 +330,7 @@ const doSave = () => { editForm.value?.validate(valid => { if (valid) { let postData = { + model_id: upForm.model_id, connection_name: upForm.connection_name, connection_label: upForm.connection_label, connection_desc: upForm.connection_desc, @@ -335,13 +339,22 @@ const doSave = () => { operator_connection_nodes: flowData.nodes, operator_connection_edges: flowData.edges }; - ConnApi.add(postData).then(d => { - if (d.data.code == 0) { - ElMessage.success("增加模型成功!"); - router.push({ path: "/connection/index" }) - } - }); - + if (info.type == "add") { + ConnApi.add(postData).then(d => { + if (d.data.code == 0) { + ElMessage.success("增加互联成功!"); + router.push({ path: "/connection/index" }) + } + }); + } else { + let id = route.query.id; + ConnApi.updatAll(id, postData).then(d => { + if (d.data.code == 0) { + ElMessage.success("修改互联成功!"); + router.push({ path: "/connection/index" }) + } + }); + } } }); @@ -349,19 +362,51 @@ const doSave = () => { const doCancel = () => { router.push({ path: "/connection/index" }) } -const initData = () => { +const initConnData = () => { let id = route.query.id; ConnApi.detail(id).then(d => { info.connInfo = d.data?.data || {}; + upForm.model_id = info.connInfo.model_id; upForm.model_name = info.connInfo.model_name; upForm.model_version = info.connInfo.model_version; upForm.model_name = info.connInfo.model_name; - upForm.model_name = info.connInfo.model_name; + upForm.connection_name = info.connInfo.connection_name; + upForm.connection_label = ""; + upForm.connection_desc = info.connInfo.connection_desc; }); }; +const initEditData = () => { + let id = route.query.id; + ConnApi.detail(id).then(d => { + info.connInfo = d.data?.data || {}; + upForm.model_id = info.connInfo.model_id; + upForm.model_name = info.connInfo.model_name; + upForm.model_version = info.connInfo.model_version; + upForm.connection_name = info.connInfo.connection_name; + upForm.connection_label = ""; + upForm.connection_desc = info.connInfo.connection_desc; + }); +} +const initData = () => { + let id = route.query.id; + ModelApi.findOne(id).then(d => { + upForm.model_id = d.data.data.model_id; + upForm.model_name = d.data.data.model_name; + upForm.model_version = d.data.data.model_version; + }); +} + onMounted(() => { - initData(); - window.xapp = getCurrentInstance(); + if (route.query.type == "edit") { + info.type = "edit" + initEditData(); + } else if (route.query.type == "addByConn") { + info.type = "add" + initConnData(); + } else { + info.type = "add" + initData(); + } }); + - - \ No newline at end of file + + .proc-card { + margin-top: 20px; + padding: 8px; + + .el-card__header { + padding: 8px; + border: none; + } + + .el-card__body { + background: #EEF7FE; + border-radius: 8px; + height: 300px; + } + + &.server-status { + background: #EEF7FE; + padding: 8px; + + .el-card__header {} + + .el-card__body { + background: #fff; + box-shadow: var(--el-box-shadow-light); + } + } + } +} + \ No newline at end of file diff --git a/src/views/model/index.vue b/src/views/model/index.vue index 84d5eed..8a9a8ed 100644 --- a/src/views/model/index.vue +++ b/src/views/model/index.vue @@ -1,13 +1,13 @@