Commit e0bc00a6 authored by 纪泽龙's avatar 纪泽龙

优化上传图片预览

parent 7227c3b9
...@@ -291,4 +291,6 @@ ...@@ -291,4 +291,6 @@
} }
} }
// background-color: ; // background-color: ;
}
\ No newline at end of file }
// 图片预览
...@@ -32,15 +32,24 @@ ...@@ -32,15 +32,24 @@
</template> </template>
的文件 的文件
</div> </div>
</el-upload> </el-upload>
<el-dialog <el-image v-show="false"
id="img"
ref="previewImg"
:src="dialogImageUrl"
:preview-src-list="bigImageArr"
:z-index="9999999"
></el-image>
<!-- <el-dialog
:center="true" :center="true"
width="50%" width="50%"
:modal="modal" :modal="modal"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
> >
<img :src="dialogImageUrl" alt="" /> <img :src="dialogImageUrl" alt="" />
</el-dialog> </el-dialog> -->
<!-- 文件列表 --> <!-- 文件列表 -->
<!-- <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul"> <!-- <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in list"> <li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in list">
...@@ -123,6 +132,9 @@ export default { ...@@ -123,6 +132,9 @@ export default {
return []; return [];
} }
}, },
bigImageArr() {
return [this.dialogImageUrl]
},
}, },
methods: { methods: {
// 上传前校检格式和大小 // 上传前校检格式和大小
...@@ -197,7 +209,9 @@ export default { ...@@ -197,7 +209,9 @@ export default {
this.dialogImageUrl = file.response ? file.response.url : file.url; this.dialogImageUrl = file.response ? file.response.url : file.url;
// this.dialogImageUrl =if(this.fileArr) this.fileArr[0].url; // this.dialogImageUrl =if(this.fileArr) this.fileArr[0].url;
this.dialogVisible = true; // this.dialogVisible = true;
this.$refs.previewImg.showViewer = true;
console.log(file); console.log(file);
// console.log(file.response.url) // console.log(file.response.url)
}, },
......
...@@ -159,7 +159,10 @@ class gaodeMap { ...@@ -159,7 +159,10 @@ class gaodeMap {
offset: new AMap.Pixel(0, 5) offset: new AMap.Pixel(0, 5)
}); });
this.setMarkerIcon(marker); this.setMarkerIcon(marker);
if (DEVICE_TYPE.WORKORDER != markerType && DEVICE_TYPE.INSPECTOR != markerType) { if (
DEVICE_TYPE.WORKORDER != markerType &&
DEVICE_TYPE.INSPECTOR != markerType
) {
marker.content = this.getMarketContent(data); marker.content = this.getMarketContent(data);
marker.on("mouseover", infoOpen); marker.on("mouseover", infoOpen);
marker.on("mouseout", infoClose); marker.on("mouseout", infoClose);
...@@ -238,16 +241,29 @@ class gaodeMap { ...@@ -238,16 +241,29 @@ class gaodeMap {
} }
function infoOpen(e) { function infoOpen(e) {
// 如果有cloneDom就删了 // 删除克隆出来的线的clonedom
console.log(that.cloneDom);
// 删除克隆出来的clonedom
that.removeCloneDom();
let options = map.getStatus(); let options = map.getStatus();
options.scrollWheel = false; options.scrollWheel = false;
map.setStatus(options); map.setStatus(options);
infoWindow.setContent(e.target.content); infoWindow.setContent(e.target.content);
infoWindow.open(map, e.target.getPosition()); infoWindow.open(map, e.target.getPosition());
console.log(infoWindow.dom);
// 这个是为了盖住vue里的东西
e.target.cloneDom = infoWindow.dom.cloneNode(true);
// console.log(infoWindow.dom.offsetLeft);
// console.log(infoWindow.dom);
e.target.cloneDom.style.top = infoWindow.dom.offsetTop + 80 + "px";
e.target.cloneDom.style.left = infoWindow.dom.offsetLeft + 100 + "px";
// 先删除之前的,后增加现在的
// this.removeCloneDom();
that.removeCloneDom();
document.body.appendChild(e.target.cloneDom);
that.markerCloneDom = e.target.cloneDom;
infoWindow.close();
that.markerInfoWindow = infoWindow; that.markerInfoWindow = infoWindow;
} }
} }
...@@ -539,7 +555,9 @@ class gaodeMap { ...@@ -539,7 +555,9 @@ class gaodeMap {
removeCloneDom() { removeCloneDom() {
this.cloneDom && document.body.removeChild(this.cloneDom); this.cloneDom && document.body.removeChild(this.cloneDom);
this.markerCloneDom && document.body.removeChild(this.markerCloneDom);
this.cloneDom = null; this.cloneDom = null;
this.markerCloneDom=null;
} }
// 创建一条新的线 // 创建一条新的线
......
...@@ -10,14 +10,16 @@ ...@@ -10,14 +10,16 @@
</div> </div>
<div class="right"> <div class="right">
<template v-for="item in list" > <template v-for="item in list">
<div class="right-content" :key="item.type"> <div class="right-content" :key="item.type">
<div class="text-icon"> <div class="text-icon">
<i class="iconfont icon-gdcd"></i> <i class="iconfont" :class="iconClass(item)"></i>
</div> </div>
<div class="text"> <div class="text">
<div class="top">{{typeName[item.type]}}</div> <div class="top">{{ typeName[item.type] }}</div>
<div class="bottom">{{item.number}}{{item.type==99?"KM":"个" }}</div> <div class="bottom">
{{ item.number }}{{ item.type == 99 ? "KM" : "个" }}
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -32,21 +34,32 @@ export default { ...@@ -32,21 +34,32 @@ export default {
type: Array, type: Array,
}, },
}, },
data(){ data() {
return { return {
typeName:{ typeName: {
"1":"调压箱", 1: "调压箱",
"2":"阀门井", 2: "阀门井",
"3":"流量计", 3: "流量计",
"4":"压力表", 4: "压力表",
"99":"管道", 99: "管道",
}, },
// type iconList: {
} 1: "icon-tyx",
2: "icon-fmj",
3: "icon-llj",
4: "icon-ylb",
99: "icon-gdcd",
},
};
}, },
created() { created() {
console.log("list", this.list); console.log("list", this.list);
}, },
methods: {
iconClass(item) {
return this.iconList[item.type]
},
},
}; };
</script> </script>
......
...@@ -375,7 +375,6 @@ export default { ...@@ -375,7 +375,6 @@ export default {
}); });
}, },
getInspectionDataByInspector(){ getInspectionDataByInspector(){
this.gaoMap.addMarker( this.gaoMap.addMarker(
DEVICE_TYPE.INSPECTOR, DEVICE_TYPE.INSPECTOR,
{longitude:114.525243,latitude:38.035002} {longitude:114.525243,latitude:38.035002}
......
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