派生自 wuyushui/SewerAndRainNetwork

yangdelong
2021-05-30 4adfa4774e09f3b388335bb8dee5dea518856e5b
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<template>
    <div class="ReportLocationSection">
        <el-form :model="form" label-width="120px">
            <el-row class="pipe-line-search">
                <el-col :span="18">
                    <el-form-item label="管线名称:">
                        <el-input v-model="form.pipeName" @change="pipelineSearch">
                            <el-button style="padding-right:10px;" slot="suffix" type="text" @click="pipelineSearch">
                                <img src="../../../../../public/assets/images/map/emergency/search.png" alt="">
                            </el-button>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-button type="primary" size="small" icon="el-icon-location-outline" @click="pipeClickLocation">定位
                    </el-button>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="管段编码:">
                        <el-input v-model="form.sectionName" disabled></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="附属设施编码:">
                        <el-input v-model="form.affiliatedFacilities" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="附属设施类型:">
                        <el-input v-model="form.affiliatedFacilitiesCode" disabled></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <div class="pipe-table" v-show="this.tableList.length>=1">
            <el-card>
                <span class="fixed-style" style="display: block">管线名称</span>
                <el-table
                        :data="tableList"
                        border
                        height="120"
                        max-height="140"
                        @row-click="sectionShowClick"
                        style="width: 100%">
                    <el-table-column
                            label="序号"
                            type="index"
                    >
                    </el-table-column>
                    <el-table-column
                            show-overflow-tooltip
                            prop="properties.pipename"
                            label="管线名称">
                    </el-table-column>
                    <el-table-column
                            show-overflow-tooltip
                            prop="properties.subchaname"
                            label="支线名称">
                    </el-table-column>
                    <el-table-column
                            show-overflow-tooltip
                            prop="properties.mediumtype"
                            label="管线类型">
                    </el-table-column>
                    <el-table-column width="40" fixed="right" label="操作">
                        <template slot-scope="scope">
                            <el-button @click="localAdr(scope.row)" type="text" size="small">定位</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-card>
            <el-card>
                <span class="fixed-style" style="display: block">管段列表</span>
                <el-table
                        :data="tableListSection"
                        border
                        @row-click="sectionCode"
                        height="100"
                        max-height="100"
                        style="width: 100%">
                    <el-table-column
                            show-overflow-tooltip
                            prop="properties.pipesegcode"
                            label="管段编码">
                    </el-table-column>
                    <el-table-column
                            show-overflow-tooltip
                            prop="properties.startpointnumber"
                            label="起点探查号">
                    </el-table-column>
                    <el-table-column
                            show-overflow-tooltip
                            prop="properties.endpointnumber"
                            label="终点探查号">
                    </el-table-column>
                    <el-table-column
                            show-overflow-tooltip
                            prop="properties.material"
                            label="材质">
                    </el-table-column>
                    <el-table-column
                            show-overflow-tooltip
                            prop="properties.embeddingmode"
                            label="埋设方式">
                    </el-table-column>
                    <el-table-column width="40" fixed="right" label="操作">
                        <template slot-scope="scope">
                            <el-button @click="localAdr(scope.row)" type="text" size="small">定位</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <span class="fixed-style" style="display: block">附属设施列表</span>
                <el-table
                        :data="tableDataAffFac"
                        border
                        @row-click="affFacName"
                        height="120"
                        max-height="140"
                        style="width: 100%">
                    <el-table-column
                            show-overflow-tooltip
                            width="150"
                            prop="properties.pipecode"
                            label="管线编号">
                    </el-table-column>
                    <el-table-column
                            show-overflow-tooltip
                            width="150"
                            prop="properties.name"
                            label="附属设施名称">
                    </el-table-column>
                    <el-table-column
                            width="150"
                            show-overflow-tooltip
                            prop="properties.type"
                            label="设施类型">
                    </el-table-column>
                    <el-table-column width="90" fixed="right" label="操作">
                        <template slot-scope="scope">
                            <el-button @click="localAdr(scope.row)" type="text" size="small">定位</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-card>
        </div>
        <el-row style="text-align: right;margin: 10px">
            <el-button type="primary" @click="confirm" size="small">确认</el-button>
        </el-row>
    </div>
</template>
 
<script>
import { highlight, fitBounds } from '../../../helpers/LocateHelper'
import WfsHelper from '@components/helpers/WfsHelper'
import AjaxUtils from '@utils/AjaxUtils'
import eventBus from '../../../../eventBus'
import { WMS_URL } from '../../../../conf/Constants'
 
export default {
  name: 'ReportLocationSection',
  data () {
    return {
      form: {
        pipeName: '',
        sectionName: '',
        affiliatedFacilities: '',
        affiliatedFacilitiesCode: ''
      },
      // 管线查询数据列表
      tableList: [],
      // 管段查询数据列表
      tableListSection: [],
      // 附属设施查询列表数据
      tableDataAffFac: [],
      // 定义类型判断 if 是搜索到的数据可以进行管线选择 else 点击定位选择的管线不可以进行选择
      SectionAndAffFacTableJudge: false
    }
  },
  mounted () {
    this.wfsHelper = new WfsHelper()
  },
  methods: {
    // 管线搜索
    async pipelineSearch () {
      this.SectionAndAffFacTableJudge = true
      this.tableList = []
      this.tableListSection = []
      this.tableDataAffFac = []
      this.wfsHelper.clearFilter()
      this.wfsHelper.setTypeName(['sewer:pipeline'])
      if (this.form.pipeName) {
        this.wfsHelper.addLike('subchaname', this.form.pipeName)
      }
      // this.wfsHelper.addEquals('pipename', '\'' + this.form.pipeName + '\'')
      const res = await AjaxUtils.GetDataAsynByUrl(this.wfsHelper.getUrl(), {})
      // console.log(res)
      if (res instanceof Object && Object.prototype.hasOwnProperty.call(res, 'features')) {
        this.total = res.totalFeatures
        // console.log(res.features)
        this.tableList = res.features
      }
      this.wfsHelper = new WfsHelper()
      // this.form.pipeName = ''
      this.form.sectionName = ''
      this.form.affiliatedFacilities = ''
      this.form.affiliatedFacilitiesCode = ''
    },
    // 点击管线列表 展示管段内容 和附属设施内容
    sectionShowClick (val) {
      // console.log(val)
      // this.SectionAndAffFacTableJudge = true
      if (this.SectionAndAffFacTableJudge === true) {
        this.searchSection(val)
        this.searchAffFacData(val)
      }
    },
    // 管段查询
    async searchSection (val) {
      const sectionNameSearch = val.properties.pipename
      this.tableListSection = []
      this.wfsHelper.clearFilter()
      this.wfsHelper.setTypeName(['sewer:pipesegment'])
      this.wfsHelper.addLike('pipename', sectionNameSearch)
      this.wfsHelper.addEquals('pipename', '\'' + sectionNameSearch + '\'')
      const res = await AjaxUtils.GetDataAsynByUrl(this.wfsHelper.getUrl(), {})
      // console.log(res)
      if (res instanceof Object && Object.prototype.hasOwnProperty.call(res, 'features')) {
        this.tableListSection = res.features
      }
    },
    // 附属设施查询
    async searchAffFacData (val) {
      this.tableDataAffFac = []
      const AffFacSearch = val.properties.pipecode
      this.wfsHelper.clearFilter()
      this.wfsHelper.setTypeName(['sewer:view_pipeline'])
      this.wfsHelper.addLike('pipecode', AffFacSearch)
      // this.wfsHelper.addEquals('type', '\'' + AffFacSearch + '\'')
      const resAffFac = await AjaxUtils.GetDataAsynByUrl(this.wfsHelper.getUrl(), {})
      console.log(resAffFac)
      if (resAffFac instanceof Object && Object.prototype.hasOwnProperty.call(resAffFac, 'features')) {
        this.tableDataAffFac = resAffFac.features
      }
    },
    // 搜索的公共方法优化
    async publicSearch (searchVal, searchKeyword, searchTypeName, tableListData) {
      tableListData = []
      this.wfsHelper = new WfsHelper()
      this.wfsHelper.clearFilter()
      this.wfsHelper.setTypeName(searchTypeName)
      this.wfsHelper.addLike(searchKeyword, searchVal)
      this.wfsHelper.addEquals(searchKeyword, '\'' + searchVal + '\'')
      const res = await AjaxUtils.GetDataAsynByUrl(this.wfsHelper.getUrl(), {})
      // console.log(res)
      if (res instanceof Object && Object.prototype.hasOwnProperty.call(res, 'features')) {
        tableListData = res.features
      }
    },
    // 点击管段列表 管段编码传递
    sectionCode (val) {
      // console.log(val)
      this.form.sectionName = val.properties.pipesegcode
    },
    // 点击附属设施列表 管段编码传递
    affFacName (val) {
      console.log(val)
      // this.form.affiliatedFacilities = val.properties.code
      this.form.affiliatedFacilities = val.properties.name
      this.form.affiliatedFacilitiesCode = val.properties.type
    },
    // 定位功能
    localAdr (val) {
      // console.log(val)
      fitBounds(val)
      highlight(val)
    },
    // 管线 点击定位管段的选择功能
    pipeClickLocation () {
      // 设施不进行 管线表格数据的点击交互
      this.SectionAndAffFacTableJudge = false
      if (this.SectionAndAffFacTableJudge === false) {
        // 点击获取数据
        window.map.on('click', (e) => {
          this.SectionAndAffFacTableJudge = false
          // 点击地图关闭弹框
          window.mapManager.clickDialogSwitch = false
          // 管线点击数据
          this.pipeData(e)
          // 管段点击数据
          this.sectionData(e)
          // 附属设施数据
          this.affFacData(e)
          // 关闭点击事件
          window.map.off('click')
        })
      }
      // 数据 重新获取 进行置空
      this.form.pipeName = ''
      this.form.sectionName = ''
      this.form.affiliatedFacilities = ''
      this.form.affiliatedFacilitiesCode = ''
      this.tableList = []
      this.tableListSection = []
      this.tableDataAffFac = []
    },
    // 点击定位区域 搜寻管线数据
    pipeData (e) {
      this.publicWay(e, 'sewer:pipeline', 'sewer:pipeline', this.tableList)
    },
    // 点击定位区域 搜寻管段数据
    sectionData (e) {
      this.publicWay(e, 'sewer:pipesegment', 'sewer:pipesegment', this.tableListSection)
    },
    // 点击定位区域 搜寻附属设施数据
    affFacData (e) {
      this.publicWay(e, 'sewer:view_pipeline', 'sewer:view_pipeline', this.tableDataAffFac, 'pipecode <> \'\'')
    },
    // 点击按钮定位 的公共事件
    publicWay (e, layer, queryLayer, dataList, cqlfilter) {
      const defaultWmsParams = {
        VERSION: '1.1.1',
        SERVICE: 'WMS',
        REQUEST: 'GetFeatureInfo',
        FORMAT: 'image/png',
        INFO_FORMAT: 'application/json',
        TRANSPARENT: true,
        FEATURE_COUNT: 50,
        SRS: 'EPSG:4326',
        cql_filter: cqlfilter,
        EXCEPTIONS: 'application/vnd.ogc.se_inimage'
      }
      const size = window.map.getSize()
      const point = window.map.latLngToContainerPoint(e.latlng, window.map.getZoom())
      const wmsParams = Object.assign({
        LAYERS: layer,
        QUERY_LAYERS: queryLayer,
        WIDTH: size.x,
        HEIGHT: size.y,
        X: Math.round(point.x),
        Y: Math.round(point.y),
        BBOX: window.map.getBounds().toBBoxString()
      }, defaultWmsParams)
      AjaxUtils.get4JsonDataByUrl(WMS_URL, wmsParams, (res) => {
        // console.log(res)
        for (let i = 0; i < res.data.features.length; i++) {
          dataList.push(res.data.features[i])
        }
      })
    },
    // 点击确认
    confirm () {
      // console.log('点击确定选择完成')
      eventBus.$emit('location-setChange', true)
      this.form.pipeName = ''
      this.form.sectionName = ''
      this.form.affiliatedFacilities = ''
      this.tableList = []
      this.tableListSection = []
      this.tableDataAffFac = []
      this.SectionAndAffFacTableJudge = false
    }
  }
}
</script>
 
<style lang="less" scoped>
    /*/deep/ .el-input {*/
    /*    width: 0.74353rem;*/
    /*}*/
 
    .pipe-line-search {
        display: flex;
        align-items: center;
 
        .el-button {
            margin: 0 15px;
        }
    }
 
    .pipe-table {
        /*display: flex;*/
        /*align-items: center;*/
        /*justify-content: space-around;*/
 
        /deep/ .el-card {
            /*width: 1.39523rem;*/
            /*max-width: 1.39523rem;*/
            /*height: 0.9343rem;*/
            /*max-height: 0.9343rem;*/
 
            .el-table {
                margin: 0.05345rem auto;
            }
        }
    }
 
    .fixed-style {
        color: @color;
    }
 
    /deep/
    .warnPagination {
        .btn-quicknext, .btn-quickprev {
            color: #e4e8f1 !important;
            background-color: transparent;
            // border: 1px solid #25AECD;
            border-left: 1px solid #25AECD;
            border-bottom: 1px solid #25AECD;
            border-top: 1px solid #25AECD;
            color: #e4e8f1;
        }
 
        .el-pager li {
            color: #e4e8f1;
            background: transparent;
            // border: 1px solid #25AECD;
            border-left: 1px solid #25AECD;
            border-bottom: 1px solid #25AECD;
            border-top: 1px solid #25AECD;
        }
 
        .el-pager li.active {
            border-color: #25AECD;
            background-color: rgba(38, 222, 253, 0.3);
            color: #e4e8f1;
        }
 
        .el-pager li:hover {
            border-color: #25AECD;
            background-color: rgba(38, 222, 253, 0.3);
            color: #34e0ff;
        }
 
        .btn-prev {
            background-color: transparent;
            // border: 1px solid #25AECD;
            border-left: 1px solid #25AECD;
            border-bottom: 1px solid #25AECD;
            border-top: 1px solid #25AECD;
            color: #e4e8f1;
        }
 
        .btn-next {
            background-color: transparent;
            border: 1px solid #25AECD;
            color: #e4e8f1;
        }
    }
</style>