派生自 wuyushui/SewerAndRainNetwork

徐旺旺
2021-05-21 e2bf4ab5fbcc29209d74101d99c0690d4ffbe234
src/components/panel/topicSearch/SewersSearch.vue
@@ -6,7 +6,7 @@
                <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"
                            <el-select style="width: 100%" v-model="form.pipelineType"
                                       :popper-class="'select-down'">
                                <el-option
                                        v-for="item in items"
@@ -38,10 +38,10 @@
                         :class="activeNum===index?'hover':''">
                        <img class="state" :src="getImgSrc()" style="background: none"/>
                        <div>
                            <h3 @click="handleLocation(item,index)">{{ item.properties.pipename }}
                                {{item.properties.companyname }}</h3>
                            <h3 @click="handleLocation(item,index)">{{ item.properties.name || item.properties.code
                                }}</h3>
                            <p>所属企业:<span>{{ item.properties.orgname }}</span>
                            <p>设施类型:<span>{{form.pipelineType}}</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)">
@@ -112,7 +112,6 @@
      list: [],
      // 图层控制
      items: [LayerPipeLines, LayerFsss, LayerHbss, LayerPk, LayerArea],
      subItems: LayerPipeLines.layers,
      // 分页
      pageSize: 10,
      total: 0,
@@ -128,6 +127,20 @@
      wfsHelper: null
    }
  },
  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 !== '流向'
          })
        }
      }
      return []
    }
  },
  mounted () {
    this.wfsHelper = new WfsHelper()
  },
@@ -135,6 +148,13 @@
    // tab切换
    handleClick (tab, event) {
      console.log(tab, event)
      if (tab.label === '分析') {
        // 关闭弹窗
        window.mapManager.clickDialogSwitch = false
      } else {
        // 打开弹窗
        window.mapManager.clickDialogSwitch = true
      }
    },
    // 根据返回数据 确认展示图片
    getImgSrc () {
@@ -146,17 +166,6 @@
      this.wfsHelper.setPage(page)
      this.handleSearch()
    },
    // 设施类型筛选
    handlePipelineType (val) {
      this.list = []
      for (let i = 0; i < this.items.length; i++) {
        const item = this.items[i]
        if (val === item.name) {
          this.subItems = item.layers
          return
        }
      }
    },
    // 二级form表单切换选择清空已选择数据
    handleDataType () {
      this.list = []
@@ -164,24 +173,25 @@
    // 搜索功能
    async handleSearch () {
      // console.log(this.form.dataType.sname, this.form.keyword)
      // console.log(this.form)
      this.list = []
      this.wfsHelper.clearFilter()
      // todo 现在管网还没区分开类型,后面改
      this.wfsHelper.setTypeName([this.form.dataType.typeName])
      this.wfsHelper.setTypeName(['sewer:view_pipeline'])
      if (this.form.keyword) {
        this.wfsHelper.addLike('pipename', this.form.keyword)
        this.wfsHelper.addLike('name', this.form.keyword)
      }
      const filter = this.form.dataType.filter
      if (filter) {
        this.wfsHelper.setFilter(filter)
      }
      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(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, index) {