派生自 wuyushui/SewerAndRainNetwork

liyuan
2021-03-16 e146dc63e63bafb4f755d59421d8f3279caea173
src/components/panel/ToolBoxPanel.vue
@@ -5,27 +5,29 @@
        <img src="@assets/images/map-pages/icon/toolbox/tool.png" alt="">
        <span>工具</span>
      </el-button>
      <el-row v-show="selectGroup" class="specific-tools-group">
        <el-popover
            placement="bottom"
            width=""
            trigger="click"
            :popper-class="'tools-panel-content'"
            v-for="(item,index) in menuList" :key="index"
        >
          <el-button slot="reference" class="el-button" :class="active === index ? 'tools-panel-choose':''"
                     @click="changeChoose(index)">
            <img :src="item.icon" alt=""/>
            <span>{{ item.label }}</span>
      <transition name="isD">
        <el-row v-show="selectGroup" class="specific-tools-group">
          <el-popover
              placement="bottom"
              width=""
              trigger="click"
              :popper-class="'tools-panel-content'"
              v-for="(item,index) in menuList" :key="index"
          >
            <el-button slot="reference" class="el-button" :class="active === index ? 'tools-panel-choose':''"
                      @click="changeChoose(index)">
              <img :src="item.icon" alt=""/>
              <span>{{ item.label }}</span>
            </el-button>
            <el-button v-for="(itemT,indexT) in item.items" :key="indexT" @click="choiceItem(itemT)">
              <img :src="itemT.icon" :title="itemT.title"/>
            </el-button>
          </el-popover>
          <el-button @click="changeSelect" class="special-button">
            <i :class="selectGroup === false ? 'el-icon-d-arrow-right':'el-icon-d-arrow-left'"></i>
          </el-button>
          <el-button v-for="(itemT,indexT) in item.items" :key="indexT" @click="choiceItem(itemT)">
            <img :src="itemT.icon" alt=""/>
          </el-button>
        </el-popover>
      </el-row>
      <el-button @click="changeSelect" class="special-button">
        <i :class="selectGroup === false ? 'el-icon-d-arrow-right':'el-icon-d-arrow-left'"></i>
      </el-button>
        </el-row>
      </transition>
    </div>
  </div>
</template>
@@ -49,11 +51,6 @@
// 测量的方法
import Measure from '@/components/plugin/MeaSure'
// import '@/components/plugin/leaflet-measure-path/leaflet-measure-path.css'
// 封装的选择弹框
// import BaseNavMenuItem from '@components/panel/BaseNavMenuItem'
// 标注的方法
// import MakeTation from '@components/plugin/MakeTation'
export default {
  name: 'ToolBoxPanel',
@@ -69,27 +66,32 @@
            {
              index: '1-1',
              label: '点标绘',
              icon: marker
              icon: marker,
              title: '点标绘'
            },
            {
              index: '1-2',
              label: '线标绘',
              icon: line
              icon: line,
              title: '线标绘'
            },
            {
              index: '1-4',
              label: '多边形',
              icon: polygonJ
              icon: polygonJ,
              title: '多边形'
            },
            {
              index: '1-5',
              label: '矩形',
              icon: polygonS
              icon: polygonS,
              title: '矩形'
            },
            {
              index: '1-3',
              label: '圆形',
              icon: polygonY
              icon: polygonY,
              title: '圆形'
            }
          ]
        },
@@ -101,12 +103,14 @@
            {
              index: '3-1',
              label: '距离',
              icon: distance
              icon: distance,
              title: '距离测量'
            },
            {
              index: '3-2',
              label: '面积',
              icon: mm
              icon: mm,
              title: '面积测量'
            }
          ]
        },
@@ -154,15 +158,21 @@
          items: [
            {
              index: '4-1',
              label: '全屏'
              label: '全屏',
              icon: '',
              title: '全屏'
            },
            {
              index: '4-2',
              label: 'A4横向'
              label: 'A4横向',
              icon: '',
              title: 'A4横向'
            },
            {
              index: '4-3',
              label: 'A4纵向'
              label: 'A4纵向',
              icon: '',
              title: 'A4纵向'
            }
          ]
        }
@@ -171,7 +181,8 @@
      drawLayer: null,
      map: null,
      L: window.L,
      active: 0
      active: 0,
      isShow: true
    }
  },
  methods: {
@@ -207,6 +218,34 @@
          break
        case '面积':
          Measure.startMeasureArea(this.map, this.L)
          break
        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
      }
    },
@@ -278,6 +317,7 @@
    // 左上功能控制
    changeSelect () {
      this.selectGroup = !this.selectGroup
      this.isShow = !this.isShow
    }
  }
}
@@ -292,10 +332,8 @@
  .specific-tools {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    .el-button {
      z-index: 999;
      padding: 0;
      margin: 0 0.015rem;
      width: 45px;
@@ -316,6 +354,7 @@
    }
    .specific-tools-group {
      z-index: 1;
      .tools-panel-choose {
        border: none;
        box-shadow: 0 0 0.03rem @color-shadow;
@@ -338,4 +377,11 @@
    }
  }
}
.isD-enter-active, .isD-leave-active{
  transition: all 0.5s;
}
.isD-enter, .isD-leave-to{
  opacity: 0;
  transform: translateX(-100px);
}
</style>