diff --git a/src/views/dataService/remoteSensingData/components/searchCondition.vue b/src/views/dataService/remoteSensingData/components/searchCondition.vue index 8d5438d..72e0634 100644 --- a/src/views/dataService/remoteSensingData/components/searchCondition.vue +++ b/src/views/dataService/remoteSensingData/components/searchCondition.vue @@ -201,7 +201,9 @@ const state = reactive({ lon: '', disLat: '', disLon: '', - data: {} + data: {}, + data2:[], + geometry: null, }) //获取所有卫星类型 onMounted(() => { @@ -209,7 +211,17 @@ onMounted(() => { let data = res.map(item=>{ return {value:item.dictValue,label:item.dictValue} }) - state.sensor = data; + state.data2=data; + //初始化加载根据state.switch判断,当时true的时候加载 landsat、Sentinel。否者加载出这两个以外所有内容 + if(state.switch){ + state.sensor=state.data2.filter(item=>{ + return item.value=='landsat'||item.value=='sentinel' + }) + }else{ + state.sensor=state.data2.filter(item=>{ + return item.value!='landsat'&&item.value!='sentinel' + }) + } state.dictData = res; }) }) @@ -282,9 +294,12 @@ const addCoordinate = () => { document.getElementsByClassName('coordinateBtn')[0].innerText = 'Add coordinates'; } }else{ + map.value.mapOperations.drawCreated() + map.value.mapOperations.off("click", onMapClick) map.value.mapOperations.drawPolygon() - map.value.mapOperations.drawCreated() + map.value.mapOperations.wktParseToMap(state.geometry) + } } @@ -400,10 +415,27 @@ watch( }, { immediate: true } ) +//监听state.switch +watch( + () => state.switch, + (newValue, oldValue) => { + if(newValue){ + state.sensor=state.data2.filter(item=>{ + return item.value=='landsat'||item.value=='sentinel' + }) + }else{ + state.sensor=state.data2.filter(item=>{ + return item.value!='landsat'&&item.value!='sentinel' + }) + } + }, + { immediate: true } +) const setData = (row) => { state.data = row; state.selectID = row.disasterId map.value.mapOperations.wktParseToMap(row.geometry) + state.geometry = row.geometry; } defineExpose({ setData