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

93 lines
1.8 KiB
Vue

<template>
<div class="pig-purchases-view">
<GenericMonitorList
:fetchData="fetchPigPurchases"
:columnsConfig="pigPurchaseColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getPigPurchases } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchPigPurchases = async (params) => {
return await getPigPurchases(params);
};
// 定义表格的列,依据 swagger.json
const pigPurchaseColumns = [
{
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: 'supplier',
key: 'supplier',
filterType: 'text',
minWidth: 150,
},
{
title: '采购数量',
dataIndex: 'quantity',
key: 'quantity',
sorter: true,
minWidth: 120,
},
{
title: '单价',
dataIndex: 'unit_price',
key: 'unit_price',
sorter: true,
minWidth: 120,
},
{
title: '总价',
dataIndex: 'total_price',
key: 'total_price',
sorter: true,
minWidth: 120,
},
{
title: '采购日期',
dataIndex: 'purchase_date',
key: 'purchase_date',
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>