From 483952d50243e1c03be2ccb0904680cc0f6278c7 Mon Sep 17 00:00:00 2001 From: lct123456 <lucht> Date: 星期二, 26 四月 2022 23:59:29 +0800 Subject: [PATCH] 四色图、校验规则 --- config/dev.env.js | 8 src/views/doublePreventAction/riskLevelManage/fourColorMap/components/oneHundredAndThirty.vue | 288 ++++++++++++++++++++++++++ src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue | 29 ++ src/views/doublePreventAction/riskLevelManage/fourColorMap/components/sixty.vue | 288 ++++++++++++++++++++++++++ src/views/doublePreventAction/riskLevelManage/fourColorMap/index.vue | 15 5 files changed, 613 insertions(+), 15 deletions(-) diff --git a/config/dev.env.js b/config/dev.env.js index d88e0d0..1f32149 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -5,8 +5,8 @@ // BASE_API: '"http://10.142.119.232:8100"', // IMG_API: '"http://10.142.119.232:8100/upload/"', - // BASE_API: '"http://222.92.213.22:8006/zhongtai"', - // IMG_API: '"http://222.92.213.22:8006/zhongtai/upload/"', + BASE_API: '"http://222.92.213.22:8006/zhongtai"', + IMG_API: '"http://222.92.213.22:8006/zhongtai/upload/"', // // BASE_API: '"https://sinanoaq.cn:8100"', // BASE_API: '"http://127.0.0.1:8100"', @@ -23,6 +23,6 @@ NANO_API: '"http://127.0.0.1:8081/zhongtaiexam"', // BASE_API: '"http://220.171.99.118:4101/api"', // IMG_API: '"http://220.171.99.118:4101/api/upload/"', - BASE_API: '"http://112.86.23.31:8006"', - IMG_API: '"http://112.86.23.31:8006/upload/"', + // BASE_API: '"http://112.86.23.31:8006"', + // IMG_API: '"http://112.86.23.31:8006/upload/"', }; diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue b/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue index 73c496e..ccebb06 100644 --- a/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue +++ b/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue @@ -343,10 +343,14 @@ execDepartment:'', inspectionTaskVisible:false, inspectionTaskFormRules:{ - hazardDep: [{ required: true, message: '责任部门不能为空', trigger: 'change' }], - hazardLiablePerson: [{ required: true, message: '责任人不能为空', trigger: 'blur' }], - hazardCode: [{ required: true, message: '安全风险分析对象编码不能为空', trigger: 'blur' }], - riskUnitName: [{ required: true, message: '安全风险分析单元名称不能为空', trigger: 'blur' }], + title: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }], + type: [{ required: true, message: '检查类型不能为空', trigger: 'change' }], + intervalSeconds: [{ required: true, message: '检查频次不能为空', trigger: 'change' }], + noticeSeconds: [{ required: true, message: '提前通知时间不能为空', trigger: 'change' }], + startTime: [{ required: true, message: '周期开始时间不能为空', trigger: 'change' }], + effectSeconds: [{ required: true, message: '任务有效时间不能为空', trigger: 'change' }], + noticeUid: [{ required: true, message: '异常通知人员不能为空', trigger: 'change' }], + execUid: [{ required: true, message: '执行巡检人员不能为空', trigger: 'change' }], }, inspectionTaskForm:{ type:null, @@ -500,6 +504,11 @@ type:'warning', message:'任务持续时间不能大于检查频次' }) + }else if(this.justifyTime(this.inspectionTaskForm.startTime,this.inspectionTaskForm.noticeSeconds)){ + this.$message({ + type:'warning', + message:'周期开始时间减去当前时间和提前通知时间要大于等于半小时' + }) }else{ if(this.title === '新建巡检计划设定'){ addInspectionTask(this.inspectionTaskForm).then((res)=>{ @@ -558,6 +567,18 @@ }) }, + justifyTime(time,interval) { + debugger + let timeStr = new Date(time.replace(/-/g,'/')) + let date = parseInt(timeStr.getTime()/1000) + let newTimeStr = new Date() + let newDate = parseInt(newTimeStr.getTime()/1000) + if(date - newDate - interval - 1800 >= 0){ + return false + }else{ + return true + } + }, deleteById(val){ this.$confirm('删除此条信息,是否继续','提示',{ confirmButtonText:'确定', diff --git a/src/views/doublePreventAction/riskLevelManage/fourColorMap/components/oneHundredAndThirty.vue b/src/views/doublePreventAction/riskLevelManage/fourColorMap/components/oneHundredAndThirty.vue new file mode 100644 index 0000000..9752b27 --- /dev/null +++ b/src/views/doublePreventAction/riskLevelManage/fourColorMap/components/oneHundredAndThirty.vue @@ -0,0 +1,288 @@ +<template> + + <div class="map-layout"> + <Map @init="init" :option="option" v-if="option" /> + <Tab v-if="loaded" /> + </div> + + +</template> + +<script> + import Map from '../../../../../components/Map'; + import Tab from '../../../../../components/Tab'; + import { global } from '../../../../../global'; + import { + getCatesian3FromPX, + Cartesian3_to_WGS84, + } from '../../../../../components/Map/libs/Point'; + + export default { + name: 'App', + components: { + Map, + Tab, + }, + data() { + return { + activeName:'first', + loaded: false, + map: null, + option: null, + heatLayer: null, + shineishiwai: true, + }; + }, + mounted() { + // 地图配置初始化 + this.option = { + // 初始化视图中心点 + viewpoint: { + y: 31.254992, + x: 120.727592, + z: 289.24, + heading: 13.8, + pitch: -37.3, + roll: 360, + }, + + // 显示位置初始化按钮 + homeButton: true, + + // 当前时间 + currentTime: '08:30:00', + + // 影像底图 + imageryProvider: new Cesium.WebMapTileServiceImageryProvider({ + url: + 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer', + layer: '', + style: 'default', + tileMatrixSetID: 'w', + format: 'tiles', + maximumLevel: 18, + }), + }; + window.sss = this; + }, + methods: { + init(map) { + this.loaded = true; + + map.addModel({ + link: 'http://222.92.213.22:8006/b3dm130/tileset.json', + name: '商业园区', + callback: tileset => { + var boundingSphere = tileset.boundingSphere; + var cartographic = Cesium.Cartographic.fromCartesian( + boundingSphere.center + ); + var surface = Cesium.Cartesian3.fromRadians( + cartographic.longitude, + cartographic.latitude, + 0.0 + ); + var offset = Cesium.Cartesian3.fromRadians( + cartographic.longitude, + cartographic.latitude, + 102 + ); + var translation = Cesium.Cartesian3.subtract( + offset, + surface, + new Cesium.Cartesian3() + ); + tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation); + }, + }); + + map.viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString( + '#050F1F' + ); + map.viewer.scene.logarithmicDepthBuffer = false; + map.viewer.scene.globe.enableLighting = true; + map.viewer.scene.sun.show = false; + map.viewer.scene.moon.show = false; + map.viewer.scene.fog.enabled = false; + map.viewer.scene.skyBox = null; + + // 初始化事件 + this.initEvent(map); + + this.testLoadedData(); + }, + // 加载测试数据 + testLoadedData() { + const map = global.map; + if (!map) return; + $.get('./public/data/plots_namisuo.geojson', res => { + map.loadGeoJSON(res); + }); + }, + initEvent(map) { + let popup = null; + const _this = this; + map.on( + 'click', + ({ + position, + cartesian3, + latLngPositionGlobe, + latLngPosition, + entity, + attr, + }) => { + if (popup) { + popup.destroy(); + popup = null; + } + let type = entity && entity.attribute && entity.attribute.type; + if (type) { + popup = new wutu3d.DivPoint(map.viewer, { + html: + "<div class='popup-wrapper'>" + + attr.name + + '<br/><br/>XXXXXXXX</div>', + position: cartesian3, + anchor: [-170, -80], + }); + popup.visible = true; + } + if (attr.name && attr.name === '含内景大楼') { + _this.changeModel(!_this.shineishiwai); + _this.shineishiwai = !_this.shineishiwai; + } + + const pos = getCatesian3FromPX(position, map.viewer); + const pos1 = Cartesian3_to_WGS84(pos); + console.log(pos1); + + var pt = turf.point([Number(pos1.lng), Number(pos1.lat)]); + var poly = turf.polygon([ + [ + [120.159277, 30.227512], + [120.158919, 30.227569], + [120.158777, 30.227431], + [120.158904, 30.227151], + [120.15911, 30.227119], + [120.159339, 30.227347], + [120.159277, 30.227512], + ], + ]); + + const inPoly = turf.booleanPointInPolygon(pt, poly); + + if ( + //自己测量对应建筑的空间范围 + inPoly && + pos1.alt > 0 && //20.562718744748462 + pos1.alt < 121.7 + ) { + _this.changeModel(!_this.shineishiwai); + _this.shineishiwai = !_this.shineishiwai; + } + } + ); + // map.on( + // 'mousemove', + // ({ cartesian3, latLngPositionGlobe, latLngPosition, entity, attr }) => { + // if (popup) { + // popup.destroy(); + // popup = null; + // } + // let type = entity && entity.attribute && entity.attribute.type; + // if (type) { + // popup = new wutu3d.DivPoint(map.viewer, { + // html: + // "<div class='popup-wrapper'>信息内容<br/><br/>XXXXXXXX</div>", + // position: cartesian3, + // anchor: [-170, -80], + // }); + // popup.visible = true; + // } + // } + // ); + }, + changeModel(val) { + console.log(val); + if (!val) { + global.map.models.map(model => { + if (model.name === '室内') { + global.map.setModelVisible(model.id, true); + global.map.flyToModel(model.id); + } else { + global.map.setModelVisible(model.id, false); + } + }); + + let viewer = global.map.viewer; + viewer.scene.skyBox = null; + viewer.scene.sun.show = false; + viewer.scene.moon.show = false; + viewer.scene.globe.show = false; + viewer.scene.logarithmicDepthBuffer = false; + viewer.scene.skyAtmosphere.show = false; + viewer.scene.backgroundColor = Cesium.Color.fromCssColorString( + 'rgba(0,0,0, 1)' + ); + } else { + global.map.models.map(model => { + if (model.name === '室内') { + global.map.setModelVisible(model.id, false); + } else { + global.map.setModelVisible(model.id, true); + } + }); + + global.map.setViewpoint( + { + y: 30.231104, + x: 120.157372, + z: 298.45, + heading: 173, + pitch: -28.8, + roll: 6.2, + }, + { duration: 1.5 } + ); + + let viewer = global.map.viewer; + viewer.scene.skyBox = null; + viewer.scene.sun.show = true; + viewer.scene.moon.show = true; + viewer.scene.globe.show = true; + viewer.scene.logarithmicDepthBuffer = true; + viewer.scene.skyAtmosphere.show = true; + viewer.scene.backgroundColor = Cesium.Color.fromCssColorString( + 'rgba(0,0,0, 1)' + ); + } + }, + }, + }; +</script> + +<style scoped> + .map-layout { + height: 920px;; + position: relative; + } + + .tool-btns { + position: absolute; + z-index: 999; + top: 10px; + left: 500px; + } + .sn-tool { + position: absolute; + bottom: 10px; + right: 10px; + z-index: 1; + padding: 3px; + background: #fff; + } + .left-switch { + margin-right: 10px; + } +</style> diff --git a/src/views/doublePreventAction/riskLevelManage/fourColorMap/components/sixty.vue b/src/views/doublePreventAction/riskLevelManage/fourColorMap/components/sixty.vue new file mode 100644 index 0000000..16af71b --- /dev/null +++ b/src/views/doublePreventAction/riskLevelManage/fourColorMap/components/sixty.vue @@ -0,0 +1,288 @@ +<template> + + <div class="map-layout"> + <Map @init="init" :option="option" v-if="option" /> + <Tab v-if="loaded" /> + </div> + + +</template> + +<script> + import Map from '../../../../../components/Map'; + import Tab from '../../../../../components/Tab'; + import { global } from '../../../../../global'; + import { + getCatesian3FromPX, + Cartesian3_to_WGS84, + } from '../../../../../components/Map/libs/Point'; + + export default { + name: 'App', + components: { + Map, + Tab, + }, + data() { + return { + activeName:'first', + loaded: false, + map: null, + option: null, + heatLayer: null, + shineishiwai: true, + }; + }, + mounted() { + // 地图配置初始化 + this.option = { + // 初始化视图中心点 + viewpoint: { + y: 31.254992, + x: 120.727592, + z: 289.24, + heading: 13.8, + pitch: -37.3, + roll: 360, + }, + + // 显示位置初始化按钮 + homeButton: true, + + // 当前时间 + currentTime: '08:30:00', + + // 影像底图 + imageryProvider: new Cesium.WebMapTileServiceImageryProvider({ + url: + 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer', + layer: '', + style: 'default', + tileMatrixSetID: 'w', + format: 'tiles', + maximumLevel: 18, + }), + }; + window.sss = this; + }, + methods: { + init(map) { + this.loaded = true; + + map.addModel({ + link: 'http://222.92.213.22:8006/b3dm60/tileset.json', + name: '商业园区', + callback: tileset => { + var boundingSphere = tileset.boundingSphere; + var cartographic = Cesium.Cartographic.fromCartesian( + boundingSphere.center + ); + var surface = Cesium.Cartesian3.fromRadians( + cartographic.longitude, + cartographic.latitude, + 0.0 + ); + var offset = Cesium.Cartesian3.fromRadians( + cartographic.longitude, + cartographic.latitude, + 102 + ); + var translation = Cesium.Cartesian3.subtract( + offset, + surface, + new Cesium.Cartesian3() + ); + tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation); + }, + }); + + map.viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString( + '#050F1F' + ); + map.viewer.scene.logarithmicDepthBuffer = false; + map.viewer.scene.globe.enableLighting = true; + map.viewer.scene.sun.show = false; + map.viewer.scene.moon.show = false; + map.viewer.scene.fog.enabled = false; + map.viewer.scene.skyBox = null; + + // 初始化事件 + this.initEvent(map); + + this.testLoadedData(); + }, + // 加载测试数据 + testLoadedData() { + const map = global.map; + if (!map) return; + $.get('./public/data/plots_namisuo.geojson', res => { + map.loadGeoJSON(res); + }); + }, + initEvent(map) { + let popup = null; + const _this = this; + map.on( + 'click', + ({ + position, + cartesian3, + latLngPositionGlobe, + latLngPosition, + entity, + attr, + }) => { + if (popup) { + popup.destroy(); + popup = null; + } + let type = entity && entity.attribute && entity.attribute.type; + if (type) { + popup = new wutu3d.DivPoint(map.viewer, { + html: + "<div class='popup-wrapper'>" + + attr.name + + '<br/><br/>XXXXXXXX</div>', + position: cartesian3, + anchor: [-170, -80], + }); + popup.visible = true; + } + if (attr.name && attr.name === '含内景大楼') { + _this.changeModel(!_this.shineishiwai); + _this.shineishiwai = !_this.shineishiwai; + } + + const pos = getCatesian3FromPX(position, map.viewer); + const pos1 = Cartesian3_to_WGS84(pos); + console.log(pos1); + + var pt = turf.point([Number(pos1.lng), Number(pos1.lat)]); + var poly = turf.polygon([ + [ + [120.159277, 30.227512], + [120.158919, 30.227569], + [120.158777, 30.227431], + [120.158904, 30.227151], + [120.15911, 30.227119], + [120.159339, 30.227347], + [120.159277, 30.227512], + ], + ]); + + const inPoly = turf.booleanPointInPolygon(pt, poly); + + if ( + //自己测量对应建筑的空间范围 + inPoly && + pos1.alt > 0 && //20.562718744748462 + pos1.alt < 121.7 + ) { + _this.changeModel(!_this.shineishiwai); + _this.shineishiwai = !_this.shineishiwai; + } + } + ); + // map.on( + // 'mousemove', + // ({ cartesian3, latLngPositionGlobe, latLngPosition, entity, attr }) => { + // if (popup) { + // popup.destroy(); + // popup = null; + // } + // let type = entity && entity.attribute && entity.attribute.type; + // if (type) { + // popup = new wutu3d.DivPoint(map.viewer, { + // html: + // "<div class='popup-wrapper'>信息内容<br/><br/>XXXXXXXX</div>", + // position: cartesian3, + // anchor: [-170, -80], + // }); + // popup.visible = true; + // } + // } + // ); + }, + changeModel(val) { + console.log(val); + if (!val) { + global.map.models.map(model => { + if (model.name === '室内') { + global.map.setModelVisible(model.id, true); + global.map.flyToModel(model.id); + } else { + global.map.setModelVisible(model.id, false); + } + }); + + let viewer = global.map.viewer; + viewer.scene.skyBox = null; + viewer.scene.sun.show = false; + viewer.scene.moon.show = false; + viewer.scene.globe.show = false; + viewer.scene.logarithmicDepthBuffer = false; + viewer.scene.skyAtmosphere.show = false; + viewer.scene.backgroundColor = Cesium.Color.fromCssColorString( + 'rgba(0,0,0, 1)' + ); + } else { + global.map.models.map(model => { + if (model.name === '室内') { + global.map.setModelVisible(model.id, false); + } else { + global.map.setModelVisible(model.id, true); + } + }); + + global.map.setViewpoint( + { + y: 30.231104, + x: 120.157372, + z: 298.45, + heading: 173, + pitch: -28.8, + roll: 6.2, + }, + { duration: 1.5 } + ); + + let viewer = global.map.viewer; + viewer.scene.skyBox = null; + viewer.scene.sun.show = true; + viewer.scene.moon.show = true; + viewer.scene.globe.show = true; + viewer.scene.logarithmicDepthBuffer = true; + viewer.scene.skyAtmosphere.show = true; + viewer.scene.backgroundColor = Cesium.Color.fromCssColorString( + 'rgba(0,0,0, 1)' + ); + } + }, + }, + }; +</script> + +<style scoped> + .map-layout { + height: 920px;; + position: relative; + } + + .tool-btns { + position: absolute; + z-index: 999; + top: 10px; + left: 500px; + } + .sn-tool { + position: absolute; + bottom: 10px; + right: 10px; + z-index: 1; + padding: 3px; + background: #fff; + } + .left-switch { + margin-right: 10px; + } +</style> diff --git a/src/views/doublePreventAction/riskLevelManage/fourColorMap/index.vue b/src/views/doublePreventAction/riskLevelManage/fourColorMap/index.vue index 274bc3e..0383b97 100644 --- a/src/views/doublePreventAction/riskLevelManage/fourColorMap/index.vue +++ b/src/views/doublePreventAction/riskLevelManage/fourColorMap/index.vue @@ -1,13 +1,11 @@ <template> <div style="height:1000px;width:100%;background:#FFFFFF;padding:20px"> <el-tabs v-model="activeName"> - <el-tab-pane label="60万吨" name="first"> - <div class="map-layout"> - <Map @init="init" :option="option" v-if="option" /> - <Tab v-if="loaded" /> - </div></el-tab-pane> + <el-tab-pane label="60万吨" name="first"> + <sixty></sixty> + </el-tab-pane> <el-tab-pane label="130万吨" name="second"> - + <oneHundredAndThirty></oneHundredAndThirty> </el-tab-pane> </el-tabs> </div> @@ -16,7 +14,8 @@ </template> <script> - import tileset from '../../../../assets/tileset.json' + import sixty from './components/sixty.vue' + import oneHundredAndThirty from './components/oneHundredAndThirty.vue' import Map from '../../../../components/Map'; import Tab from '../../../../components/Tab'; import { global } from '../../../../global'; @@ -30,6 +29,8 @@ components: { Map, Tab, + oneHundredAndThirty, + sixty }, data() { return { -- Gitblit v1.9.2