From c77f109ade55f12043acc3a94d77fd5f85144ae8 Mon Sep 17 00:00:00 2001
From: yinbangzhong <zhongbangyin@126.com>
Date: 星期四, 15 八月 2024 17:37:13 +0800
Subject: [PATCH] 角色

---
 src/views/dmx/model/index.vue |   93 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 67 insertions(+), 26 deletions(-)

diff --git a/src/views/dmx/model/index.vue b/src/views/dmx/model/index.vue
index bf2602d..6c3bde1 100644
--- a/src/views/dmx/model/index.vue
+++ b/src/views/dmx/model/index.vue
@@ -61,6 +61,9 @@
                           <div class="arco-btn-group">
                             <a-space class="btn-group">
                               <!-- <editModel></editModel> -->
+                              <a-button @click="handleDeleteModel(item, 1)">
+                                鍒犻櫎
+                              </a-button>
                               <a-button
                                 type="primary"
                                 @click="handleEditModel(item, 1)"
@@ -102,12 +105,12 @@
                               <a-button @click="handleDeleteModel(list)">
                                 鍒犻櫎
                               </a-button>
-                              <a-button
+                              <!-- <a-button
                                 type="primary"
                                 @click="handleEditModel(list)"
                               >
                                 缂栬緫
-                              </a-button>
+                              </a-button> -->
 
                               <!-- <editModel></editModel> -->
                             </a-space>
@@ -120,7 +123,7 @@
               </a-tabs>
             </a-col>
             <div> </div>
-            <div class="box_right">
+            <div class="box_right" v-if="Object.keys(tabData).length > 0">
               <!-- <div class="search_input">
                 <a-input-search
                   :placeholder="$t('cardList.searchInput.placeholder')"
@@ -128,8 +131,11 @@
                 />
               </div> -->
               <div>
-                <!-- <addModel></addModel> -->
-                <a-button type="primary" @click="handleAddModel">
+                <a-button
+                  type="primary"
+                  @click="handleAddModel"
+                  :disabled="addBtn"
+                >
                   <template #icon>
                     <icon-plus />
                   </template>
@@ -172,6 +178,7 @@
     modelmyLlms,
     deleteLlm,
     deleteLlmFactory,
+    getFactoryDetail,
   } from '@/api/model';
   import { Modal, Message } from '@arco-design/web-vue';
   import { userModelState } from '@/store';
@@ -180,6 +187,7 @@
 
   const modelStore = userModelState();
   let count = 5;
+  const addBtn = ref(false);
   const activeKey = ref(1);
   const data = ref([
     {
@@ -202,6 +210,7 @@
     key: {
       tags: '娣诲姞key',
       id: 1,
+      live: 1,
     },
   });
 
@@ -209,8 +218,9 @@
 
   const modalList = ref({});
   const tabKey = ref('key');
-  const changeTabs = (val) => {
+  const changeTabs = async (val) => {
     tabKey.value = val;
+    await getFactory();
   };
 
   const httpUrl = modelStore.hrefUrl;
@@ -252,27 +262,31 @@
   };
 
   //鍒犻櫎妯″瀷
-  const handleDeleteModel = (val) => {
-    Modal.confirm({
-      title: '璀﹀憡',
-      content: '纭鍒犻櫎鍚�',
-      okText: '纭畾',
-      cancelText: '鍙栨秷',
-      onOk: async () => {
-        const factory = tabKey.value;
-        const res = await deleteLlm({
-          llm_factory: tabKey.value,
-          llm_name: val.name,
-        });
+  const handleDeleteModel = (val, type) => {
+    if (type == 1) {
+      handleDelete(val);
+    } else {
+      Modal.confirm({
+        title: '璀﹀憡',
+        content: '纭鍒犻櫎鍚�',
+        okText: '纭畾',
+        cancelText: '鍙栨秷',
+        onOk: async () => {
+          const factory = tabKey.value;
+          const res = await deleteLlm({
+            llm_factory: tabKey.value,
+            llm_name: val.name,
+          });
 
-        if ((res as any).code == 0) {
-          queryModel();
-          tabKey.value = factory;
-        } else {
-        }
-      },
-      onCancel: () => {},
-    });
+          if ((res as any).code == 0) {
+            queryModel();
+            tabKey.value = factory;
+          } else {
+          }
+        },
+        onCancel: () => {},
+      });
+    }
   };
 
   //鐖剁骇妯″瀷
@@ -325,12 +339,36 @@
     modalList.value = res.data;
     loading.value = true;
     tabData.value = Object.assign({}, tabData.value, res.data);
+    tabData.value = filterObject(tabData.value, 1);
+    tabKey.value = Object.keys(tabData.value)[0];
+    await getFactory();
   };
   queryModel();
+  //杩斿洖婊¤冻鏉′欢鐨勫璞�
+  const filterObject = (obj, threshold) => {
+    return Object.keys(obj)
+      .filter((key) => obj[key].added == 1)
+      .reduce((result, key) => {
+        result[key] = obj[key];
+        return result;
+      }, {});
+  };
 
   const refreshParentMethod = () => {
     queryModel();
     // 杩欓噷鎵ц闇�瑕佺殑鎿嶄綔
+  };
+
+  const getFactory = async () => {
+    const { data } = await getFactoryDetail({
+      factory_name: tabKey.value,
+    });
+
+    if (data.set_type == 2) {
+      addBtn.value = true;
+    } else {
+      addBtn.value = false;
+    }
   };
 </script>
 
@@ -415,6 +453,9 @@
       // border-radius: 0;
       // background-color: #eee;
     }
+    :deep(.arco-tabs-tab-close-btn) {
+      display: none;
+    }
     :deep(.arco-tabs-tab-close-btn .arco-icon) {
       color: #666;
     }

--
Gitblit v1.8.0