ny
昨天 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<script lang="ts" setup>
import type { BasicColumn } from '@jnpf/ui/vxeTable';
 
import { reactive, ref } from 'vue';
 
import { BasicPopup, usePopupInner } from '@jnpf/ui/popup';
import { BasicVxeTable, useVxeTable } from '@jnpf/ui/vxeTable';
 
import dayjs from 'dayjs';
 
import { getTaskLogList } from '#/api/system/task';
 
const id = ref('');
const title = ref('');
const [registerPopup] = usePopupInner(init);
const columns: BasicColumn[] = [
  { title: '执行时间', dataIndex: 'runTime', width: 150, format: 'date|YYYY-MM-DD HH:mm:ss' },
  { title: '执行结果', dataIndex: 'runResult', width: 100, slots: { default: 'runResult' } },
  { title: '执行说明', dataIndex: 'description' },
];
const searchInfo = reactive({
  id: id.value,
});
const [registerTable, { reload: reloadTable }] = useVxeTable({
  api: getTaskLogList,
  columns,
  useSearchForm: true,
  showTableSetting: false,
  formConfig: {
    schemas: [
      {
        field: 'pickerVal',
        label: '执行时间',
        component: 'DateRange',
        componentProps: {
          format: 'YYYY-MM-DD HH:mm:ss',
          showTime: { defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('23:59:59', 'HH:mm:ss')] },
          placeholder: ['开始时间', '结束时间'],
        },
      },
      {
        field: 'runResult',
        label: '执行结果',
        component: 'Select',
        componentProps: {
          placeholder: '请选择执行结果',
          options: [
            { fullName: '成功', id: 0 },
            { fullName: '失败', id: 1 },
          ],
        },
      },
    ],
    fieldMapToTime: [['pickerVal', ['startTime', 'endTime']]],
  },
  immediate: false,
});
 
function init(data) {
  id.value = data.id;
  title.value = data.title || '查看详情';
  searchInfo.id = id.value;
  reloadTable({ page: 1 });
}
</script>
<template>
  <BasicPopup v-bind="$attrs" @register="registerPopup" :title="title" class="full-popup">
    <BasicVxeTable @register="registerTable" :search-info="searchInfo">
      <template #runResult="{ record }">
        <a-tag :color="record.runResult == 0 ? 'success' : 'error'">{{ record.runResult == 0 ? '成功' : '失败' }}</a-tag>
      </template>
    </BasicVxeTable>
  </BasicPopup>
</template>