From 99b7194ce9364b0a6ab49a738c03bb89e6c223e7 Mon Sep 17 00:00:00 2001
From: zhangxiao <898441624@qq.com>
Date: 星期六, 17 八月 2024 15:06:59 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/web/flow_web

---
 src/views/sessionManager/components/addSession.vue |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/views/sessionManager/components/addSession.vue b/src/views/sessionManager/components/addSession.vue
index 0735a0e..833acbe 100644
--- a/src/views/sessionManager/components/addSession.vue
+++ b/src/views/sessionManager/components/addSession.vue
@@ -4,6 +4,7 @@
   import { addSessionApi, getDialogListApi } from '@/api/session';
   const props = defineProps({
     modalObj: Object,
+    dialogId: String,
   });
   const conversation = ref({ dialog_id: '', conversation_desc: '' });
   const dialogList = ref([]);
@@ -12,6 +13,7 @@
     const { code, data } = await getDialogListApi();
     if (code === 200) {
       dialogList.value = data;
+      conversation.value.dialog_id = data[0].id;
     }
   };
 
@@ -22,12 +24,12 @@
         message: '鏅鸿兘鍔╂墜涓嶈兘涓虹┖',
       },
     ],
-    conversation_desc: [
-      {
-        required: true,
-        message: '鎻忚堪涓嶈兘涓虹┖',
-      },
-    ],
+    // conversation_desc: [
+    //   {
+    //     required: true,
+    //     message: '鎻忚堪涓嶈兘涓虹┖',
+    //   },
+    // ],
   };
   onMounted(() => {
     queryDialogList();
@@ -36,6 +38,10 @@
   const handleOk = () => {
     formRef.value.validate().then(async (res) => {
       if (!res) {
+        if (!conversation.value.conversation_desc) {
+          conversation.value.conversation_desc = '鏈懡鍚嶄細璇�';
+        }
+
         const { code } = await addSessionApi({ ...conversation.value });
         if (code === 200) {
           Message.success('娣诲姞鎴愬姛');
@@ -64,6 +70,13 @@
   //     )?.name;
   //   }
   // );
+
+  watch(
+    () => props.dialogId,
+    (newVal, oldVal) => {
+      conversation.value.dialog_id = newVal;
+    }
+  );
 </script>
 
 <template>
@@ -76,11 +89,12 @@
     >
       <template #title> 鏂板浼氳瘽 </template>
       <a-form ref="formRef" :model="conversation" :rules="rules">
-        <a-form-item label="鍔╂墜鍏宠仈:" field="dialog_id" @submit="handleSubmit">
+        <a-form-item label="鍔╂墜鍏宠仈:" field="dialog_id">
           <a-select
             style="width: 80%"
             v-model="conversation.dialog_id"
             placeholder="璇烽�夋嫨鍏宠仈鍔╂墜"
+            disabled
           >
             <a-option
               v-for="dialog in dialogList"
@@ -90,7 +104,7 @@
             >
           </a-select>
         </a-form-item>
-        <a-form-item label="鍚嶅瓧:" field="conversation_desc">
+        <a-form-item label="鍚嶅瓧:">
           <a-textarea
             placeholder="璇疯緭鍏ュ悕瀛�"
             :max-length="100"

--
Gitblit v1.8.0