|
|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
- <div class="add-inspection-task-container" v-if="visible">
|
|
|
+ <div class="add-inspection-task-container">
|
|
|
<div class="add-inspection-task-title">
|
|
|
<span class="title-text">新增巡查任务</span>
|
|
|
- <img src="@/assets/image/common/close.png" style="cursor: pointer" alt="" @click="visible = false" />
|
|
|
+ <img src="@/assets/image/common/close.png" style="cursor: pointer" alt="" @click="closeModal" />
|
|
|
</div>
|
|
|
<div class="add-inspection-task-content">
|
|
|
<el-form ref="addTaskFormRef" :model="addTaskFrom" label-width="0.8rem" size="mini">
|
|
|
@@ -21,10 +21,6 @@
|
|
|
<img src="@/assets/image/safety-inspection/add.png" alt="" v-if="isLastItem(index)" @click="addOption" />
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
- <!-- <el-form-item label="巡查时长">
|
|
|
- <el-input v-model="addTaskFrom.taskDuration" placeholder="请输入" style="width: 85%"></el-input>
|
|
|
- <span style="color: #fff"> min</span>
|
|
|
- </el-form-item> -->
|
|
|
<el-form-item label="责任人">
|
|
|
<el-select v-model="addTaskFrom.responsiblePerson" placeholder="请选择责任人" style="width: 100%" :popper-append-to-body="false" popper-class="u-popper-select">
|
|
|
<el-option :label="p.name" :value="p.name" v-for="(p,i) in personList" :key="i"></el-option>
|
|
|
@@ -32,7 +28,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<div style="display: flex; justify-content: flex-end; margin-top: 0.22rem">
|
|
|
- <el-button size="mini" plain @click="visible = false" class="cancelBtn">取消</el-button>
|
|
|
+ <el-button size="mini" plain @click="closeModal" class="cancelBtn">取消</el-button>
|
|
|
<el-button size="mini" type="primary" @click="toSave">保存</el-button>
|
|
|
<el-button size="mini" type="primary" @click="startInspection">开始巡查</el-button>
|
|
|
</div>
|
|
|
@@ -50,12 +46,15 @@ import { toAddSecurityPatrol } from '@/api/securityPatrolApi'
|
|
|
// 为了方便使用,绑定到原型链,在其他vue文件,直接this.mars3d 来使用
|
|
|
Vue.prototype.mars3d = mars3d
|
|
|
Vue.prototype.Cesium = mars3d.Cesium
|
|
|
-let graphicsLayer = null
|
|
|
+// let graphicsLayer = null
|
|
|
export default {
|
|
|
name: 'addInspectionTask',
|
|
|
+ props:{
|
|
|
+ visible:Boolean,
|
|
|
+ inspectionOptions:Array
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
- visible: false,
|
|
|
addTaskFrom: {
|
|
|
securityPatrolName: '',
|
|
|
securityPatrolContext: '',
|
|
|
@@ -73,51 +72,58 @@ export default {
|
|
|
name:'谢智宇'
|
|
|
}
|
|
|
],
|
|
|
- inspectionOptions: [
|
|
|
- {
|
|
|
- latitude: '28.189249',
|
|
|
- longitude: '113.065505',
|
|
|
- devName: '浏阳市中和丁字村无线机房_1"',
|
|
|
- deviceCode: '43010000831327000018',
|
|
|
- channelCode: '430100430000000021130000033'
|
|
|
- },
|
|
|
- {
|
|
|
- latitude: '28.194911',
|
|
|
- longitude: '113.066789',
|
|
|
- devName: '长沙芙蓉区隆平路与望龙路交叉口-东瑞社区',
|
|
|
- deviceCode: '43010000831327000019',
|
|
|
- channelCode: '430100430000000021130000037'
|
|
|
- }
|
|
|
- ],
|
|
|
+ // inspectionOptions: [
|
|
|
+ // {
|
|
|
+ // latitude: '28.189249',
|
|
|
+ // longitude: '113.065505',
|
|
|
+ // devName: '浏阳市中和丁字村无线机房_1"',
|
|
|
+ // deviceCode: '43010000831327000018',
|
|
|
+ // channelCode: '430100430000000021130000033'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // latitude: '28.194911',
|
|
|
+ // longitude: '113.066789',
|
|
|
+ // devName: '长沙芙蓉区隆平路与望龙路交叉口-东瑞社区',
|
|
|
+ // deviceCode: '43010000831327000019',
|
|
|
+ // channelCode: '430100430000000021130000037'
|
|
|
+ // }
|
|
|
+ // ],
|
|
|
isPatrolling: false,
|
|
|
currentPatrolIndex: 0,
|
|
|
- patrolInterval: null,
|
|
|
- countdown: 20
|
|
|
+ patrolInterval: null
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.$globalEventBus.$on('clcikAddTask', () => {
|
|
|
- this.addTaskFrom={
|
|
|
+ // this.$globalEventBus.$on('clcikAddTask', () => {
|
|
|
+ // this.addTaskFrom={
|
|
|
+ // securityPatrolName: '',
|
|
|
+ // securityPatrolContext: '',
|
|
|
+ // inspectionPoint: [{ value: '' }],
|
|
|
+ // responsiblePerson: ''
|
|
|
+ // }
|
|
|
+ // this.closeModal()
|
|
|
+ // this.addInitialPoints()
|
|
|
+ // })
|
|
|
+ this.addTaskFrom={
|
|
|
securityPatrolName: '',
|
|
|
securityPatrolContext: '',
|
|
|
inspectionPoint: [{ value: '' }],
|
|
|
responsiblePerson: ''
|
|
|
}
|
|
|
- this.visible = true
|
|
|
- this.addInitialPoints()
|
|
|
- })
|
|
|
+ // this.addInitialPoints()
|
|
|
},
|
|
|
destroyed() {
|
|
|
- this.$globalEventBus.$off('clcikAddTask')
|
|
|
this.stopPatrol()
|
|
|
},
|
|
|
methods: {
|
|
|
+ closeModal(){
|
|
|
+ this.$emit('closeAddTask')
|
|
|
+ },
|
|
|
toSave(){
|
|
|
toAddSecurityPatrol(this.addTaskFrom).then((res)=>{
|
|
|
if(res.data){
|
|
|
this.$message.success('添加成功')
|
|
|
- // this.$globalEventBus.$emit('refreshInspectList')
|
|
|
- this.visible = false
|
|
|
+ this.closeModal()
|
|
|
}else{
|
|
|
this.$message.error('添加失败')
|
|
|
}
|
|
|
@@ -193,43 +199,43 @@ export default {
|
|
|
this.isPatrolling = false
|
|
|
clearInterval(this.patrolInterval)
|
|
|
},
|
|
|
- // 添加初始点
|
|
|
- addInitialPoints() {
|
|
|
- this.inspectionOptions.forEach((point) => {
|
|
|
- this.addPointToMap(point)
|
|
|
- })
|
|
|
- },
|
|
|
+ // // 添加初始点
|
|
|
+ // addInitialPoints() {
|
|
|
+ // this.inspectionOptions.forEach((point) => {
|
|
|
+ // this.addPointToMap(point)
|
|
|
+ // })
|
|
|
+ // },
|
|
|
|
|
|
- // 添加点到地图
|
|
|
- addPointToMap(point) {
|
|
|
- // if (graphicsLayer) {
|
|
|
- // window.map.removeLayer(graphicsLayer)
|
|
|
- // }
|
|
|
- graphicsLayer = new this.mars3d.layer.GraphicLayer()
|
|
|
- window.map.addLayer(graphicsLayer)
|
|
|
- const graphic = new mars3d.graphic.PointEntity({
|
|
|
- position: [point.longitude, point.latitude],
|
|
|
- billboard: {
|
|
|
- image: require('./image/camera.png'),
|
|
|
- scale: 1,
|
|
|
- horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER,
|
|
|
- verticalOrigin: this.Cesium.VerticalOrigin.BOTTOM
|
|
|
- },
|
|
|
- label: {
|
|
|
- text: point.devName,
|
|
|
- font_size: 32,
|
|
|
- color: '#red',
|
|
|
- outline: true,
|
|
|
- outlineColor: '#000000',
|
|
|
- outlineWidth: 2,
|
|
|
- horizontalOrigin: this.Cesium.HorizontalOrigin.LEFT,
|
|
|
- verticalOrigin: this.Cesium.VerticalOrigin.BOTTOM,
|
|
|
- pixelOffset: new this.Cesium.Cartesian2(15, 0)
|
|
|
- }
|
|
|
- })
|
|
|
+ // // 添加点到地图
|
|
|
+ // addPointToMap(point) {
|
|
|
+ // // if (graphicsLayer) {
|
|
|
+ // // window.map.removeLayer(graphicsLayer)
|
|
|
+ // // }
|
|
|
+ // graphicsLayer = new this.mars3d.layer.GraphicLayer()
|
|
|
+ // window.map.addLayer(graphicsLayer)
|
|
|
+ // const graphic = new mars3d.graphic.PointEntity({
|
|
|
+ // position: [point.longitude, point.latitude],
|
|
|
+ // billboard: {
|
|
|
+ // image: require('./image/camera.png'),
|
|
|
+ // scale: 1,
|
|
|
+ // horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER,
|
|
|
+ // verticalOrigin: this.Cesium.VerticalOrigin.BOTTOM
|
|
|
+ // },
|
|
|
+ // label: {
|
|
|
+ // text: point.devName,
|
|
|
+ // font_size: 32,
|
|
|
+ // color: '#red',
|
|
|
+ // outline: true,
|
|
|
+ // outlineColor: '#000000',
|
|
|
+ // outlineWidth: 2,
|
|
|
+ // horizontalOrigin: this.Cesium.HorizontalOrigin.LEFT,
|
|
|
+ // verticalOrigin: this.Cesium.VerticalOrigin.BOTTOM,
|
|
|
+ // pixelOffset: new this.Cesium.Cartesian2(15, 0)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
|
|
|
- graphicsLayer.addGraphic(graphic)
|
|
|
- },
|
|
|
+ // graphicsLayer.addGraphic(graphic)
|
|
|
+ // },
|
|
|
// 定位到点
|
|
|
flyToPoint(point) {
|
|
|
window.map.flyToPoint([point.longitude, point.latitude], {
|