From 9bfb8f9b0ad23e71a02b7e45d90b4c1d5efd617e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 20 Dec 2024 18:03:35 +0800
Subject: [PATCH] 企业搜索

---
 src/views/comprehensiveSearch/components/searchGroup.vue |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/src/views/comprehensiveSearch/components/searchGroup.vue b/src/views/comprehensiveSearch/components/searchGroup.vue
index b588237..395f632 100644
--- a/src/views/comprehensiveSearch/components/searchGroup.vue
+++ b/src/views/comprehensiveSearch/components/searchGroup.vue
@@ -3,16 +3,14 @@
     <div class=''>
         <!-- // 地址搜索 企业搜索 两个按钮  -->
         <div class="search-group-box">
-            <el-button type="primary" plain>地址搜索</el-button>
-            <el-button type="success" plain>企业搜索</el-button>
+            <el-button @click="change(1)" :type="serachIndex == 1 ? 'primary' : ''">地址搜索</el-button>
+            <el-button @click="change(2)" :type="serachIndex == 2 ? 'primary' : ''">企业搜索</el-button>
         </div>
         <!-- 企业地址搜索框-->
         <div class="search-group-input">
-            <el-input clearable v-model="input" placeholder="请输入内容"></el-input>
-            <el-button type="primary" icon="el-icon-search" plain>搜索</el-button>
+            <el-input clearable v-model="searchKey" placeholder="请输入内容"></el-input>
+            <el-button @click="searchClick" type="primary" icon="el-icon-search" plain></el-button>
         </div>
-
-
 
     </div>
 </template>
@@ -21,10 +19,14 @@
 export default {
     //import引入的组件需要注入到对象中才能使用
     components: {},
+    // 父组件给子组件传过来的参数
+    props: {
+    },
     data() {
         //这里存放数据
         return {
-
+            serachIndex: 1,
+            searchKey: '',
         };
     },
     //监听属性 类似于data概念
@@ -33,6 +35,23 @@
     watch: {},
     //方法集合
     methods: {
+        change(type) {
+            this.serachIndex = type
+            this.$EventBus.$emit("searchIndex", {
+                searchIndex: this.serachIndex
+            })
+        },
+        searchClick() {
+            // 判断是综合搜索还是企业搜索
+            if (this.serachIndex == 1) {
+                // 搜索地址
+            } else {
+                // 搜索企业
+                this.$EventBus.$emit("searchKey", {
+                    searchKey: this.searchKey
+                })
+            }
+        },
 
     },
     //生命周期 - 创建完成(可以访问当前this实例)

--
Gitblit v1.9.3