|
@@ -240,53 +240,53 @@ function toggleSingleLayer(data, show = true) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-let timer_handleLayering
|
|
|
+// let timer_handleLayering
|
|
|
let lastBigLayers = []
|
|
|
let lastSmallLayers = []
|
|
|
function handleLayering() {
|
|
|
- if (timer_handleLayering) {
|
|
|
- clearTimeout(timer_handleLayering)
|
|
|
+ // if (timer_handleLayering) {
|
|
|
+ // clearTimeout(timer_handleLayering)
|
|
|
+ // }
|
|
|
+ // timer_handleLayering = setTimeout(() => {
|
|
|
+ const { layeringType, layersBig, layersSmall, 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)
|
|
|
+ } else if (!layersBig.includes(i.value) && lastBigLayers.includes(i.value)) {
|
|
|
+ toggleSingleLayer({ ...i }, false)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ 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))
|
|
|
}
|
|
|
- timer_handleLayering = setTimeout(() => {
|
|
|
- const { layeringType, layersBig, layersSmall, 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)
|
|
|
- } else if (!layersBig.includes(i.value) && lastBigLayers.includes(i.value)) {
|
|
|
- toggleSingleLayer({ ...i }, false)
|
|
|
- }
|
|
|
- })
|
|
|
- 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)
|
|
|
+ // }, 1000)
|
|
|
}
|
|
|
|
|
|
const layersListBig = [
|
|
@@ -386,6 +386,7 @@ function clearAll(all = false) {
|
|
|
Object.keys(indeterminate).forEach((k) => (indeterminate[k] = false))
|
|
|
form.value.layersBig = []
|
|
|
form.value.layersSmall = []
|
|
|
+ form.value.range = null
|
|
|
drawResult = null
|
|
|
queryResult = null
|
|
|
}
|