Files
pig-farm-controller-fe/src/views/monitor/PigSickLogsView.vue
2025-10-20 16:31:16 +08:00

107 lines
2.3 KiB
Vue

<template>
<div class="pig-sick-logs-view">
<GenericMonitorList
:fetchData="fetchPigSickLogs"
:columnsConfig="pigSickLogColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getPigSickLogs } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchPigSickLogs = async (params) => {
return await getPigSickLogs(params);
};
// 定义表格的列,依据 swagger.json
const pigSickLogColumns = [
{
title: '记录ID',
dataIndex: 'id',
key: 'id',
sorter: true,
minWidth: 100,
},
{
title: '猪批次ID',
dataIndex: 'pig_batch_id',
key: 'pig_batch_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '猪栏ID',
dataIndex: 'pen_id',
key: 'pen_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '原因',
dataIndex: 'reason',
key: 'reason',
filterType: 'select',
filterOptions: [
{ text: '患病', value: '患病' },
{ text: '康复', value: '康复' },
{ text: '死亡', value: '死亡' },
{ text: '淘汰', value: '淘汰' },
{ text: '转入', value: '转入' },
{ text: '转出', value: '转出' },
{ text: '其他', value: '其他' },
],
minWidth: 120,
},
{
title: '治疗地点',
dataIndex: 'treatment_location',
key: 'treatment_location',
filterType: 'select',
filterOptions: [
{ text: '原地治疗', value: '原地治疗' },
{ text: '病猪栏治疗', value: '病猪栏治疗' },
],
minWidth: 130,
},
{
title: '变更数量',
dataIndex: 'change_count',
key: 'change_count',
sorter: true,
minWidth: 120,
},
{
title: '发生时间',
dataIndex: 'happened_at',
key: 'happened_at',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '操作员ID',
dataIndex: 'operator_id',
key: 'operator_id',
filterType: 'number',
minWidth: 120,
},
{
title: '备注',
dataIndex: 'remarks',
key: 'remarks',
minWidth: 200,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>