From 1b90ab69c77b1e4717bc9be45ea1acb36b2f6873 Mon Sep 17 00:00:00 2001
From: 陈泽平 <chenzeping>
Date: 星期二, 25 五月 2021 11:38:41 +0800
Subject: [PATCH] 企业应急事件上报页面修改

---
 src/components/panel/topicSearch/SewersSearch.vue |  312 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 189 insertions(+), 123 deletions(-)

diff --git a/src/components/panel/topicSearch/SewersSearch.vue b/src/components/panel/topicSearch/SewersSearch.vue
index f8b485f..b77c2be 100644
--- a/src/components/panel/topicSearch/SewersSearch.vue
+++ b/src/components/panel/topicSearch/SewersSearch.vue
@@ -1,152 +1,218 @@
 <template>
-  <div class="sewers-search" v-if="gdVisible">
-    <div class="panel-title">{{ title }}</div>
-    <div class="search-panel ">
-      <el-form ref="form" :model="form" label-width="90px" class="search-form">
-        <el-form-item label="璁炬柦绫诲瀷锛�" size="mini" class="search-panel-item">
-          <el-select style="width: 100%" v-model="form.pipelineType" @change="handlePipelineType"
-                     :popper-class="'select-down'">
-            <el-option
-                v-for="item in pipelineTypeOptions"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value">
-            </el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item :label="form.pipelineType+'锛�'" size="mini">
-          <el-select style="width: 100%" v-model="form.dataType" @change="handleDataType" :popper-class="'select-down'">
-            <el-option
-                v-for="item in dataTypeOptions"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value">
-            </el-option>
-          </el-select>
-        </el-form-item>
-        <!--              <el-form-item >-->
-        <div class="rightButtonSearch">
-          <el-input v-model="form.keyword" size="mini" placeholder="鍦ㄦ杈撳叆鍏抽敭瀛楁悳绱�">
-            <!-- <el-button slot="append" icon="el-icon-search" size="mini"></el-button>-->
-            <!-- <i slot="prefix" class="el-input__icon el-icon-search"></i>-->
-            <!-- <i slot="suffix" class="search-btn el-input__icon el-icon-search" @click="handleSearch"></i> -->
-          </el-input>
-          <el-button class="el-icon-search" @click="handleSearch"></el-button>
-        </div>
-        <!--              </el-form-item>-->
-        <!--              <el-form-item>-->
-        <!--                <input type="button" class="btn-ok" @click="handleSearch" value="鏌ヨ">-->
-        <!--                <input type="button" class="btn-reset" @click="handleSearch" value="閲嶇疆">-->
-        <!--              </el-form-item>-->
-      </el-form>
+    <div class="sewers-search" v-if="gdVisible">
+        <div class="panel-title">{{ title }}</div>
+        <el-tabs v-model="activeName" @tab-click="handleClick">
+            <el-tab-pane label="鏌ヨ" name="first">
+                <div class="search-panel ">
+                    <el-form ref="form" :model="form" label-width="90px" class="search-form">
+                        <el-form-item label="璁炬柦绫诲瀷锛�" size="mini" class="search-panel-item">
+                            <el-select style="width: 100%" v-model="form.pipelineType"
+                                       :popper-class="'select-down'">
+                                <el-option
+                                        v-for="item in items"
+                                        :key="item.code"
+                                        :label="item.name"
+                                        :value="item.name">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item :label="form.pipelineType+'锛�'" size="mini">
+                            <el-select style="width: 100%" v-model="form.dataType" value-key="code"
+                                       :popper-class="'select-down'" @change="handleDataType">
+                                <el-option
+                                        v-for="item in subItems"
+                                        :key="item.code"
+                                        :label="item.name"
+                                        :value="item">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                        <div class="rightButtonSearch">
+                            <el-input v-model="form.keyword" size="mini" placeholder="鍦ㄦ杈撳叆鍏抽敭瀛楁悳绱�"></el-input>
+                            <el-button class="el-icon-search" @click="handleSearch"></el-button>
+                        </div>
+                    </el-form>
+                </div>
+                <el-scrollbar style="height:413px;">
+                    <div class="environmental-risk-list" v-for="(item,index) in list" :key="index"
+                         :class="activeNum===index?'hover':''">
+                        <img class="state" :src="getImgSrc()" style="background: none"/>
+                        <div>
+                            <h3 @click="handleLocation(item,index)">{{ item.properties.name || item.properties.code
+                                }}</h3>
+                            <p>鎵�灞炰紒涓氾細<span>{{ item.properties.orgname }}</span>
+                            <p>璁炬柦绫诲瀷锛�<span>{{ item.properties.type }}</span>
+                                <el-button v-if="fuShuSheShiShow" class="rt btn00fff6" size="mini"
+                                           style="margin-right: 0.04rem;"
+                                           @click="btnAffiliatedFacilities(item,index)">
+                                    闄勫睘璁炬柦
+                                </el-button>
+                            </p>
+                        </div>
+                    </div>
+                </el-scrollbar>
+                <el-card class="footer-page" v-if="total > 10">
+                    <el-pagination
+                            small
+                            @current-change="handlePage"
+                            :page-size=pageSize
+                            layout="prev, pager, next"
+                            :total=total
+                            class="warnPagination"
+                    >
+                    </el-pagination>
+                </el-card>
+            </el-tab-pane>
+            <el-tab-pane label="鍒嗘瀽" name="second">
+                <SewersAnalysis></SewersAnalysis>
+            </el-tab-pane>
+            <el-tab-pane label="鍘嗗彶" name="third">
+                <SewersHistory></SewersHistory>
+            </el-tab-pane>
+        </el-tabs>
+        <!-- 闄勫睘璁炬柦闈㈡澘 -->
+        <affiliated-facilities :facilitiesParameter="facilitiesParameter"
+                               v-if="fuShuSheShiShow"></affiliated-facilities>
     </div>
-    <el-scrollbar style="height:380.44px;">
-      <div class="environmental-risk-list" v-for="(item,index) in list" :key="index">
-        <!--  <i class="state"></i> -->
-        <div @click="handleLocation(item)">
-          <h3 class="B-TMD-table-list-title-y"
-              :class="['B-TMD-table-list-title-y-nam', { 'warning': item.vehicleStatus==='910003' }, { 'offline': item.vehicleStatus==='910001' }]">
-            {{ item.properties.pipename }}</h3>
-          <p v-for="itm in labelList" :key="itm.label">
-            <span>{{ itm.label }}锛�</span>
-            <span :title="item.properties[itm.key] ">{{ item.properties[itm.key] }}</span>
-          </p>
-        </div>
-      </div>
-    </el-scrollbar>
-    <el-card class="footer-page" v-if="total > 10">
-      <el-pagination
-          small
-          @current-change="handlePage"
-          :page-size=pageSize
-          layout="prev, pager, next"
-          :total=total
-          :current-page=current
-          class="warnPagination"
-      >
-      </el-pagination>
-    </el-card>
-  </div>
-  <!--        <div class="monitor2" v-if="hbVisible">-->
-  <!--          <env-protect-search></env-protect-search>-->
-  <!--        </div>-->
-  <!--        <div class="monitor2" v-if="pkVisible">-->
-  <!--          <discharge-search></discharge-search>-->
-  <!--        </div>-->
 </template>
 
 <script>
-import { PipelineTypeOptions } from '@/conf/layers/LayerSewers'
-
+// 寮曞叆缁勪欢鍐呭 =銆� 闄勫睘璁炬柦
+import AffiliatedFacilities from '@components/base-page/pipeline/AffiliatedFacilities'
+// 绠$嚎鍒嗘瀽鍔熻兘
+import SewersAnalysis from '@components/panel/topicSearch/sewers-select/SewersAnalysis'
+// 绠$嚎鏌ヨ鍘嗗彶鍔熻兘
+import SewersHistory from '@components/panel/topicSearch/sewers-select/SewersHistory'
+// form绫诲瀷鍙�夋嫨鏁版嵁 鍥惧眰鎺у埗
+import { LayerPipeLines } from '@src/conf/layers/LayerPipeLines'
+import { LayerFsss } from '@src/conf/layers/LayerFsss'
+import { LayerHbss } from '@src/conf/layers/LayerHbss'
+import { LayerPk } from '@src/conf/layers/LayerPk'
+import { LayerArea } from '@src/conf/layers/LayerArea'
+// 鏂规硶
 import WfsHelper from '@components/helpers/WfsHelper'
 import AjaxUtils from '@utils/AjaxUtils'
+import { fitBounds, highlight, locate } from '../../helpers/LocateHelper'
 
 export default {
   name: 'SewersSearch',
+  props: ['title'],
+  components: {
+    SewersAnalysis,
+    SewersHistory,
+    AffiliatedFacilities
+  },
   data () {
     return {
+      // 鍒ゆ柇鏄剧ず/闅愯棌
       gdVisible: true,
+      // tab鍒囨崲 缁戝畾褰撳墠鍊�
+      activeName: 'first',
+      // 鎼滅储鏁版嵁 鐢ㄤ簬灞曠ず鏁版嵁瀛樺偍
       list: [],
-      labelList: PipelineTypeOptions[0].labelList,
+      // 鍥惧眰鎺у埗
+      items: [LayerPipeLines, LayerFsss, LayerHbss, LayerPk, LayerArea],
+      // 鍒嗛〉
+      pageSize: 10,
       total: 0,
-      pipelineTypeOptions: PipelineTypeOptions,
-      dataTypeOptions: PipelineTypeOptions[0].options,
+      // form琛ㄥ崟缁戝畾鏁版嵁
       form: {
-        pipelineType: PipelineTypeOptions[0].label,
-        dataType: PipelineTypeOptions[0].options[0].label,
-        query: PipelineTypeOptions[0].options[0],
-        keyword: '鐮旂┒闄�01璺痀S000001'
-        // ,
-        // size: 10,
-        // current: 1
+        pipelineType: '绠$嚎',
+        dataType: '',
+        keyword: ''
       },
-      // pageSize: 10,
-      // current: 1,
-      isWaybillHover: true,
-      isRouteHover: false
+      facilitiesParameter: null,
+      fuShuSheShiShow: true,
+      activeNum: -1,
+      wfsHelper: null
     }
   },
-  props: ['title'],
-  methods: {
-    handlePipelineType (val) {
-      this.pipelineTypeOptions.forEach((itm) => {
-        if (val === itm.value) {
-          this.dataTypeOptions = itm.options
-          this.form.pipelineType = itm.label
-          this.form.labelList = itm.labelList
+  computed: {
+    subItems () {
+      const val = this.form.pipelineType
+      for (let i = 0; i < this.items.length; i++) {
+        const item = this.items[i]
+        if (val === item.name) {
+          return item.layers.filter(function (value, index, array) {
+            return value.name !== '娴佸悜'
+          })
         }
-      })
-      this.form.dataType = this.dataTypeOptions[0].label
-      this.form.key = this.dataTypeOptions[0].key
-    },
-    handleDataType (val) {
-      this.dataTypeOptions.forEach((itm) => {
-        if (val === itm.value) {
-          this.form.query = itm
-        }
-      })
-    },
-    async handleSearch () {
-      const param = {
-        pipelineType: this.form.pipelineType,
-        dataType: this.form.dataType
       }
-      console.log(param)
-      var wfsHelper = new WfsHelper()
-      wfsHelper.addTypeName(this.form.query.layerName)
-      wfsHelper.addLike(this.form.query.key, this.form.keyword)
+      return []
+    }
+  },
+  mounted () {
+    this.wfsHelper = new WfsHelper()
+  },
+  methods: {
+    // tab鍒囨崲
+    handleClick (tab, event) {
+      console.log(tab, event)
+      if (tab.label === '鍒嗘瀽') {
+        // 鍏抽棴寮圭獥
+        window.mapManager.clickDialogSwitch = false
+      } else {
+        // 鎵撳紑寮圭獥
+        window.mapManager.clickDialogSwitch = true
+      }
+    },
+    // 鏍规嵁杩斿洖鏁版嵁 纭灞曠ず鍥剧墖
+    getImgSrc () {
+      const icon = this.form.dataType.icon
+      return icon ? 'assets/images/map/' + icon : ''
+    },
+    // 椤甸潰鍒囨崲 鍒嗛〉鍔熻兘
+    handlePage (page) {
+      this.wfsHelper.setPage(page)
+      this.handleSearch()
+    },
+    // 浜岀骇form琛ㄥ崟鍒囨崲閫夋嫨娓呯┖宸查�夋嫨鏁版嵁
+    handleDataType () {
+      this.list = []
+    },
+    // 鎼滅储鍔熻兘
+    async handleSearch () {
+      // console.log(this.form.dataType.sname, this.form.keyword)
+      this.list = []
+      this.wfsHelper.clearFilter()
+      // todo 鐜板湪绠$綉杩樻病鍖哄垎寮�绫诲瀷锛屽悗闈㈡敼
+      this.wfsHelper.setTypeName(['sewer:view_pipeline'])
+      if (this.form.keyword) {
+        this.wfsHelper.addLike('name', this.form.keyword)
+      }
+      this.wfsHelper.addEquals('type', '\'' + this.form.dataType.sname + '\'')
+      // const filter = this.form.dataType.filter
+      // if (filter) {
+      //   this.wfsHelper.setFilter(filter)
+      // }
       // const _this = this
-      const res = await AjaxUtils.GetDataAsynByUrl(wfsHelper.getUrl(), {})
+      const res = await AjaxUtils.GetDataAsynByUrl(this.wfsHelper.getUrl(), {})
       if (res instanceof Object && Object.prototype.hasOwnProperty.call(res, 'features')) {
+        this.total = res.totalFeatures
         this.list = res.features
       }
+      this.wfsHelper = new WfsHelper()
     },
-    handleLocation (val) {
-      console.log(val)
-      const bound = this.L.geoJSON([val], {}).getBounds()
-      var layer = window.serviceLayerHelper.getByLayerId(val.id)
-      layer && layer.openPopup()
-      this.$store.state.map.map.flyToBounds(bound)
+    // 鐐瑰嚮鎼滅储鍒扮殑鏁版嵁 瀹炵幇鍔熻兘 = 瀹氫綅 楂樹寒 寮规
+    handleLocation (val, index) {
+      // console.log(val)
+      this.activeNum = index
+      // layer && layer.openPopup()
+      const config = this.form.dataType
+      locate(val, config)
+    },
+    // 闄勫睘璁炬柦鍔熻兘缁勪欢
+    btnAffiliatedFacilities (val, index) {
+      this.activeNum = index
+      this.facilitiesParameter = val
+      // 鍒ゆ柇閫夋嫨鏄惁鏄绾匡紝濡傛灉鏄垯鏄剧ず銆婇檮灞炶鏂姐�嬪脊妗�
+      if (this.form.pipelineType === '绠$嚎') {
+        this.fuShuSheShiShow = true
+      } else {
+        this.fuShuSheShiShow = false
+      }
+      fitBounds(val, this.form.dataType.code)
+      highlight(val)
     }
   }
 }

--
Gitblit v1.8.0