<template>
|
<div class="fy-card">
|
<div class="fy-h1">线索清单</div>
|
<div class="fy-flex-row">
|
<span>时间</span>
|
<el-date-picker
|
v-model="updateTime"
|
type="datetime"
|
placeholder="选择日期和时间"
|
/>
|
<el-button type="primary" @click="getClues">查询</el-button>
|
<el-button type="primary" @click="fetchRemoteClue" plain
|
>拉取线索</el-button
|
>
|
</div>
|
<el-scrollbar height="70vh" class="p-h-1">
|
<ClueList
|
:dataList="clueList"
|
@itemSelected="selectClue"
|
></ClueList>
|
</el-scrollbar>
|
</div>
|
</template>
|
|
<script setup>
|
import ClueList from './components/ClueList.vue';
|
|
import clueApi from '@/api/clue/clueApi';
|
import { onMapMounted } from '@/components/map/baseMap';
|
import moment from 'moment';
|
import { ref, onMounted } from 'vue';
|
|
const emits = defineEmits('itemSelected');
|
|
// 下发时间(每次查询大于此时间的数据)
|
const updateTime = ref();
|
// 线索清单
|
const clueList = ref([]);
|
|
/**
|
* 查询已下发的线索清单
|
*/
|
const getClues = function () {
|
let sTime;
|
let eTime;
|
if (updateTime.value) {
|
const now = moment(updateTime.value);
|
sTime = now.format('YYYY-MM-DD HH:mm:ss');
|
eTime = now.add(1, 'month').format('YYYY-MM-DD HH:mm:ss');
|
}
|
onMapMounted(() => {
|
clueApi.getClue({ sTime, eTime }).then((res) => {
|
clueList.value = res;
|
});
|
});
|
};
|
|
function fetchRemoteClue() {
|
const time = moment(updateTime.value).format('YYYY-MM-DD HH:mm:ss');
|
onMapMounted(() => {
|
clueApi.fetchRemoteClue(time).then((res) => {
|
clueList.value = res;
|
});
|
});
|
}
|
|
/**
|
* 选择线索事件
|
*/
|
const selectClue = function (clue) {
|
emits('itemSelected', clue);
|
};
|
|
onMounted(() => {
|
getClues();
|
});
|
</script>
|
<style scoped>
|
|
</style>
|