From 4123b18e86c05753e52c68a48c8a4067c2a6d625 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期三, 21 八月 2024 15:41:21 +0800
Subject: [PATCH] 智能体详情信息

---
 src/views/dmx/IntelligentAgent/components/agentConfig.vue |   33 ++++------------
 src/views/dmx/IntelligentAgent/index.vue                  |   59 +++++++++++++++++++++++------
 2 files changed, 54 insertions(+), 38 deletions(-)

diff --git a/src/views/dmx/IntelligentAgent/components/agentConfig.vue b/src/views/dmx/IntelligentAgent/components/agentConfig.vue
index 7ee066c..65c161f 100644
--- a/src/views/dmx/IntelligentAgent/components/agentConfig.vue
+++ b/src/views/dmx/IntelligentAgent/components/agentConfig.vue
@@ -1,25 +1,4 @@
 <template>
-  <a-button
-    v-if="typeAngint == 'add'"
-    type="primary"
-    @click="handleClick"
-    style="margin-left: 10px"
-  >
-    <template #icon>
-      <icon-plus />
-    </template>
-    鏂板缓鏅鸿兘浣�
-  </a-button>
-  <a-button
-    v-if="typeAngint == 'edit'"
-    type="text"
-    size="small"
-    @click="editClick"
-  >
-    <template #icon>
-      <icon-tool />
-    </template>
-  </a-button>
   <a-modal
     v-model:visible="visible"
     title="鏅鸿兘浣撻厤缃�"
@@ -514,9 +493,6 @@
   const handleClick = () => {
     visible.value = true;
   };
-  defineExpose({
-    handleClick,
-  });
 
   const handleCancel = () => {
     visible.value = false;
@@ -546,7 +522,7 @@
           '浣犳槸涓�涓櫤鑳藉姪鎵嬶紝璇锋�荤粨鐭ヨ瘑搴撶殑鍐呭鏉ュ洖绛旈棶棰橈紝璇峰垪涓剧煡璇嗗簱涓殑鏁版嵁璇︾粏鍥炵瓟銆傚綋鎵�鏈夌煡璇嗗簱鍐呭閮戒笌闂鏃犲叧鏃讹紝浣犵殑鍥炵瓟蹇呴』鍖呮嫭鈥滅煡璇嗗簱涓湭鎵惧埌鎮ㄨ鐨勭瓟妗堬紒鈥濊繖鍙ヨ瘽銆�' +
           '鍥炵瓟闇�瑕佽�冭檻鑱婂ぉ鍘嗗彶銆俓n        浠ヤ笅鏄煡璇嗗簱锛歕n        {knowledge}\n        浠ヤ笂鏄煡璇嗗簱銆�';
       }
-      console.log(form, '鏂板缓鏅鸿兘浣撳脊绐�');
+      // console.log(form, '鏂板缓鏅鸿兘浣撳脊绐�');
       avatarShow.value = false;
       setTimeout(() => {
         avatarShow.value = true;
@@ -629,6 +605,7 @@
     });
   };
 
+
   const addVariable = () => {
     form.prompt_config.parameters.push({
       index: form.prompt_config.parameters.length,
@@ -699,6 +676,12 @@
   onMounted(() => {});
 
   onBeforeUnmount(() => {});
+
+  defineExpose({
+    handleClick,
+    editClick
+  });
+
 </script>
 <style lang="less" scoped>
   :deep(.arco-tabs-nav-tab-list) {
diff --git a/src/views/dmx/IntelligentAgent/index.vue b/src/views/dmx/IntelligentAgent/index.vue
index 38b17b9..3013586 100644
--- a/src/views/dmx/IntelligentAgent/index.vue
+++ b/src/views/dmx/IntelligentAgent/index.vue
@@ -10,7 +10,16 @@
               style="width: 240px"
               @change="queryList"
             />
-            <agent-config typeAngint="add"></agent-config>
+            <a-button
+              type="primary"
+              @click="handleClick"
+              style="margin-left: 10px"
+            >
+              <template #icon>
+                <icon-plus />
+              </template>
+              鏂板缓鏅鸿兘浣�
+            </a-button>
           </div>
           <a-divider style="margin: 10px 0" />
           <a-row justify="space-between">
@@ -72,12 +81,15 @@
                       >
                         <a-space>
                           <span v-show="!item.off">
-                            <agent-config
-                              ref="editAgentKuai"
-                              typeAngint="edit"
-                              :formData="item"
-                              @queryList="queryList"
-                            ></agent-config>
+                              <a-button
+                                type="text"
+                                size="small"
+                                @click="editClick(item)"
+                              >
+                              <template #icon>
+                                <icon-tool />
+                              </template>
+                            </a-button>
                           </span>
                           <a-popconfirm
                             :content="'纭畾鍒犻櫎鍚�'"
@@ -195,6 +207,12 @@
         </a-card>
       </a-col>
     </a-row>
+    <agent-config
+      ref="editAgentKuai"
+      :typeAngint="addType"
+      :formData="itemObj"
+      @queryList="queryList"
+    ></agent-config>
   </div>
 </template>
 
@@ -208,7 +226,7 @@
     onBeforeUnmount,
   } from 'vue';
   import { Message } from '@arco-design/web-vue';
-  import { deletedialog, queryCanvasList, querydialogList } from "@/api/Agent";
+  import { deletedialog, queryCanvasList, querydialogdetail, querydialogList } from "@/api/Agent";
   import useLoading from '@/hooks/loading';
   const { loading, setLoading } = useLoading(true);
   import EventBus from '@/utils/EventBus';
@@ -220,7 +238,7 @@
   let count = 5;
   const activeKey = ref(1);
   const addAgents = ref();
-  const editAgentKuai = ref();
+  const editAgentKuai = ref(null);
   const imgSrc = ref(logo);
   const agentList = ref([]);
   const agentNewList = ref([]);
@@ -233,10 +251,25 @@
 
   const visible = ref(false);
   const formRef = ref(null);
-  const form = reactive({
-    // size: 'medium',
-    // name: '',
-  });
+  let addType = ref('add');
+  let itemObj = reactive({});
+  const form = reactive({});
+
+
+  const handleClick = () => {
+    addType.value = 'add';
+    editAgentKuai.value.handleClick();
+  };
+
+  const editClick = async(data) => {
+    let res = await querydialogdetail({
+      dialog_id: data.id
+    })
+    Object.assign(itemObj, res.data);
+    addType.value = 'edit';
+    editAgentKuai.value.editClick();
+  };
+
 
   const queryList = async (params = {}) => {
     setLoading(true);

--
Gitblit v1.8.0