cmc-web/webs/ams-web/src/views/data-collection/history/index.vue

93 lines
2.6 KiB
Vue
Raw Normal View History

2024-08-20 12:11:31 +00:00
<template>
2024-08-28 08:53:22 +00:00
<div>
2024-08-28 08:02:19 +00:00
<AmsPosition></AmsPosition>
2024-08-28 08:53:22 +00:00
<div class="warpper">
<history-detail v-if="detailDialog.visible" :dialog="detailDialog"></history-detail>
<cb-advance-table v-show="!detailDialog.visible" title="采集历史" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #name="name, record">
<span class="detail-href" @click="getDetail(record)">{{ name }}</span>
</template>
<template #status="status">
<cb-status-icon :type="taskExeStatusFilter(status, 'color')">
{{ taskExeStatusFilter(status) }}
</cb-status-icon>
</template>
<template #type="type">
<el-tag type="primary">{{ typeOptions[type] }}</el-tag>
</template>
</cb-advance-table>
</div>
2024-08-20 12:11:31 +00:00
</div>
</template>
<script lang="ts">
import { defineComponent, reactive, toRefs, ref } from 'vue'
import { useTable } from '@cmp/cmp-element'
import HistoryDetail from './HistoryDetail.vue'
import { getCollectionTasksInstances } from 'services/data-collection/history'
import { columns, searchConfigs } from './config'
import { taskExeStatusFilter } from '@/filters/index'
import { cloneDeep } from 'lodash-es'
import { useRoute } from '@cmp/cmp-core'
2024-08-28 08:50:02 +00:00
import usePostion from '@/views/usePosition'
2024-08-28 08:02:19 +00:00
import AmsPosition from '@/views/AmsPosition.vue'
2024-08-20 12:11:31 +00:00
export default defineComponent({
2024-08-28 08:02:19 +00:00
components: { HistoryDetail, AmsPosition },
2024-08-20 12:11:31 +00:00
setup(props, context: any) {
2024-08-28 08:02:19 +00:00
usePostion(() => getList())
2024-08-20 12:11:31 +00:00
const typeOptions = {
standard: '标准任务',
2024-08-21 01:17:14 +00:00
scheduled: '定时任务',
2024-08-20 12:11:31 +00:00
}
const { list, loading, params, getList, total } = useTable({
2024-08-21 01:17:14 +00:00
getService: getCollectionTasksInstances,
2024-08-20 12:11:31 +00:00
})
const state = reactive({
2024-08-21 01:17:14 +00:00
searchConfigs: cloneDeep(searchConfigs),
2024-08-20 12:11:31 +00:00
})
const detailDialog: any = reactive({
visible: false,
2024-08-21 01:17:14 +00:00
record: {},
2024-08-20 12:11:31 +00:00
})
const route = useRoute()
if (route.params && route.params.taskId) {
state.searchConfigs.push({
type: 'Const',
value: 'taskId',
2024-08-21 01:17:14 +00:00
initValue: route.params.taskId,
2024-08-20 12:11:31 +00:00
})
}
const getDetail = (record: any) => {
detailDialog.visible = true
detailDialog.record = record
}
return {
taskExeStatusFilter,
typeOptions,
columns,
list,
loading,
params,
total,
detailDialog,
getDetail,
getList,
2024-08-21 01:17:14 +00:00
...toRefs(state),
2024-08-20 12:11:31 +00:00
}
2024-08-21 01:17:14 +00:00
},
2024-08-20 12:11:31 +00:00
})
</script>
<style lang="scss" scoped>
.warpper {
height: calc(100vh - 100px);
background-color: #fff;
}
</style>