实现所有监控展示

This commit is contained in:
2025-10-20 16:31:16 +08:00
parent 0cddf99456
commit b1a8611554
18 changed files with 1539 additions and 21 deletions

View File

@@ -0,0 +1,92 @@
<template>
<div class="feed-usage-record-view">
<GenericMonitorList
:fetchData="fetchFeedUsageRecords"
:columnsConfig="feedUsageRecordColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getFeedUsageRecords } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchFeedUsageRecords = async (params) => {
return await getFeedUsageRecords(params);
};
// 定义表格的列配置
// 根据 swagger, 支持的筛选参数有: feed_formula_id, operator_id, pen_id, start_time, end_time
const feedUsageRecordColumns = [
{
title: '记录ID',
dataIndex: 'id',
key: 'id',
sorter: true,
minWidth: 100,
},
{
title: '用量(kg)',
dataIndex: 'amount',
key: 'amount',
sorter: true,
minWidth: 120,
},
{
title: '饲料配方',
dataIndex: ['feed_formula', 'name'], // 访问嵌套属性
key: 'feed_formula_name',
minWidth: 150,
},
{
title: '配方ID (筛选)',
dataIndex: 'feed_formula_id',
key: 'feed_formula_id',
filterType: 'number',
minWidth: 150,
},
{
title: '猪栏',
dataIndex: ['pen', 'name'], // 访问嵌套属性
key: 'pen_name',
minWidth: 120,
},
{
title: '猪栏ID (筛选)',
dataIndex: 'pen_id',
key: 'pen_id',
filterType: 'number',
minWidth: 150,
},
{
title: '操作员ID',
dataIndex: 'operator_id',
key: 'operator_id',
filterType: 'number',
minWidth: 120,
},
{
title: '记录时间',
dataIndex: 'recorded_at',
key: 'recorded_at',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '备注',
dataIndex: 'remarks',
key: 'remarks',
minWidth: 200,
},
];
</script>
<style scoped>
.feed-usage-record-view {
/* 视图容器样式 */
}
</style>

View File

@@ -0,0 +1,94 @@
<template>
<div class="medication-logs-view">
<GenericMonitorList
:fetchData="fetchMedicationLogs"
:columnsConfig="medicationLogColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getMedicationLogs } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchMedicationLogs = async (params) => {
return await getMedicationLogs(params);
};
// 定义表格的列,依据 swagger.json
const medicationLogColumns = [
{
title: '记录ID',
dataIndex: 'id',
key: 'id',
sorter: true,
minWidth: 100,
},
{
title: '药品名称',
dataIndex: ['medication', 'name'], // 嵌套属性
key: 'medication_name',
minWidth: 150,
},
{
title: '用量',
dataIndex: 'dosage_used',
key: 'dosage_used',
sorter: true,
minWidth: 100,
},
{
title: '目标数量',
dataIndex: 'target_count',
key: 'target_count',
minWidth: 100,
},
{
title: '原因',
dataIndex: 'reason',
key: 'reason',
filterType: 'select',
filterOptions: [
{ text: '预防', value: '预防' },
{ text: '治疗', value: '治疗' },
{ text: '保健', value: '保健' },
],
minWidth: 120,
},
{
title: '发生时间',
dataIndex: 'happened_at',
key: 'happened_at',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '猪批次ID',
dataIndex: 'pig_batch_id',
key: 'pig_batch_id',
filterType: 'number',
minWidth: 120,
},
{
title: '操作员ID',
dataIndex: 'operator_id',
key: 'operator_id',
filterType: 'number',
minWidth: 120,
},
{
title: '描述',
dataIndex: 'description',
key: 'description',
minWidth: 200,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View File

@@ -0,0 +1,70 @@
<template>
<div class="pending-collections-view">
<GenericMonitorList
:fetchData="fetchPendingCollections"
:columnsConfig="pendingCollectionColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getPendingCollections } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchPendingCollections = async (params) => {
return await getPendingCollections(params);
};
// 定义表格的列,依据 swagger.json
const pendingCollectionColumns = [
{
title: '关联ID',
dataIndex: 'correlation_id',
key: 'correlation_id',
minWidth: 300,
},
{
title: '设备ID',
dataIndex: 'device_id',
key: 'device_id',
sorter: true,
filterType: 'number',
minWidth: 120,
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
filterType: 'select',
filterOptions: [
{ text: '等待中', value: '等待中' },
{ text: '已完成', value: '已完成' },
{ text: '已超时', value: '已超时' },
],
minWidth: 120,
},
{
title: '创建时间',
dataIndex: 'created_at',
key: 'created_at',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '完成时间',
dataIndex: 'fulfilled_at',
key: 'fulfilled_at',
sorter: true,
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View File

@@ -0,0 +1,99 @@
<template>
<div class="pig-batch-logs-view">
<GenericMonitorList
:fetchData="fetchPigBatchLogs"
:columnsConfig="pigBatchLogColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getPigBatchLogs } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchPigBatchLogs = async (params) => {
return await getPigBatchLogs(params);
};
// 定义表格的列,依据 swagger.json
const pigBatchLogColumns = [
{
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: 'change_type',
key: 'change_type',
filterType: 'select',
filterOptions: [
{ text: '死亡', value: '死亡' },
{ text: '淘汰', value: '淘汰' },
{ text: '销售', value: '销售' },
{ text: '购买', value: '购买' },
{ text: '转入', value: '转入' },
{ text: '转出', value: '转出' },
{ text: '盘点校正', value: '盘点校正' },
],
minWidth: 120,
},
{
title: '变更数量',
dataIndex: 'change_count',
key: 'change_count',
sorter: true,
minWidth: 120,
},
{
title: '变更前数量',
dataIndex: 'before_count',
key: 'before_count',
minWidth: 120,
},
{
title: '变更后数量',
dataIndex: 'after_count',
key: 'after_count',
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: 'reason',
key: 'reason',
minWidth: 200,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View 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>

View File

@@ -0,0 +1,92 @@
<template>
<div class="pig-sales-view">
<GenericMonitorList
:fetchData="fetchPigSales"
:columnsConfig="pigSaleColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getPigSales } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchPigSales = async (params) => {
return await getPigSales(params);
};
// 定义表格的列,依据 swagger.json
const pigSaleColumns = [
{
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: 'buyer',
key: 'buyer',
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: 'sale_date',
key: 'sale_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>

View File

@@ -0,0 +1,106 @@
<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>

View File

@@ -0,0 +1,102 @@
<template>
<div class="pig-transfer-logs-view">
<GenericMonitorList
:fetchData="fetchPigTransferLogs"
:columnsConfig="pigTransferLogColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getPigTransferLogs } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchPigTransferLogs = async (params) => {
return await getPigTransferLogs(params);
};
// 定义表格的列,依据 swagger.json
const pigTransferLogColumns = [
{
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: 'type',
key: 'type',
filterType: 'select',
filterOptions: [
{ text: '群内调栏', value: '群内调栏' },
{ text: '跨群调栏', value: '跨群调栏' },
{ text: '销售', value: '销售' },
{ text: '死亡', value: '死亡' },
{ text: '淘汰', value: '淘汰' },
{ text: '新购入', value: '新购入' },
{ text: '产房转入', value: '产房转入' },
],
minWidth: 130,
},
{
title: '数量',
dataIndex: 'quantity',
key: 'quantity',
sorter: true,
minWidth: 100,
},
{
title: '迁移时间',
dataIndex: 'transfer_time',
key: 'transfer_time',
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: '关联ID',
dataIndex: 'correlation_id',
key: 'correlation_id',
filterType: 'text',
minWidth: 280,
},
{
title: '备注',
dataIndex: 'remarks',
key: 'remarks',
minWidth: 200,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View File

@@ -0,0 +1,79 @@
<template>
<div class="plan-execution-logs-view">
<GenericMonitorList
:fetchData="fetchPlanExecutionLogs"
:columnsConfig="planExecutionLogColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getPlanExecutionLogs } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchPlanExecutionLogs = async (params) => {
return await getPlanExecutionLogs(params);
};
// 定义表格的列,依据 swagger.json
const planExecutionLogColumns = [
{
title: '记录ID',
dataIndex: 'id',
key: 'id',
sorter: true,
minWidth: 100,
},
{
title: '计划ID',
dataIndex: 'plan_id',
key: 'plan_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
filterType: 'select',
filterOptions: [
{ text: '已开始', value: '已开始' },
{ text: '已完成', value: '已完成' },
{ text: '失败', value: '失败' },
{ text: '已取消', value: '已取消' },
{ text: '等待中', value: '等待中' },
],
minWidth: 120,
},
{
title: '开始时间',
dataIndex: 'started_at',
key: 'started_at',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '结束时间',
dataIndex: 'ended_at',
key: 'ended_at',
sorter: true,
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '错误信息',
dataIndex: 'error',
key: 'error',
minWidth: 250,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View File

@@ -0,0 +1,85 @@
<template>
<div class="raw-material-purchases-view">
<GenericMonitorList
:fetchData="fetchRawMaterialPurchases"
:columnsConfig="rawMaterialPurchaseColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getRawMaterialPurchases } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchRawMaterialPurchases = async (params) => {
return await getRawMaterialPurchases(params);
};
// 定义表格的列,依据 swagger.json
const rawMaterialPurchaseColumns = [
{
title: '采购ID',
dataIndex: 'id',
key: 'id',
sorter: true,
minWidth: 100,
},
{
title: '原料名称',
dataIndex: ['raw_material', 'name'], // 嵌套属性
key: 'raw_material_name',
minWidth: 150,
},
{
title: '原料ID',
dataIndex: 'raw_material_id',
key: 'raw_material_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '供应商',
dataIndex: 'supplier',
key: 'supplier',
filterType: 'text',
minWidth: 150,
},
{
title: '数量',
dataIndex: 'amount',
key: 'amount',
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,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View File

@@ -0,0 +1,87 @@
<template>
<div class="raw-material-stock-logs-view">
<GenericMonitorList
:fetchData="fetchRawMaterialStockLogs"
:columnsConfig="rawMaterialStockLogColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getRawMaterialStockLogs } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchRawMaterialStockLogs = async (params) => {
return await getRawMaterialStockLogs(params);
};
// 定义表格的列,依据 swagger.json
const rawMaterialStockLogColumns = [
{
title: '记录ID',
dataIndex: 'id',
key: 'id',
sorter: true,
minWidth: 100,
},
{
title: '原料ID',
dataIndex: 'raw_material_id',
key: 'raw_material_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '来源类型',
dataIndex: 'source_type',
key: 'source_type',
filterType: 'select',
filterOptions: [
{ text: '采购入库', value: '采购入库' },
{ text: '饲喂出库', value: '饲喂出库' },
{ text: '变质出库', value: '变质出库' },
{ text: '售卖出库', value: '售卖出库' },
{ text: '杂用领取', value: '杂用领取' },
{ text: '手动盘点', value: '手动盘点' },
],
minWidth: 130,
},
{
title: '来源ID',
dataIndex: 'source_id',
key: 'source_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '变更数量',
dataIndex: 'change_amount',
key: 'change_amount',
sorter: true,
minWidth: 120,
},
{
title: '发生时间',
dataIndex: 'happened_at',
key: 'happened_at',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '备注',
dataIndex: 'remarks',
key: 'remarks',
minWidth: 200,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View File

@@ -0,0 +1,72 @@
<template>
<div class="sensor-data-view">
<GenericMonitorList
:fetchData="fetchSensorData"
:columnsConfig="sensorDataColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getSensorData } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchSensorData = async (params) => {
return await getSensorData(params);
};
// 定义表格的列,依据 swagger.json
const sensorDataColumns = [
{
title: '设备ID',
dataIndex: 'device_id',
key: 'device_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '传感器类型',
dataIndex: 'sensor_type',
key: 'sensor_type',
filterType: 'select',
filterOptions: [
{ text: '信号强度', value: '信号强度' },
{ text: '电池电量', value: '电池电量' },
{ text: '温度', value: '温度' },
{ text: '湿度', value: '湿度' },
{ text: '重量', value: '重量' },
],
minWidth: 150,
},
{
title: '数据',
dataIndex: 'data',
key: 'data',
// 将数组格式化为逗号分隔的字符串
formatter: (row, column, cellValue) => Array.isArray(cellValue) ? cellValue.join(', ') : cellValue,
minWidth: 150,
},
{
title: '采集时间',
dataIndex: 'time',
key: 'time',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '区域主控ID',
dataIndex: 'regional_controller_id',
key: 'regional_controller_id',
minWidth: 120,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View File

@@ -0,0 +1,93 @@
<template>
<div class="task-execution-logs-view">
<GenericMonitorList
:fetchData="fetchTaskExecutionLogs"
:columnsConfig="taskExecutionLogColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getTaskExecutionLogs } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchTaskExecutionLogs = async (params) => {
return await getTaskExecutionLogs(params);
};
// 定义表格的列,依据 swagger.json
const taskExecutionLogColumns = [
{
title: '记录ID',
dataIndex: 'id',
key: 'id',
sorter: true,
minWidth: 100,
},
{
title: '任务ID',
dataIndex: 'task_id',
key: 'task_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '任务名称',
dataIndex: ['task', 'name'], // 嵌套属性
key: 'task_name',
minWidth: 150,
},
{
title: '计划执行ID',
dataIndex: 'plan_execution_log_id',
key: 'plan_execution_log_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
filterType: 'select',
filterOptions: [
{ text: '已开始', value: '已开始' },
{ text: '已完成', value: '已完成' },
{ text: '失败', value: '失败' },
{ text: '已取消', value: '已取消' },
{ text: '等待中', value: '等待中' },
],
minWidth: 120,
},
{
title: '开始时间',
dataIndex: 'started_at',
key: 'started_at',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '结束时间',
dataIndex: 'ended_at',
key: 'ended_at',
sorter: true,
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '输出',
dataIndex: 'output',
key: 'output',
minWidth: 250,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View File

@@ -0,0 +1,100 @@
<template>
<div class="user-action-logs-view">
<GenericMonitorList
:fetchData="fetchUserActionLogs"
:columnsConfig="userActionLogColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getUserActionLogs } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchUserActionLogs = async (params) => {
return await getUserActionLogs(params);
};
// 定义表格的列,依据 swagger.json
const userActionLogColumns = [
{
title: '记录ID',
dataIndex: 'id',
key: 'id',
sorter: true,
minWidth: 100,
},
{
title: '用户名',
dataIndex: 'username',
key: 'username',
filterType: 'text',
minWidth: 130,
},
{
title: '用户ID',
dataIndex: 'user_id',
key: 'user_id',
filterType: 'number',
sorter: true,
minWidth: 100,
},
{
title: '操作类型',
dataIndex: 'action_type',
key: 'action_type',
filterType: 'text',
minWidth: 130,
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
filterType: 'select',
filterOptions: [
{ text: '成功', value: '成功' },
{ text: '失败', value: '失败' },
],
minWidth: 100,
},
{
title: 'HTTP方法',
dataIndex: 'http_method',
key: 'http_method',
minWidth: 110,
},
{
title: 'HTTP路径',
dataIndex: 'http_path',
key: 'http_path',
minWidth: 250,
},
{
title: '来源IP',
dataIndex: 'source_ip',
key: 'source_ip',
minWidth: 150,
},
{
title: '操作时间',
dataIndex: 'time',
key: 'time',
sorter: true,
filterType: 'dateRange',
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
minWidth: 180,
},
{
title: '描述',
dataIndex: 'description',
key: 'description',
minWidth: 250,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>

View File

@@ -0,0 +1,65 @@
<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>

View File

@@ -0,0 +1,79 @@
<template>
<div class="weighing-records-view">
<GenericMonitorList
:fetchData="fetchWeighingRecords"
:columnsConfig="weighingRecordColumns"
/>
</div>
</template>
<script setup>
import GenericMonitorList from '../../components/GenericMonitorList.vue';
import { getWeighingRecords } from '../../api/monitor.js';
import { formatRFC3339 } from '../../utils/format.js';
// 适配通用组件的 fetchData prop
const fetchWeighingRecords = async (params) => {
return await getWeighingRecords(params);
};
// 定义表格的列,依据 swagger.json
const weighingRecordColumns = [
{
title: '记录ID',
dataIndex: 'id',
key: 'id',
sorter: true,
minWidth: 100,
},
{
title: '批次称重ID',
dataIndex: 'weighing_batch_id',
key: 'weighing_batch_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '猪栏ID',
dataIndex: 'pen_id',
key: 'pen_id',
filterType: 'number',
sorter: true,
minWidth: 120,
},
{
title: '重量',
dataIndex: 'weight',
key: 'weight',
sorter: true,
minWidth: 100,
},
{
title: '称重时间',
dataIndex: 'weighing_time',
key: 'weighing_time',
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: 'remark',
key: 'remark',
minWidth: 200,
},
];
</script>
<style scoped>
/* 视图容器样式 */
</style>