|
@@ -28,12 +28,6 @@
|
|
|
:props="cascaderProps"
|
|
|
class="w-full" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="分层方式" prop="layeringType">
|
|
|
- <el-radio-group v-model="form.layeringType">
|
|
|
- <el-radio label="广域分层" value="广域分层" />
|
|
|
- <el-radio label="细微分层" value="细微分层" />
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
<el-form v-model="form" class="mt-3" label-position="top">
|
|
@@ -52,60 +46,6 @@
|
|
|
@change="(val) => handleCheck('big', val, 3)">
|
|
|
<el-checkbox v-for="item in layersListBig" :label="item.label" :value="item.value" />
|
|
|
</el-checkbox-group>
|
|
|
-
|
|
|
- <template v-else>
|
|
|
- <div class="title-sub mb-2 w-full">
|
|
|
- 120以下
|
|
|
- <el-checkbox
|
|
|
- v-model="checkAll.small_1"
|
|
|
- @change="(val) => handleCheckAll('small_1', val)"
|
|
|
- class="ml-auto pr-1"
|
|
|
- :indeterminate="indeterminate.small_1"
|
|
|
- >全选</el-checkbox
|
|
|
- >
|
|
|
- </div>
|
|
|
- <el-checkbox-group v-model="form.layersSmall" @change="(val) => handleCheck('small_1', val)">
|
|
|
- <el-checkbox
|
|
|
- v-for="item in layersListSmall.slice(0, 6)"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- class="w-1/3 mr-0 mb-1 pl-2" />
|
|
|
- </el-checkbox-group>
|
|
|
- <div class="title-sub my-2 w-full">
|
|
|
- 120-300
|
|
|
- <el-checkbox
|
|
|
- v-model="checkAll.small_2"
|
|
|
- @change="(val) => handleCheckAll('small_2', val)"
|
|
|
- class="ml-auto pr-1"
|
|
|
- :indeterminate="indeterminate.small_2"
|
|
|
- >全选</el-checkbox
|
|
|
- >
|
|
|
- </div>
|
|
|
- <el-checkbox-group v-model="form.layersSmall" @change="(val) => handleCheck('small_2', val)">
|
|
|
- <el-checkbox
|
|
|
- v-for="item in layersListSmall.slice(6, 15)"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- class="w-1/3 mr-0 mb-1 pl-2" />
|
|
|
- </el-checkbox-group>
|
|
|
- <div class="title-sub my-2 w-full">
|
|
|
- 300-600
|
|
|
- <el-checkbox
|
|
|
- v-model="checkAll.small_3"
|
|
|
- @change="(val) => handleCheckAll('small_3', val)"
|
|
|
- class="ml-auto pr-1"
|
|
|
- :indeterminate="indeterminate.small_3"
|
|
|
- >全选</el-checkbox
|
|
|
- >
|
|
|
- </div>
|
|
|
- <el-checkbox-group v-model="form.layersSmall" class="w-full" @change="(val) => handleCheck('small_3', val)">
|
|
|
- <el-checkbox
|
|
|
- v-for="item in layersListSmall.slice(15)"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- class="w-1/3 mr-0 pl-2" />
|
|
|
- </el-checkbox-group>
|
|
|
- </template>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -134,7 +74,6 @@ function handleRestoreChecked() {
|
|
|
if (!Object.keys(temp).length) return
|
|
|
form.value = temp.form
|
|
|
lastBigLayers = temp.lastBigLayers
|
|
|
- lastSmallLayers = temp.lastSmallLayers
|
|
|
Object.keys(checkAll).forEach((k) => {
|
|
|
checkAll[k] = temp.checkAll[k]
|
|
|
})
|
|
@@ -146,7 +85,6 @@ const form = ref({
|
|
|
rangeType: '自定义绘制',
|
|
|
layeringType: '广域分层',
|
|
|
layersBig: [],
|
|
|
- layersSmall: [],
|
|
|
})
|
|
|
|
|
|
const colorArr = [
|
|
@@ -179,19 +117,6 @@ const cascaderProps = {
|
|
|
watch(
|
|
|
form,
|
|
|
(val) => {
|
|
|
- if (val.rangeType === '行政区划' && !districtList.value.length) {
|
|
|
- GetDistrictTree()
|
|
|
- .then((res) => {
|
|
|
- if (!Array.isArray(res.data)) {
|
|
|
- ElMessage({ offset: 90, type: 'warning', message: '行政区划获取失败' })
|
|
|
- return
|
|
|
- }
|
|
|
- districtList.value = res.data
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- ElMessage({ offset: 90, type: 'warning', message: '行政区划获取失败' })
|
|
|
- })
|
|
|
- }
|
|
|
handleLayering()
|
|
|
},
|
|
|
{ deep: true }
|
|
@@ -232,35 +157,23 @@ function toggleSingleLayer(data, show = true) {
|
|
|
} else {
|
|
|
clearLayering(data.id)
|
|
|
}
|
|
|
- } else {
|
|
|
- AirSpaceLayer({
|
|
|
- Visible: show,
|
|
|
- Heights: data.value,
|
|
|
- })
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let timer_handleLayering
|
|
|
let lastBigLayers = []
|
|
|
-let lastSmallLayers = []
|
|
|
function handleLayering() {
|
|
|
if (timer_handleLayering) {
|
|
|
clearTimeout(timer_handleLayering)
|
|
|
}
|
|
|
timer_handleLayering = setTimeout(() => {
|
|
|
- const { layeringType, layersBig, layersSmall, rangeType, range } = form.value
|
|
|
+ const { layeringType, layersBig, rangeType, range } = form.value
|
|
|
const rings = rangeType === '自定义绘制' ? drawResult : queryResult
|
|
|
if (!rings) return
|
|
|
console.log('start draw')
|
|
|
console.log('range', range)
|
|
|
|
|
|
if (layeringType === '广域分层') {
|
|
|
- layersListSmall.value.forEach((i) => {
|
|
|
- if (lastSmallLayers.includes(i.value)) {
|
|
|
- toggleSingleLayer({ id: i.id, value: i.value }, false)
|
|
|
- }
|
|
|
- })
|
|
|
- lastSmallLayers = []
|
|
|
layersListBig.forEach((i) => {
|
|
|
if (layersBig.includes(i.value) && !lastBigLayers.includes(i.value)) {
|
|
|
toggleSingleLayer({ ...i, rings }, true)
|
|
@@ -269,22 +182,6 @@ function handleLayering() {
|
|
|
}
|
|
|
})
|
|
|
lastBigLayers = JSON.parse(JSON.stringify(layersBig))
|
|
|
- } else {
|
|
|
- // 细微分层
|
|
|
- layersListBig.forEach((i) => {
|
|
|
- if (lastBigLayers.includes(i.value)) {
|
|
|
- toggleSingleLayer({ id: i.id, value: i.value }, false)
|
|
|
- }
|
|
|
- })
|
|
|
- lastBigLayers = []
|
|
|
- layersListSmall.value.forEach((i) => {
|
|
|
- if (layersSmall.includes(i.value) && !lastSmallLayers.includes(i.value)) {
|
|
|
- toggleSingleLayer({ ...i, rings }, true)
|
|
|
- } else if (!layersSmall.includes(i.value) && lastSmallLayers.includes(i.value)) {
|
|
|
- toggleSingleLayer({ ...i }, false)
|
|
|
- }
|
|
|
- })
|
|
|
- lastSmallLayers = JSON.parse(JSON.stringify(layersSmall))
|
|
|
}
|
|
|
}, 1000)
|
|
|
}
|
|
@@ -295,23 +192,6 @@ const layersListBig = [
|
|
|
{ label: '300-600', id: 'big_3', value: '300,600', color: colorArr[2] },
|
|
|
]
|
|
|
|
|
|
-const layersListSmall = computed(() => {
|
|
|
- let res = []
|
|
|
- let last = 0
|
|
|
- for (let i = 0; i < 18; i++) {
|
|
|
- const step = i < 15 ? 20 : 100
|
|
|
- const end = last + step
|
|
|
- res.push({
|
|
|
- label: `${last}-${end}`,
|
|
|
- value: `${last},${end}`,
|
|
|
- id: `small_${i + 1}`,
|
|
|
- color: i < 6 ? colorArr[0] : i > 14 ? colorArr[2] : colorArr[1],
|
|
|
- })
|
|
|
- last = end
|
|
|
- }
|
|
|
- return res
|
|
|
-})
|
|
|
-
|
|
|
const checkAll = reactive({
|
|
|
big: false,
|
|
|
small_1: false,
|
|
@@ -332,59 +212,32 @@ function handleCheck(type, checkVal) {
|
|
|
if (type === 'big') {
|
|
|
checkedLen = checkVal.length
|
|
|
typeAll = layersListBig
|
|
|
- } else {
|
|
|
- typeAll = layersListSmall.value.slice(typeMap[type][0], typeMap[type][1])
|
|
|
- checkedLen = typeAll.filter((a) => checkVal.indexOf(a) > -1).length
|
|
|
}
|
|
|
indeterminate[type] = checkedLen < typeAll.length && checkedLen > 0
|
|
|
checkAll[type] = checkedLen === typeAll.length
|
|
|
}
|
|
|
|
|
|
-const typeMap = {
|
|
|
- small_1: [0, 5],
|
|
|
- small_2: [6, 14],
|
|
|
- small_3: [15, 17],
|
|
|
-}
|
|
|
-
|
|
|
function handleCheckAll(type, checkVal) {
|
|
|
indeterminate[type] = false
|
|
|
|
|
|
if (type === 'big') {
|
|
|
form.value.layersBig = checkVal ? layersListBig.map((i) => i.value) : []
|
|
|
- } else {
|
|
|
- const iMin = typeMap[type][0]
|
|
|
- const iMax = typeMap[type][1]
|
|
|
- let layersSmallTemp = JSON.parse(JSON.stringify(form.value.layersSmall))
|
|
|
- layersListSmall.value.forEach((row, index) => {
|
|
|
- const isInclude = layersSmallTemp.includes(row.value)
|
|
|
- if (index >= iMin && index <= iMax) {
|
|
|
- if (checkVal && !isInclude) {
|
|
|
- layersSmallTemp.push(row.value)
|
|
|
- } else if (!checkVal && isInclude) {
|
|
|
- const targetIndex = layersSmallTemp.findIndex((i) => i === row.value)
|
|
|
- layersSmallTemp.splice(targetIndex, 1)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- form.value.layersSmall = layersSmallTemp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function clearAll(all = false) {
|
|
|
- const currentList = form.value.layeringType === '广域分层' ? layersListBig : layersListSmall.value
|
|
|
+ const currentList = layersListBig
|
|
|
currentList.forEach((i) => {
|
|
|
- if ([...lastBigLayers, ...lastSmallLayers].includes(i.value)) {
|
|
|
+ if ([...lastBigLayers].includes(i.value)) {
|
|
|
toggleSingleLayer({ id: i.id, value: i.value })
|
|
|
}
|
|
|
})
|
|
|
lastBigLayers = []
|
|
|
- lastSmallLayers = []
|
|
|
clearDraw()
|
|
|
if (all) {
|
|
|
Object.keys(checkAll).forEach((k) => (checkAll[k] = false))
|
|
|
Object.keys(indeterminate).forEach((k) => (indeterminate[k] = false))
|
|
|
form.value.layersBig = []
|
|
|
- form.value.layersSmall = []
|
|
|
drawResult = null
|
|
|
queryResult = null
|
|
|
}
|
|
@@ -395,7 +248,6 @@ function handleStoreChecked() {
|
|
|
form: form.value,
|
|
|
checkAll,
|
|
|
lastBigLayers,
|
|
|
- lastSmallLayers,
|
|
|
drawResult,
|
|
|
queryResult,
|
|
|
})
|