Commit 9f2cc5eb authored by aoobao's avatar aoobao

fix 合并页面

parent bd9f1393
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>amap-line-edit</title> <title>amap-line-edit</title>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.13&key=c81eeaf774b25626ffb1b32e13acbd99&plugin=AMap.CustomLayer"></script> <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.13&key=c81eeaf774b25626ffb1b32e13acbd99&plugin=AMap.CustomLayer,AMap.MouseTool"></script>
</head> </head>
<body> <body>
<noscript> <noscript>
......
<script>
// 线段编辑
export default {
render () { return null },
props: {
draw: {
type: Boolean,
default: false
}
},
mounted () {
if (this.draw) {
this.initDraw()
}
},
beforeDestroy () {
if (this.draw) this.destory()
},
methods: {
initDraw () {
},
destory () {
}
},
watch: {
draw (val, oldval) {
if (val != oldval) {
if (val) {
this.initDraw()
} else {
this.destory()
}
}
}
}
}
</script>
<template> <template>
<el-dialog title="合并线段" width="840px" :visible="visible" :center="false" :before-close="handleClose"> <el-dialog title="合并线段" width="840px" :visible="visible" :center="false" :before-close="handleClose">
<div class="context"> <div class="context">
<div class="select-container"> <div class="select-container">
<span class="title">待合并线段</span> <span class="title">待合并线段</span>
<el-button style="margin-left:10px;" @click="addLine(item,index)" v-for="(item,index) in chooseList" :key="item.key">{{item.label}}</el-button> <el-button style="margin-left:10px;" @click="addLine(item,index)" v-for="(item,index) in chooseList" :key="item.key">{{item.label}}</el-button>
</div> </div>
<div class="image-container" :style="getImageStyle()"> <div class="image-container" :style="getImageStyle()">
<!-- <img v-if="base64" :src="base64" alt=""> --> <!-- <img v-if="base64" :src="base64" alt=""> -->
</div> </div>
<div style="clear :both;"></div> <div style="clear :both;"></div>
<span class="title">需合并线段</span> <span class="title">需合并线段</span>
<div class="choose-model"> <div class="choose-model">
<el-tag style="margin-left:10px;" v-for="(item,index) in data" :key="item.key" closable @close="tagClose(item,index)">{{item.label}}</el-tag> <el-tag style="margin-left:10px;" v-for="(item,index) in data" :key="item.key" closable @close="tagClose(item,index)">{{item.label}}</el-tag>
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer "> <span slot="footer" class="dialog-footer ">
<el-button type="primary " @click="submit ">确 定</el-button> <el-button type="primary " @click="submit ">确 定</el-button>
<el-button type="primary " @click="createImage ">生成图片</el-button> <el-button type="primary " @click="createImage ">生成图片</el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
dataList: Array, dataList: Array,
base64: String base64: String
}, },
data () { data () {
return { return {
visible: false, visible: false,
data: [] data: []
} }
}, },
computed: { computed: {
chooseList () { chooseList () {
let list = this.dataList.filter(t => { let list = this.dataList.filter(t => {
let m = this.data.find(a => a.key == t.key) let m = this.data.find(a => a.key == t.key)
return !m return !m
}) })
return list return list
} }
}, },
methods: { methods: {
handleClose () { handleClose () {
this.visible = false this.visible = false
this.$emit('close') this.$emit('close')
}, },
show () { show () {
this.visible = true this.visible = true
}, },
submit () { submit () {
this.$emit('merge', { this.$emit('merge', {
data: this.data data: this.data
}) })
this.visible = false this.visible = false
}, },
createImage () { createImage () {
this.$emit('createImage', { this.$emit('createImage', {
data: this.data data: this.data
}) })
}, },
addLine (data) { addLine (data) {
this.data.push(data) this.data.push(data)
}, },
tagClose (item, index) { tagClose (item, index) {
this.data.splice(index, 1) this.data.splice(index, 1)
}, },
getImageStyle () { getImageStyle () {
return { return {
backgroundImage: `url('${this.base64}')` backgroundImage: `url('${this.base64}')`
} }
} }
}, },
watch: { watch: {
visible (val) { visible (val) {
if (!val) { if (!val) {
this.data = [] this.data = []
} }
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.select-container { .select-container {
width: 50%; width: 50%;
height: 200px; min-height: 200px;
background-color: aqua; background-color: aqua;
text-align: left; text-align: left;
float: left; float: left;
} }
.image-container { .image-container {
width: 50%; width: 50%;
height: 200px; height: 200px;
float: left; float: left;
//overflow: auto; //overflow: auto;
// background-size: contain; // background-size: contain;
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.title { .title {
text-align: left; text-align: left;
} }
.choose-model { .choose-model {
text-align: left; text-align: left;
} }
</style> </style>
...@@ -3,15 +3,16 @@ ...@@ -3,15 +3,16 @@
<div class="map-container" @mousemove="mapMouseMove" @mouseout="mapMouseOut"> <div class="map-container" @mousemove="mapMouseMove" @mouseout="mapMouseOut">
<div class="map" ref="map"></div> <div class="map" ref="map"></div>
<LineManagerView v-if="map" :map="map" :data="lineList" ref="lineManager" :status="status" :x="x" :y="y" :clearWidth="clearNumber" /> <LineManagerView v-if="map" :map="map" :data="lineList" ref="lineManager" :status="status" :x="x" :y="y" :clearWidth="clearNumber" />
<DrawLine :draw="isDrawLine" @createLine="createLine" />
</div> </div>
<div class="control"> <div class="control">
<div class="button-control"> <div class="button-control">
<label>{{statusName}}</label> <label>{{statusName}}</label>
<el-button style="margin-left:5px;" type="primary" @click="showAdd">新增</el-button> <el-button v-if="!exportVisible && !isDrawLine && statusName === '查看'" style="margin-left:5px;" type="primary" @click="showAdd">新增</el-button>
<el-button style="margin-left:5px;" type="warning" @click="clearModel">{{statusName == '擦除' ? '取消擦除' : '擦除'}}</el-button> <el-button v-if="!exportVisible && !isDrawLine" style="margin-left:5px;" type="warning" @click="clearModel">{{statusName == '擦除' ? '取消擦除' : '擦除'}}</el-button>
<el-button style="margin-left:5px;" type="success" @click="merge">合并</el-button> <el-button v-if="!exportVisible && !isDrawLine && statusName === '查看'" style="margin-left:5px;" type="success" @click="merge">合并</el-button>
<el-button style="margin-left:5px;" @click="exportAll">{{exportVisible ? '关闭导出' : '批量导出'}}</el-button> <el-button style="margin-left:5px;" @click="exportAll">{{exportVisible ? '关闭导出' : '导出'}}</el-button>
</div> </div>
<div class="line-control"> <div class="line-control">
<template v-if="statusName == '查看'"> <template v-if="statusName == '查看'">
...@@ -37,6 +38,7 @@ ...@@ -37,6 +38,7 @@
let __id = 0 let __id = 0
// import HANG_ZHOU from '../assets/HANGZHOU' // import HANG_ZHOU from '../assets/HANGZHOU'
// import SHAO_XING from '../assets/SHAOXING' // import SHAO_XING from '../assets/SHAOXING'
import DrawLine from '@/components/DrawLine'
import AddDialog from '@/components/AddDialog' import AddDialog from '@/components/AddDialog'
import RemarkDialog from '@/components/RemarkDialog' import RemarkDialog from '@/components/RemarkDialog'
import TransferDialog from '@/components/TransferDialog' import TransferDialog from '@/components/TransferDialog'
...@@ -54,7 +56,8 @@ export default { ...@@ -54,7 +56,8 @@ export default {
LineManagerView, LineManagerView,
TransferDialog, TransferDialog,
RemarkDialog, RemarkDialog,
ExportDialog ExportDialog,
DrawLine
}, },
data () { data () {
return { return {
...@@ -68,7 +71,8 @@ export default { ...@@ -68,7 +71,8 @@ export default {
mergeList: [], mergeList: [],
remark: null, remark: null,
imgBase64: null, imgBase64: null,
exportVisible: false exportVisible: false,
isDrawLine: false
} }
}, },
computed: { computed: {
...@@ -117,6 +121,9 @@ export default { ...@@ -117,6 +121,9 @@ export default {
}, },
methods: { methods: {
createLine (line) {
console.log(line)
},
copyLine (lineObj) { copyLine (lineObj) {
let line = lineObj.line let line = lineObj.line
let st = LineToString(line) let st = LineToString(line)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment