Commit 40f47753 authored by 纪泽龙's avatar 纪泽龙

基本完成,准备修改设备路径

parent 76fe364a
......@@ -8,17 +8,17 @@
<el-form ref="form" :model="form" :rules="rules" label-width="135px">
<el-row>
<el-col :span="11">
<el-form-item label="所属管道" prop="pipeCode">
<el-form-item label="所属管道" prop="pipeId">
<el-select
v-model="form.pipeCode"
v-model="form.pipeId"
placeholder="请选择所属管道"
style="width: 100%"
>
<el-option
v-for="item in pipeList"
:key="item.pipeCode"
:key="item.pipeId"
:label="item.pipeName"
:value="item.pipeCode"
:value="item.pipeId"
>
</el-option>
</el-select>
......@@ -163,7 +163,7 @@ export default {
pipeList: [],
rules: {
pipeCode: [
pipeId: [
{ required: true, message: "请选择所属管道", trigger: "blur" },
// { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
],
......@@ -211,6 +211,8 @@ export default {
},
submitForm() {
this.$refs["form"].validate((valid) => {
// console.log("this.form流量计",this.form)
// return;
if (valid) {
if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then((response) => {
......
......@@ -8,17 +8,17 @@
<el-form ref="form" :model="form" :rules="rules" label-width="135px">
<el-row>
<el-col :span="11">
<el-form-item label="所属管道" prop="pipeCode">
<el-form-item label="所属管道" prop="pipeId">
<el-select
v-model="form.pipeCode"
v-model="form.pipeId"
placeholder="请选择所属管道"
style="width: 100%"
>
<el-option
v-for="item in pipeList"
:key="item.pipeCode"
:key="item.pipeId"
:label="item.pipeName"
:value="item.pipeCode"
:value="item.pipeId"
>
</el-option>
</el-select>
......@@ -156,7 +156,7 @@ export default {
fileList: [],
// 表单校验
rules: {
pipeCode: [
pipeId: [
{ required: true, message: "请选择所属管道", trigger: "blur" },
// { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
],
......@@ -209,6 +209,8 @@ export default {
},
submitForm() {
this.$refs["form"].validate((valid) => {
// console.log("this.form)",this.form)
if (valid) {
if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then((response) => {
......
......@@ -8,17 +8,17 @@
<el-form ref="form" :model="form" :rules="rules" label-width="135px">
<el-row>
<el-col :span="11">
<el-form-item label="所属管道" prop="pipeCode">
<el-form-item label="所属管道" prop="pipeId">
<el-select
v-model="form.pipeCode"
v-model="form.pipeId"
placeholder="请选择所属管道"
style="width: 100%"
>
<el-option
v-for="item in pipeList"
:key="item.pipeCode"
:key="item.pipeId"
:label="item.pipeName"
:value="item.pipeCode"
:value="item.pipeId"
>
</el-option>
</el-select>
......@@ -160,7 +160,7 @@ export default {
fileArr: [],
pipeList: [],
rules: {
pipeCode: [
pipeId: [
{ required: true, message: "请选择所属管道", trigger: "blur" },
// { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
],
......@@ -209,6 +209,7 @@ export default {
},
submitForm() {
this.$refs["form"].validate((valid) => {
// console.log("this.form",this.form)
if (valid) {
if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then((response) => {
......
......@@ -132,9 +132,10 @@ export default {
deviceMore() {
console.log(this.obj.polyline.getExtData().lineData)
this.obj.polyline.getExtData().class.view.$router.push({
path: "/realtimeData/realtimedetail",
path: "/dataMonitoring/realtimedetail",
query: {
deviceId: this.obj.polyline.getExtData().lineData.pipeId,
deviceType:"0"
},
});
},
......
......@@ -54,8 +54,11 @@ router.afterEach((to, from) => {
// console.log('全局后置钩子',to, from)
if (to.path == "/enterprise/mapView") {
store.dispatch("app/toggleDevice", "mobile");
store.dispatch("app/closeSideBar", { withoutAnimation: true });
} else {
store.dispatch("app/toggleDevice", "desktop");
store.dispatch("app/closeSideBar", { withoutAnimation: false });
}
NProgress.done();
});
......@@ -5,10 +5,10 @@ import flowMeter from "../components/PopWindow/flowMeter.vue";
import pressureGage from "../components/PopWindow/pressureGage.vue";
import pipelineView from "../components/PopWindow/pipelineView.vue";
import lineInfoWindow from "../components/PopWindow/lineInfoWindow.vue";
import { delDeviceInfo } from "@/api/device/deviceInfo";
import { delDeviceInfo, updateDeviceInfo } from "@/api/device/deviceInfo";
import markerInfoWindow from "../components/PopWindow/markerInfoWindow.vue";
import { getArray } from "@/utils/gassafety.js";
import { delPipe } from "@/api/device/pipe.js";
import { delPipe, updatePipe } from "@/api/device/pipe.js";
import vue from "../main";
let defaultCenter = "石家庄";
export let map;
......@@ -77,15 +77,15 @@ class gaodeMap {
});
// 地图开始平移删除infowindow
this.myMap.on("movestart",()=>{
this.myMap.on("movestart", () => {
// console.log("地图平移");
this.closeInfoWindow()
})
this.closeInfoWindow();
});
// 地图开始缩放删除infowindow
this.myMap.on("zoomstart",()=>{
this.myMap.on("zoomstart", () => {
// console.log("缩放开始")
this.closeInfoWindow()
})
this.closeInfoWindow();
});
this.districtBoundaries();
}
......@@ -155,12 +155,12 @@ class gaodeMap {
offset: new AMap.Pixel(24, -38),
anchor: "left-top"
});
infoWindow.on("mouseover",function () {
infoWindow.on("mouseover", function() {
let options = map.getStatus();
options.scrollWheel = false;
map.setStatus(options);
});
infoWindow.on("mouseout",function () {
infoWindow.on("mouseout", function() {
let options = map.getStatus();
options.scrollWheel = true;
map.setStatus(options);
......@@ -171,7 +171,10 @@ class gaodeMap {
offset: new AMap.Pixel(0, 5)
});
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.on("mouseover", infoOpen);
marker.on("mouseout", infoClose);
......@@ -190,14 +193,40 @@ class gaodeMap {
editWindow.form = e.target.getExtData();
editWindow.show();
} else if ("delete" == that.mapOperateType) {
let diviceType = {"2":"调压箱","3":"阀门井","4":"流量计","7":"压力表",};
vue.$confirm('是否删除名称为"'+e.target.getExtData().deviceName+'"的'+diviceType[markerType]+" ?", "提示", {
let diviceType = {
"2": "调压箱",
"3": "阀门井",
"4": "流量计",
"7": "压力表"
};
vue
.$confirm(
'是否删除名称为"' +
e.target.getExtData().deviceName +
'"的' +
diviceType[markerType] +
" ?",
"提示",
{
type: "warning"
// center: true
}).then(() => {
}
)
.then(() => {
// that.deleteMarker(markerType, data.deviceId);
that.deleteMarker(markerType, data).then(res => {
if (res.code == 200) {
map.remove(marker);
that.deleteMarker(markerType, data.deviceId);
}).catch(() => {
// 数组里也删了
const ind = that.markers.indexOf(marker);
if (ind >= 0) {
that.markers.splice(ind, 1);
console.log(that.markers)
}
}
});
})
.catch(() => {
vue.$message({
type: "info",
// center:true,
......@@ -220,22 +249,19 @@ class gaodeMap {
editWindow.form.longitude = e.lnglat.lng;
editWindow.form.latitude = e.lnglat.lat;
});
}else{
marker.on("mouseover",function(){
} else {
marker.on("mouseover", function() {
marker.setLabel({
offset: new AMap.Pixel(0, -10), //设置文本标注偏移量
content: "<div class='info'>"+data.deviceName+"</div>", //设置文本标注内容
direction: 'top' //设置文本标注方位
content: "<div class='info'>" + data.deviceName + "</div>", //设置文本标注内容
direction: "top" //设置文本标注方位
});
});
marker.on("mouseout",function(){
marker.on("mouseout", function() {
marker.setLabel({
content: null
});
});
}
this.markers.push(marker);
......@@ -256,8 +282,6 @@ class gaodeMap {
infoWindow.setContent(e.target.content);
infoWindow.open(map, e.target.getPosition());
that.markerInfoWindow = infoWindow;
}
}
......@@ -334,14 +358,17 @@ class gaodeMap {
* @param delType
* @param deviceId
*/
deleteMarker(delType, deviceId) {
deleteMarker(delType, deviceData) {
if (
DEVICE_TYPE.REGEULATORBOX == delType ||
DEVICE_TYPE.VALUEWELL == delType ||
DEVICE_TYPE.FLOWMETER == delType ||
DEVICE_TYPE.PRESSUREGAGE == delType
) {
delDeviceInfo(deviceId);
// delDeviceInfo(deviceId);
const upDataObj = { ...deviceData };
upDataObj.isDel = 1;
return updateDeviceInfo(upDataObj);
}
}
......@@ -634,27 +661,60 @@ class gaodeMap {
// console.log("deviceType",deviceType);
});
}
// 其实是修改了状态,不是真的删除
lineDelete(obj) {
const {
lineData: { pipeName }
lineData: { pipeName, deviceInfoList }
} = obj.getExtData();
console.log("deviceInfoList", deviceInfoList);
var devices = " ";
for (var i = 0; i < deviceInfoList.length; i++) {
var item = deviceInfoList[i];
devices = devices + item.deviceName + " ";
}
vue
.$confirm(`是否删除名称为"${pipeName}"的管道 ?`, "提示", {
.$confirm(
'请确认是否删除管道名称为"' +
pipeName +
'"的数据项,该管道下包含的设备(' +
devices +
")将一并删除",
"提示",
{
// confirmButtonText: "确定",
// cancelButtonText: "取消",
type: "warning"
// center: true
})
}
)
.then(() => {
const {
lineData: { pipeId }
} = obj.getExtData();
console.log(pipeId);
delPipe(pipeId).then(res => {
const { lineData } = obj.getExtData();
// updatePipe
// delPipe(pipeId).then(res => {
let upDataObj = { ...lineData };
upDataObj.isDel = 1;
updatePipe(upDataObj).then(res => {
if (res.code == 200) {
const index = this.polyLines.indexOf(obj);
// 如果是老线,就要线删除原来的,然后重新包装一遍
if (index >= 0) {
this.polyLines.splice(index, 1);
// 删除管道的时候,与管道管理额的设备也要删除
for (var i = 0; i < deviceInfoList.length; i++) {
const item = deviceInfoList[i];
for (let j = 0; j < this.markers.length; j++) {
const item2 = this.markers[j];
if (item.deviceId == item2.getExtData().deviceId) {
map.remove(item2);
const ind = this.markers.indexOf(item2);
if (ind >= 0) {
this.markers.splice(ind, 1);
}
break;
}
}
}
map.remove(obj);
}
vue.$message({
......@@ -665,9 +725,12 @@ class gaodeMap {
});
// 关闭当前线条的infowindow
// this.closeLineInfoWindow();
console.log("改变线条");
}
});
})
.catch(() => {
.catch(err => {
console.log(err);
vue.$message({
type: "info",
// center:true,
......@@ -752,25 +815,24 @@ class gaodeMap {
device.show();
});
e.obj.on("mouseover",function () {
e.obj.on("mouseover", function() {
that.mouseTool.close();
});
e.obj.on("mouseout",function () {
e.obj.on("mouseout", function() {
that.draw(that.deviceType);
})
});
that.markerOverlays.push(e.obj);
}
if (e.obj && e.obj.getExtData().type == "newLine") {
console.log("挂上事件");
that.newLineAddEvent(e.obj);
// 记录这条线
// console.log(e.obj.getPath().length)
// 如果只有一个点,并没有连成线的时候就不close 大于一个点的时候才执行clse
console.log(that.lineType)
console.log(that.lineType);
if (e.obj.getPath().length > 1) {
that.newLineObj = e.obj;
that.mouseTool.close();
......@@ -803,22 +865,22 @@ class gaodeMap {
}
case DEVICE_TYPE.REGEULATORBOX: {
return createPop(regulatorBox, {
title: val+ "调压箱"
title: val + "调压箱"
});
}
case DEVICE_TYPE.VALUEWELL: {
return createPop(valveWell, {
title: val+ "阀门井"
title: val + "阀门井"
});
}
case DEVICE_TYPE.FLOWMETER: {
return createPop(flowMeter, {
title: val+ "流量计"
title: val + "流量计"
});
}
case DEVICE_TYPE.PRESSUREGAGE: {
return createPop(pressureGage, {
title: val+ "压力表"
title: val + "压力表"
});
}
}
......@@ -902,7 +964,6 @@ class gaodeMap {
});
}
closeAddMarker() {
this.mouseTool.close();
map.remove(this.markerOverlays);
......
......@@ -342,6 +342,7 @@ export default {
created() {
// 让左边的框隐藏
this.$store.dispatch("app/toggleDevice", "mobile");
console.log("sasdasdas")
},
mounted() {
......@@ -396,7 +397,6 @@ export default {
}
});
},
getDeviceInfo(queryParams) {
this.loading = true;
return getAllDeviceInfo(queryParams).then((response) => {
......
......@@ -81,7 +81,7 @@ export default {
code: [{ required: true, trigger: "change", message: "验证码不能为空" }]
},
loading: false,
redirect: "/index"
redirect: ""
};
},
watch: {
......@@ -134,7 +134,9 @@ export default {
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
// this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
// console.log(this.redirect)
this.$router.push({ path: "/enterprise/mapView" || "/" }).catch(()=>{});
}).catch(() => {
this.loading = false;
this.getCode();
......
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