首页添加今日图斑及历史图斑

main
zhufu 2025-06-27 16:23:51 +08:00
parent 40954971e9
commit 84440238f4
1 changed files with 36 additions and 3 deletions

View File

@ -20,6 +20,12 @@
<div class="home-button" @click="handlerInitialize"> <div class="home-button" @click="handlerInitialize">
</div> </div>
<div :class="`switch-button ${showTodayType === 1? 'switch-button-active': ''}`" style="margin-top: 20px;" @click="showToday(1)">
<span>&nbsp;最新图斑</span>
</div>
<div :class="`switch-button ${showTodayType === 0? 'switch-button-active': ''}`" style="margin-top: 10px;" @click="showToday(0)">
<span>&nbsp;历史图斑</span>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -42,6 +48,13 @@
const { VITE_GLOB_YINGXIANG_SERVER, VITE_GLOB_YAOGANYINGXIANG_SERVER } = getAppEnvConfig(); const { VITE_GLOB_YINGXIANG_SERVER, VITE_GLOB_YAOGANYINGXIANG_SERVER } = getAppEnvConfig();
const networkType = ref("WAN"); const networkType = ref("WAN");
const showTodayType = ref<null | number>(null)
const handlerLoadPolygonAttr = ref({
code: '',
filter:'',
type:'',
level:'',
})
// //
@ -250,11 +263,14 @@
} }
function handlerLoadPolygon(code = '', filter = '', type = '', level = '') { function handlerLoadPolygon(code = '', filter = '', type = '', level = '') {
handlerLoadPolygonAttr.value = {
code,filter,type,level,
}
let sql_filter; let sql_filter;
let map_filter; let map_filter;
let type_filter; let type_filter;
let table_filter = layerSettings.value.tablename; let table_filter = layerSettings.value.tablename;
let field_filter = '&field="gid","tubantype","Id",'; let field_filter = '&field="gid","tubantype","Id","is_today",';
let color_filter: any = []; let color_filter: any = [];
if (code) { if (code) {
sql_filter = '&filter="countyid"=\'' + code + "'"; sql_filter = '&filter="countyid"=\'' + code + "'";
@ -289,7 +305,13 @@
} else if (!filter && type) { } else if (!filter && type) {
map_filter = ['all', ['!=', ['get', 'gid'], 0], type_filter]; map_filter = ['all', ['!=', ['get', 'gid'], 0], type_filter];
} }
if(showTodayType.value !== null){
if(map_filter[0] == 'all'){
map_filter.push(['==', ['get', 'is_today'], showTodayType.value])
}else{
map_filter = ['all',map_filter,['==', ['get', 'is_today'], showTodayType.value]]
}
}
if (map.getSource('historyLayerLine')) { if (map.getSource('historyLayerLine')) {
polygonVisibility.value = map.getLayoutProperty('historyLayerLine', 'visibility'); polygonVisibility.value = map.getLayoutProperty('historyLayerLine', 'visibility');
map.removeLayer('historyLayerLine'); map.removeLayer('historyLayerLine');
@ -307,7 +329,6 @@
localStorage.getItem('userid') + localStorage.getItem('userid') +
')'; ')';
} }
map.addLayer({ map.addLayer({
id: 'historyLayerLine', id: 'historyLayerLine',
type: 'line', type: 'line',
@ -1146,6 +1167,15 @@
}); });
tifLayers.value = []; tifLayers.value = [];
} }
const showToday = (value) => {
if(showTodayType.value === value){
showTodayType.value = null
}else{
showTodayType.value = value
}
const { code, filter, type, level } = handlerLoadPolygonAttr.value;
handlerLoadPolygon(code, filter, type, level);
}
</script> </script>
<style type="less" scoped> <style type="less" scoped>
.map-container { .map-container {
@ -1183,6 +1213,9 @@
background: url(/map/change-view-btn.png); background: url(/map/change-view-btn.png);
background-size: 100% 100%; background-size: 100% 100%;
} }
.map-type-switch-container .switch-button-active {
color: yellow;
}
.map-type-switch-container .switch-button span { .map-type-switch-container .switch-button span {
font-size: 14px; font-size: 14px;