Commit 11150222 authored by 耿迪迪's avatar 耿迪迪
parents 1484ab5b 3dc96d01
package com.zehong.web.controller.system; package com.zehong.web.controller.system;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import com.zehong.framework.systemsetting.SystemSetting; import com.zehong.framework.systemsetting.SystemSetting;
import com.zehong.framework.web.domain.server.Sys;
import com.zehong.system.service.ISysPostService; import com.zehong.system.service.ISysPostService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -81,14 +80,17 @@ public class SysLoginController ...@@ -81,14 +80,17 @@ public class SysLoginController
Set<String> roles = permissionService.getRolePermission(user); Set<String> roles = permissionService.getRolePermission(user);
// 权限集合 // 权限集合
Set<String> permissions = permissionService.getMenuPermission(user); Set<String> permissions = permissionService.getMenuPermission(user);
HashMap hashMap=new HashMap(); //参数集合
Map<String, String> systemWebSetting = systemSetting.getSystemWebSetting();
/* HashMap hashMap=new HashMap();
hashMap.put("map_center","[114.684979,38.038292]");//经开区 hashMap.put("map_center","[114.684979,38.038292]");//经开区
hashMap.put("prod_test","prod"); hashMap.put("prod_test","prod");*/
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("user", user); ajax.put("user", user);
ajax.put("roles", roles); ajax.put("roles", roles);
ajax.put("permissions", permissions); ajax.put("permissions", permissions);
ajax.put("systemSetting",hashMap); ajax.put("systemSetting",systemWebSetting);
ajax.put("posts",iSysPostService.getPostListByUserId(user.getUserId())); ajax.put("posts",iSysPostService.getPostListByUserId(user.getUserId()));
return ajax; return ajax;
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<script> <script>
import { EditorMap } from "@/utils/mapClass/getPath.js"; import { EditorMap } from "@/utils/mapClass/getPath.js";
import { _ } from "core-js";
export default { export default {
name: "draw-area", name: "draw-area",
props:{ props:{
...@@ -49,50 +50,18 @@ ...@@ -49,50 +50,18 @@
searchinput: "" searchinput: ""
} }
}, },
mounted(){ mounted(){
this.initMap(); this.initMap();
this.$nextTick(() => {
const input = this.$refs.input.$refs.input;
this.gaoMap.positionSearch(input);
});
}, },
methods:{ methods:{
//地图初始化 //地图初始化
initMap(){ initMap(){
const path = eval(this.$store.state.user.systemSetting.map_center); const path = eval(this.$store.state.user.systemSetting.map_center);
this.gaoMap = new EditorMap("drawArea", {center:path}, this); this.gaoMap = new EditorMap("drawArea", {center:path}, this);
this.initMapEvent();
if(this.value.length > 0){ if(this.value.length > 0){
this.loadArea(); this.loadArea();
}else{ }
this.initMouseEvent(); this.initMouseEvent();
}
},
initMapEvent(){
let that = this;
this.gaoMap.map.on("click", () => {
// if(that.nowMouseTarget && !that.isClickPolygonFlag){
// //that.$emit("input", []);
// // that.mouseTool && that.mouseTool.close();
// // that.nowMouseTarget.polygonEditor && that.nowMouseTarget.polygonEditor.close();
// //that.gaoMap.map.remove(that.nowMouseTarget);
// // that.mouseTool && that.mouseTool.polygon(that.opts);
// // if(!that.mouseTool){
// // that.initMouseEvent();
// // }
// that.isClickPolygonFlag = true;
// this.drawLayers.push('[' + that.nowMouseTarget + ']');
// // that.nowMouseTarget.setMap(this.gaoMap.map);
// this.selectedLayerIndex = this.drawLayers.length - 1; // 设置当前选中的图层索引
// console.log("this.drawLayers = " + this.drawLayers)
// that.nowMouseTarget = null;
// that.mouseTool.polygon(that.opts);
// }
// if (!that.isClickPolygonFlag) {
// that.mouseTool.polygon(that.opts);
// }
});
}, },
//初始化鼠标事件 //初始化鼠标事件
initMouseEvent(){ initMouseEvent(){
...@@ -103,6 +72,7 @@ ...@@ -103,6 +72,7 @@
that.mouseTool.on('draw',function(e){ that.mouseTool.on('draw',function(e){
let nowMouseTargetObj = new Object(); let nowMouseTargetObj = new Object();
nowMouseTargetObj= e.obj; nowMouseTargetObj= e.obj;
// 如果只允许画一个则用这个方法 发数据
// that.$emit("input", that.nowMouseTarget._opts.path); // that.$emit("input", that.nowMouseTarget._opts.path);
that.isClickPolygonFlag = false; that.isClickPolygonFlag = false;
if(nowMouseTargetObj._opts.path.length > 2){ if(nowMouseTargetObj._opts.path.length > 2){
...@@ -113,12 +83,11 @@ ...@@ -113,12 +83,11 @@
nowMouseTargetObj.on('click',function () { nowMouseTargetObj.on('click',function () {
that.isClickPolygonFlag = true; that.isClickPolygonFlag = true;
that.firstClick++; that.firstClick++;
if(that.firstClick < 2){ // if(that.firstClick < 2){
that.gaoMap.map.plugin(["AMap.PolygonEditor"],(n) => { that.gaoMap.map.plugin(["AMap.PolygonEditor"],(n) => {
const polygonEditor = new AMap.PolygonEditor(that.gaoMap.map,e.obj); const polygonEditor = new AMap.PolygonEditor(that.gaoMap.map,e.obj);
nowMouseTargetObj.polygonEditor = polygonEditor; nowMouseTargetObj.polygonEditor = polygonEditor;
polygonEditor.on("removenode", (e) => { polygonEditor.on("removenode", (e) => {
// that.$emit("input", e.target._opts.path);
that.isClickPolygonFlag = true; that.isClickPolygonFlag = true;
if(nowMouseTargetObj._opts.path.length == 0){ if(nowMouseTargetObj._opts.path.length == 0){
setTimeout(() => { setTimeout(() => {
...@@ -127,25 +96,23 @@ ...@@ -127,25 +96,23 @@
} }
}); });
polygonEditor.on("adjust",(e) =>{ polygonEditor.on("adjust",(e) =>{
// that.$emit("input", e.target._opts.path); that.$emit("update-path", that.drawLayers);
}) })
polygonEditor.on("addnode",(e) =>{ polygonEditor.on("addnode",(e) =>{
// that.$emit("input", e.target._opts.path); that.$emit("update-path", that.drawLayers);
}) })
polygonEditor.open(); polygonEditor.open();
}); });
} // }
}); });
nowMouseTargetObj.on("mouseout", (e) => { nowMouseTargetObj.on("mouseout", (e) => {
that.isClickPolygonFlag = false; that.isClickPolygonFlag = false;
that.mouseTool.polygon(that.opts); that.mouseTool.polygon(that.opts);
console.log("mouseout === 了。。。。。。")
}) })
// 鼠标放到了这个上面 // 鼠标放到了这个上面
nowMouseTargetObj.on("mouseover", (e) => { nowMouseTargetObj.on("mouseover", (e) => {
that.mouseTool.polygon(null); that.mouseTool && that.mouseTool.close();
console.log("mouseover === 了。。。。。。")
}) })
//右键关闭区域编辑 //右键关闭区域编辑
nowMouseTargetObj.on("rightclick",(e) => { nowMouseTargetObj.on("rightclick",(e) => {
...@@ -170,54 +137,162 @@ ...@@ -170,54 +137,162 @@
that.drawLayers.splice(deleteIndex, 1); that.drawLayers.splice(deleteIndex, 1);
} }
}).catch(() => {}); }).catch(() => {});
that.$emit("update-path", that.drawLayers);
}) })
if (nowMouseTargetObj._opts.path.length > 2) { if (nowMouseTargetObj._opts.path.length > 2) {
that.$set(that.drawLayers, that.drawLayers.length, nowMouseTargetObj);
let haveObjNum = null;
if (that.drawLayers.length > 0) {
for (let i = 0; i < that.drawLayers.length; i++) {
let item = that.drawLayers[i];
// 是后来新添加的
if (item._opts.path) {
let optsPathItem = item._opts.path;
if (JSON.stringify(optsPathItem) === JSON.stringify(nowMouseTargetObj._opts.path)) {
haveObjNum = i;
}
// 是之前回显的数据
}
if (item.getPath()) {
let pointsItem = item.getPath();
if (JSON.stringify(pointsItem) === JSON.stringify(nowMouseTargetObj._opts.path)) {
haveObjNum = i;
}
}
}
}
if (haveObjNum == null) {
that.$set(that.drawLayers, that.drawLayers.length, nowMouseTargetObj);
}
} }
that.$emit("update-path", that.drawLayers);
that.mouseTool.polygon(that.opts); that.mouseTool.polygon(that.opts);
}) })
}); });
}, },
//区域回显 initMapPolygon(value) {
loadArea(){ let that = this;
let haveObjNum = null;
if (that.drawLayers.length > 0) {
for (let i = 0; i < that.drawLayers.length; i++) {
let item = that.drawLayers[i];
// 是后来新添加的
if (item._opts.path) {
let optsPathItem = item._opts.path;
if (JSON.stringify(optsPathItem) === JSON.stringify(value)) {
haveObjNum = i;
}
// 是之前回显的数据
}
if (item.getPath()) {
if (JSON.stringify(item.getPath()) === JSON.stringify(value)) {
haveObjNum = i;
}
}
}
}
if (haveObjNum != null) {
return;
}
const polygon = new AMap.Polygon({ const polygon = new AMap.Polygon({
map:this.gaoMap.map, map:that.gaoMap.map,
path: this.value, path: value,
fillColor:'#00b0ff', fillColor:'#00b0ff',
strokeColor:'#80d8ff' strokeColor:'#80d8ff',
extData: {id: that.drawLayers.length}
}); });
this.nowMouseTarget = polygon; let mouseTarget = new Object();
this.firstClick = 0; mouseTarget = polygon;
polygon.on("click",(e) =>{ that.firstClick = 0;
this.isClickPolygonFlag = true; mouseTarget.on("click",(e) =>{
this.firstClick++; that.isClickPolygonFlag = true;
if(this.firstClick < 2){ that.firstClick++;
this.gaoMap.map.plugin(["AMap.PolygonEditor"],()=> { if(that.firstClick < 2){
this.nowMouseTarget.polygonEditor = new AMap.PolygonEditor(this.gaoMap.map,e.target); that.gaoMap.map.plugin(["AMap.PolygonEditor"],()=> {
this.nowMouseTarget.polygonEditor.on("removenode", (e) => { mouseTarget.polygonEditor = new AMap.PolygonEditor(that.gaoMap.map,e.target);
this.isClickPolygonFlag = true; mouseTarget.polygonEditor.on("removenode", (e) => {
this.$emit("input", e.target._opts.path); that.isClickPolygonFlag = true;
}); });
this.nowMouseTarget.polygonEditor.on("adjust",(e) =>{ mouseTarget.polygonEditor.on("adjust",(e) =>{
this.$emit("input", e.target._opts.path); that.$emit("update-path", that.drawLayers);
}) })
this.nowMouseTarget.polygonEditor.on("addnode",(e) =>{ mouseTarget.polygonEditor.on("addnode",(e) =>{
this.$emit("input", e.target._opts.path); that.$emit("update-path", that.drawLayers);
}) })
this.nowMouseTarget.polygonEditor.open(); mouseTarget.polygonEditor.open();
}) })
} }
}); });
polygon.on("mouseout", (e) => { mouseTarget.on("mouseout", (e) => {
this.isClickPolygonFlag = false; that.isClickPolygonFlag = false;
}) })
polygon.on("rightclick",() => { mouseTarget.on("rightclick",() => {
this.firstClick = 0; that.firstClick = 0;
this.nowMouseTarget.polygonEditor && this.nowMouseTarget.polygonEditor.close(); mouseTarget.polygonEditor && mouseTarget.polygonEditor.close();
}); });
this.gaoMap.setCenter(this.value[0]); mouseTarget.on("mouseout", (e) => {
this.gaoMap.map.setZoom(12) that.isClickPolygonFlag = false;
that.mouseTool.polygon(that.opts);
})
// 鼠标放到了这个上面
mouseTarget.on("mouseover", (e) => {
that.mouseTool && that.mouseTool.close();
})
// 双击删除
mouseTarget.on("dblclick",(e) => {
that.firstClick = 0;
that.$confirm("是否删除此区域", { type: "warning" })
.then(() => {
let deleteIndex = null;
for (let i = 0;i < that.drawLayers.length;i ++) {
if (that.drawLayers[i]._opts.path) {
var isPointInRing = AMap.GeometryUtil.isPointInRing(e.lnglat,that.drawLayers[i]._opts.path);
if (isPointInRing) {
deleteIndex = i;
}
}
if (that.drawLayers[i].getPath()) {
var isPointInRing = AMap.GeometryUtil.isPointInRing(e.lnglat,that.drawLayers[i].getPath());
if (isPointInRing) {
deleteIndex = i;
}
}
}
if (deleteIndex != null) {
if (that.drawLayers[deleteIndex].polygonEditor) {
that.drawLayers[deleteIndex].polygonEditor.close();
}
that.gaoMap.map.remove(that.drawLayers[deleteIndex]);
that.drawLayers.splice(deleteIndex, 1);
}
that.$emit("update-path", that.drawLayers);
}).catch(() => {});
})
if (haveObjNum === null) {
that.$set(that.drawLayers, that.drawLayers.length, mouseTarget);
}
},
//区域回显
loadArea(){
if (this.value.length > 1) {
for (let i = 0;i < this.value.length;i++) {
this.initMapPolygon(this.value[i]);
}
this.gaoMap.map.setZoom(12)
} else if(this.value.length === 1) {
this.initMapPolygon(this.value[0]);
this.gaoMap.setCenter(this.value[0][0]);
this.gaoMap.map.setZoom(12)
}
} }
} }
} }
......
...@@ -42,38 +42,38 @@ ...@@ -42,38 +42,38 @@
<el-table v-loading="loading" :data="filesList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="filesList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="阀类型名称" align="center" prop="fValveName" :show-overflow-tooltip="true" width="100"/> <el-table-column label="阀类型名称" align="center" prop="fValveName" :show-overflow-tooltip="true"/>
<el-table-column label="钢瓶规格名称" align="center" prop="fBotSpecName" :show-overflow-tooltip="true" width="100"/> <el-table-column label="钢瓶规格名称" align="center" prop="fBotSpecName" :show-overflow-tooltip="true"/>
<el-table-column label="钢瓶型号" align="center" prop="fBottleType" :show-overflow-tooltip="true" width="100"/> <el-table-column label="钢瓶型号" align="center" prop="fBottleType" :show-overflow-tooltip="true"/>
<el-table-column label="气瓶许可证号" align="center" prop="fPermitNo" :show-overflow-tooltip="true" width="100"/> <el-table-column label="气瓶许可证号" align="center" prop="fPermitNo" :show-overflow-tooltip="true"/>
<el-table-column label="上检日期" align="center" prop="fPChkDate" width="100"> <el-table-column label="上检日期" align="center" prop="fPChkDate">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.fPChkDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.fPChkDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="下检日期" align="center" prop="fNChkDate" width="100"> <el-table-column label="下检日期" align="center" prop="fNChkDate">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.fNChkDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.fNChkDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="生产日期" align="center" prop="fProductDate" width="100"> <el-table-column label="生产日期" align="center" prop="fProductDate">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.fProductDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.fProductDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="报废日期" align="center" prop="fDiscardDate" width="100"> <el-table-column label="报废日期" align="center" prop="fDiscardDate">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.fDiscardDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.fDiscardDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="安全评定日期" align="center" prop="fSafeJudgeDate" width="100"> <el-table-column label="安全评定日期" align="center" prop="fSafeJudgeDate">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.fSafeJudgeDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.fSafeJudgeDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="已检验次数" align="center" prop="fInspectedTimes" width="100"/> <el-table-column label="已检验次数" align="center" prop="fInspectedTimes"/>
<el-table-column label="状态" align="center" prop="fState" width="100" /> <el-table-column label="状态" align="center" prop="fState"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
......
...@@ -116,13 +116,29 @@ ...@@ -116,13 +116,29 @@
const path = eval(this.$store.state.user.systemSetting.map_center); const path = eval(this.$store.state.user.systemSetting.map_center);
const gaoMap = new EditorMap("areaInfo", {center:path}, this); const gaoMap = new EditorMap("areaInfo", {center:path}, this);
if(this.detailInfo.fGasStopArea){ if(this.detailInfo.fGasStopArea){
new AMap.Polygon({ if (this.detailInfo.fGasStopArea.includes("#")){
let areas = this.detailInfo.fGasStopArea.split("#");
for (let i = 0; i < areas.length;i++) {
let areasItem = areas[i];
if (areasItem != null && areasItem != "") {
new AMap.Polygon({
map: gaoMap.map,
path: JSON.parse(areasItem),
fillColor:'#00b0ff',
strokeColor:'#80d8ff'
});
}
}
} else {
new AMap.Polygon({
map: gaoMap.map, map: gaoMap.map,
path: JSON.parse(this.detailInfo.fGasStopArea), path: JSON.parse(this.detailInfo.fGasStopArea),
fillColor:'#00b0ff', fillColor:'#00b0ff',
strokeColor:'#80d8ff' strokeColor:'#80d8ff'
}); });
gaoMap.setCenter(JSON.parse(this.detailInfo.fGasStopArea)[0]); gaoMap.setCenter(JSON.parse(this.detailInfo.fGasStopArea)[0]);
}
gaoMap.map.setZoom(12) gaoMap.map.setZoom(12)
} }
} }
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
/> />
<!-- 添加或修改停气监管对话框 --> <!-- 添加或修改停气监管对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body destroy-on-close :close-on-click-modal="false"> <el-dialog :title="title" :visible.sync="open" v-if="open" width="1200px" append-to-body :close-on-click-modal="false">
<el-form label-position="top" ref="form" :model="form" :rules="rules" label-width="120px"> <el-form label-position="top" ref="form" :model="form" :rules="rules" label-width="120px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
<el-col :span="12" style="padding-left: 10px"> <el-col :span="12" style="padding-left: 10px">
<el-form-item label="停气区域" prop="fGasStopArea"> <el-form-item label="停气区域" prop="fGasStopArea">
<DrawArea class="area-change" v-model="path"/> <DrawArea class="area-change" v-model="path" @update-path="handleUpdatePathFromParent"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -246,7 +246,9 @@ ...@@ -246,7 +246,9 @@
<script> <script>
import { listSup, getSup, delSup, addSup, updateSup, exportSup } from "@/api/supplybalance/stop"; import { listSup, getSup, delSup, addSup, updateSup, exportSup } from "@/api/supplybalance/stop";
// 如果只允许画一个,则用这个
// import DrawArea from "@/components/DrawArea"; // import DrawArea from "@/components/DrawArea";
// 如果需要画多个,则用这个
import DrawArea from "@/components/GasShutDownDrawArea" import DrawArea from "@/components/GasShutDownDrawArea"
import DetailInfo from "./components/DetailInfo"; import DetailInfo from "./components/DetailInfo";
export default { export default {
...@@ -337,14 +339,36 @@ export default { ...@@ -337,14 +339,36 @@ export default {
watch:{ watch:{
path(newVal,oldVal){ path(newVal,oldVal){
console.log("index.watch.path = " + newVal); console.log("index.watch.path = " + newVal);
if(newVal.length == 0){ // 如果只允许画一个多边形,则用这个方法接收数据
this.form.fGasStopArea = ""; // if(newVal.length == 0){
return // this.form.fGasStopArea = "";
} // return
this.form.fGasStopArea = JSON.stringify(newVal); // }
// this.form.fGasStopArea = JSON.stringify(newVal);
} }
}, },
methods: { methods: {
// 需要画多个 多边形时 需要正确使用 emit 接收 drawArea 发回来的数据
handleUpdatePathFromParent(data) {
// 如果需要画多个则,需要这样接数据
if(data.length === 0) {
this.form.fGasStopArea = "";
return
}
this.form.fGasStopArea = "";
for(let i = 0;i < data.length;i ++) {
let newValItem = data[i];
if (newValItem._opts) {
this.form.fGasStopArea += JSON.stringify(newValItem._opts.path) + "#";
} else {
this.form.fGasStopArea += JSON.stringify(newValItem) + "#";
}
console.log("this.form.fGasStopArea = " + this.form.fGasStopArea);
}
},
/** 查询停气监管列表 */ /** 查询停气监管列表 */
getList() { getList() {
this.loading = true; this.loading = true;
...@@ -420,8 +444,24 @@ export default { ...@@ -420,8 +444,24 @@ export default {
const fGasStopId = row.fGasStopId || this.ids const fGasStopId = row.fGasStopId || this.ids
getSup(fGasStopId).then(response => { getSup(fGasStopId).then(response => {
this.form = response.data; this.form = response.data;
if(this.form.fGasStopArea){ if(this.form.fGasStopArea){
this.path = JSON.parse(this.form.fGasStopArea); console.log("this.from.fGasStopArea = " + this.form.fGasStopArea);
let areasArr = [];
if (this.form.fGasStopArea.includes("#")){
let areas = this.form.fGasStopArea.split("#");
for (let i = 0; i < areas.length;i++) {
console.log("i = " + i+ "item = " + areas[i]);
let areasItem = areas[i];
if (areasItem != null && areasItem != "") {
areasArr.push(JSON.parse(areasItem))
}
}
this.path = areasArr;
console.log("this.path = " + this.path);
} else{
areasArr.push( this.form.fGasStopArea);
this.path = areasArr;
}
} }
this.open = true; this.open = true;
this.title = "修改停气监管"; this.title = "修改停气监管";
......
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