From 72e8ced67fe06adf794678a03d95bc1eb0947d4e Mon Sep 17 00:00:00 2001
From: 徐旺旺 <11530253@qq.com>
Date: 星期四, 15 四月 2021 17:34:05 +0800
Subject: [PATCH] 弹框组件初步,管线动画控制,默认值修改

---
 src/components/layer/src/helper/helper.js                   |  160 ++++++++++
 src/conf/layers/LayerPipeLines.js                           |   18 
 src/conf/layers/LayerWasteWater.js                          |   17 
 src/components/layer/src/layer.vue                          |   46 ++
 src/conf/LayerTopic.js                                      |    2 
 src/conf/layers/LayerFsss.js                                |    1 
 src/conf/layers/LayerPollutionSources.js                    |    6 
 src/conf/layers/LayerWasteGas.js                            |   22 
 src/conf/layers/LayerAirQuality.js                          |    7 
 src/conf/layers/LayerArea.js                                |    6 
 src/components/LayerController/service/LayerFactory.js      |   81 ++--
 src/components/layer/src/page.vue                           |   73 ++++
 src/conf/layers/LayerWasteSolid.js                          |    7 
 src/components/layer/index.js                               |    9 
 src/components/LayerController/logic/PipeLineAnimal.js      |   82 ++++-
 src/components/LayerController/service/EventLayerService.js |   25 +
 src/main.js                                                 |    2 
 src/conf/Constants.js                                       |    2 
 src/conf/layers/LayerEnvRisk.js                             |   14 
 src/conf/layers/LayerSoilGroundWater.js                     |   27 -
 src/components/layer/src/layer.js                           |  195 ++++++++++++
 src/components/layer/src/iframe.vue                         |  126 +++++++
 22 files changed, 802 insertions(+), 126 deletions(-)

diff --git a/src/components/LayerController/logic/PipeLineAnimal.js b/src/components/LayerController/logic/PipeLineAnimal.js
index 585147b..f712d96 100644
--- a/src/components/LayerController/logic/PipeLineAnimal.js
+++ b/src/components/LayerController/logic/PipeLineAnimal.js
@@ -1,28 +1,78 @@
+
 /**
  *  绠$嚎鍔ㄧ敾鎺у埗閫昏緫
  */
-const layerPipeLines = require('../../../conf/layers/LayerPipeLines').LayerPipeLines
+const LayerPipeLines = require('../../../conf/layers/LayerPipeLines').LayerPipeLines
+const STYLES = require('../../../conf/Constants').STYLES
 
 module.exports = function () {
-  this.init = (layer, L) => {
-    console.log('sssssss')
-    const layers = layerPipeLines.layers
+  this.init = () => {
+    const layers = LayerPipeLines.layers
     for (var i = 0; i < layers.length; i++) {
       const config = layers[i]
       const code = config.code
+      // window.layerFactory.show(config)
       const layer = window.layerFactory.layers[code]
-      layer.setStyle({
-        FILL: true,
-        WEIGHT: 3,
-        FILL_COLOR: '#73b2ff',
-        COLOR: '#73b2ff',
-        FILL_OPACITY: 0.2,
-        OPACITY: 1,
-        DASH_ARRAY: '4,4',
-        DASH_SPPED: -5,
-        ICON_SIZE: [10, 10]
-      })
-      console.log(layer)
+      if (layer) {
+        if (layer.eachLayer) {
+          layer.eachLayer(function (layer) {
+            layer.setStyle({
+              fill: STYLES.FILL,
+              weight: STYLES.WEIGHT,
+              fillColor: STYLES.FILL_COLOR,
+              color: STYLES.COLOR,
+              fillOpacity: STYLES.FILL_OPACITY,
+              opacity: STYLES.OPACITY,
+              dashArray: STYLES.DASH_ARRAY,
+              dashSpeed: STYLES.DASH_SPPED
+            })
+          })
+          // 閲嶆柊娣诲姞鍒板湴鍥句笂锛屽姩鐢绘墠鏈夋晥鏋�
+          window.map.removeLayer(layer)
+          window.layerFactory.show(config)
+        }
+      }
+    }
+    /* window.$layer.iframe({
+      content: {
+        content: publicBounced,
+        parent: this,
+        data: {
+          info: this.info,
+          fn: () => {
+            alert(1)
+          }
+        }
+      },
+      area: ['901px', '101px'],
+      title: '杩欐槸涓�涓爣棰樿繖鏄竴涓爣棰樿繖鏄竴涓爣棰樿繖鏄竴涓爣棰�',
+      maxmin: true,
+      shade: false,
+      shadeClose: false,
+      scrollbar: false,
+      resize: true,
+      btn: ['a', 'b'],
+      cancel: () => {
+        alert(2110)
+      }
+    }) */
+  }
+
+  this.destory = () => {
+    console.log('destory!!!')
+    const layers = LayerPipeLines.layers
+    for (var i = 0; i < layers.length; i++) {
+      const config = layers[i]
+      const code = config.code
+      // window.layerFactory.show(config)
+      const layer = window.layerFactory.layers[code]
+      if (layer) {
+        if (layer.eachLayer) {
+          layer.eachLayer(function (layer) {
+            layer.resetStyle()
+          })
+        }
+      }
     }
   }
 }
diff --git a/src/components/LayerController/service/EventLayerService.js b/src/components/LayerController/service/EventLayerService.js
new file mode 100644
index 0000000..a8916df
--- /dev/null
+++ b/src/components/LayerController/service/EventLayerService.js
@@ -0,0 +1,25 @@
+import { logicMapper } from '../../../conf/Constants'
+
+class EventLayerService {
+  constructor (config) {
+    this.L = window.L
+    this.map = window.map
+    this.config = config
+  }
+
+  init () {
+    // 寮曞叆 鍏宠仈鐨刯s锛屽湪constant.js涓牴鎹甤onfig閰嶇疆鐨刬d寰楀埌澶勭悊js
+    const id = this.config.code
+    const checked = this.config.checked
+    const file = logicMapper[id]
+    if (!file) {
+      console.log('鎵句笉鍒伴�昏緫澶勭悊js!!!' + id)
+    } else {
+      var BusiLayer = require('../logic/' + file)
+      var busiLayer = new BusiLayer()
+      checked ? busiLayer.init(this.config) : busiLayer.destory(this.config)
+    }
+  }
+}
+
+export default EventLayerService
diff --git a/src/components/LayerController/service/LayerFactory.js b/src/components/LayerController/service/LayerFactory.js
index ae561e5..d475fb6 100644
--- a/src/components/LayerController/service/LayerFactory.js
+++ b/src/components/LayerController/service/LayerFactory.js
@@ -1,6 +1,7 @@
 import WfsLayerService from './WfsLayerService'
 import BusiLayerService from './BusiLayerService'
 import WmsLayerService from './WmsLayerService'
+import EventLayerService from './EventLayerService'
 
 class LayerFactory {
   constructor (options) {
@@ -27,9 +28,9 @@
   }
 
   /**
-   * 鎺у埗鏄剧ず鐨勭骇鍒�
-   * @param layerConfig
-   */
+     * 鎺у埗鏄剧ず鐨勭骇鍒�
+     * @param layerConfig
+     */
   initEvent (layerConfig) {
     this.map.on('zoomend ', (e) => this.toggleZoomByLayer(layerConfig))
   }
@@ -67,30 +68,35 @@
     var wfs = config.wfs
     var wms = config.wms
     var url = config.url
+    var checked = config.checked
     // 鍒ゆ柇鏄惁宸茬粡鍔犺浇杩囷紝鍔犺浇杩囧氨 鐩存帴寰楀埌瀵硅薄璋冪敤 鏄剧ず鍑芥暟
     var layer = this.layers[code]
-    if (!layer) {
-      layer = this.L.featureGroup({}).addTo(this.map)
+    // todo if鏄笉鏄お澶氫簡
+    if (checked) {
+      if ((wfs || wms || url)) {
+        if (layer) {
+          this.show(code)
+        } else {
+          layer = this.L.featureGroup({}).addTo(this.map)
+          this.layers[code] = layer
+        }
+      }
       // 2. 鍒ゆ柇绫诲瀷
       if (wfs) {
         // 3. 瀹炰緥鍖栧叿浣搒ervice
         var wfsLayerService = new WfsLayerService(config)
         wfsLayerService.init(layer)
         this.setZIndex(layer)
-      }
-      if (wms) {
+      } else if (wms) {
         var wmsLayerService = new WmsLayerService(config)
         wmsLayerService.init(layer)
-      }
-      // 璇锋眰涓氬姟鏁版嵁鎺ュ彛
-      if (url) {
+      } else if (url) {
         var busiLayerService = new BusiLayerService(config)
         busiLayerService.init(layer)
       }
-      layer ? (this.layers[code] = layer) : console.log('LayerFactory锛歯ewLayer is null锛宲lease check !!!')
-    } else {
-      this.show(code)
     }
+    var eventLayerService = new EventLayerService(config)
+    eventLayerService.init()
   }
 
   show (config) {
@@ -106,6 +112,7 @@
   hide (config) {
     var layer = this.layers[config.code]
     layer && this.map.removeLayer(layer)
+    this.load(config)
   }
 
   toggle (code) {
@@ -130,25 +137,25 @@
       })
     }
     /* for (var k in this.layers) {
-      var layerGroup = this.layers[k]
-      layerGroup.eachLayer(function (layer) {
-        console.log(layer)
-        console.log(layer.getAttribution())
-      })
-      var layers = layerGroup.getLayers()
-      if (layers) {
-        for (var m = 0; m < layers.length; m++) {
-          var layer = layers[m]
-          console.log(layer)
-          console.log(layer.getLayerId(val.id))
-          /!* var feature = layer.feature
-          if (feature.id === layerId) {
-            this.map.flyToBounds(bound)
-            return layer
-          } *!/
-        }
-      }
-    } */
+          var layerGroup = this.layers[k]
+          layerGroup.eachLayer(function (layer) {
+            console.log(layer)
+            console.log(layer.getAttribution())
+          })
+          var layers = layerGroup.getLayers()
+          if (layers) {
+            for (var m = 0; m < layers.length; m++) {
+              var layer = layers[m]
+              console.log(layer)
+              console.log(layer.getLayerId(val.id))
+              /!* var feature = layer.feature
+              if (feature.id === layerId) {
+                this.map.flyToBounds(bound)
+                return layer
+              } *!/
+            }
+          }
+        } */
     return null
   }
 
@@ -164,11 +171,11 @@
   }
 
   /**
-   * todo 杩欓噷鏃犳晥锛岃矊浼兼槸鍥犱负geojson鍔犺浇鍒板湴鍥句篃鏄釜layergroup
-   *
-   * 璁剧疆index,绾垮湪鏈�涓嬮潰锛岀偣鍦ㄤ笂闈�
-   * @param layerGroup 鍥惧眰缁�
-   */
+     * todo 杩欓噷鏃犳晥锛岃矊浼兼槸鍥犱负geojson鍔犺浇鍒板湴鍥句篃鏄釜layergroup
+     *
+     * 璁剧疆index,绾垮湪鏈�涓嬮潰锛岀偣鍦ㄤ笂闈�
+     * @param layerGroup 鍥惧眰缁�
+     */
   setZIndex (layer) {
     if (Array.isArray(layer)) {
       for (var i = 0; i < layer.length; i++) {
diff --git a/src/components/layer/index.js b/src/components/layer/index.js
new file mode 100644
index 0000000..7599395
--- /dev/null
+++ b/src/components/layer/index.js
@@ -0,0 +1,9 @@
+import layer from './src/layer.js'
+
+// 涓虹粍浠舵彁渚� install 瀹夎鏂规硶锛屼緵鎸夐渶寮曞叆
+layer.install = function (Vue) {
+  Vue.component('layer', layer)
+}
+
+// 榛樿瀵煎嚭缁勪欢
+export default layer
diff --git a/src/components/layer/src/helper/helper.js b/src/components/layer/src/helper/helper.js
new file mode 100644
index 0000000..82e75f7
--- /dev/null
+++ b/src/components/layer/src/helper/helper.js
@@ -0,0 +1,160 @@
+export default class helper {
+  /**
+   * 鐐瑰嚮mask鍏抽棴寮圭獥
+   * @param  {[type]} event [description]
+   * @param  {[type]} layer [description]
+   * @return {[type]}       [description]
+   */
+  static clickMaskCloseAll (event, layer, id) {
+    const mask = event.target.getAttribute('class')
+    if (mask && (mask.indexOf('notify-mask') > -1 || mask.indexOf('icon-remove') > -1)) {
+      layer.close(id)
+    }
+  }
+
+  /**
+   * 榛樿鐨剏es鎸夐挳鎿嶄綔
+   * @param  {[type]} event [description]
+   * @return {[type]}       [description]
+   */
+  static btnyes (event, options, formValue) {
+    if (typeof (options.yes) === 'function') {
+      if (options.type === 6) {
+        options.yes(formValue, options.id)
+      } else {
+        options.yes(options.id)
+      }
+    } else {
+      options.layer.close(options.id)
+    }
+  }
+
+  /**
+   * 榛樿鍙栨秷鎸夐挳鎿嶄綔
+   * @param  {[type]} event [description]
+   * @return {[type]}       [description]
+   */
+  static async btncancel (event, options) {
+    if (typeof (options.cancel) === 'function') {
+      await options.cancel(options.id)
+    } else {
+      options.layer.close(options.id)
+    }
+  }
+
+  /**
+   * 闅愯棌婊氬姩鏉�
+   */
+  static hiddenScrollBar (options) {
+    if (!options.scrollbar) {
+      const htmlDom = document.getElementsByTagName('html')[0]
+      const htmlClass = [...htmlDom.classList]
+      if (htmlClass.indexOf('vl-html-scrollbar-hidden') > -1) {
+        return
+      }
+
+      const htmlWidth = htmlDom.offsetWidth
+      // 闅愯棌婊氬姩鏉�
+      // htmlDom.style.overflowY = "hidden";
+      htmlDom.classList.add('vl-html-scrollbar-hidden')
+      const htmlWidthH = htmlDom.offsetWidth
+      htmlDom.style.marginRight = htmlWidthH - htmlWidth + 'px'
+    }
+  }
+
+  /**
+   * 榧犳爣鎷栧姩寮圭獥
+   * @param  {[type]} event   [description]
+   * @param  {[type]} options [description]
+   * @return {[type]}         [description]
+   */
+  static moveStart (event, options) {
+    options.offset = options.offset === 'auto' ? [] : options.offset
+    if (options.offset.length === 0) {
+      options.offset.push(document.getElementById(options.id + '').offsetLeft)
+      options.offset.push(document.getElementById(options.id + '').offsetTop)
+      options.offset.push(0)
+    }
+    if (options.offset.length === 2) {
+      options.offset.push(0)
+    }
+    options.offset[0] = (document.getElementById(options.id + '').offsetLeft)
+    options.offset[1] = (document.getElementById(options.id + '').offsetTop)
+  }
+
+  /**
+   * 鎷栧姩寮圭獥
+   * @param  {[type]} event  [description]
+   * @param  {[type]} ismove [description]
+   * @return {[type]}        [description]
+   */
+  static move (event, options, ismove) {
+    if (ismove) {
+      const o = document.getElementById(options.id + '_alert')
+      o.style.left = options.offset[0] + (event.clientX - this.moveLeft) + 'px'
+      o.style.top = options.offset[1] + (event.clientY - this.moveTop) + 'px'
+    }
+  }
+
+  /**
+   * [sleep description]
+   * @param  {[type]} ms [description]
+   * @return {[type]}    [description]
+   */
+  static sleep (ms) {
+    return new Promise(resolve => setTimeout(resolve, ms))
+  }
+
+  /**
+   *  娣卞害鎷疯礉
+   * @param {*} source
+   */
+  static deepClone (target) {
+    const copyedObjs = [] // 姝ゆ暟缁勮В鍐充簡寰幆寮曠敤鍜岀浉鍚屽紩鐢ㄧ殑闂锛屽畠瀛樻斁宸茬粡閫掑綊鍒扮殑鐩爣瀵硅薄
+    function _deepCopy (target) {
+      if ((typeof target !== 'object') || !target) {
+        return target
+      }
+      for (let i = 0; i < copyedObjs.length; i++) {
+        if (copyedObjs[i].target === target) {
+          return copyedObjs[i].copyTarget
+        }
+      }
+      let obj = {}
+      if (Array.isArray(target)) {
+        obj = [] // 澶勭悊target鏄暟缁勭殑鎯呭喌
+      }
+      copyedObjs.push({
+        target: target,
+        copyTarget: obj
+      })
+      Object.keys(target).forEach(key => {
+        if (obj[key]) {
+          return
+        }
+        obj[key] = _deepCopy(target[key])
+      })
+      return obj
+    }
+    return _deepCopy(target)
+  }
+
+  /**
+   *  鍙栧伓鏁�
+   * @param {*} str
+   */
+  static evenNumber (str = '') {
+    const result = str.match(/\d+/g)
+    if (result) {
+      const n = parseInt(result[0])
+      if (n % 2 === 0) {
+        return str
+      } else {
+        str = str.replace(n, n + 1)
+        return str
+      }
+    } else {
+      return str
+    }
+  }
+}
diff --git a/src/components/layer/src/iframe.vue b/src/components/layer/src/iframe.vue
new file mode 100644
index 0000000..4b9d07f
--- /dev/null
+++ b/src/components/layer/src/iframe.vue
@@ -0,0 +1,126 @@
+<template>
+  <div class="public-bounced map-background" v-drag>
+    <div class="public-bounced-title panel-title" ref="publicBounced">
+      <span>{{options.title}}</span>
+      <i class="el-icon-circle-close" @click="close"></i>
+    </div>
+    <div class="public-bounced-content" :id="id">
+      {{options.content}}
+    </div>
+  </div>
+</template>
+
+<script>
+import helper from './helper/helper.js'
+
+export default {
+  data () {
+    return {
+      cls: {
+        'vl-notify-iframe': true
+      },
+      id: 'vlip' + new Date().getTime()
+    }
+  },
+  props: {
+    options: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  computed: {
+    contentStyle () {
+      return {
+        height: 'calc(100% - 50px)', // parseInt(this.options.area[1]) - 50 + "px",
+        minHeight: '20px',
+        overflow: 'auto'
+      }
+    }
+  },
+  async mounted () {
+    this.getContent()
+    helper.hiddenScrollBar(this.options)
+  },
+  methods: {
+    close () {
+
+    },
+    async getContent () {
+      await helper.sleep(10)
+      const propsData = helper.deepClone(this.options.content.data) || {}
+      propsData.layerid = this.options.id
+      propsData.lydata = this.options.content.data
+      propsData.lyoption = this.options
+      console.log(this.options.content.content)
+      const instance = new this.options.content.content({
+        // 鍏蜂綋鍙傛暟淇℃伅锛岃鍙傝�僾ue婧愮爜
+        parent: this.options.content.parent,
+        propsData: propsData
+      })
+      instance.vm = instance.$mount()
+      document.getElementById(this.id).appendChild(instance.vm.$el)
+      this.options.layer.instancesVue[this.options.id].iframe = instance.vm
+    },
+
+    btnyes (event) {
+      helper.btnyes(event, this.options)
+    },
+    btncancel (event) {
+      helper.btncancel(event, this.options)
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .public-bounced {
+    z-index: 2000;
+    position: absolute;
+    top: 35%;
+    left: 20%;
+
+  .public-bounced-title {
+    cursor: move;
+    height: 0.1rem;
+    padding: 10px 0;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+
+  span {
+    color: #f4f7ff;
+    margin: 0 15px;
+    font-size: 14px;
+  }
+
+  i {
+    color: #C0C4CC;
+    margin: 0 15px;
+    font-size: 22px;
+    cursor: pointer;
+  }
+
+  i:hover {
+    color: #00fff6;
+  }
+  }
+
+  .public-bounced-content {
+    padding: 0.1rem;
+    display: flex;
+  //align-items: center;
+  //justify-content: space-around;
+
+  .public-bounced-content-left {
+  //width: 4.8rem;
+  }
+
+  .public-bounced-content-right {
+  //width: 3rem;
+    margin-left: 0.1rem;
+  }
+  }
+  }
+</style>
diff --git a/src/components/layer/src/layer.js b/src/components/layer/src/layer.js
new file mode 100644
index 0000000..b42ef27
--- /dev/null
+++ b/src/components/layer/src/layer.js
@@ -0,0 +1,195 @@
+import layerVue from './layer.vue'
+const Notification = function (Vue, globalOption = {
+  msgtime: 1.5 // msg娑堝け鏃堕棿
+}) {
+  const NotificationConstructor = Vue.extend(layerVue)
+  const self = {}
+  const defOptions = {
+    type: 0, // 0锛堜俊鎭锛岄粯璁わ級1锛堥〉闈㈠眰锛�2锛坕frame灞傦級3锛堝姞杞藉眰锛�4锛坱ips灞傦級,5msg,6prompt
+    title: '淇℃伅',
+    content: '',
+    area: 'auto',
+    offset: 'auto',
+    icon: -1,
+    btn: '纭畾',
+    time: 0,
+    maxmin: false, // 鏈�澶ф渶灏忓寲
+    shade: true,
+    yes: '',
+    cancel: '',
+    tips: [0, {}], // 鏀寔涓婂彸涓嬪乏鍥涗釜鏂瑰悜锛岄�氳繃1-4杩涜鏂瑰悜璁惧畾,鍙互璁惧畾tips: [1, '#c00']
+    tipsMore: false, // 鏄惁鍏佽澶氫釜tips
+    shadeClose: true,
+    scrollbar: true, // 鏄惁鍏佽娴忚鍣ㄥ嚭鐜版粴鍔ㄦ潯:榛樿鏄厑璁�
+    resize: false // 鏄惁鍏佽鎷変几锛岄粯璁ゆ槸涓嶅厑璁�
+  }
+  self.instances = {}
+  self.instancesVue = []
+  self.iframeMinList = []
+  let seed = 0
+
+  /**
+   * [function description]
+   * @method function
+   * @param  {[type]} options [description]
+   * @return {[type]}         [description]
+   */
+  self.open = function (options) {
+    options = mergeJson(options, defOptions)
+    const id = `notification_${new Date().getTime()}_${seed++}`
+    options.id = id
+    options.layer = self
+    const instance = new NotificationConstructor({
+      data: options
+    })
+    if (options.type === 1) {
+      options.content.content = Vue.extend(options.content.content)
+    }
+    instance.id = id
+    instance.vm = instance.$mount()
+    self.instances[id] = {
+      inst: instance,
+      type: options.type
+    }
+    document.body.appendChild(instance.vm.$el)
+    self.instancesVue[id] = {
+      mask: '',
+      main: instance.vm,
+      iframe: ''
+    }
+    return id
+  }
+  /**
+   * [description]
+   * @param  {[type]} options [description]
+   * @return {[type]}         [description]
+   */
+  self.iframe = function (opt) {
+    let option = {
+      type: 1,
+      content: opt.content,
+      area: opt.area
+    }
+    option = mergeJson(option, opt)
+    console.log(option)
+    return self.open(option)
+  }
+  /**
+   * 鍏抽棴涓�涓脊绐�
+   * @param  {[type]} id [description]
+   * @return {[type]}    [description]
+   */
+  self.close = function (id) {
+    const oElm = document.getElementById(id)
+    if (oElm) {
+      document.body.removeChild(oElm)
+      delete self.instances[id]
+      self.instancesVue[id].main.$destroy()
+      if (self.instancesVue[id].iframe !== '') {
+        const minindex = parseInt(self.instancesVue[id].main.$el.getAttribute('minindex') || -2)
+        if (minindex > -1) {
+          self.iframeMinList[minindex] = -1
+        }
+        self.instancesVue[id].iframe.$destroy()
+      }
+      // 鍙栨秷闅愯棌婊氬姩鏉�
+      if (!self.instancesVue[id].main.scrollbar) {
+        let scrollbarCount = 0
+        for (const key in self.instancesVue) {
+          if (!self.instancesVue[key].main.scrollbar) {
+            scrollbarCount++
+          }
+        }
+        if (scrollbarCount === 1) {
+          const htmlDom = document.getElementsByTagName('html')[0]
+          htmlDom.style.marginRight = 'auto'
+          htmlDom.classList.remove('vl-html-scrollbar-hidden')
+        }
+      }
+      // 鎺у埗閬僵,鍒犻櫎鎺夊綋鍓嶇殑閬僵
+      if (self.instancesVue[id].main.shade) {
+        const layerMask = document.getElementById(id + '_mask')
+        const maskId = id + '_mask'
+        document.body.removeChild(layerMask)
+        if (self.instancesVue[maskId]) {
+          self.instancesVue[maskId].mask.$destroy()
+        }
+      }
+      delete self.instancesVue[id]
+    } else {
+      setTimeout(function () {
+        const oElm = document.getElementById(id)
+        if (oElm) {
+          document.body.removeChild(oElm)
+          delete self.instances[id]
+          self.instancesVue[id].main.$destroy()
+          if (self.instancesVue[id].iframe !== '') {
+            self.instancesVue[id].iframe.$destroy()
+          }
+        }
+      }, 200)
+    }
+  }
+  /**
+   * 鍏抽棴涓�涓脊绐�
+   * @param  {[type]} id [description]
+   * @return {[type]}    [description]
+   */
+  self.closeAll = function (type = -1) {
+    const types = {
+      page: 0,
+      iframe: 1
+    }
+    if (type === -1) {
+      for (const k in self.instances) {
+        self.close(k)
+      }
+    } else {
+      const targetType = types[type]
+      for (const k in self.instances) {
+        if (self.instances[k].type === targetType) {
+          self.close(k)
+        }
+      }
+    }
+  }
+  /**
+   * 鎵嬪姩鏈�澶у寲
+   */
+  self.full = function (id = '') {
+    document.querySelector('#' + id + ' .lv-icon-max').click()
+  }
+  /**
+   * 鎵嬪姩鏈�灏忓寲
+   */
+  self.min = function (id = '') {
+    document.querySelector('#' + id + ' .lv-icon-mini').click()
+  }
+  /**
+   * 鎵嬪姩鏈�灏忓寲
+   */
+  self.restore = function (id = '') {
+    document.querySelector('#' + id + ' .lv-icon-huanyuan').click()
+  }
+
+  /**
+   * 鍚堝苟json
+   * @method mergeJson
+   * @param  {[type]}  optons [description]
+   * @param  {[type]}  def    [description]
+   * @return {[type]}         [description]
+   */
+  function mergeJson (options, def) {
+    for (const key in def) {
+      if (options[key] === undefined) {
+        options[key] = def[key]
+      }
+    }
+    return options
+  }
+
+  return self
+}
+
+// module.exports = Notification;
+export default Notification
diff --git a/src/components/layer/src/layer.vue b/src/components/layer/src/layer.vue
new file mode 100644
index 0000000..1ef2000
--- /dev/null
+++ b/src/components/layer/src/layer.vue
@@ -0,0 +1,46 @@
+<template lang="html">
+    <component :options="this.$data" :is="getActiveName"></component>
+</template>
+
+<script>
+import pzpage from './page.vue'
+import pziframe from './iframe.vue'
+
+export default {
+  data () {
+    return {
+      id: '',
+      type: 0, // 0锛坅lert榛樿锛�1锛堥〉闈㈠眰锛�2锛坕frame灞傦級3锛坙oading锛�4锛坱ips灞傦級,5(msg),6(prompt)
+      title: '淇℃伅',
+      content: '',
+      area: 'auto',
+      offset: 'auto',
+      icon: -1,
+      btn: '纭畾',
+      time: 0,
+      shade: true,
+      yes: '',
+      cancel: ''
+    }
+  },
+  computed: {
+    getActiveName () {
+      const comps = [
+        'pzpage',
+        'pziframe'
+      ]
+      return comps[this.$data.type]
+    }
+  },
+  mounted () {},
+  methods: {},
+  watch: {},
+  components: {
+    pzpage,
+    pziframe
+  }
+}
+</script>
+
+<style lang="less">
+</style>
diff --git a/src/components/layer/src/page.vue b/src/components/layer/src/page.vue
new file mode 100644
index 0000000..153f993
--- /dev/null
+++ b/src/components/layer/src/page.vue
@@ -0,0 +1,73 @@
+<template lang="html">
+    <div class="public-bounced map-background" v-drag v-show="flag">
+        <div class="public-bounced-title panel-title" ref="publicBounced">
+            <span>{{options.title}}</span>
+            <i class="el-icon-circle-close" @click="closePopup"></i>
+        </div>
+        <div class="public-bounced-content">
+            {{options.content}}
+        </div>
+    </div>
+</template>
+
+<script>
+export default {
+  data () {
+    return {
+      moveLeft: 0, // 宸︾Щ鐨勮窛绂�
+      moveTop: 0, // 涓婄Щ鐨勮窛绂�
+      ismove: false
+    }
+  },
+  props: {
+    options: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  computed: {},
+  mounted () { },
+  methods: {
+    close: function (event) {
+      const mask = event.target.getAttribute('class')
+      if (mask && mask.indexOf('notify-mask') > -1) {
+        this.options.layer.close(this.options.id)
+      }
+    },
+    moveStart: function (event) {
+      this.options.offset = this.options.offset === 'auto' ? [] : this.options.offset
+      if (this.options.offset.length === 0) {
+        this.options.offset.push(document.getElementById(this.options.id + '_alert').offsetLeft)
+        this.options.offset.push(document.getElementById(this.options.id + '_alert').offsetTop)
+        this.options.offset.push(0)
+      }
+      if (this.options.offset.length === 2) {
+        this.options.offset.push(0)
+      }
+      this.options.offset[0] = (document.getElementById(this.options.id + '_alert').offsetLeft)
+      this.options.offset[1] = (document.getElementById(this.options.id + '_alert').offsetTop)
+      this.moveLeft = event.clientX
+      this.moveTop = event.clientY
+      this.ismove = true
+    },
+    move: function (event) {
+      if (this.ismove) {
+        const o = document.getElementById(this.options.id + '_alert')
+        o.style.left = this.options.offset[0] + (event.clientX - this.moveLeft) + 'px'
+        o.style.top = this.options.offset[1] + (event.clientY - this.moveTop) + 'px'
+      }
+    },
+    moveEnd: function () {
+      this.ismove = false
+    }
+  },
+  watch: {
+
+  },
+  components: {
+
+  }
+}
+</script>
diff --git a/src/conf/Constants.js b/src/conf/Constants.js
index d4c087e..df02453 100644
--- a/src/conf/Constants.js
+++ b/src/conf/Constants.js
@@ -4,7 +4,7 @@
   POLYGON: 'polygon'
 }
 
-export const PIPELINE_WFS = 'http://xearth.cn:8088/server/ogcserver/PipeLine2/wfs'
+export const PIPELINE_WFS = 'http://xearth.cn:8088/server/ogcserver/PipeLine/wfs'
 
 export const logicMapper = {
   wasteGasPfk: 'WasteGas.js',
diff --git a/src/conf/LayerTopic.js b/src/conf/LayerTopic.js
index da1a49e..4cf11c4 100644
--- a/src/conf/LayerTopic.js
+++ b/src/conf/LayerTopic.js
@@ -15,7 +15,7 @@
 export const LayerTopic = {
   code: 'sewersTopic',
   name: '涓撻鍥惧眰',
-  checked: true,
+  checked: false,
   isShow: true,
   layers: [LayerPollutionSources, LayerWasteWater, LayerWasteGas, LayerWasteSolid, LayerAirQuality, LayerEnvRisk, LayerSoilGroundWater, LayerPipeLines, LayerVideo, LayerArea]
 }
diff --git a/src/conf/layers/LayerAirQuality.js b/src/conf/layers/LayerAirQuality.js
index 5c0de19..ba96008 100644
--- a/src/conf/layers/LayerAirQuality.js
+++ b/src/conf/layers/LayerAirQuality.js
@@ -6,15 +6,14 @@
 export const LayerAirQuality = {
   code: 'sewersAirQuality',
   name: '绌烘皵璐ㄩ噺',
-  checked: true,
+  checked: false,
   layers: [
     {
       code: 'airQualityStation',
       name: '鐩戞祴绔�',
       sname: '鐩戞祴绔�', // 琛ㄥ悕
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: WFS_URL + '?TYPENAME=鍏徃',
-      minZoom: 10
+      checked: false, // 榛樿閫変腑鐘舵��
+      url: WFS_URL + '?TYPENAME=鍏徃'
     }
   ]
 }
diff --git a/src/conf/layers/LayerArea.js b/src/conf/layers/LayerArea.js
index ffdbf98..0ec2ae6 100644
--- a/src/conf/layers/LayerArea.js
+++ b/src/conf/layers/LayerArea.js
@@ -6,7 +6,7 @@
 export const LayerArea = {
   code: 'sewersArea',
   name: '鍖哄煙淇℃伅',
-  checked: true,
+  checked: false,
   layers: [
     {
       code: 'sewersAreaGs',
@@ -19,14 +19,14 @@
       code: 'sewersAreaMt',
       name: '鐮佸ご',
       sname: '鐮佸ご',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false, // 榛樿閫変腑鐘舵��
       wfs: WFS_URL + '?TYPENAME=鐮佸ご'
     },
     {
       code: 'sewersAreaZz',
       name: '瑁呯疆鍖�',
       sname: '瑁呯疆鍖�',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false, // 榛樿閫変腑鐘舵��
       wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�'
     }
   ]
diff --git a/src/conf/layers/LayerEnvRisk.js b/src/conf/layers/LayerEnvRisk.js
index b1dfafe..def8c62 100644
--- a/src/conf/layers/LayerEnvRisk.js
+++ b/src/conf/layers/LayerEnvRisk.js
@@ -6,31 +6,29 @@
 export const LayerEnvRisk = {
   code: 'sewersEnvRisk',
   name: '鐜椋庨櫓',
-  checked: true,
+  checked: false,
   layers: [
     {
       code: 'envRiskChart',
       name: '椋庨櫓缁熻鍥�',
       sname: '椋庨櫓缁熻鍥�', // 琛ㄥ悕
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false, // 榛樿閫変腑鐘舵��
       url: WFS_URL + '?TYPENAME=鍏徃',
-      minZoom: 10,
       color: ''
     },
     {
       code: 'envRiskMaterial',
       name: '鐗╄祫搴�',
       sname: '鐗╄祫搴�',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false, // 榛樿閫変腑鐘舵��
       wfs: WFS_URL + '?TYPENAME=鐮佸ご',
-      minZoom: 10,
       color: ''
     },
     {
       code: 'envRiskMajor',
       name: '閲嶅ぇ椋庨櫓',
       sname: '閲嶅ぇ椋庨櫓',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false, // 榛樿閫変腑鐘舵��
       wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�',
       minZoom: 10,
       color: 'red'
@@ -39,7 +37,7 @@
       code: 'envRiskFirst',
       name: '涓�绾ч闄�',
       sname: '涓�绾ч闄�',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false, // 榛樿閫変腑鐘舵��
       wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�',
       minZoom: 10,
       color: 'sandybrown'
@@ -48,7 +46,7 @@
       code: 'envRiskSecond',
       name: '浜岀骇椋庨櫓',
       sname: '浜岀骇椋庨櫓',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false, // 榛樿閫変腑鐘舵��
       wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�',
       minZoom: 10,
       color: 'yellow'
diff --git a/src/conf/layers/LayerFsss.js b/src/conf/layers/LayerFsss.js
index 4fb6a1d..85df78c 100644
--- a/src/conf/layers/LayerFsss.js
+++ b/src/conf/layers/LayerFsss.js
@@ -54,7 +54,6 @@
       code: 'pipesegment',
       name: '娴佸悜',
       sname: 'ywslx',
-      url: 'pipesegment',
       checked: false
     },
     {
diff --git a/src/conf/layers/LayerPipeLines.js b/src/conf/layers/LayerPipeLines.js
index 6e3f5b1..d579631 100644
--- a/src/conf/layers/LayerPipeLines.js
+++ b/src/conf/layers/LayerPipeLines.js
@@ -10,14 +10,14 @@
 export const LayerPipeLines = {
   code: 'sewersPipeLines',
   name: '绠$嚎',
-  checked: true,
+  checked: false,
   childLayer: [LayerFsss, LayerHbss],
   layers: [
     {
       code: 'rainline',
       name: '闆ㄦ按绾�',
       sname: '闆ㄦ按绾�',
-      checked: true,
+      checked: false,
       wfs: WFS_URL + '?TYPENAME=绠$綉',
       minZoom: 10
     },
@@ -25,7 +25,7 @@
       code: 'accidentline',
       name: '浜嬫晠姘寸嚎',
       sname: '浜嬫晠姘�',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false,
       wfs: WFS_URL + '?TYPENAME=浜嬫晠姘�',
       minZoom: 10
     },
@@ -33,7 +33,7 @@
       code: 'oilline',
       name: '鍚补姹℃按绾�',
       sname: '鍚补姹℃按',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false,
       wfs: WFS_URL + '?TYPENAME=鍚补姹℃按',
       minZoom: 10
     },
@@ -41,7 +41,7 @@
       code: 'saltline',
       name: '鍚洂姹℃按绾�',
       sname: '鍚洂姹℃按',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false,
       wfs: WFS_URL + '?TYPENAME=鍚洂姹℃按',
       minZoom: 10
     },
@@ -49,7 +49,7 @@
       code: 'alkaliline',
       name: '鍚⒈姹℃按绾�',
       sname: '鍚⒈姹℃按',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false,
       wfs: WFS_URL + '?TYPENAME=鍚⒈姹℃按',
       minZoom: 10
     },
@@ -57,7 +57,7 @@
       code: 'lifeline',
       name: '鐢熸椿姹℃按',
       sname: '鐢熸椿姹℃按',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false,
       wfs: WFS_URL + '?TYPENAME=鐢熸椿姹℃按',
       minZoom: 10
     },
@@ -65,7 +65,7 @@
       code: 'purifyline',
       name: '鍑�鍖栨按绾�',
       sname: '鍑�鍖栨按',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false,
       wfs: WFS_URL + '?TYPENAME=鍑�鍖栨按',
       minZoom: 10
     },
@@ -73,7 +73,7 @@
       code: 'loopline',
       name: '寰幆姘寸嚎',
       sname: '寰幆姘�',
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false,
       wfs: WFS_URL + '?TYPENAME=寰幆姘�',
       minZoom: 10
     }
diff --git a/src/conf/layers/LayerPollutionSources.js b/src/conf/layers/LayerPollutionSources.js
index 324b69e..369016c 100644
--- a/src/conf/layers/LayerPollutionSources.js
+++ b/src/conf/layers/LayerPollutionSources.js
@@ -5,13 +5,13 @@
 export const LayerPollutionSources = {
   code: 'pollutionSources',
   name: '姹℃煋婧�',
-  checked: true,
+  checked: false,
   layers: [
     {
       code: 'pollutionSourcesSczz',
       name: '鐢熶骇瑁呯疆',
       sname: '鐢熶骇瑁呯疆', // 琛ㄥ悕
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false, // 榛樿閫変腑鐘舵��
       url: 'http://www.baidu.com', // 璇锋眰涓氬姟鏁版嵁鎺ュ彛
       minZoom: 10 // 鍦ㄦ寚瀹氱骇鍒樉绀�
     },
@@ -19,7 +19,7 @@
       code: 'pollutionSourcesZlss',
       name: '娌荤悊璁炬柦',
       sname: '娌荤悊璁炬柦', // 琛ㄥ悕
-      checked: true, // 榛樿閫変腑鐘舵��
+      checked: false, // 榛樿閫変腑鐘舵��
       url: 'http://www.baidu.com', // 璇锋眰涓氬姟鏁版嵁鎺ュ彛
       minZoom: 10 // 鍦ㄦ寚瀹氱骇鍒樉绀�
     }]
diff --git a/src/conf/layers/LayerSoilGroundWater.js b/src/conf/layers/LayerSoilGroundWater.js
index 471d241..b042c48 100644
--- a/src/conf/layers/LayerSoilGroundWater.js
+++ b/src/conf/layers/LayerSoilGroundWater.js
@@ -6,47 +6,42 @@
 export const LayerSoilGroundWater = {
   code: 'sewersSoilGroundWater',
   name: '鍦熷¥鍙婂湴涓嬫按',
-  checked: true,
+  checked: false,
   layers: [
     {
       code: 'soil',
       name: '鍦熷¥',
       sname: '鍦熷¥', // 琛ㄥ悕
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: WFS_URL + '?TYPENAME=鍏徃',
-      minZoom: 10
+      checked: false, // 榛樿閫変腑鐘舵��
+      url: WFS_URL + '?TYPENAME=鍏徃'
     },
     {
       code: 'groundWater',
       name: '鍦颁笅姘�',
       sname: '鍦颁笅姘�',
-      checked: true, // 榛樿閫変腑鐘舵��
-      wfs: WFS_URL + '?TYPENAME=鐮佸ご',
-      minZoom: 10
+      checked: false, // 榛樿閫変腑鐘舵��
+      wfs: WFS_URL + '?TYPENAME=鐮佸ご'
     },
     {
       code: 'firstRiskBlock',
       name: '涓�绾ч闄╁湴鍧�',
       sname: '涓�绾ч闄╁湴鍧�',
-      checked: true, // 榛樿閫変腑鐘舵��
-      wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�',
-      minZoom: 10
+      checked: false, // 榛樿閫変腑鐘舵��
+      wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�'
     },
     {
       code: 'secondRiskBlock',
       name: '浜岀骇椋庨櫓鍦板潡',
       sname: '浜岀骇椋庨櫓鍦板潡',
-      checked: true, // 榛樿閫変腑鐘舵��
-      wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�',
-      minZoom: 10
+      checked: false, // 榛樿閫変腑鐘舵��
+      wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�'
     },
     {
       code: 'threeRiskBlock',
       name: '涓夌骇椋庨櫓鍦板潡',
       sname: '涓夌骇椋庨櫓鍦板潡',
-      checked: true, // 榛樿閫変腑鐘舵��
-      wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�',
-      minZoom: 10
+      checked: false, // 榛樿閫変腑鐘舵��
+      wfs: WFS_URL + '?TYPENAME=瑁呯疆鍖�'
     }
   ]
 }
diff --git a/src/conf/layers/LayerWasteGas.js b/src/conf/layers/LayerWasteGas.js
index a516977..6156087 100644
--- a/src/conf/layers/LayerWasteGas.js
+++ b/src/conf/layers/LayerWasteGas.js
@@ -5,39 +5,35 @@
 export const LayerWasteGas = {
   code: 'wasteGas',
   name: '搴熸皵',
-  checked: true,
+  checked: false,
   layers: [
     {
       code: 'wasteGasPfk',
       name: '鎺掓斁鍙�',
       sname: '鎺掓斁鍙�', // 琛ㄥ悕
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: 'http://www.baidu.com', // 璇锋眰涓氬姟鏁版嵁鎺ュ彛
-      minZoom: 10 // 鍦ㄦ寚瀹氱骇鍒樉绀�
+      checked: false,
+      url: 'http://www.baidu.com'
     },
     {
       code: 'wasteGasKrq',
       name: '鍙噧姘�',
       sname: '鍙噧姘�',
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: '',
-      minZoom: 10
+      checked: false,
+      url: ''
     },
     {
       code: 'wasteGasYhq',
       name: '鏈夊姘�',
       sname: '鏈夊姘�',
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: '',
-      minZoom: 10
+      checked: false,
+      url: ''
     },
     {
       code: 'wasteGasVocs',
       name: 'VOCs',
       sname: 'VOCs',
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: '',
-      minZoom: 10
+      checked: false,
+      url: ''
     }
   ]
 }
diff --git a/src/conf/layers/LayerWasteSolid.js b/src/conf/layers/LayerWasteSolid.js
index f75e58e..ca2129b 100644
--- a/src/conf/layers/LayerWasteSolid.js
+++ b/src/conf/layers/LayerWasteSolid.js
@@ -6,15 +6,14 @@
 export const LayerWasteSolid = {
   code: 'wasteSolid',
   name: '鍥哄簾',
-  checked: true,
+  checked: false,
   layers: [
     {
       code: 'wasteSolidCcd',
       name: '璐瓨鐐�',
       sname: '璐瓨鐐�',
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: 'http://www.baidu2.com',
-      minZoom: 10
+      checked: false,
+      url: 'http://www.baidu2.com'
     }
   ]
 }
diff --git a/src/conf/layers/LayerWasteWater.js b/src/conf/layers/LayerWasteWater.js
index 13ffea0..b3ed821 100644
--- a/src/conf/layers/LayerWasteWater.js
+++ b/src/conf/layers/LayerWasteWater.js
@@ -5,31 +5,28 @@
 export const LayerWasteWater = {
   code: 'wasteWater',
   name: '搴熸按',
-  checked: true,
+  checked: false,
   layers: [
     {
       code: 'wasteWaterPfk',
       name: '鎺掓斁鍙�',
       sname: '鎺掓斁鍙�', // 琛ㄥ悕
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: 'http://www.baidu.com', // 璇锋眰涓氬姟鏁版嵁鎺ュ彛
-      minZoom: 10 // 鍦ㄦ寚瀹氱骇鍒樉绀�
+      checked: false, // 榛樿閫変腑鐘舵��
+      url: 'http://www.baidu.com'
     },
     {
       code: 'wasteWaterJcd',
       name: '娴侀噺',
       sname: '娴侀噺',
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: 'http://www.baidu2.com',
-      minZoom: 10
+      checked: false, // 榛樿閫変腑鐘舵��
+      url: 'http://www.baidu2.com'
     },
     {
       code: 'wasteWaterfk',
       name: '娑蹭綅',
       sname: '娑蹭綅',
-      checked: true, // 榛樿閫変腑鐘舵��
-      url: '',
-      minZoom: 10
+      checked: false, // 榛樿閫変腑鐘舵��
+      url: ''
     }
   ]
 }
diff --git a/src/main.js b/src/main.js
index 2d3203a..be81e98 100644
--- a/src/main.js
+++ b/src/main.js
@@ -18,6 +18,7 @@
 import '@components/plugin/leaflet-measure-path/leaflet-measure-path.css'
 import '@components/plugin/leaflet-measure-path/leaflet-measure-path'
 import '@components/plugin/PathDrag'
+import layer from './components/layer'
 const appConfig = require('@/app.config')
 Vue.config.productionTip = false
 
@@ -27,6 +28,7 @@
 Vue.prototype.$config = appConfig
 Vue.prototype.$echarts = echarts // 鎸傝浇echarts
 window.Vue = Vue
+window.$layer = layer(Vue)
 // 娉ㄥ唽鎸囦护7
 // registerDirectives(Vue)
 

--
Gitblit v1.8.0