This commit is contained in:
glj 2023-06-09 17:58:57 +08:00
commit c67287b910
3 changed files with 50 additions and 19 deletions

View File

@ -57,16 +57,15 @@ export const Session = {
window.sessionStorage.setItem(Local.setKey(key), JSON.stringify({data:val,time:curTime}));
},
//如果缓存过期则返回null
getEx(key,time = 6*60*1000) {
getEx(key,time = false) {
let data = window.sessionStorage.getItem(Local.setKey(key));
let dataObj = JSON.parse(data);
//如果dataObj为null表示该数据从未设置过期时间
if (dataObj == null) {
return null;
}
if (new Date().getTime() - dataObj.time > time) {
window.sessionStorage.removeItem(Local.setKey(key));
return null;
if (time) {
return dataObj;
} else {
return dataObj.data;
}

View File

@ -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.switchtrue landsatSentinel
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)
}
}
@ -298,8 +313,8 @@ const clearCoordinate = () => {
return;
}
state.coordinateList = [];
state.startTime = '';
state.endTime = '';
// state.startTime = '';
// state.endTime = '';
state.addCoord = false
map.value.mapOperations.deleteRectangle()
map.value.mapOperations.off("click", onMapClick)
@ -308,7 +323,6 @@ const clearCoordinate = () => {
//
const editCoordinate = () => {
}
//
const startCrawl = () => {
if (!state.startTime) {
@ -371,10 +385,16 @@ const startCrawl = () => {
var typeStr=typeArr.join('、')
// getData();
ElMessage({
message: 'Successfully launched '+typeStr+' crawler',
type: 'success',
})
//使
ElMessageBox.confirm('The '+typeStr+' data has been crawled, do you want to stay on this page?', 'Prompt', {
confirmButtonText: 'Stay',
cancelButtonText: 'Return to the list',
type: 'warning'
}).then(() => {
}).catch(() => {
emit('response')
});
})
})
}
@ -400,10 +420,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

View File

@ -1,6 +1,5 @@
<template>
<div class="system-role-container layout-padding">
<el-config-provider :locale="en">
<el-row :gutter="22">
<el-col :span="10">
<div class="system-role-padding layout-padding-auto layout-padding-view" style="height: 85vh;">
@ -81,7 +80,6 @@
</div>
</el-col>
</el-row>
</el-config-provider>
<RoleDialog ref="roleDialogRef" @refresh="getTableData()" />
<HotspotForm ref="hotspotRef" @callback="getTableData" />
<WordClouds ref="wordCloudsRef" @callback="getTableData" />
@ -91,13 +89,11 @@
</template>
<script lang="ts" setup name="systemRole">
import type { TabsPaneContext } from 'element-plus';
import HotspotForm from './component/hotspotForm.vue';
import WordClouds from './component/wordCloudForm.vue';
import EditHotspotForm from './component/editHotspotForm.vue';
import EditWordCloudsForm from './component/editWordCloudForm.vue';
import { getWordClouds, getHotspot, getDisasterPage, delData } from '/@/api/data/visualData.js';
import en from 'element-plus/dist/locale/en.mjs'
const activeName = ref('first');
const hotspotRef = ref();
const wordCloudsRef = ref();
@ -108,7 +104,6 @@ const editWordCloudsRef = ref();
import { defineAsyncComponent, reactive, onMounted, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import disasterTable from "/@/components/table/DisasterTable.vue";
import { ta } from 'element-plus/es/locale';
import { landsat, submit } from '/@/api/crawl/index.js'
import { useUserInfo } from '/@/stores/userInfo';