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

66 lines
1.4 KiB
Vue

<template>
<div class="weighing-batches-view">
<GenericMonitorList
:fetchData="fetchWeighingBatches"
:columnsConfig="weighingBatchColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getWeighingBatches } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchWeighingBatches = async (params) => {
return await getWeighingBatches(params);
};
// 定义表格的列,依据 swagger.json
const weighingBatchColumns = [
{
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: '称重时间',
dataIndex: 'weighing_time',
key: 'weighing_time',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '描述',
dataIndex: 'description',
key: 'description',
minWidth: 250,
},
{
title: '创建时间',
dataIndex: 'created_at',
key: 'created_at',
sorter: true,
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>