实现所有监控展示
This commit is contained in:
92
src/views/monitor/PigPurchasesView.vue
Normal file
92
src/views/monitor/PigPurchasesView.vue
Normal file
@@ -0,0 +1,92 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user