修改障碍物保存逻辑

main
suixy 4 weeks ago
parent 42f3b1d86d
commit bcb7b3f70a

@ -1,6 +1,10 @@
import request from '@/utils/request'; import request from '@/utils/request';
const test = () => {
return new Promise((resolve, reject) => {
resolve({})
})
}
export function getParasPos(data) { export function getParasPos(data) {
return request({ return request({
url: '/api/ParasPos/GetParasPos', method: 'get', params: data url: '/api/ParasPos/GetParasPos', method: 'get', params: data
@ -32,6 +36,7 @@ export function getShildList(data) {
} }
export function addShildData(data) { export function addShildData(data) {
return test()
return request({ return request({
url: '/api/Fod/AddShild', method: 'post', data: data url: '/api/Fod/AddShild', method: 'post', data: data
}); });
@ -165,6 +170,7 @@ export function UpdateImage(data) {
} }
export function InserDealObstacleModel(data) { export function InserDealObstacleModel(data) {
return test()
return request({ return request({
url: '/api/Fod/InserDealObstacleModel', method: 'post', data: data url: '/api/Fod/InserDealObstacleModel', method: 'post', data: data
}); });

@ -61,11 +61,30 @@
left: `${getDotX(dot.x)}%`, left: `${getDotX(dot.x)}%`,
bottom: `${getDotY(dot.y)}%`, bottom: `${getDotY(dot.y)}%`,
transform: `translate(-50%, 50%) `, transform: `translate(-50%, 50%) `,
background: dot.type == 0 ? 'radial-gradient(circle at center, #ea1212 0%, rgba(228, 116, 116, 0.2) 100%)':(dot.type == 2?'radial-gradient(circle at center, #12ea12 0%, rgba(116, 228, 116, 0.2) 100%)':'') background: 'radial-gradient(circle at center, #ea1212 0%, rgba(228, 116, 116, 0.2) 100%)'
}" }"
style="white-space: nowrap" style="white-space: nowrap"
> >
<!-- {{ getDotX(dot.x) }} - {{ getDotY(dot.y) }}--> <span style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);color: #fff;font-size: 12px">
{{ index + 1 }}
</span>
</div>
<div
v-for="(dot, index) in dots1"
:key="index"
class="dot"
:id="`dota${index+1}`"
:style="{
left: `${getDotX(dot.x)}%`,
bottom: `${getDotY(dot.y)}%`,
transform: `translate(-50%, 50%) `,
background: 'radial-gradient(circle at center, #12ea12 0%, rgba(116, 228, 116, 0.2) 100%)'
}"
style="white-space: nowrap"
>
<span style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);color: #fff;font-size: 12px">
{{ index + 1 }}
</span>
</div> </div>
</div> </div>
</div> </div>
@ -84,7 +103,9 @@ const props = defineProps({
height: {type: Number, required: true,}, height: {type: Number, required: true,},
boxPos: {type: Object, required: true,}, boxPos: {type: Object, required: true,},
dots: {type: Array, required: true,}, dots: {type: Array, required: true,},
dotIndex: {type: Number, required: true,} dotIndex: {type: Number, required: true,},
dots1: {type: Array, required: true,},
dotIndex1: {type: Number, required: true,}
}) })
const boxContentX = ref(0) const boxContentX = ref(0)
const boxContentY = ref(0) const boxContentY = ref(0)
@ -102,6 +123,9 @@ watch(() => JSON.stringify(props.boxPos), (newVal, oldVal) => {
if (props.dotIndex >= 0) { if (props.dotIndex >= 0) {
getLineData('head', `dot${props.dotIndex + 1}`) getLineData('head', `dot${props.dotIndex + 1}`)
} }
if (props.dotIndex1 >= 0) {
getLineData('head', `dota${props.dotIndex1 + 1}`)
}
}) })
onMounted(() => { onMounted(() => {
getBoxPos() getBoxPos()
@ -109,9 +133,12 @@ onMounted(() => {
if (props.dotIndex >= 0) { if (props.dotIndex >= 0) {
getLineData('head', `dot${props.dotIndex + 1}`) getLineData('head', `dot${props.dotIndex + 1}`)
} }
if (props.dotIndex1 >= 0) {
getLineData('head', `dota${props.dotIndex1 + 1}`)
}
}) })
}) })
watch(() => props.dotIndex, (newVal, oldVal) => { watch(() => JSON.stringify([props.dotIndex, props.dotIndex1]), (newVal, oldVal) => {
getBoxPos() getBoxPos()
getDistanceAndZoom() getDistanceAndZoom()
if (distance1.value) { if (distance1.value) {
@ -124,16 +151,14 @@ watch(() => props.dotIndex, (newVal, oldVal) => {
} }
if (props.dotIndex >= 0) { if (props.dotIndex >= 0) {
getLineData('head', `dot${props.dotIndex + 1}`) getLineData('head', `dot${props.dotIndex + 1}`)
} else if (props.dotIndex1 >= 0) {
getLineData('head', `dota${props.dotIndex1 + 1}`)
}else{ }else{
zoomScale(props.boxPos.y, 0) zoomScale(props.boxPos.y, 0)
} }
}) })
const getDistanceAndZoom = () => { const getDistanceAndZoom = () => {
if (props.dotIndex === -1) { if (props.dotIndex >= 0) {
distance1.value = 0
} else {
console.log(props.dots )
console.log(props.dots[props.dotIndex])
let dotx = props.dots[props.dotIndex].x let dotx = props.dots[props.dotIndex].x
let doty = props.dots[props.dotIndex].y let doty = props.dots[props.dotIndex].y
let carx = props.boxPos.x let carx = props.boxPos.x
@ -141,6 +166,16 @@ const getDistanceAndZoom = () => {
let a = dotx - carx let a = dotx - carx
let b = doty - cary let b = doty - cary
distance1.value = Math.sqrt(a * a + b * b); distance1.value = Math.sqrt(a * a + b * b);
} else if (props.dotIndex1 >= 0) {
let dotx = props.dots1[props.dotIndex1].x
let doty = props.dots1[props.dotIndex1].y
let carx = props.boxPos.x
let cary = props.boxPos.y
let a = dotx - carx
let b = doty - cary
distance1.value = Math.sqrt(a * a + b * b);
} else {
distance1.value = 0
} }
@ -174,8 +209,8 @@ const getLineData = (fromId, toId) => {
const x1 = Math.floor(fromRect.left) + Math.floor(window.scrollX) const x1 = Math.floor(fromRect.left) + Math.floor(window.scrollX)
const y1 = Math.floor(fromRect.top) + Math.floor(window.scrollY) const y1 = Math.floor(fromRect.top) + Math.floor(window.scrollY)
const x2 = Math.floor(toRect.left) + Math.floor(window.scrollX) + 5 const x2 = Math.floor(toRect.left) + Math.floor(window.scrollX) + 10
const y2 = Math.floor(toRect.top) + Math.floor(window.scrollY) + 5 const y2 = Math.floor(toRect.top) + Math.floor(window.scrollY) + 10
const dx = x2 - x1; const dx = x2 - x1;
@ -195,7 +230,12 @@ function zoomScale(value, type) {
centerValue.value = value centerValue.value = value
zoomType.value = type zoomType.value = type
setTimeout(() => { setTimeout(() => {
getLineData('head', `dot${props.dotIndex + 1}`) if (props.dotIndex >= 0) {
getLineData('head', `dot${props.dotIndex + 1}`)
}
if (props.dotIndex1 >= 0) {
getLineData('head', `dota${props.dotIndex1 + 1}`)
}
}, 10) }, 10)
} }
@ -395,8 +435,8 @@ const ticks = computed(() => {
left: 40px; left: 40px;
.dot { .dot {
width: 10px; width: 20px;
height: 10px; height: 20px;
position: absolute; position: absolute;
border-radius: 50%; border-radius: 50%;
} }

@ -53,6 +53,8 @@
:boxPos="boxPos" :boxPos="boxPos"
:dots="dots" :dots="dots"
:dotIndex="dotIndex" :dotIndex="dotIndex"
:dots1="dots1"
:dotIndex1="dotIndex1"
/> />
</div> </div>
@ -203,14 +205,14 @@
<el-table <el-table
ref="table1Ref" ref="table1Ref"
highlight-current-row highlight-current-row
:data="table1Data" :data="table1Data.slice((currentPage1 - 1) * pageSize1, currentPage1 * pageSize1)"
style="width: 100%" style="width: 100%"
@row-click="table1Current" @row-click="table1Current"
> >
<el-table-column type="selection" width="55"/> <el-table-column type="selection" width="55"/>
<el-table-column label="序号" width="60"> <el-table-column label="序号" width="60">
<template #default="scope"> <template #default="scope">
{{(currentPage1 - 1) * pageSize1 + scope.$index +1}} {{ (currentPage1 - 1) * pageSize1 + scope.$index + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="Lon" label="目标经度" width="100"/> <el-table-column prop="Lon" label="目标经度" width="100"/>
@ -239,7 +241,7 @@
:pager-count="4" :pager-count="4"
:page-sizes="[10,20,50,100, 200, 300, 400]" :page-sizes="[10,20,50,100, 200, 300, 400]"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="tableData1.length" :total="table1Data.length"
/> />
</el-card> </el-card>
@ -247,28 +249,33 @@
<el-card shadow="always" style="margin-top: 12px"> <el-card shadow="always" style="margin-top: 12px">
<el-table <el-table
highlight-current-row highlight-current-row
:data="tableData2" :data="table2Data.slice((currentPage2 - 1) * pageSize2, currentPage2 * pageSize2)"
style="width: 100%" style="width: 100%"
@row-click="table1Current1"
> >
<!-- <el-table-column type="selection" width="55"/>--> <el-table-column type="selection" width="55"/>
<el-table-column label="序号" type="index" width="60" /> <el-table-column label="序号" width="60">
<el-table-column prop="name" label="名称" width="100"/>
<el-table-column prop="lon" label="目标经度" width="100"/>
<el-table-column prop="lat" label="目标纬度" width="100"/>
<el-table-column prop="strength" label="强度信息" width="100"/>
<el-table-column label="处理方式" show-overflow-tooltip width="160" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button type="primary" link @click.stop="openShildDialog1(scope)">修改</el-button> {{ (currentPage2 - 1) * pageSize2 + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="Lon" label="目标经度" width="100"/>
<el-table-column prop="Lat" label="目标纬度" width="100"/>
<el-table-column prop="Strength" label="强度信息" width="100"/>
<el-table-column label="处理方式" show-overflow-tooltip width="200" fixed="right">
<template #default="scope">
<el-button type="primary" @click.stop="openHandleObstacleDialog(scope)" link>处置</el-button>
<el-popconfirm <el-popconfirm
class="box-item" class="box-item"
title="确定删除这个点位吗?" title="确定删除这个点位吗?"
placement="top" placement="top"
@confirm="delShildItem(scope)" @confirm="delPoint(scope)"
> >
<template #reference> <template #reference>
<el-button type="primary" @click.stop link>删除</el-button> <el-button type="primary" @click.stop link>删除</el-button>
</template> </template>
</el-popconfirm> </el-popconfirm>
<el-button type="primary" @click.stop="openShildDialog(scope)" link>固定物</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -278,7 +285,7 @@
:pager-count="4" :pager-count="4"
:page-sizes="[10,20,50,100, 200, 300, 400]" :page-sizes="[10,20,50,100, 200, 300, 400]"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="total2" :total="table2Data.length"
@change="getShildTableList" @change="getShildTableList"
/> />
</el-card> </el-card>
@ -599,22 +606,43 @@
<div v-if="itemsId === 5" class="tabsItem"> <div v-if="itemsId === 5" class="tabsItem">
<!-- 数据表格 --> <!-- 数据表格 -->
<el-card shadow="always" style="margin-top: 12px"> <el-card shadow="always" style="margin-top: 12px">
<el-table :data="tableData2" style="width: 100%">
<el-table
highlight-current-row
:data="tableData2"
style="width: 100%"
>
<!-- <el-table-column type="selection" width="55"/>-->
<el-table-column label="序号" type="index" width="60"/> <el-table-column label="序号" type="index" width="60"/>
<el-table-column prop="coordinate" label="目标坐标" width="120"/> <el-table-column prop="name" label="名称" width="100"/>
<el-table-column label="告警等级" width="160"> <el-table-column prop="lon" label="目标经度" width="100"/>
<el-table-column prop="lat" label="目标纬度" width="100"/>
<el-table-column prop="strength" label="强度信息" width="100"/>
<el-table-column label="处理方式" show-overflow-tooltip width="160" fixed="right">
<template #default="scope"> <template #default="scope">
<el-rate :model-value="scope.row.rate" disabled/> <el-button type="primary" link @click.stop="openShildDialog1(scope)">修改</el-button>
</template> <el-popconfirm
</el-table-column> class="box-item"
<el-table-column label="处理状态" show-overflow-tooltip> title="确定删除这个点位吗?"
<template #default="scope"> placement="top"
<span v-if="scope.row.type === 1"></span> @confirm="delShildItem(scope)"
<span v-else-if="scope.row.type === 2">不处理</span> >
<span v-else-if="scope.row.type === 3">未发现</span> <template #reference>
<el-button type="primary" @click.stop link>删除</el-button>
</template>
</el-popconfirm>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination
v-model:current-page="currentPage3"
v-model:page-size="pageSize3"
:pager-count="4"
:page-sizes="[10,20,50,100, 200, 300, 400]"
layout="total, sizes, prev, pager, next, jumper"
:total="total3"
@change="getShildTableList"
/>
</el-card> </el-card>
</div> </div>
</div> </div>
@ -727,7 +755,7 @@
</template> </template>
<script setup> <script setup>
import Ruler from "@/components/ruler.vue"; import Ruler from "@/components/ruler.vue";
import {onMounted, ref, watch,computed } from "vue"; import {onMounted, ref, watch, computed} from "vue";
import { import {
addShildData, addShildData,
DeleteCData, DeleteCData,
@ -954,12 +982,21 @@ const boxPos = ref({x: 100, y: 150, rotate: 0})
const currentPosition = ref({}) const currentPosition = ref({})
// //
const table1Current = (e,) => { const table1Current = (e,) => {
dotIndex1.value = -1
if (dotIndex.value === e.index) { if (dotIndex.value === e.index) {
dotIndex.value = -1 dotIndex.value = -1
} else { } else {
dotIndex.value = e.index dotIndex.value = e.index
} }
} }
const table1Current1 = (e,) => {
dotIndex.value = -1
if (dotIndex1.value === e.index) {
dotIndex1.value = -1
} else {
dotIndex1.value = e.index
}
}
// ws // ws
const getSocket = () => { const getSocket = () => {
@ -1023,24 +1060,78 @@ const setTable1Data = (e) => {
// //
const tableData1 = ref([]) const tableData1 = ref([])
const table1Data = computed(() => { const table1Data = computed(() => {
return tableData1.value.slice((currentPage1.value - 1) * pageSize1.value, currentPage1.value * pageSize1.value) return tableData1.value.filter(e => e.Status == 0).map((v, k) => {
return {
...v,
index: k
}
})
}); });
// //
const currentPage1 = ref(1) const currentPage1 = ref(1)
// //
const pageSize1 = ref(10) const pageSize1 = ref(10)
// const table2Data = computed(() => {
const tableData2 = ref([]) return tableData1.value.filter(e => e.Status == 2).map((v, k) => {
return {
...v,
index: k
}
})
});
// //
const currentPage2 = ref(1) const currentPage2 = ref(1)
// //
const pageSize2 = ref(10) const pageSize2 = ref(10)
const total2 = ref(0)
//
const tableData2 = ref([])
//
const currentPage3 = ref(1)
//
const pageSize3 = ref(10)
const total3 = ref(0)
// //
const dots = ref([]) const dots = computed(() => {
return table1Data.value.map((v, k) => {
if (v.Lon && v.Lat) {
const rectInfo = calcRectangleFromPoints(areaPoints.value);
const point = {
lon: v.Lon,
lat: v.Lat,
rotate: 0,
};
return {
...correctDeviation(getLocalPositionRelativeToP4(point, areaPoints.value, rectInfo)),
type: v.Status
}
} else {
return null
}
}).filter(v => v)
})
const dots1 = computed(() => {
return table2Data.value.map((v, k) => {
if (v.Lon && v.Lat) {
const rectInfo = calcRectangleFromPoints(areaPoints.value);
const point = {
lon: v.Lon,
lat: v.Lat,
rotate: 0,
};
return {
...correctDeviation(getLocalPositionRelativeToP4(point, areaPoints.value, rectInfo)),
type: v.Status
}
} else {
return null
}
}).filter(v => v)
})
// //
const dotIndex = ref(-1) const dotIndex = ref(-1)
const dotIndex1 = ref(-1)
// //
const shildDialog = ref(false) const shildDialog = ref(false)
const shildForm = ref({}) const shildForm = ref({})
@ -1063,20 +1154,23 @@ const openShildDialog1 = (e) => {
} }
// //
const addShildItem = () => { const addShildItem = () => {
if (shildForm.value.id) { let data = null
updateShildData(shildForm.value).then(e => { if (dotIndex.value >= 0) {
shildDialog.value = false data = table1Data.value[dotIndex.value]
shildForm.value = {}
getShildTableList()
})
} else {
tableData1.value.splice((currentPage1.value - 1) * pageSize1.value + shildForm.value.$index, 1);
addShildData(shildForm.value).then(e => {
shildDialog.value = false
shildForm.value = {}
getShildTableList()
})
} }
tableData1.value = tableData1.value.filter(v => !(v.Lon === shildForm.value.lon && v.Lat === shildForm.value.lat && v.Strength === shildForm.value.strength))
if (data) {
let index = table1Data.value.findIndex(v => v.Lon === data.Lon && v.Lat === data.Lat && v.Strength === data.Strength)
if (index >= 0) {
dotIndex.value = index
}
}
addShildData(shildForm.value).then(e => {
shildDialog.value = false
shildForm.value = {}
getShildTableList()
})
} }
// //
const delShildItem = (e) => { const delShildItem = (e) => {
@ -1087,12 +1181,11 @@ const delShildItem = (e) => {
// //
const getShildTableList = () => { const getShildTableList = () => {
getShildList({ getShildList({
pageIndex: currentPage2.value, pageIndex: currentPage3.value,
pageSize: pageSize2.value, pageSize: pageSize3.value,
}).then((e) => { }).then((e) => {
tableData2.value = e.data tableData2.value = e.data
total2.value = e.totalCount total3.value = e.totalCount
}) })
} }
@ -1103,11 +1196,21 @@ const dialogImageUrl = ref('')
const imgDialog = ref(false) const imgDialog = ref(false)
// //
const delPoint = (e) => { const delPoint = (e) => {
let arr = JSON.parse(JSON.stringify(tableData1.value))
arr.splice((currentPage1.value - 1) * pageSize1.value + e.$index, 1); let data = null
tableData1.value = arr || [] if (dotIndex.value >= 0) {
dotIndexF((currentPage1.value - 1) * pageSize1.value + e.$index) data = table1Data.value[dotIndex.value]
table1DataIndexF() }
tableData1.value = tableData1.value.filter(v => !(v.Lon === e.row.Lon && v.Lat === e.row.Lat && v.Strength === e.row.Strength))
if (data) {
let index = table1Data.value.findIndex(v => v.Lon === data.Lon && v.Lat === data.Lat && v.Strength === data.Strength)
if (index >= 0) {
dotIndex.value = index
}
}
} }
// //
const openHandleObstacleDialog = (e) => { const openHandleObstacleDialog = (e) => {
@ -1119,7 +1222,7 @@ const openHandleObstacleDialog = (e) => {
longitude: e.row.Lon, longitude: e.row.Lon,
latitude: e.row.Lat, latitude: e.row.Lat,
strength: e.row.Strength, strength: e.row.Strength,
fileList: [{url: 'https://dummyimage.com/640x360'}, {url: 'https://placehold.co/600x400/png'}] fileList: []
} }
} }
// //
@ -1131,18 +1234,30 @@ const handleObstacle = () => {
files: dialog1Form.value.fileList.map(e => e.url), files: dialog1Form.value.fileList.map(e => e.url),
findTime: dialog1Form.value.time, findTime: dialog1Form.value.time,
}).then(e => { }).then(e => {
let data = null
if (dotIndex.value >= 0) {
data = table1Data.value[dotIndex.value]
}
dialog1.value = false dialog1.value = false
dotIndexF(dialog1Form.value.dotIndex) tableData1.value = tableData1.value.filter(v => !(v.Lon === dialog1Form.value.longitude && v.Lat === dialog1Form.value.latitude && v.Strength === dialog1Form.value.strength))
tableData1.value.splice((currentPage1.value - 1) * pageSize1.value + dialog1Form.value.index, 1); if (data) {
table1DataIndexF() let index = table1Data.value.findIndex(v => v.Lon === data.Lon && v.Lat === data.Lat && v.Strength === data.Strength)
if (index >= 0) {
dotIndex.value = index
}
}
}) })
} }
// //
const table1Ref = ref() const table1Ref = ref()
const batchDisposal = () => { const batchDisposal = () => {
dotIndex.value = -1 let data = null
if (dotIndex.value >= 0) {
data = table1Data.value[dotIndex.value]
}
let datas = table1Ref.value.getSelectionRows() let datas = table1Ref.value.getSelectionRows()
let arr = JSON.parse(JSON.stringify(tableData1.value))
datas.forEach((row) => { datas.forEach((row) => {
InserDealObstacleModel({ InserDealObstacleModel({
longitude: row.Lon, longitude: row.Lon,
@ -1151,24 +1266,44 @@ const batchDisposal = () => {
files: [], files: [],
findTime: '', findTime: '',
}) })
tableData1.value = tableData1.value.filter(item => row.index !== item.index); arr = arr.filter(v => !(v.Lon === row.Lon && v.Lat === row.Lat && v.Strength === row.Strength))
}) })
tableData1.value = arr
getShildTableList() getShildTableList()
table1DataIndexF() if (data) {
let index = table1Data.value.findIndex(v => v.Lon === data.Lon && v.Lat === data.Lat && v.Strength === data.Strength)
if (index >= 0) {
dotIndex.value = index
}
}
} }
// //
const batchDel = () => { const batchDel = () => {
dotIndex.value = -1 let data = null
if (dotIndex.value >= 0) {
data = table1Data.value[dotIndex.value]
}
let datas = table1Ref.value.getSelectionRows() let datas = table1Ref.value.getSelectionRows()
let arr = JSON.parse(JSON.stringify(tableData1.value))
datas.forEach((row) => { datas.forEach((row) => {
tableData1.value = tableData1.value.filter(item => row.index !== item.index); arr = arr.filter(v => !(v.Lon === row.Lon && v.Lat === row.Lat && v.Strength === row.Strength))
}) })
table1DataIndexF() tableData1.value = arr
if (data) {
let index = table1Data.value.findIndex(v => v.Lon === data.Lon && v.Lat === data.Lat && v.Strength === data.Strength)
if (index >= 0) {
dotIndex.value = index
}
}
} }
// //
const batchShild = () => { const batchShild = () => {
dotIndex.value = -1 let data = null
if (dotIndex.value >= 0) {
data = table1Data.value[dotIndex.value]
}
let datas = table1Ref.value.getSelectionRows() let datas = table1Ref.value.getSelectionRows()
let arr = JSON.parse(JSON.stringify(tableData1.value))
datas.forEach((row) => { datas.forEach((row) => {
addShildData({ addShildData({
lon: row.Lon, lon: row.Lon,
@ -1178,10 +1313,16 @@ const batchShild = () => {
deviation: shieldInfoForm.value.deviation, deviation: shieldInfoForm.value.deviation,
shielding: shieldInfoForm.value.shielding, shielding: shieldInfoForm.value.shielding,
}) })
tableData1.value = tableData1.value.filter(item => row.index !== item.index); arr = arr.filter(v => !(v.Lon === row.Lon && v.Lat === row.Lat && v.Strength === row.Strength))
}) })
tableData1.value = arr
getShildTableList() getShildTableList()
table1DataIndexF() if (data) {
let index = table1Data.value.findIndex(v => v.Lon === data.Lon && v.Lat === data.Lat && v.Strength === data.Strength)
if (index >= 0) {
dotIndex.value = index
}
}
} }
// //
@ -1228,24 +1369,123 @@ const dotIndexF = (index) => {
} }
} }
const readTableData = () => { const readTableData = () => {
const storedStr = localStorage.getItem('tableData1'); tableData1.value = [
if (!storedStr) { {"Lon": 119.68158733286303, "Lat": 25.929632812633325, "Status": 0},
return; {"Lon": 119.68226426875183, "Lat": 25.930447575308917, "Status": 2},
} {"Lon": 119.68096665515995, "Lat": 25.92785426333515, "Status": 0},
const storedData = JSON.parse(storedStr); {"Lon": 119.68278645438862, "Lat": 25.931322676440597, "Status": 2},
if (!Array.isArray(storedData)) { {"Lon": 119.6812308665526, "Lat": 25.92833823728329, "Status": 0},
return; {"Lon": 119.68318456612818, "Lat": 25.93195533358216, "Status": 2},
} {"Lon": 119.68036755668337, "Lat": 25.926887965282527, "Status": 0},
tableData1.value.splice(0, tableData1.value.length, ...(storedData.map((e, index) => { {"Lon": 119.68192384565978, "Lat": 25.92998287455529, "Status": 2},
{"Lon": 119.68250211437338, "Lat": 25.930826764153685, "Status": 0},
{"Lon": 119.68173244334253, "Lat": 25.92945659218239, "Status": 2},
{"Lon": 119.68295065558712, "Lat": 25.93161275117524, "Status": 0},
{"Lon": 119.68105985472717, "Lat": 25.92803513687375, "Status": 2},
{"Lon": 119.68341837732858, "Lat": 25.932375885682826, "Status": 0},
{"Lon": 119.68064788438357, "Lat": 25.927279242277973, "Status": 2},
{"Lon": 119.68209525287522, "Lat": 25.93029711876587, "Status": 0},
{"Lon": 119.68265453337758, "Lat": 25.931034055557433, "Status": 2},
{"Lon": 119.68139455255315, "Lat": 25.928622731163285, "Status": 0},
{"Lon": 119.6832675327453, "Lat": 25.93210835721747, "Status": 2},
{"Lon": 119.68018322877646, "Lat": 25.92664065235554, "Status": 0},
{"Lon": 119.68150073637315, "Lat": 25.929251557521317, "Status": 2},
{"Lon": 119.68237556552133, "Lat": 25.93061626521737, "Status": 0},
{"Lon": 119.68289878364453, "Lat": 25.93148441687782, "Status": 2},
{"Lon": 119.68087065652437, "Lat": 25.927625231566176, "Status": 0},
{"Lon": 119.68183456587315, "Lat": 25.92978651727634, "Status": 2},
{"Lon": 119.68241653211357, "Lat": 25.93071232314118, "Status": 0},
{"Lon": 119.68309635565385, "Lat": 25.93180587653187, "Status": 2},
{"Lon": 119.68114278553872, "Lat": 25.92820365476537, "Status": 0},
{"Lon": 119.68055145252318, "Lat": 25.92715353326578, "Status": 2},
{"Lon": 119.6821865443212, "Lat": 25.93045772867326, "Status": 0},
{"Lon": 119.68271563257338, "Lat": 25.93115482282882, "Status": 2},
{"Lon": 119.6816754333553, "Lat": 25.92959862621233, "Status": 0},
{"Lon": 119.68334676542355, "Lat": 25.932253615880354, "Status": 2},
{"Lon": 119.68027543254352, "Lat": 25.92676543256789, "Status": 0},
{"Lon": 119.68198765432156, "Lat": 25.93012345678901, "Status": 2},
{"Lon": 119.68256789012345, "Lat": 25.93098765432156, "Status": 0},
{"Lon": 119.68143215432156, "Lat": 25.92876543215678, "Status": 2},
{"Lon": 119.6829123456789, "Lat": 25.9315432156789, "Status": 0},
{"Lon": 119.68076543215678, "Lat": 25.92743215678901, "Status": 2},
{"Lon": 119.68226543215678, "Lat": 25.93034567890123, "Status": 0},
{"Lon": 119.6831123456789, "Lat": 25.93198765432156, "Status": 2},
{"Lon": 119.68126543215678, "Lat": 25.92843215678901, "Status": 0},
{"Lon": 119.68046543215678, "Lat": 25.92698765432156, "Status": 2},
{"Lon": 119.68186543215678, "Lat": 25.92984567890123, "Status": 0},
{"Lon": 119.68266543215678, "Lat": 25.93114567890123, "Status": 2},
{"Lon": 119.68346543215678, "Lat": 25.93244567890123, "Status": 0},
{"Lon": 119.68066543215678, "Lat": 25.92734567890123, "Status": 2},
{"Lon": 119.68166543215678, "Lat": 25.92944567890123, "Status": 0},
{"Lon": 119.68246543215678, "Lat": 25.93074567890123, "Status": 2},
{"Lon": 119.68306543215678, "Lat": 25.93184567890123, "Status": 0},
{"Lon": 119.68096543215678, "Lat": 25.92774567890123, "Status": 2},
{"Lon": 119.68216543215678, "Lat": 25.93024567890123, "Status": 0},
{"Lon": 119.68286543215678, "Lat": 25.93134567890123, "Status": 2},
{"Lon": 119.68136543215678, "Lat": 25.92864567890123, "Status": 0},
{"Lon": 119.68036543215678, "Lat": 25.92684567890123, "Status": 2},
{"Lon": 119.68176543215678, "Lat": 25.92964567890123, "Status": 0},
{"Lon": 119.68256543215678, "Lat": 25.93084567890123, "Status": 2},
{"Lon": 119.68326543215678, "Lat": 25.93204567890123, "Status": 0},
{"Lon": 119.68106543215678, "Lat": 25.92794567890123, "Status": 2},
{"Lon": 119.68236543215678, "Lat": 25.93054567890123, "Status": 0},
{"Lon": 119.68296543215678, "Lat": 25.93164567890123, "Status": 2},
{"Lon": 119.68156543215678, "Lat": 25.92914567890123, "Status": 0},
{"Lon": 119.68086543215678, "Lat": 25.92764567890123, "Status": 2},
{"Lon": 119.68206543215678, "Lat": 25.92994567890123, "Status": 0},
{"Lon": 119.68276543215678, "Lat": 25.93124567890123, "Status": 2},
{"Lon": 119.68336543215678, "Lat": 25.93234567890123, "Status": 0},
{"Lon": 119.68116543215678, "Lat": 25.92824567890123, "Status": 2},
{"Lon": 119.68056543215678, "Lat": 25.92704567890123, "Status": 0},
{"Lon": 119.68196543215678, "Lat": 25.93004567890123, "Status": 2},
{"Lon": 119.68266543215678, "Lat": 25.93094567890123, "Status": 0},
{"Lon": 119.68316543215678, "Lat": 25.93174567890123, "Status": 2},
{"Lon": 119.68066543215678, "Lat": 25.92724567890123, "Status": 0},
{"Lon": 119.68146543215678, "Lat": 25.92884567890123, "Status": 2},
{"Lon": 119.68226543215678, "Lat": 25.93044567890123, "Status": 0},
{"Lon": 119.68286543215678, "Lat": 25.93144567890123, "Status": 2},
{"Lon": 119.68356543215678, "Lat": 25.93254567890123, "Status": 0},
{"Lon": 119.68076543215678, "Lat": 25.92754567890123, "Status": 2},
{"Lon": 119.68136543215678, "Lat": 25.92854567890123, "Status": 0},
{"Lon": 119.68216543215678, "Lat": 25.93034567890123, "Status": 2},
{"Lon": 119.68296543215678, "Lat": 25.93174567890123, "Status": 0},
{"Lon": 119.68166543215678, "Lat": 25.92934567890123, "Status": 2},
{"Lon": 119.68046543215678, "Lat": 25.92694567890123, "Status": 0},
{"Lon": 119.68186543215678, "Lat": 25.92974567890123, "Status": 2},
{"Lon": 119.68246543215678, "Lat": 25.93064567890123, "Status": 0},
{"Lon": 119.68306543215678, "Lat": 25.93154567890123, "Status": 2},
{"Lon": 119.68326543215678, "Lat": 25.93214567890123, "Status": 0},
{"Lon": 119.68106543215678, "Lat": 25.92784567890123, "Status": 2},
{"Lon": 119.68236543215678, "Lat": 25.93064567890123, "Status": 0},
{"Lon": 119.68276543215678, "Lat": 25.93114567890123, "Status": 2},
{"Lon": 119.68126543215678, "Lat": 25.92834567890123, "Status": 0},
{"Lon": 119.68026543215678, "Lat": 25.92664567890123, "Status": 2}
].map((e, i) => {
return { return {
...e, ...e,
index: index, Strength: Math.ceil(Math.random() * 200),
index: i
} }
}))); })
if (table1Ref.value) { // const storedStr = localStorage.getItem('tableData1');
table1Ref.value.doLayout(); // // if (!storedStr) {
} // return;
// }
// const storedData = JSON.parse(storedStr);
// if (!Array.isArray(storedData)) {
// return;
// }
// tableData1.value.splice(0, tableData1.value.length, ...(storedData.map((e, index) => {
// return {
// ...e,
// index: index,
// }
// })));
// if (table1Ref.value) {
// table1Ref.value.doLayout(); //
// }
} }
const getTableData = async () => { const getTableData = async () => {
await getAllAirPort().then(e => { await getAllAirPort().then(e => {
options1.value = e.data options1.value = e.data
@ -1280,8 +1520,7 @@ onMounted(() => {
getSocket() getSocket()
getOption() getOption()
getShildTableList() getShildTableList()
// testFun() testFun()
getDotsData()
}) })
const testFun = () => { const testFun = () => {
let areaData111 = [ let areaData111 = [
@ -1340,30 +1579,13 @@ const testFun = () => {
getLocal() getLocal()
} }
const getDotsData = () => {
dots.value = [...tableData1.value.map((v, k) => {
const rectInfo = calcRectangleFromPoints(areaPoints.value);
const point = {
lon: v.Lon,
lat: v.Lat,
rotate: 0,
};
return {
...correctDeviation(getLocalPositionRelativeToP4(point, areaPoints.value, rectInfo)),
type: v.Status
}
}).filter(v => v)]
}
watch(() => JSON.stringify([tableData1.value, areaPoints.value]), (oldVal, newVal) => { watch(() => JSON.stringify([tableData1.value, areaPoints.value]), (oldVal, newVal) => {
console.log(tableData1.value)
localStorage.setItem('tableData1', JSON.stringify(tableData1.value)); localStorage.setItem('tableData1', JSON.stringify(tableData1.value));
getDotsData()
console.log(dots.value)
}, {deep: true}) }, {deep: true})
const table1DataIndexF = () => { const table1DataIndexF = () => {
tableData1.value = tableData1.value.map((v, k) => { tableData1.value = tableData1.value.map((v, k) => {
return { return {
...v, ...v,

Loading…
Cancel
Save