|
@@ -1,183 +1,186 @@
|
|
|
<!-- 栅格占用查询 -->
|
|
|
<template>
|
|
|
- <div class="flex flex-col aside-left-inner">
|
|
|
- <div class="title-main">立体空域网格占用查询</div>
|
|
|
-
|
|
|
- <el-form ref="formRef" class="p-form mt-7" :model="form" :rules="rules" label-position="left" size="large">
|
|
|
- <el-form-item label="计算层级" prop="level">
|
|
|
- <el-select v-model="form.level" placeholder="">
|
|
|
- <el-option label="23级" value="23" />
|
|
|
- <el-option label="24级" value="24" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="高度" prop="height">
|
|
|
- <el-input v-model="form.minZ" :max="form.maxZ" type="number" class="flex-1"></el-input>
|
|
|
- <div class="mx-2">--</div>
|
|
|
- <el-input v-model="form.maxZ" :min="form.minZ" type="number" class="flex-1"></el-input>
|
|
|
- <el-button class="btn-secondary ml-3 -mb-1" @click="handleDraw">绘制区域</el-button>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="评价系数">
|
|
|
- <el-checkbox v-model="form.evaluation">展示</el-checkbox>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <table class="table-default stripe mb-6">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th class="w-16">序号</th>
|
|
|
- <th>经度</th>
|
|
|
- <th>纬度</th>
|
|
|
- <th class="w-24">海拔高/m</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody style="max-height: 580px;">
|
|
|
- <tr v-for="(row, index) in tableData">
|
|
|
- <td class="w-16">{{ index + 1 }}</td>
|
|
|
- <td>{{ row[0] }}</td>
|
|
|
- <td>{{ row[1] }}</td>
|
|
|
- <td class="w-24">{{ row[2] }}</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
-
|
|
|
- <div class="text-center">
|
|
|
- <el-button class="btn-main" @click="handleCalc" :loading="loading.calc">开始计算</el-button>
|
|
|
- <el-button class="btn-main" @click="handleClear(true)">清空结果</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="flex flex-col aside-left-inner">
|
|
|
+ <div class="title-main">立体空域网格占用查询</div>
|
|
|
+
|
|
|
+ <el-form ref="formRef" class="p-form mt-7" :model="form" :rules="rules" label-position="left" size="large">
|
|
|
+ <el-form-item label="计算层级" prop="level">
|
|
|
+ <el-select v-model="form.level" placeholder="">
|
|
|
+ <el-option label="23级" value="23" />
|
|
|
+ <el-option label="24级" value="24" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="高度" prop="height">
|
|
|
+ <el-input v-model="form.minZ" :max="form.maxZ" type="number" class="flex-1"></el-input>
|
|
|
+ <div class="mx-2">--</div>
|
|
|
+ <el-input v-model="form.maxZ" :min="form.minZ" type="number" class="flex-1"></el-input>
|
|
|
+ <el-button class="btn-secondary ml-3 -mb-1" @click="handleDraw">绘制区域</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="评价系数">
|
|
|
+ <el-checkbox v-model="form.evaluation">展示</el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <table class="table-default stripe mb-6">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th class="w-16">序号</th>
|
|
|
+ <th>经度</th>
|
|
|
+ <th>纬度</th>
|
|
|
+ <th class="w-24">海拔高/m</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody style="max-height: 580px">
|
|
|
+ <tr v-for="(row, index) in tableData">
|
|
|
+ <td class="w-16">{{ index + 1 }}</td>
|
|
|
+ <td>{{ row[0] }}</td>
|
|
|
+ <td>{{ row[1] }}</td>
|
|
|
+ <td class="w-24">{{ row[2] }}</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+
|
|
|
+ <div class="text-center">
|
|
|
+ <el-button class="btn-main" @click="handleCalc" :loading="loading.calc">开始计算</el-button>
|
|
|
+ <el-button class="btn-main" @click="handleClear(true)">清空结果</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { onBeforeMount, onBeforeUnmount, reactive, ref, watch } from 'vue';
|
|
|
+import { onBeforeMount, onBeforeUnmount, reactive, ref, watch } from 'vue'
|
|
|
import { DrawPolygon, QueryCube, clearDraw } from '@/utils/map/addLayer'
|
|
|
-import { useMapStore } from '@/store/map';
|
|
|
-import usePanelStore from '@/store/panel';
|
|
|
-import { geometryMeshEffect } from "@/utils/map/addTool.js";
|
|
|
+import { useMapStore } from '@/store/map'
|
|
|
+import usePanelStore from '@/store/panel'
|
|
|
+import { geometryMeshEffect } from '@/utils/map/addTool.js'
|
|
|
|
|
|
const mapStore = useMapStore()
|
|
|
const panelStore = usePanelStore()
|
|
|
|
|
|
onBeforeMount(() => {
|
|
|
- handleRestoreChecked()
|
|
|
+ handleRestoreChecked()
|
|
|
})
|
|
|
|
|
|
function handleRestoreChecked() {
|
|
|
- const temp = panelStore.sgzy
|
|
|
- if (!Object.keys(temp).length) return
|
|
|
- form.value = temp.form
|
|
|
- tableData.value = temp.tableData
|
|
|
+ const temp = panelStore.sgzy
|
|
|
+ if (!Object.keys(temp).length) return
|
|
|
+ form.value = temp.form
|
|
|
+ tableData.value = temp.tableData
|
|
|
}
|
|
|
|
|
|
const form = ref({
|
|
|
- level: '23',
|
|
|
- minZ: '0',
|
|
|
- maxZ: '120',
|
|
|
- evaluation: false
|
|
|
+ level: '23',
|
|
|
+ minZ: '0',
|
|
|
+ maxZ: '120',
|
|
|
+ evaluation: false,
|
|
|
})
|
|
|
|
|
|
const rules = []
|
|
|
|
|
|
function handleDraw() {
|
|
|
- DrawPolygon({ hasZ: true })
|
|
|
+ DrawPolygon({ hasZ: true })
|
|
|
}
|
|
|
|
|
|
let drawResult = []
|
|
|
const tableData = ref([])
|
|
|
|
|
|
-watch(() => mapStore.draw_geometry, (val) => {
|
|
|
- drawResult = val?.rings
|
|
|
- tableData.value = drawResult.flat()
|
|
|
-}, { deep: true })
|
|
|
+watch(
|
|
|
+ () => mapStore.draw_geometry,
|
|
|
+ (val) => {
|
|
|
+ drawResult = val?.rings
|
|
|
+ tableData.value = drawResult.flat()
|
|
|
+ },
|
|
|
+ { deep: true }
|
|
|
+)
|
|
|
|
|
|
// watch(() => mapStore.queryResult, () => {
|
|
|
// loading.calc = false
|
|
|
// }, { deep: true })
|
|
|
|
|
|
function handleClear(clearAll) {
|
|
|
- //开始计算之后取消绘制功能,转而使用带高度三维体显示
|
|
|
- clearDraw()
|
|
|
- getMesh("hide")
|
|
|
- if (clearAll) {
|
|
|
- tableData.value = []
|
|
|
- }
|
|
|
- QueryCube({
|
|
|
- show: false,
|
|
|
- })
|
|
|
+ //开始计算之后取消绘制功能,转而使用带高度三维体显示
|
|
|
+ clearDraw()
|
|
|
+ getMesh('hide')
|
|
|
+ if (clearAll) {
|
|
|
+ tableData.value = []
|
|
|
+ }
|
|
|
+ QueryCube({
|
|
|
+ show: false,
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
//获取带高度三维体
|
|
|
function getMesh(status) {
|
|
|
- if (status == "hide") {
|
|
|
- geometryMeshEffect({
|
|
|
- id: 'sgzy_mesh',
|
|
|
- status: "hide"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- let height = form.value.maxZ * 1 - form.value.minZ * 1
|
|
|
- let rings = [];
|
|
|
- for (let i = 0; i < drawResult[0].length; i++) {
|
|
|
- rings.push([drawResult[0][i][0], drawResult[0][i][1], form.value.minZ * 1])
|
|
|
- }
|
|
|
- debugger
|
|
|
- geometryMeshEffect({
|
|
|
- id: 'sgzy_mesh',
|
|
|
- status: "show",
|
|
|
- data: [{
|
|
|
- type: 'polygon',
|
|
|
- shape: {
|
|
|
- height: height,
|
|
|
- rings: [rings],
|
|
|
- color: [0, 255, 0, 0.2]
|
|
|
- }
|
|
|
- }]
|
|
|
- })
|
|
|
-
|
|
|
+ if (status == 'hide') {
|
|
|
+ geometryMeshEffect({
|
|
|
+ id: 'sgzy_mesh',
|
|
|
+ status: 'hide',
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let height = form.value.maxZ * 1 - form.value.minZ * 1
|
|
|
+ let rings = []
|
|
|
+ for (let i = 0; i < drawResult[0].length; i++) {
|
|
|
+ rings.push([drawResult[0][i][0], drawResult[0][i][1], form.value.minZ * 1])
|
|
|
+ }
|
|
|
+ geometryMeshEffect({
|
|
|
+ id: 'sgzy_mesh',
|
|
|
+ status: 'show',
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ type: 'polygon',
|
|
|
+ shape: {
|
|
|
+ height: height,
|
|
|
+ rings: [rings],
|
|
|
+ color: [0, 255, 0, 0.2],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const loading = reactive({
|
|
|
- calc: false
|
|
|
+ calc: false,
|
|
|
})
|
|
|
|
|
|
function handleCalc() {
|
|
|
- const { maxZ, minZ } = form.value
|
|
|
- if (!drawResult) return
|
|
|
- if (!minZ || !maxZ) return
|
|
|
- // loading.calc = true
|
|
|
- handleClear();
|
|
|
- getMesh("show");
|
|
|
- setTimeout(() => {
|
|
|
- QueryCube({
|
|
|
- ...form.value,
|
|
|
- show: true,
|
|
|
- level: Number(form.value.level),
|
|
|
- rings: drawResult
|
|
|
- })
|
|
|
- }, 300);
|
|
|
+ const { maxZ, minZ } = form.value
|
|
|
+ if (!drawResult) return
|
|
|
+ if (!minZ || !maxZ) return
|
|
|
+ // loading.calc = true
|
|
|
+ handleClear()
|
|
|
+ getMesh('show')
|
|
|
+ setTimeout(() => {
|
|
|
+ QueryCube({
|
|
|
+ ...form.value,
|
|
|
+ show: true,
|
|
|
+ level: Number(form.value.level),
|
|
|
+ rings: drawResult,
|
|
|
+ })
|
|
|
+ }, 300)
|
|
|
}
|
|
|
|
|
|
function handleStoreChecked() {
|
|
|
- if (!tableData.value.length) {
|
|
|
- panelStore.setSgzy({})
|
|
|
- return
|
|
|
- }
|
|
|
- panelStore.setSgzy({
|
|
|
- form: form.value,
|
|
|
- tableData: tableData.value,
|
|
|
- })
|
|
|
+ if (!tableData.value.length) {
|
|
|
+ panelStore.setSgzy({})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ panelStore.setSgzy({
|
|
|
+ form: form.value,
|
|
|
+ tableData: tableData.value,
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
- //handleClear(true)
|
|
|
- handleStoreChecked()
|
|
|
+ //handleClear(true)
|
|
|
+ handleStoreChecked()
|
|
|
})
|
|
|
-
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
:deep(.p-form) {
|
|
|
- .el-form-item__label {
|
|
|
- width: 105px;
|
|
|
- }
|
|
|
+ .el-form-item__label {
|
|
|
+ width: 105px;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|