From f19e5267cc23b1c714dc746239864f33ed715dd9 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 05 十二月 2025 17:55:02 +0800
Subject: [PATCH] 完成地图制作任务功能初版

---
 src/views/fysp/task/components/CompSubTaskSelect.vue |   53 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/src/views/fysp/task/components/CompSubTaskSelect.vue b/src/views/fysp/task/components/CompSubTaskSelect.vue
index 738df23..11a515e 100644
--- a/src/views/fysp/task/components/CompSubTaskSelect.vue
+++ b/src/views/fysp/task/components/CompSubTaskSelect.vue
@@ -17,7 +17,7 @@
               collapse-tags
               placeholder="閫夋嫨鎵ц浜�"
               :max-collapse-tags="1"
-              style="width: 240px"
+              style="width: 150px"
             >
               <template #header>
                 <el-checkbox
@@ -40,9 +40,13 @@
       </FYForm>
     </el-row>
     <div>
-      <el-scrollbar :height="scrollHeight" v-if="data.length > 0">
-        <el-space wrap>
-          <ItemMonitorObj v-for="obj in data" :key="obj.movid" :item="obj">
+      <el-scrollbar :height="height" v-if="modelValue.length > 0">
+        <el-space wrap :direction="direction">
+          <ItemMonitorObj
+            v-for="obj in modelValue"
+            :key="obj.movid"
+            :item="obj"
+          >
             <template #default="{ item }">
               <el-button
                 size="small"
@@ -79,21 +83,34 @@
 
 const props = defineProps({
   // 瀛愪换鍔¢泦鍚�
-  data: {
+  modelValue: {
     type: Array,
     default: () => []
   },
-  height: String,
+  height: {
+    type: String,
+    default: '14vh'
+  },
+  direction: {
+    type: String,
+    default: 'horizontal'
+  },
   // 鏃ヤ换鍔�
   dayTask: Object
 });
 
-const emit = defineEmits(['submit', 'delete']);
+const emit = defineEmits(['submit', 'delete', 'update:modelValue']);
 
-const scrollHeight = ref('14vh');
+const data = computed(() => props.modelValue);
 
 // 绉婚櫎浠诲姟鍦烘櫙
 function deleteScene(item) {
+  item.select = false;
+  const index = data.value.indexOf(item);
+  if (index > -1) {
+    data.value.splice(index, 1);
+    emit('update:modelValue', data.value);
+  }
   emit('delete', item);
 }
 
@@ -109,17 +126,21 @@
   ]
 });
 function submit(v, success, fail) {
-  if (props.data.length == 0) {
-    // ElMessage({
-    //   message: '鏈�夋嫨鐩戠鍦烘櫙',
-    //   type: 'warning'
-    // });
+  if (props.modelValue.length == 0) {
     fail('鏈�夋嫨鐩戠鍦烘櫙');
+  } else if (v.value.executor.length == 0) {
+    fail('鏈�夋嫨鎵ц浜�');
   } else {
     success();
     // 灏嗕换鍔℃墽琛屼汉鏍煎紡鍖栧苟浼犻��
     const param = TaskProxy.getExecutors(v.value.executor, executors.value);
-    emit('submit', param);
+    TaskProxy.createSubtasks(props.dayTask, props.modelValue, param).then(
+      () => {
+        formInfo.value.executor = [];
+        emit('update:modelValue', []);
+        emit('submit');
+      }
+    );
   }
 }
 
@@ -163,6 +184,7 @@
   });
 
   executors.value = list;
+  formInfo.value.executor = [];
 }
 // watch(topTask, (nV, oV) => {
 //   if (nV != oV) {
@@ -174,7 +196,8 @@
   () => props.dayTask,
   (nV, oV) => {
     if (nV != oV) {
-      taskApi.fetchTaskById(nV.guid).then((res) => {
+      // 鏍规嵁鏃ヤ换鍔★紝鑾峰彇瀵瑰簲鐨勬�讳换鍔′俊鎭紝鍐嶈幏鍙栨墽琛屼汉鍛樹俊鎭�
+      taskApi.fetchTaskById(nV.tsGuid).then((res) => {
         getExecutors(res);
       });
     }

--
Gitblit v1.9.3