派生自 wuyushui/SewerAndRainNetwork

chenzeping
2021-03-09 3ecb480a576bb684f029ec655cd29af621d3c155
src/components/panel/ToolBoxPanel.vue
@@ -15,7 +15,7 @@
        </transition>
        <el-dropdown-menu>
          <el-dropdown-item v-for="(ite,index) in item.items" :key="index" :command='ite.headings'>
            <span @click='toggleActive(ite)'>{{ ite.headings }}</span>
            <span>{{ ite.headings }}</span>
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
@@ -34,7 +34,6 @@
export default {
  name: 'ToolBoxPanel',
  components: {},
  props: ['map'],
  data () {
    return {
      isPanelVisible: false,
@@ -103,7 +102,9 @@
        enterprise: ''
      },
      selectGroup: false,
      selectGroupOne: false
      drawLayer: null,
      L: window.L,
      map: null
    }
  },
  methods: {
@@ -118,13 +119,59 @@
    },
    handleCommand (command) {
      console.log(command)
      if (command === '全屏') {
        this.map.toggleFullscreen()
      }
    },
    toggleActive (k) {
      if (k === 'fullscreen') {
        this.map.toggleFullscreen()
      switch (command) {
        case '全屏':
          // this.map.toggleFullscreen()
          var printer = this.L.easyPrint({
            sizeModes: ['Current', 'A4Landscape', 'A4Portrait'],
            filename: 'map_image',
            exportOnly: true,
            hideControlContainer: true
          }).addTo(this.map)
          printer.printMap('CurrentSize', 'MyManualPrint')
          break
        case 'A4横向':
          var printerX = this.L.easyPrint({
            sizeModes: ['Current', 'A4Landscape', 'A4Portrait'],
            filename: 'map_image',
            exportOnly: true,
            hideControlContainer: true
          }).addTo(this.map)
          printerX.printMap('A4Landscape page', 'MyManualPrint')
          break
        case 'A4纵向':
          var printerY = this.L.easyPrint({
            sizeModes: ['Current', 'A4Landscape', 'A4Portrait'],
            filename: 'map_image',
            exportOnly: true,
            hideControlContainer: true
          }).addTo(this.map)
          printerY.printMap('A4Portrait page', 'MyManualPrint')
          break
        case '线标绘':
          this.drawLayer = this.map.editTools.startPolyline()
          this.drawLayer.on('dblclick').on('dblclick', this.drawLayer.toggleEdit)
          break
        case '面标绘':
          this.drawLayer = this.map.editTools.startPolygon()
          this.drawLayer.on('dblclick').on('dblclick', this.drawLayer.toggleEdit)
          break
        case '箭头标绘':
          this.drawLayer = this.map.editTools.startPolyline()
          this.drawLayer.on('dblclick').on('dblclick', this.drawLayer.toggleEdit)
          break
        case '点标注':
          this.drawLayer = this.map.editTools.startMarker()
          this.drawLayer.on('dblclick').on('dblclick', this.drawLayer.toggleEdit)
          break
        case '图标标注':
          this.drawLayer = this.map.editTools.startIcon()
          this.drawLayer.on('dblclick').on('dblclick', this.drawLayer.toggleEdit)
          break
        case '文字标注':
          this.drawLayer = this.map.editTools.startText()
          this.drawLayer.on('dblclick').on('dblclick', this.drawLayer.toggleEdit)
          break
      }
    },
    loadData () {
@@ -153,7 +200,7 @@
    background: #305B62;
    //margin-top: 15px;
    width: 35px;
    height: 35px;
    height: 38px;
    border-radius: 50%;
    border: 2px skyblue solid;
    display: flex;