Commit d4754930 authored by 耿迪迪's avatar 耿迪迪

设备管理地图 gengdidi

parent 9bdbfdcb
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
data () { data () {
return { return {
form : { form : {
deviceType : "1" deviceType : "3"
}, },
dialogVisible : false, dialogVisible : false,
fileList: [], fileList: [],
...@@ -106,6 +106,8 @@ ...@@ -106,6 +106,8 @@
if (this.form.deviceId != null) { if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then(response => { updateDeviceInfo(this.form).then(response => {
this.dialogVisible = false; this.dialogVisible = false;
this.map.remove(this.obj);
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
}); });
} else { } else {
......
<template>
<el-dialog
:title="title"
:visible.sync="dialogVisible"
width="80%"
:before-close="handleClose">
<el-form ref="form" :model="form" :rules="rules" label-width="135px">
<el-form-item label="所属管道" prop="pipeCode">
<el-input v-model="form.pipeCode" placeholder="请输入所属管道" />
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="所在地址" prop="deviceAddr">
<el-input v-model="form.deviceAddr" placeholder="请输入所在地址" />
</el-form-item>
<el-form-item label="设备型号" prop="deviceModel">
<el-input v-model="form.deviceModel" placeholder="请输入设备型号" />
</el-form-item>
<el-form-item label="经度" prop="longitude">
<el-input v-model="form.longitude" placeholder="请输入经度" />
</el-form-item>
<el-form-item label="纬度" prop="latitude">
<el-input v-model="form.latitude" placeholder="请输入纬度" />
</el-form-item>
<el-form-item label="物联网编号" prop="iotNo">
<el-input v-model="form.iotNo" placeholder="请输入物联网编号" />
</el-form-item>
<el-form-item label="设备图片上传" prop="iconUrl">
<MyFileUpload
listType="picture-card"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileArr"
/>
</el-form-item>
<el-form-item label="联系人" prop="linkman">
<el-input v-model="form.linkman" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话" />
</el-form-item>
<el-form-item label="安装时间" prop="installationTime">
<el-date-picker clearable size="small"
v-model="form.installationTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择安装时间">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import { getAllDeviceInfo ,addDeviceInfo, updateDeviceInfo } from "@/api/device/deviceInfo";
import MyFileUpload from "@/components/MyFileUpload";
import { DEVICE_TYPE } from "utils/gaodeMap.js";
export default {
props: {
title: { type: String }
},
data () {
return {
form : {
deviceType : "4"
},
dialogVisible : false,
fileList: [],
// 表单校验
rules: {
},
map : null,
obj : null,
gaoMap : null,
fileArr: []
}
},
components: {
MyFileUpload,
},
methods: {
show () {
this.dialogVisible = true;
},
hide () {
this.remove()
},
getFileInfo(res){
this.form.iconUrl = res.url;
},
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then(response => {
this.dialogVisible = false;
this.map.remove(this.obj);
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.msgSuccess("修改成功");
});
} else {
addDeviceInfo(this.form).then(response => {
if(response.code == 200){
this.remove();
this.map.remove(this.obj);
this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功");
}else{
this.msgSuccess("新增失败");
}
});
}
}
});
},
handleClose(done) {
done();
},
listRemove(e) {
this.form.url = "";
this.fileArr = [];
}
}
}
</script>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
rules: { rules: {
}, },
map : null, map : null,
obj : Object, obj : null,
gaoMap : null, gaoMap : null,
fileArr: [] fileArr: []
} }
...@@ -104,6 +104,8 @@ ...@@ -104,6 +104,8 @@
if (this.form.deviceId != null) { if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then(response => { updateDeviceInfo(this.form).then(response => {
this.dialogVisible = false; this.dialogVisible = false;
this.map.remove(this.obj);
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
}); });
} else { } else {
...@@ -112,6 +114,7 @@ ...@@ -112,6 +114,7 @@
this.remove(); this.remove();
this.map.remove(this.obj); this.map.remove(this.obj);
this.form.deviceId = response.data; this.form.deviceId = response.data;
console.log(this.gaoMap,"addgaoMap")
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.gaoMap.closeAddMarker();
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
data () { data () {
return { return {
form : { form : {
deviceType : "1" deviceType : "2"
}, },
dialogVisible : false, dialogVisible : false,
fileList: [], fileList: [],
...@@ -106,6 +106,8 @@ ...@@ -106,6 +106,8 @@
if (this.form.deviceId != null) { if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then(response => { updateDeviceInfo(this.form).then(response => {
this.dialogVisible = false; this.dialogVisible = false;
this.map.remove(this.obj);
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
}); });
} else { } else {
......
...@@ -15,7 +15,8 @@ export const DEVICE_TYPE = { ...@@ -15,7 +15,8 @@ export const DEVICE_TYPE = {
VALUEWELL: "3", VALUEWELL: "3",
FLOWMETER: "4", FLOWMETER: "4",
DUTYPERSON: "5", DUTYPERSON: "5",
WORKORDER: "6" WORKORDER: "6",
PRESSUREGAGE: "7"
}; };
class gaodeMap { class gaodeMap {
// 所有线的数组 // 所有线的数组
...@@ -117,6 +118,9 @@ class gaodeMap { ...@@ -117,6 +118,9 @@ class gaodeMap {
that.deviceType = markerType; that.deviceType = markerType;
let editWindow = that.createInfowindow(); let editWindow = that.createInfowindow();
editWindow.fileArr = data.iconUrl != "" && data.iconUrl != undefined ? [{ url: data.iconUrl }] : []; editWindow.fileArr = data.iconUrl != "" && data.iconUrl != undefined ? [{ url: data.iconUrl }] : [];
editWindow.obj = marker;
editWindow.gaoMap = that;
editWindow.map = map;
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();
...@@ -213,6 +217,16 @@ class gaodeMap { ...@@ -213,6 +217,16 @@ class gaodeMap {
dom.remove(); dom.remove();
return html; return html;
} }
case DEVICE_TYPE.PRESSUREGAGE: {
const dom = createPop(markerInfoWindow,{
title: "压力表",
data: data,
map:map
});
const html = dom.$el;
dom.remove();
return html;
}
} }
} }
...@@ -223,7 +237,7 @@ class gaodeMap { ...@@ -223,7 +237,7 @@ class gaodeMap {
* @param deviceId * @param deviceId
*/ */
deleteMarker(delType,deviceId){ deleteMarker(delType,deviceId){
if(DEVICE_TYPE.REGEULATORBOX == delType || DEVICE_TYPE.VALUEWELL == delType || DEVICE_TYPE.FLOWMETER == delType){ if(DEVICE_TYPE.REGEULATORBOX == delType || DEVICE_TYPE.VALUEWELL == delType || DEVICE_TYPE.FLOWMETER == delType || DEVICE_TYPE.PRESSUREGAGE == delType){
delDeviceInfo(deviceId); delDeviceInfo(deviceId);
} }
...@@ -275,6 +289,14 @@ class gaodeMap { ...@@ -275,6 +289,14 @@ class gaodeMap {
marker.setIcon(icon); marker.setIcon(icon);
break; break;
} }
case DEVICE_TYPE.PRESSUREGAGE: {
let icon = new AMap.Icon({
//size: new AMap.Size(51, 23),
image: require("../assets/images/zhibaorenyuan.png"),
});
marker.setIcon(icon);
break;
}
} }
} }
...@@ -630,6 +652,11 @@ class gaodeMap { ...@@ -630,6 +652,11 @@ class gaodeMap {
title: "流量计" title: "流量计"
}); });
} }
case DEVICE_TYPE.PRESSUREGAGE: {
return createPop(flowMeter, {
title: "压力表"
});
}
} }
} }
...@@ -643,7 +670,8 @@ class gaodeMap { ...@@ -643,7 +670,8 @@ class gaodeMap {
if ( if (
DEVICE_TYPE.REGEULATORBOX == deviceType || DEVICE_TYPE.REGEULATORBOX == deviceType ||
DEVICE_TYPE.VALUEWELL == deviceType || DEVICE_TYPE.VALUEWELL == deviceType ||
DEVICE_TYPE.FLOWMETER == deviceType DEVICE_TYPE.FLOWMETER == deviceType ||
DEVICE_TYPE.PRESSUREGAGE == deviceType
) { ) {
that.mouseTool.marker({ that.mouseTool.marker({
draggable: true draggable: true
......
...@@ -202,7 +202,7 @@ export default { ...@@ -202,7 +202,7 @@ export default {
label: "流量计", label: "流量计",
}, },
{ {
value: 5, value: 7,
icon: "icon-ylb", icon: "icon-ylb",
label: "压力表", label: "压力表",
}, },
...@@ -334,6 +334,9 @@ export default { ...@@ -334,6 +334,9 @@ export default {
if("3" == response.data[i].deviceType){ if("3" == response.data[i].deviceType){
this.gaoMap.addMarker(DEVICE_TYPE.FLOWMETER,response.data[i]) this.gaoMap.addMarker(DEVICE_TYPE.FLOWMETER,response.data[i])
} }
if("4" == response.data[i].deviceType){
this.gaoMap.addMarker(DEVICE_TYPE.PRESSUREGAGE,response.data[i])
}
} }
} }
this.loading = false; this.loading = false;
......
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