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

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

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