From b330e57051e54789eb83d10dc58c4d9d10c608e1 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期三, 17 九月 2025 09:55:19 +0800
Subject: [PATCH] 2025.9.17 数据产品模块(待完成)

---
 src/components/SearchBar.vue |   75 ++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 30 deletions(-)

diff --git a/src/components/SearchBar.vue b/src/components/SearchBar.vue
index 50fd81e..c3609f4 100644
--- a/src/components/SearchBar.vue
+++ b/src/components/SearchBar.vue
@@ -1,10 +1,14 @@
 <template>
   <el-row class="layout">
-    <el-col :span="12">
+    <el-col :span="10">
       <el-form :inline="true" :model="formSearch">
         <el-form-item label="鎬讳换鍔�">
           <!-- <el-input v-model="formSearch.topTaskId" placeholder="鎬讳换鍔�" /> -->
-          <el-select v-model="formSearch.topTaskId" placeholder="鎬讳换鍔�">
+          <el-select
+            v-model="formSearch.topTaskId"
+            placeholder="鎬讳换鍔�"
+            style="width: 260px"
+          >
             <el-option
               v-for="s in topTasks"
               :key="s.value"
@@ -13,22 +17,17 @@
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="鍦烘櫙绫诲瀷">
-          <el-select v-model="formSearch.sceneTypeId" placeholder="鍦烘櫙绫诲瀷">
-            <el-option
-              v-for="s in sceneTypes"
-              :key="s.value"
-              :label="s.label"
-              :value="s.value"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item>
+        <FYOptionScene
+          :allOption="false"
+          :type="2"
+          v-model:value="formSearch.scenetype"
+        ></FYOptionScene>
+        <el-form-item v-show="btnShow">
           <el-button type="primary" @click="onSubmit">鏌ヨ</el-button>
         </el-form-item>
       </el-form>
     </el-col>
-    <el-col :span="12">
+    <el-col :span="14">
       <el-row justify="end">
         <slot name="summary"></slot>
       </el-row>
@@ -38,49 +37,65 @@
 
 <script>
 import taskApi from '@/api/fysp/taskApi';
-import { enumScene } from "@/enum/scene";
 
 export default {
   emits: ['onSubmit'],
+  props: {
+    btnShow: {
+      type: Boolean,
+      default: true
+    },
+    init: {
+      type: Boolean,
+      default: true
+    }
+  },
+
   data() {
     return {
       topTasks: [],
-      sceneTypes: enumScene(2, false),
       formSearch: {
         topTaskId: '',
-        sceneTypeId: '',
-      },
+        scenetype: ''
+      }
     };
   },
   methods: {
     //鑾峰彇鏌ヨ鏉′欢
     getOptions() {
       taskApi.getTopTask().then((res) => {
-        const list = [];
-        res.forEach((r) => {
-          list.push({
+        const list = res.map((r) => {
+          return {
             value: r.tguid,
             label: r.name,
-            towncode: r.towncode,
-            districtCode: r.districtcode,
-            month: r.starttime.slice(0, 7),
-          });
+            data: r
+          };
         });
         this.topTasks = list;
         this.formSearch.topTaskId = list[0].value;
-        this.$emit('onSubmit', this.formSearch);
+        if (this.init) {
+          this.onSubmit();
+        }
       });
     },
     //鏌ヨ瀛愪换鍔$粺璁′俊鎭�
     onSubmit() {
-      // console.log(this.formSearch.sceneTypeId)
-      this.$emit('onSubmit', this.formSearch);
-    },
+      const task = this.topTasks.find(
+        (t) => t.data.tguid == this.formSearch.topTaskId
+      );
+      const param = {
+        topTask: task ? task.data : {},
+        sceneTypeId: this.formSearch.scenetype.value
+      };
+      // console.log(param);
+
+      this.$emit('onSubmit', param);
+    }
   },
   mounted() {
-    this.formSearch.sceneTypeId = this.sceneTypes[0].value;
     this.getOptions();
   },
+  expose: ['onSubmit']
 };
 </script>
 

--
Gitblit v1.9.3