派生自 wuyushui/SewerAndRainNetwork

chenyabin
2021-05-13 86bda67d835094fdb7d96500ab5393299b36919c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<template>
    <!-- 附属设施 -弹框 -->
    <div class="affiliatedFacilities">
        <el-dialog
                custom-class="affiliatedFacilities-dialog"
                :title="facilitiesParameter && facilitiesParameter.properties.pipename"
                :visible.sync="dialogVisible"
                :append-to-body="true"
                :modal="false"
                 v-dialogDragBottom
                >
            <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">
                       <div class="el-select el-select--mini">8888</div>
                    </el-form-item> -->
                    <el-form-item label="设施类型:" size="mini" class="search-panel-item">
                        <el-select style="width: 100%"  v-model="dataType" value-key="code" @change="handleDataType" :popper-class="'select-down'">
                            <el-option v-for="(item,index) in classification" :key="index" :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:300px;">
                <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.pipename }}</h3>
                        <p>所属企业:<span>{{ item.properties.orgcode }}</span>
                        <p>设施类型:<span>{{ item.properties.teetype }}</span>
                            <!--  <el-button v-if="fuShuSheShiShow" class="rt" size="mini" style="margin-right: 0.04rem" @click="btnAffiliatedFacilities(item)" >附属设施</el-button> -->
                        </p>
                    </div>
                </div>
            </el-scrollbar>
            <!-- <div v-for="(item,index) in classification" :key="index">
                <h3 @click="btnfuShuSheShiSubItems(item,index)"> <i :class="item.isShow?'icon iconfont iconcaret-right':'icon iconfont iconsort-down'"></i> {{item.name}}</h3>
                <ul v-if="item.isShow">
                    <li v-for="(item1,index1) in item.features" :key="index1" @click="btnFeatures(item,item1,index,index1)" :class="item.activeNum==index1?'hover':''" >{{item1.properties.pipename}}</li>
                </ul>
            </div> -->
        </el-dialog>
    </div>
</template>
 
<script>
import WfsHelper from '@components/helpers/WfsHelper'
import AjaxUtils from '@utils/AjaxUtils'
import { LayerFsss } from '@src/conf/layers/LayerFsss'
 
console.log(LayerFsss, 8888888888)
export default {
  name: 'AffiliatedFacilities',
  data () {
    return {
      dialogVisible: false,
      form: {
        areaVal: '',
        keyword: ''
      },
      dataType: '',
      classification: LayerFsss.layers,
      list: [],
      activeNum: -1
    }
  },
  props: ['facilitiesParameter', 'fuShuSheShiSubItems'],
  watch: {
    facilitiesParameter: {
      handler (newValue, oldValue) {
        this.dialogVisible = true
        this.list = []
      },
      deep: true
    }
  },
  methods: {
    getImgSrc () {
      const icon = this.dataType.icon
      return icon ? 'assets/images/map/' + icon : ''
    },
    handleClose (done) {
      // this.$confirm('确认关闭?').then(_ => { done() }).catch(_ => {})
    },
    btnFeatures (val, val1, index, index1) {
      this.classification.forEach((item) => {
        item.activeNum = -1
      })
      this.classification[index].activeNum = index1
      this.$forceUpdate()
      window.layerFactory.flyByFeature(val1, val.code)
    },
    handleDataType () {
      this.list = []
    },
    async handleSearch () {
      var wfsHelper = new WfsHelper()
      // todo 现在管网还没区分开类型,后面改
      wfsHelper.addTypeName(this.dataType.typeName)
      if (this.form.keyword) {
        wfsHelper.addLike('name', this.form.keyword)
      }
      // const _this = this
 
      const res = await AjaxUtils.GetDataAsynByUrl(wfsHelper.getUrl(), {})
      // console.log(res)
 
      if (res instanceof Object && Object.prototype.hasOwnProperty.call(res, 'features')) {
        this.list = res.features
 
        // this.$forceUpdate()
      }
    },
    handleLocation (val, index) {
      this.activeNum = index
      window.layerFactory.flyByFeature(val, this.dataType.code)
    }
  }
}
</script>
 
<style  lang="less">
.affiliatedFacilities-dialog{
    width: calc(20% - 60px) !important; // calc(30% - 15px);
    left: 60%;
    .el-dialog__body{
        padding: 0.04rem;
        .search-panel {
            background-color: transparent;
            padding: 10px;
            border-bottom: 1px solid @background-color-split;
            // .el-input{width:calc(100% - 40px);position: relative}
            /deep/ input {
                border-radius: 0;
                background-color: @background-color-split;
                border: solid 1px @color;
                color: @color-gray;
                font-size: 0.01rem;
                padding: 0 15px;
 
                .el-select .el-input.is-focus .el-input__inner {
                    border-color: @color;
                }
            }
            .el-form-item__label{
                color:#00fff6
            }
            .el-input__inner {
                background: none;
                color: #fff;
                font-size: 14px;
                border-radius: 0;
                border-color: @color;
                background: rgba(0, 16, 30, .5);
            }
        }
        /*input 点击搜索样式*/
 
        .rightButtonSearch {
            display: flex;
            justify-content: space-between;
            align-items: center;
 
            .el-input {
                margin-right: 10px
            }
 
            .el-icon-search {
                width: 40px;
                border: 1px solid @color;
                height: 28px;
                line-height: 28px;
                text-align: center;
                color: #fff;
                border-radius: 2px;
                cursor: pointer;
                background: rgba(0, 16, 30, .5);
                padding: 0;
            }
        }
        .environmental-risk-list {
            position: relative;
            padding-left: 50px;
            padding-top: 5px;
            padding-bottom: 5px;
            color: @color-shadow;
            border-bottom: 1px solid @background-color-split;
            h3{ cursor: pointer;}
            .state {
                width: 30px;
                height: 30px;
                position: absolute;
                top: 50%;
                left: 10px;
                margin-top: -15px;
                border-radius: 50%;
                box-shadow: 0 0 3px #000;
                background: #0B3B6D;
            }
        }
 
        .environmental-risk-list.hover,
        .environmental-risk-list:hover {
            color: @color-highlight;
            background: @background-color;
        }
    }
}
</style >