add-or-update.vue 26.1 KB
Newer Older
葛齐林's avatar
葛齐林 committed
1 2 3 4 5 6 7 8 9 10 11
<template lang="pug">
    el-dialog(width="60%" :visible.sync='visible' :append-to-body='true' :before-close="handleClose")
        div(slot='title')
            span.title-bold 修改资源点
        el-form(:model='dataForm' :rules='dataRule' ref='dataForm'  label-width='100px')
            el-row()
                el-col(:span="12" class='info-block')
                    div(class='info-title') 基本信息
                    div(class='info-form')
                        el-form-item(label='资源点名称:' prop='name')
                            el-input(v-model='dataForm.name' placeholder='请填写资源点名称')
12 13 14
                        el-form-item(label='资源点编码:' prop='code')
                            //- el-input(v-model='dataForm.code' placeholder='保存后系统自动生成' readonly)
                            el-input(v-model='dataForm.code' placeholder='请填写资源点编码' )
葛齐林's avatar
葛齐林 committed
15 16 17
                        el-form-item(label='资源点类型:' prop='type' )
                            el-select( v-model="dataForm.type" placeholder="请选择资源点类型" disabled)
                                el-option(v-for="(item,index) in typeList" :key="index" :label="item.name" :value="item.id")
18 19 20 21 22 23 24 25 26 27 28
                        el-form-item(label='品牌:' prop='brand')
                            el-select(v-model="dataForm.brand" placeholder="请选择品牌" )
                                el-option(v-for="(item,index) in brandList" :key="index" :label="item.name" :value="item.id" :code="item.id")
                        el-form-item(label='型号:' prop='equipmentModel')
                            el-input(v-model='dataForm.equipmentModel' placeholder='请填写型号')
                        el-form-item(label='最大功率:' prop='maxPower')
                            el-input(v-model='dataForm.maxPower' placeholder='请填写最大功率')
                        el-form-item(label="安装日期:", prop="installDate")
                            el-date-picker.mywidth(v-model="dataForm.installDate", value-format="yyyy-MM-dd", type="date", placeholder="请选择安装日期", clearable)
                        el-form-item(label="维保日期:", prop="maintenanceDate")
                            el-date-picker.mywidth(v-model="dataForm.maintenanceDate", value-format="yyyy-MM-dd", type="date", placeholder="请选择维保日期", clearable)
葛齐林's avatar
葛齐林 committed
29 30 31 32 33 34 35 36 37 38 39 40
                        el-form-item(label='地址码:' prop='addressCode')
                            el-input(v-model='dataForm.addressCode' placeholder='请填写地址码')
                        el-form-item(label='端口号:' prop='port')
                            el-input(v-model='dataForm.port' placeholder='请填写端口号')
                        el-form-item(label='用户名:' prop='username')
                            el-input(v-model='dataForm.username' placeholder='请填写用户名')
                        el-form-item(label='密码:' prop='password')
                            el-input(v-model='dataForm.password' placeholder='请填写密码')
                el-col(:span="11" style="margin-left: 30px;")
                    el-row( class='info-block')
                        div(class='info-title') 位置信息
                        div(class='info-form')
41
                            el-form-item(label='X坐标:' prop='xlongit')
葛齐林's avatar
葛齐林 committed
42
                                el-input(v-model='dataForm.xlongit' placeholder='请填写X坐标' readonly)
43
                            el-form-item(label='Y坐标:' prop='ylat')
葛齐林's avatar
葛齐林 committed
44 45
                                el-input(v-model='dataForm.ylat' placeholder='请填写Y坐标' readonly)
                            el-form-item(label='地图层级:' prop='tierId')
46
                                el-select(v-model="dataForm.tierId" placeholder="请选择地图层级" @change="tierChange" disabled)
葛齐林's avatar
葛齐林 committed
47
                                    el-option(v-for="(item,index) in tierList" :key="index" :label="item.name" :value="item.id" :code="item.id")
48 49 50
                            el-form-item(label='所属区域:' prop='region')
                                el-select(v-model="dataForm.region" placeholder="请选择所属区域" )
                                    el-option(v-for="(item,index) in regionList" :key="index" :label="item.name" :value="item.id" :code="item.id")
co_dengxiongwen's avatar
co_dengxiongwen committed
51
                            el-form-item(label='人工模式:' prop='modeTypes')
高超凡's avatar
高超凡 committed
52
                                el-checkbox-group(v-model="dataForm.modeTypes" placeholder="请选择人工模式" @change="checkGroupChange($event)")
co_dengxiongwen's avatar
co_dengxiongwen committed
53
                                    el-checkbox(v-for="(item, index) in modeList" :key="index" :label="item.id") {{item.name}}
葛齐林's avatar
葛齐林 committed
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
                            el-form-item(label='部署位置:' prop='deployLocation')
                                el-input(v-model='dataForm.deployLocation' placeholder='请填写部署位置')
                    el-row( class='info-block' style="margin-top: 20px;")
                        div(class='info-title') 附属信息
                        div(class='info-form')
                            el-form-item(label='当前操作员:' prop='operatorName')
                                el-input(v-model='dataForm.operatorName' placeholder='请填写当前操作员' disabled)
                            el-form-item(label='附属信息:' prop='attachedInfo')
                                el-input.mywidth(type="textarea" :rows=5 resize="none" v-model="dataForm.attachedInfo"  placeholder='请填写附属信息')
                            el-form-item(label='备注:' prop='remark')
                                el-input.mywidth(type="textarea" :rows=5 resize="none" v-model="dataForm.remark"  placeholder='请填写备注')
        span.dialog-footer(slot='footer')
            el-button(@click='cancel' type='primary' size='medium') 取消
            el-button(type='primary' size='medium' @click='dataFormSubmit()' v-prevent-re-click) 保存
</template>

<script>
import Vue from 'vue'
import { mapState } from 'vuex'
// openlayer
import 'ol/ol.css'
import { Map, View } from 'ol'
import { Projection } from 'ol/proj'
import { getCenter } from 'ol/extent'
import ImageLayer from 'ol/layer/Image'
import ImageStatic from 'ol/source/ImageStatic'
import Zoom from 'ol/control/Zoom'

// 图上图标相关
import OlFeature from 'ol/Feature'
import OlGeomPoint from 'ol/geom/Point'
import OlLayerVector from 'ol/layer/Vector'
import OlSourceVector from 'ol/source/Vector'
import OlStyleStyle from 'ol/style/Style'
import OlStyleIcon from 'ol/style/Icon'

// 用来添加相关文字描述的
import Text from 'ol/style/Text'
import Fill from 'ol/style/Fill'
let that
export default {
  computed: {
    ...mapState('d2admin/user', ['info'])
  },
co_dengxiongwen's avatar
co_dengxiongwen committed
98
  props: ['pList'],
99
  data() {
葛齐林's avatar
葛齐林 committed
100 101 102 103 104
    return {
      mapDialog: null,
      imgLayer: null,
      vectorLayer: null,
      projection: null,
co_dengxiongwen's avatar
co_dengxiongwen committed
105
      urlPath: window.CONFIG.urlPath,
葛齐林's avatar
葛齐林 committed
106 107
      extent: [-1100, 110, 1460, 820],
      visible: false,
108 109 110 111 112
      regionList: [
        { id: 1, name: '候车大厅' },
        { id: 2, name: '办公区域' },
        { id: 3, name: '屋顶' }
      ],
co_dengxiongwen's avatar
co_dengxiongwen committed
113 114 115 116 117
      modeList: [
        { id: '1', name: '供暖模式' },
        { id: '2', name: '机械通风' },
        { id: '3', name: '自然通风' }
      ],
葛齐林's avatar
葛齐林 committed
118 119 120 121 122 123 124 125
      icon: {},
      list: [],
      typeList: [],
      tierList: [],
      tierMap: {},
      tier: {},
      brandList: [],
      dataForm: {
126
        id: '',
葛齐林's avatar
葛齐林 committed
127
        name: '',
128 129
        code: '',
        type: '',
co_dengxiongwen's avatar
co_dengxiongwen committed
130
        modeTypes: [],
131 132 133 134 135
        equipmentModel: '',
        maxPower: '',
        installDate: null,
        maintenanceDate: null,
        region: '',
葛齐林's avatar
葛齐林 committed
136 137 138 139 140 141 142 143 144 145 146 147 148
        stationId: localStorage.getItem('stationId'),
        stationName: '',
        tierId: '',
        addressCode: '',
        port: '',
        username: '',
        password: '',
        remark: '',
        status: 1
      },
      dataRule: {
        name: [
          { required: true, message: '资源点名称不能为空', trigger: 'blur' },
149
          { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
葛齐林's avatar
葛齐林 committed
150
        ],
151 152 153
        code: [
          { required: true, message: '资源点编码不能为空', trigger: 'blur' },
          { min: 1, max: 30, message: '长度在 1 到 30 个字符', trigger: 'blur' }
co_dengxiongwen's avatar
co_dengxiongwen committed
154
        ],
155 156
        equipmentModel: [
          { required: true, message: '型号不能为空', trigger: 'blur' }
co_dengxiongwen's avatar
co_dengxiongwen committed
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
        maxPower: [
          { required: true, message: '最大功率不能为空', trigger: 'blur' }
        ],
        type: [
          { required: true, message: '资源点类型不能为空', trigger: 'blur' }
        ],
        region: [
          {
            required: true,
            message: '所属区域不能为空',
            trigger: ['blur', 'change']
          }
        ],
        installDate: [
          {
            required: true,
            message: '安装日期不能为空',
            trigger: ['blur', 'change']
          }
        ],
        maintenanceDate: [
          {
            required: true,
            message: '维保日期不能为空',
            trigger: ['blur', 'change']
          }
        ],
        addressCode: [
          { min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }
        ],
        port: [
          { message: '请输入端口号', trigger: 'change' },
          {
            validator(rule, value, callback) {
              if (value) {
                if (
                  Number.isInteger(Number(value)) &&
                  Number(value) < 65536 &&
                  Number(value) > 0
                ) {
                  callback()
                } else {
                  callback(new Error('请输入1到65535之间的正整数'))
                }
co_dengxiongwen's avatar
co_dengxiongwen committed
202
              } else {
203
                callback()
co_dengxiongwen's avatar
co_dengxiongwen committed
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
            },
            trigger: 'blur'
          }
        ],
        username: [
          { min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }
        ],
        password: [
          { min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }
        ],
        xlongit: [
          { required: true, message: 'X1坐标不能为空', trigger: 'blur' },
          { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
        ],
        ylat: [
          { required: true, message: 'Y1坐标不能为空', trigger: 'blur' },
          { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
        ],

        tierId: [
          { required: true, message: '地图层级不能为空', trigger: 'blur' }
        ],
        deployLocation: [
          { required: true, message: '部署位置不能为空', trigger: 'blur' },
          { min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }
        ],
        operatorName: [
          { required: true, message: '当前操作员不能为空', trigger: 'blur' }
        ],
        brand: [
          {
            required: true,
            message: '品牌不能为空',
            trigger: ['blur', 'change']
          }
        ],
        icon: [
          { required: true, message: '资源点图标不能为空', trigger: 'blur' }
        ],
        attachedInfo: [
          {
            min: 1,
            max: 500,
            message: '长度在 1 到 500 个字符',
            trigger: 'blur'
          }
        ],
        remark: [
          {
            min: 1,
            max: 500,
            message: '长度在 1 到 500 个字符',
            trigger: 'blur'
          }
        ]
葛齐林's avatar
葛齐林 committed
260 261 262
      }
    }
  },
263 264
  created() {
    that = this
葛齐林's avatar
葛齐林 committed
265 266
  },
  methods: {
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
    initMap(bean) {
      if (this.mapDialog) {
        this.mapDialog.removeLayer(this.imgLayer)
        this.mapDialog.removeLayer(this.vectorLayer)
      }
      let zoomControl = new Zoom({
        delta: 0.2,
        zoomInTipLabel: '',
        zoomOutTipLabel: ''
      })
      this.projection = new Projection({
        // 投影
        code: 'xkcd-image',
        units: 'pixels',
        extent: this.extent
      })
葛齐林's avatar
葛齐林 committed
283

284 285 286 287 288 289 290 291 292
      this.imgLayer = new ImageLayer({
        id: bean.id,
        source: new ImageStatic({
          url: bean.readPath, //这里添加静态图片的地址
          projection: this.projection,
          imageExtent: this.extent
        }),
        visible: true
      })
葛齐林's avatar
葛齐林 committed
293

294 295 296 297 298 299 300 301 302 303 304 305 306 307
      this.mapDialog = new Map({
        target: 'mapDialog',
        layers: [this.imgLayer],
        controls: [zoomControl],
        view: new View({
          projection: this.projection,
          center: getCenter([0, 0, 418, 600]), // 获取范围的中心坐标。
          zoom: 2.5,
          maxZoom: 5,
          minZoom: 1.5,
          extent: [-1100, -100, 2000, 1000]
        })
      })
      //点击事件
co_dengxiongwen's avatar
co_dengxiongwen committed
308 309 310 311 312 313 314
      this.mapDialog.on('click', function (evt) {
        let feature = evt.map.forEachFeatureAtPixel(
          evt.pixel,
          function (feature) {
            return feature
          }
        )
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
        if (feature) {
          for (let i in that.list) {
            if (feature.getId() === that.list[i].id) {
              that.list[i].active = !that.list[i].active
              let style = null
              if (that.list[i].active) {
                style = that.getPointStyle(
                  that.list[i].imageSrc + '2.png',
                  that.list[i].name,
                  0.3
                )
              } else {
                style = that.getPointStyle(
                  that.list[i].imageSrc + '.png',
                  that.list[i].name
                )
              }
              feature.setStyle(style)
            }
          }
        }
      })
葛齐林's avatar
葛齐林 committed
337
    },
338 339
    init(bean) {
      console.log('bean:', bean)
co_dengxiongwen's avatar
co_dengxiongwen committed
340
      this.dataForm = {}
葛齐林's avatar
葛齐林 committed
341 342
      this.visible = true
      if (bean) {
co_dengxiongwen's avatar
co_dengxiongwen committed
343
        this.dataForm = JSON.parse(JSON.stringify(bean))
co_dengxiongwen's avatar
co_dengxiongwen committed
344 345 346
        if (this.dataForm.modeTypes) {
          console.log('111111:')
          this.dataForm.modeTypes = this.dataForm.modeTypes.split(',')
高超凡's avatar
高超凡 committed
347 348
        }else{
          this.dataForm.modeTypes = []
co_dengxiongwen's avatar
co_dengxiongwen committed
349
        }
葛齐林's avatar
葛齐林 committed
350
      }
co_dengxiongwen's avatar
co_dengxiongwen committed
351
      console.log('dataForm:', this.dataForm)
葛齐林's avatar
葛齐林 committed
352 353 354 355 356
      this.dataForm.operatorName = this.info.name
      this.initResourceTypeDicList()
      this.initBrandDicList()
      this.initStationMapList()
    },
357
    initStationMapList() {
葛齐林's avatar
葛齐林 committed
358 359 360 361
      this.$http({
        url: this.$http.adornUrl(`/liStation/getId/${this.dataForm.stationId}`),
        method: 'get',
        params: this.$http.adornParams()
362
      }).then((data) => {
葛齐林's avatar
葛齐林 committed
363 364 365 366 367
        if (data && data.code === 0) {
          this.tierList = data.bean.mapList
        }
      })
    },
368
    initResourceTypeDicList() {
葛齐林's avatar
葛齐林 committed
369 370 371 372 373 374
      this.$http({
        url: this.$http.adornUrl('/sysDictionary/getResourceTypeDicList'),
        method: 'get',
        params: this.$http.adornParams({
          stationId: localStorage.getItem('stationId')
        })
375
      }).then((data) => {
葛齐林's avatar
葛齐林 committed
376 377
        if (data && data.code === 0) {
          this.typeList = data.list
378
          this.typeList.forEach((e) => {
co_dengxiongwen's avatar
co_dengxiongwen committed
379 380 381 382
            if (e.id === this.dataForm.type) {
              this.dataForm.dicTypeName = e.name
            }
          })
葛齐林's avatar
葛齐林 committed
383 384 385
        }
      })
    },
386
    initBrandDicList() {
葛齐林's avatar
葛齐林 committed
387 388 389 390 391 392 393
      this.brandList = []
      this.$http({
        url: this.$http.adornUrl('/sysDictionary/getBrandDicList'),
        method: 'get',
        params: this.$http.adornParams({
          stationId: localStorage.getItem('stationId')
        })
394
      }).then((data) => {
葛齐林's avatar
葛齐林 committed
395 396 397 398 399
        if (data && data.code === 0) {
          this.brandList = data.list
        }
      })
    },
400 401
    tierChange(e) {
      this.tierList.forEach((a) => {
葛齐林's avatar
葛齐林 committed
402 403 404 405 406 407 408
        if (a.name === e) {
          this.dataForm.tierId = a.id
          this.dataForm.tierName = a.name
          this.tier = a
        }
      })
    },
409 410 411 412 413 414 415 416 417 418 419 420 421
    addTips(tips, base, resource) {
      switch (base.type) {
        //枪机 球机 安检机
        case 'b6af764f2a6e454490a6b1b3c9057e57':
        case 'ece0b8b2db27411886254e81134988a3':
        case '303310efddb34a2e9bf269bdff8a7dc5':
          if (
            !base.addressCode ||
            !base.port ||
            !base.byx1 ||
            base.deleted === 1
          ) {
            break
葛齐林's avatar
葛齐林 committed
422
          }
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
          if (
            base.addressCode === resource.addressCode &&
            base.port === resource.port &&
            base.byx1 === resource.byx1
          ) {
            //添加到重复提示
            let tip =
              '地址码:' +
              base.addressCode +
              ' 端口:' +
              base.port +
              ' 通道号:' +
              base.byx1
            if (tips && !tips.includes(tip)) {
              tips.push(tip)
            }
葛齐林's avatar
葛齐林 committed
439
          }
440 441 442 443
          break
        default:
          if (!base.addressCode || !base.port || base.deleted === 1) {
            break
葛齐林's avatar
葛齐林 committed
444
          }
445 446 447 448 449 450 451 452
          if (
            base.addressCode === resource.addressCode &&
            base.port === resource.port
          ) {
            //添加到重复提示
            let tip = '地址码:' + base.addressCode + ' 端口:' + base.port
            if (tips && !tips.includes(tip)) {
              tips.push(tip)
葛齐林's avatar
葛齐林 committed
453 454 455 456 457
            }
          }
      }
    },
    // 表单提交
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
    dataFormSubmit(id) {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          //校验数据重复
          //后台返回的本地是否重复
          let list = this.pList
          let size = list.length
          let tips = []
          //添加或修改的数据跟本地比较是否重复
          for (let h = 0; h < size; h++) {
            const resource = list[h]
            if (resource.id === this.dataForm.id) {
              continue
            }
            this.addTips(tips, resource, this.dataForm)
          }
          //添加或修改的数据跟数据库是否重复
          this.$http({
            url: this.$http.adornUrl('/liResource/list'),
            method: 'post',
            data: {
              stationId: localStorage.getItem('stationId')
            }
          }).then((data) => {
            if (data && data.code === 0) {
              let list = data.page.rows
              for (let index = 0; index < list.length; index++) {
                const resource = list[index]
                if (resource.id === this.dataForm.id) {
                  continue
co_dengxiongwen's avatar
co_dengxiongwen committed
488
                }
489 490
                this.addTips(tips, resource, this.dataForm)
              }
葛齐林's avatar
葛齐林 committed
491
            }
492 493 494 495 496 497 498 499 500 501 502
          })
          // console.log('tips', tips)
          if (tips.length > 0) {
            let message = ''
            tips.map((item) => {
              message += item + '<br>'
            })
            // console.log(message)
            this.$emit('addNotify', message)
            return
          }
co_dengxiongwen's avatar
co_dengxiongwen committed
503 504 505
          if (this.dataForm.modeTypes) {
            this.dataForm.modeTypes = this.dataForm.modeTypes.join(',')
          }
506 507 508 509 510 511 512
          setTimeout(() => {
            this.$emit('refreshBean', this.dataForm)
            this.$emit('refreshdatalist', this.dataForm)
          }, 100)
          this.visible = false
        }
      })
葛齐林's avatar
葛齐林 committed
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
      // this.$refs['dataForm'].validate(valid => {
      //   if (valid) {
      //     this.dataForm.stationId = localStorage.getItem('stationId')
      //     this.$http({
      //       url: this.$http.adornUrl(
      //         `/liResource/${!this.dataForm.id ? 'save' : 'update'}`
      //       ),
      //       method: 'post',
      //       data: this.dataForm
      //     }).then(data => {
      //       if (data && data.code === 0) {
      //         this.$message({
      //           message: '操作成功',
      //           type: 'success',
      //           duration: 1500,
      //           onClose: () => {
      //             this.visible = false
      //             this.checkCameraList = []
      //             this.$emit('refreshdatalist', data.bean)
      //           }
      //         })
      //       } else {
      //         this.$message.error(data.msg)
      //       }
      //     })
      //   }
      // })
    },
    //关闭前
542
    handleClose() {
葛齐林's avatar
葛齐林 committed
543
      this.visible = false
co_dengxiongwen's avatar
co_dengxiongwen committed
544
      //this.$emit('refreshBean', this.dataForm)
葛齐林's avatar
葛齐林 committed
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
      this.$refs.dataForm.resetFields()
    },
    //取消
    cancel() {
      this.$confirm('确认取消?', '修改资源点', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          this.handleClose()
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消退出'
          })
        })
    },
    changeImageLayer(bean) {
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
      if (bean === null) return
      if (this.mapDialog) {
        this.mapDialog.removeLayer(this.imgLayer)
      } else {
        return
      }
      this.imgLayer = new ImageLayer({
        id: bean.id,
        source: new ImageStatic({
          url: bean.readPath, //这里添加静态图片的地址
          projection: this.projection,
          imageExtent: this.extent
        }),
        visible: true
      })
      this.mapDialog.addLayer(this.imgLayer)
葛齐林's avatar
葛齐林 committed
581
    },
582 583 584 585 586 587 588
    changeVectorLayer(list) {
      if (!list) return
      if (this.mapDialog) {
        this.mapDialog.removeLayer(this.vectorLayer)
      } else {
        return
      }
葛齐林's avatar
葛齐林 committed
589

590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
      let featuresArr = []
      for (let i in list) {
        if (list[i].imageSrc) {
          featuresArr.push(this.getFeature(list[i].xlongit, list[i].ylat))
          let style = null
          if (list[i].active) {
            style = this.getPointStyle(
              list[i].imageSrc + '2.png',
              this.list[i].name,
              0.3
            )
          } else {
            style = this.getPointStyle(
              list[i].imageSrc + '.png',
              this.list[i].name
            )
葛齐林's avatar
葛齐林 committed
606
          }
607 608 609
          featuresArr[i].setStyle(style)
          featuresArr[i].setId(list[i].id)
        }
葛齐林's avatar
葛齐林 committed
610
      }
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642
      this.vectorLayer = new OlLayerVector({
        source: new OlSourceVector({
          features: featuresArr
        })
      })
      this.mapDialog.addLayer(this.vectorLayer)
    },
    getFeature(x, y) {
      return new OlFeature({
        type: 'icon',
        geometry: new OlGeomPoint([x, y])
      })
    },
    getPointStyle(src, name, zoom) {
      let style = new OlStyleStyle({
        image: new OlStyleIcon({
          anchor: [0.5, 0.5],
          scale: zoom || 0.4,
          //rotation:0 旋转度
          src: require('@/assets/images/' + src)
        }),
        text: new Text({
          text: name, // 添加文字描述
          font: '14px font-size', // 设置字体大小
          fill: new Fill({
            // 设置字体颜色
            color: 'black'
          }),
          offsetY: 30 // 设置文字偏移量
        })
      })
      return style
高超凡's avatar
高超凡 committed
643 644 645 646
    },
    // 多选框组改变事件
    checkGroupChange(val){
      this.$set(this.dataForm,this.dataForm.modeTypes,val)
647
    }
葛齐林's avatar
葛齐林 committed
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845
  }
}
</script>
<style lang="scss" scoped>
.el-icon-qiangji5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-qiuji5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-quanjing5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-fangqu5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-hongwai5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-yeti5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-zhaoming5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-ruqin5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-anjian5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-zhayao5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-anjianmen5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-baojing5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-menjin5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-icon-shuangjian5 {
  width: 31px;
  height: 34px;
  background-size: 182%;
}

.el-table__header {
  width: 100% !important;
}

.el-table__body {
  width: 100% !important;
}

.info-title {
  line-height: 50px;
  font-size: 18px;
  height: 50px;
  padding: 0 20px;
  background-color: #dfeaf7;
  border-bottom: 1px solid #cccccc;
}

.info-form {
  padding: 10px;
}

.info-block {
  border: 1px solid #cccccc;
}

.el-select {
  width: 100%;
}

.resource-container {
  width: 100%;
  height: 100%;
  position: relative;
  border: 0px solid black;
  overflow: auto;

  .span-box {
    height: 30px;
    width: 30px;
    // background-color: #0097ff;
    font-size: 12px;
    border-radius: 5px;
    /* border: 1px solid red; */
    position: absolute;
    // left: 0;
    // top: 0;
    .span-img {
      width: 100%;
      height: 100%;
      border-radius: 5px;
    }
  }

  .isActive {
    background-color: #fd949d;
    width: 40px;
    height: 40px;

    .el-icon-qiangji5 {
      width: 40px;
      height: 46px;
      background-size: 182%;
    }

    .el-icon-qiuji5 {
      width: 40px;
      height: 46px;
      background-size: 182%;
    }
  }
}

.mod-menu {
  .icon-list__input {
    > .el-input__inner {
      cursor: pointer;
    }
  }

  &__icon-popover {
    max-width: 370px;
  }

  &__icon-list {
    max-height: 180px;
    padding: 0;
    margin: -8px 0 0 -8px;

    > .el-button {
      padding: 8px;
      margin: 8px 0 0 8px;

      > span {
        display: inline-block;
        vertical-align: middle;
        width: 18px;
        height: 18px;
        font-size: 18px;
      }
    }
  }

  .icon-list__tips {
    font-size: 18px;
    text-align: center;
    color: #e6a23c;
    cursor: pointer;
  }
}
.map-dialog {
846 847 848
  /deep/ .el-dialog__body {
    padding: 0;
  }
葛齐林's avatar
葛齐林 committed
849 850
}
</style>