| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <template>
- <a-card>
- <a-row>
- <a-space>
- <a-col>
- <a-range-picker v-model:value="time" format="YYYY/MM/DD" />
- </a-col>
- <a-col>
- <a-button type="primary" @click="getTrackTaskList">搜索</a-button>
- </a-col>
- </a-space>
- </a-row>
- <a-table
- style="margin-top: 20px;"
- :columns="columns"
- :data-source="state.dataSource"
- :loading="state.loading"
- :pagination="queryParamsState"
- @change="changePage"
- >
- <template #bodyCell="{column, record}">
- <template v-if="column.key === 'ts'" >
- {{dayjs(record.ts).format('YYYY/MM/DD HH:mm:ss')}}
- </template>
- <template v-if="column.key === 'action'" >
- <a-space>
- <a @click="openModal('preview', record.id)" >详情</a>
- </a-space>
- </template>
- </template>
- </a-table>
- </a-card>
- <modal-pro
- style="width: 700px;overflow: hidden;"
- label="最终详情"
- :open="state.visable"
- @cancel="state.visable = false"
- @ok="state.visable = false"
- >
- </modal-pro>
- </template>
- <script lang='ts' setup >
- import { TaskController } from '@/controller/iot/task'
- import { onMounted, reactive, ref, watch } from 'vue'
- import dayjs from 'dayjs'
- const columns = [
- {
- title: '任务id',
- dataIndex: 'taskId'
- },
- {
- title: '执行时间',
- dataIndex: 'ts',
- key: 'ts'
- },
- {
- title: '任务参数',
- dataIndex: 'params',
- key: 'params'
- },
- {
- title: '任务结果',
- dataIndex: 'ret',
- key: 'ret'
- },
- {
- title: '操作',
- dataIndex: 'action',
- key: 'action'
- }
- ]
- const time = ref([])
- const queryParamsState = reactive({
- page: 1,
- pageSize: 10,
- start: '',
- end: '',
- taskId: ''
- })
- const state = reactive({
- taskList: [],
- dataSource: [],
- loading: false,
- visable: false,
- opraState: '',
- id: ''
- })
- watch(
- () => time.value,
- () => {
- if (time.value && time.value.length === 2) {
- queryParamsState.start = new Date(dayjs(time.value[0])).getTime()
- queryParamsState.end = new Date(dayjs(time.value[1])).getTime()
- } else {
- queryParamsState.start = ''
- queryParamsState.end = ''
- }
- },
- {
- deep: true
- }
- )
- const openModal = (opraState: 'preview', id: string) => {
- state.opraState = opraState
- state.id = id
- }
- const changePage = ({ current }) => {
- queryParamsState.page = current
- getTrackTaskList()
- }
- const getTrackTaskList = async () => {
- state.loading = true
- const { data } = await TaskController.trackTaskPage(queryParamsState)
- state.loading = false
- state.dataSource = data
- }
- onMounted(() => {
- getTrackTaskList()
- })
- </script>
- <style lang='less' scoped >
- </style>
|