From 2f5fbb2144ca03477eb91ab36a990ea013065214 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期四, 08 八月 2024 17:47:32 +0800
Subject: [PATCH] 解析块页面修改

---
 src/views/dmx/model/components/addTableName.vue |   78 ++++++++++++++++++++-------------------
 1 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/src/views/dmx/model/components/addTableName.vue b/src/views/dmx/model/components/addTableName.vue
index 45ace16..0b5648c 100644
--- a/src/views/dmx/model/components/addTableName.vue
+++ b/src/views/dmx/model/components/addTableName.vue
@@ -2,7 +2,7 @@
   <!-- 娣诲姞妯″瀷 -->
   <a-modal
     v-model:visible="addTabVisible"
-    title="娣诲姞妯″紡"
+    :title="title"
     @before-open="handleOpened"
     @cancel="handleCancel"
     :footer="false"
@@ -66,7 +66,7 @@
     ref,
     computed,
   } from 'vue';
-  import { addLlmFactory, getLlmDetail } from '@/api/model';
+  import { addLlmFactory, getLlmDetail, editLlmFactory } from '@/api/model';
   import { Message } from '@arco-design/web-vue';
 
   const addTabVisible = defineModel('tabShow');
@@ -79,6 +79,10 @@
     nameList: {
       type: Object,
       default: {},
+    },
+    title: {
+      type: String,
+      default: '娣诲姞妯″瀷',
     },
   });
   const editList = computed(() => props.nameList);
@@ -113,23 +117,40 @@
     console.log(editList, 9999);
     formRef.value.validate().then(async (res) => {
       if (!res) {
-        await addLlmFactory({
-          name: form.name,
-          tags: form.tags,
-          api_base: form.api_base,
-          // all_params: all_params,
-          logo: imageUrls.value[0],
-        })
-          .then((resData) => {
-            if ((resData as any).code === 200) {
-              emit('refresh-parent');
-              addTabVisible.value = false;
-              Message.success('娣诲姞鎴愬姛');
-            }
+        if (props.title == '缂栬緫妯″瀷') {
+          await editLlmFactory({
+            name: form.name,
+            tags: form.tags,
+            api_base: form.api_base,
+            // all_params: all_params,
+            logo: imageUrls.value[0],
           })
-          .catch(() => {
-            Message.error('娣诲姞澶辫触');
-          });
+            .then((resData) => {
+              if ((resData as any).code === 200) {
+                emit('refresh-parent');
+                addTabVisible.value = false;
+              }
+            })
+            .catch(() => {});
+        } else {
+          await addLlmFactory({
+            name: form.name,
+            tags: form.tags,
+            api_base: form.api_base,
+            // all_params: all_params,
+            logo: imageUrls.value[0],
+          })
+            .then((resData) => {
+              if ((resData as any).code === 200) {
+                emit('refresh-parent');
+                addTabVisible.value = false;
+                Message.success('娣诲姞鎴愬姛');
+              }
+            })
+            .catch(() => {
+              Message.error('娣诲姞澶辫触');
+            });
+        }
       }
     });
   };
@@ -164,31 +185,12 @@
     formRef.value?.resetFields();
   };
 
-  // onMounted(() => {
-  //   if (editList.value) {
-  //     getDetail();
-  //   }
-  // });
-
-  // const getDetail = async () => {
-  //   const data = await getLlmDetail(
-  //     editList.value.llm_factory,
-  //     editList.value.tags
-  //   );
-
-  //   form.urlS = data.data.urlS;
-  //   imageUrls.value = data.data.logo;
-  // };
-
   watchEffect(() => {
-    if (props.nameList) {
-      console.log(props.nameList);
+    if (props.nameList && props.title == '缂栬緫妯″瀷') {
       form.name = props.nameList.llm_factory;
       form.tags = props.nameList.tags;
       form.urlS = props.nameList.logo;
     }
-
-    // getDetail();
   });
 </script>
 

--
Gitblit v1.8.0