Commit 52bc4206 authored by 耿迪迪's avatar 耿迪迪

设备维护 gengdidi

parent 866dbca3
...@@ -27,7 +27,12 @@ ...@@ -27,7 +27,12 @@
<el-input v-model="form.iotNo" placeholder="请输入物联网编号" /> <el-input v-model="form.iotNo" placeholder="请输入物联网编号" />
</el-form-item> </el-form-item>
<el-form-item label="设备图片上传" prop="iconUrl"> <el-form-item label="设备图片上传" prop="iconUrl">
<FileUpload :fileArr="fileList" @resFun="getFileInfo"/> <MyFileUpload
listType="picture-card"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileArr"
/>
</el-form-item> </el-form-item>
<el-form-item label="联系人" prop="linkman"> <el-form-item label="联系人" prop="linkman">
<el-input v-model="form.linkman" placeholder="请输入联系人" /> <el-input v-model="form.linkman" placeholder="请输入联系人" />
...@@ -58,7 +63,7 @@ ...@@ -58,7 +63,7 @@
import { getAllDeviceInfo ,addDeviceInfo, updateDeviceInfo } from "@/api/device/deviceInfo"; import { getAllDeviceInfo ,addDeviceInfo, updateDeviceInfo } from "@/api/device/deviceInfo";
import FileUpload from '@/components/FileUpload'; import MyFileUpload from "@/components/MyFileUpload";
import { DEVICE_TYPE } from "utils/gaodeMap.js"; import { DEVICE_TYPE } from "utils/gaodeMap.js";
...@@ -78,11 +83,12 @@ ...@@ -78,11 +83,12 @@
}, },
map : null, map : null,
obj : null, obj : null,
gaoMap : null gaoMap : null,
fileArr: []
} }
}, },
components: { components: {
FileUpload, MyFileUpload,
}, },
methods: { methods: {
show () { show () {
...@@ -99,6 +105,7 @@ ...@@ -99,6 +105,7 @@
if (valid) { if (valid) {
if (this.form.deviceId != null) { if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then(response => { updateDeviceInfo(this.form).then(response => {
this.dialogVisible = false;
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
}); });
} else { } else {
...@@ -109,6 +116,7 @@ ...@@ -109,6 +116,7 @@
this.form.deviceId = response.data; this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form); this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear(); this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
}else{ }else{
this.msgSuccess("新增失败"); this.msgSuccess("新增失败");
...@@ -120,6 +128,10 @@ ...@@ -120,6 +128,10 @@
}, },
handleClose(done) { handleClose(done) {
done(); done();
},
listRemove(e) {
this.form.url = "";
this.fileArr = [];
} }
} }
} }
......
...@@ -27,7 +27,12 @@ ...@@ -27,7 +27,12 @@
<el-input v-model="form.iotNo" placeholder="请输入物联网编号" /> <el-input v-model="form.iotNo" placeholder="请输入物联网编号" />
</el-form-item> </el-form-item>
<el-form-item label="设备图片上传" prop="iconUrl"> <el-form-item label="设备图片上传" prop="iconUrl">
<FileUpload :fileArr="fileList" @resFun="getFileInfo"/> <MyFileUpload
listType="picture-card"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileArr"
/>
</el-form-item> </el-form-item>
<el-form-item label="联系人" prop="linkman"> <el-form-item label="联系人" prop="linkman">
<el-input v-model="form.linkman" placeholder="请输入联系人" /> <el-input v-model="form.linkman" placeholder="请输入联系人" />
...@@ -57,9 +62,7 @@ ...@@ -57,9 +62,7 @@
<script> <script>
import { getAllDeviceInfo ,addDeviceInfo, updateDeviceInfo } from "@/api/device/deviceInfo"; import { getAllDeviceInfo ,addDeviceInfo, updateDeviceInfo } from "@/api/device/deviceInfo";
import MyFileUpload from "@/components/MyFileUpload";
import FileUpload from '@/components/FileUpload';
import { DEVICE_TYPE } from "utils/gaodeMap.js"; import { DEVICE_TYPE } from "utils/gaodeMap.js";
export default { export default {
...@@ -77,15 +80,13 @@ ...@@ -77,15 +80,13 @@
rules: { rules: {
}, },
map : null, map : null,
obj : null, obj : Object,
gaoMap : null gaoMap : null,
fileArr: []
} }
}, },
mounted(){
console.log(this.form.longitude,"===============")
},
components: { components: {
FileUpload, MyFileUpload
}, },
methods: { methods: {
show () { show () {
...@@ -102,6 +103,7 @@ ...@@ -102,6 +103,7 @@
if (valid) { if (valid) {
if (this.form.deviceId != null) { if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then(response => { updateDeviceInfo(this.form).then(response => {
this.dialogVisible = false;
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
}); });
} else { } else {
...@@ -112,6 +114,7 @@ ...@@ -112,6 +114,7 @@
this.form.deviceId = response.data; this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form); this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear(); this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
}else{ }else{
this.msgSuccess("新增失败"); this.msgSuccess("新增失败");
...@@ -121,6 +124,10 @@ ...@@ -121,6 +124,10 @@
} }
}); });
}, },
listRemove(e) {
this.form.url = "";
this.fileArr = [];
},
handleClose(done) { handleClose(done) {
done(); done();
} }
......
...@@ -27,7 +27,12 @@ ...@@ -27,7 +27,12 @@
<el-input v-model="form.iotNo" placeholder="请输入物联网编号" /> <el-input v-model="form.iotNo" placeholder="请输入物联网编号" />
</el-form-item> </el-form-item>
<el-form-item label="设备图片上传" prop="iconUrl"> <el-form-item label="设备图片上传" prop="iconUrl">
<FileUpload :fileArr="fileList" @resFun="getFileInfo"/> <MyFileUpload
listType="picture-card"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileArr"
/>
</el-form-item> </el-form-item>
<el-form-item label="联系人" prop="linkman"> <el-form-item label="联系人" prop="linkman">
<el-input v-model="form.linkman" placeholder="请输入联系人" /> <el-input v-model="form.linkman" placeholder="请输入联系人" />
...@@ -58,7 +63,7 @@ ...@@ -58,7 +63,7 @@
import { getAllDeviceInfo ,addDeviceInfo, updateDeviceInfo } from "@/api/device/deviceInfo"; import { getAllDeviceInfo ,addDeviceInfo, updateDeviceInfo } from "@/api/device/deviceInfo";
import FileUpload from '@/components/FileUpload'; import MyFileUpload from "@/components/MyFileUpload";
import { DEVICE_TYPE } from "utils/gaodeMap.js"; import { DEVICE_TYPE } from "utils/gaodeMap.js";
...@@ -78,11 +83,12 @@ ...@@ -78,11 +83,12 @@
}, },
map : null, map : null,
obj : null, obj : null,
gaoMap : null gaoMap : null,
fileArr: []
} }
}, },
components: { components: {
FileUpload, MyFileUpload,
}, },
methods: { methods: {
show () { show () {
...@@ -99,6 +105,7 @@ ...@@ -99,6 +105,7 @@
if (valid) { if (valid) {
if (this.form.deviceId != null) { if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then(response => { updateDeviceInfo(this.form).then(response => {
this.dialogVisible = false;
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
}); });
} else { } else {
...@@ -109,6 +116,7 @@ ...@@ -109,6 +116,7 @@
this.form.deviceId = response.data; this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form); this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear(); this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
}else{ }else{
this.msgSuccess("新增失败"); this.msgSuccess("新增失败");
...@@ -120,6 +128,10 @@ ...@@ -120,6 +128,10 @@
}, },
handleClose(done) { handleClose(done) {
done(); done();
},
listRemove(e) {
this.form.url = "";
this.fileArr = [];
} }
} }
} }
......
...@@ -116,6 +116,7 @@ class gaodeMap { ...@@ -116,6 +116,7 @@ class gaodeMap {
marker.setExtData(data); marker.setExtData(data);
that.deviceType = markerType; that.deviceType = markerType;
let editWindow = that.createInfowindow(); let editWindow = that.createInfowindow();
editWindow.fileArr = data.iconUrl != "" && data.iconUrl != undefined ? [{ url: data.iconUrl }] : [];
marker.on("click", function(e) { marker.on("click", function(e) {
if ("edit" == that.mapOperateType) { if ("edit" == that.mapOperateType) {
editWindow.form = e.target.getExtData(); editWindow.form = e.target.getExtData();
...@@ -567,14 +568,15 @@ class gaodeMap { ...@@ -567,14 +568,15 @@ class gaodeMap {
//监听draw事件可获取画好的覆盖物 //监听draw事件可获取画好的覆盖物
this.overlays = []; this.overlays = [];
let that = this; let that = this;
this.markerOverlays = [];
this.mouseTool.on("draw", function(e) { this.mouseTool.on("draw", function(e) {
if (e.obj.getExtData().type != "newLine") { if (e.obj.getExtData().type != "newLine") {
map.remove(that.markerOverlays);
const device = that.createInfowindow(); const device = that.createInfowindow();
device.map = map; device.map = map;
device.obj = e.obj; device.obj = e.obj;
device.gaoMap = that; device.gaoMap = that;
e.obj.on("click", function(aa) { e.obj.on("click", function(aa) {
console.log(aa,"fdsfdsfdsa===click")
let postion = aa.target._position; let postion = aa.target._position;
//兼容拖拽后单击事件,拖拽后点击事件返回位置为数组 //兼容拖拽后单击事件,拖拽后点击事件返回位置为数组
if(postion instanceof Array){ if(postion instanceof Array){
...@@ -587,6 +589,7 @@ class gaodeMap { ...@@ -587,6 +589,7 @@ class gaodeMap {
device.show(); device.show();
}); });
that.markerOverlays.push(e.obj);
} }
if (e.obj.getExtData().type == "newLine") { if (e.obj.getExtData().type == "newLine") {
...@@ -594,12 +597,13 @@ class gaodeMap { ...@@ -594,12 +597,13 @@ class gaodeMap {
that.newLineAddEvent(e.obj); that.newLineAddEvent(e.obj);
// 右键菜单 // 右键菜单
// that.addEditorAndMenu(e.obj) // that.addEditorAndMenu(e.obj)
}
that.overlays.push(e.obj); that.overlays.push(e.obj);
}
// if(e.obj.getExtData().type=="line"){ // if(e.obj.getExtData().type=="line"){
// return; // return;
// } // }
that.mouseTool.close(); //that.mouseTool.close();
}); });
} }
...@@ -716,5 +720,10 @@ class gaodeMap { ...@@ -716,5 +720,10 @@ class gaodeMap {
placeSearch.search(keyWord); //关键字查询查询 placeSearch.search(keyWord); //关键字查询查询
}) })
} }
closeAddMarker(){
this.mouseTool.close();
map.remove(this.markerOverlays);
}
} }
export default gaodeMap; export default gaodeMap;
...@@ -274,9 +274,6 @@ export default { ...@@ -274,9 +274,6 @@ export default {
this.gaoMap.lineType=1; this.gaoMap.lineType=1;
this.gaoMap.createNewLine(); this.gaoMap.createNewLine();
}else { }else {
console.log(this.createValue,"rewrewqrew===========")
console.log(this.targetNum,"rewrewqrew===========1111111111")
this.gaoMap.draw(this.createValue.toString()); this.gaoMap.draw(this.createValue.toString());
} }
}, },
...@@ -298,6 +295,7 @@ export default { ...@@ -298,6 +295,7 @@ export default {
this.gaoMap.mapOperateType = "edit"; this.gaoMap.mapOperateType = "edit";
this.gaoMap.addMarkerDragg(); this.gaoMap.addMarkerDragg();
this.gaoMap.placeSearch.clear(); this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
}, },
deleteDevice() { deleteDevice() {
this.targetNum = this.targetNum != 3 ? 3 : 0; this.targetNum = this.targetNum != 3 ? 3 : 0;
...@@ -308,6 +306,7 @@ export default { ...@@ -308,6 +306,7 @@ export default {
this.gaoMap.mapOperateType = "delete"; this.gaoMap.mapOperateType = "delete";
this.gaoMap.removeMarkerDragg(); this.gaoMap.removeMarkerDragg();
this.gaoMap.placeSearch.clear(); this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
}, },
selectDeviceType(val) { selectDeviceType(val) {
// if("add" == this.operationType){ // if("add" == this.operationType){
......
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