refactor (views/feed) 完善配料清单和饲喂量统计页面

+ 修改了配料清单和饲喂量统计页面的部分页面逻辑
This commit is contained in:
HashMap 2025-08-26 12:18:28 +08:00
parent e7a0c1d274
commit a28829840c
2 changed files with 30 additions and 12 deletions

View File

@ -19,9 +19,9 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['feed:FeedList:add']">新增</el-button> <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['feed:FeedList:add']">新增</el-button>
</el-col> </el-col> -->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate" <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
v-hasPermi="['feed:FeedList:edit']">修改</el-button> v-hasPermi="['feed:FeedList:edit']">修改</el-button>
@ -49,11 +49,11 @@
<span>{{ scope.row.rootPlan ? parseTime(scope.row.rootPlan.planDate, '{y}-{m}-{d}') : '' }}</span> <span>{{ scope.row.rootPlan ? parseTime(scope.row.rootPlan.planDate, '{y}-{m}-{d}') : '' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="配料日期" align="center" prop="deployDate" width="180"> <!-- <el-table-column label="配料日期" align="center" prop="deployDate" width="180">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.deployDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.deployDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" icon="View" @click="handleView(scope.row)">详情</el-button> <el-button link type="primary" icon="View" @click="handleView(scope.row)">详情</el-button>
@ -75,11 +75,11 @@
<el-form-item label="饲草班人员" prop="zookeeper"> <el-form-item label="饲草班人员" prop="zookeeper">
<el-input v-model="form.zookeeper" placeholder="请输入饲草班人员名称" /> <el-input v-model="form.zookeeper" placeholder="请输入饲草班人员名称" />
</el-form-item> </el-form-item>
<el-form-item label="配料日期" prop="deployDate"> <!-- <el-form-item label="配料日期" prop="deployDate">
<el-date-picker clearable v-model="form.deployDate" type="date" value-format="YYYY-MM-DD" <el-date-picker clearable v-model="form.deployDate" type="date" value-format="YYYY-MM-DD"
placeholder="请选择配料日期"> placeholder="请选择配料日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item> -->
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -102,7 +102,7 @@
<el-divider content-position="left">配料列表</el-divider> <el-divider content-position="left">配料列表</el-divider>
<el-table :data="showFeedList.formulaList" stripe border style="width: 100%" max-height="300"> <el-table :data="showFeedList.rootFormula.sgFormulaList" stripe border style="width: 100%" max-height="300">
<el-table-column label="序号" type="index" width="60" align="center" /> <el-table-column label="序号" type="index" width="60" align="center" />
<!-- <el-table-column label="原料编号" prop="materialId" align="center" /> --> <!-- <el-table-column label="原料编号" prop="materialId" align="center" /> -->
<el-table-column label="原料" align="center"> <el-table-column label="原料" align="center">
@ -186,6 +186,7 @@
openModel.value = "view" openModel.value = "view"
title.value = "配料清单详情" title.value = "配料清单详情"
console.log("查看配料清单", row) console.log("查看配料清单", row)
console.log("HandView", showFeedList.value)
} }
/** 查询配料清单列表 */ /** 查询配料清单列表 */

View File

@ -35,7 +35,7 @@
<el-table v-loading="loading" :data="FeedStatisticList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="FeedStatisticList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="UUID" align="center" prop="id" /> <el-table-column label="UID" align="center" prop="id" />
<el-table-column label="配方编号" align="center" prop="formulaId" /> <el-table-column label="配方编号" align="center" prop="formulaId" />
<el-table-column label="配方批号" align="center" prop="formulaBatchId" /> <el-table-column label="配方批号" align="center" prop="formulaBatchId" />
<el-table-column label="羊只数量" align="center" prop="sheepFoldCount" /> <el-table-column label="羊只数量" align="center" prop="sheepFoldCount" />
@ -93,7 +93,7 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="日期" prop="planDate"> <el-form-item label="日期" prop="planDate">
<el-date-picker clearable v-model="showFeedStatistic.feedDate" type="date" value-format="YYYY-MM-DD" <el-date-picker clearable v-model="showFeedStatistic.feedDate" type="date" value-format="YYYY-MM-DD"
placeholder="请选择时间"> placeholder="请选择时间" @change="handleDeployDateChange(showFeedStatistic, $event)">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -102,7 +102,11 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" icon="Plus" @click="handleAddMaterial()">添加</el-button> <el-button type="primary" icon="Plus" @click="handleAddMaterial()"
:disabled="
showFeedStatistic.feedDate == null
|| showFeedStatistic.formulaId === null
|| showFeedStatistic.formulaBatchId == null">添加</el-button>
</el-col> </el-col>
</el-row> </el-row>
@ -152,7 +156,11 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" icon="Plus" @click="handleAddSheep()">添加</el-button> <el-button type="primary" icon="Plus" @click="handleAddSheep()"
:disabled ="
showFeedStatistic.feedDate == null
|| showFeedStatistic.formulaId == null
|| showFeedStatistic.formulaBatchId == null">添加</el-button>
</el-col> </el-col>
<el-table :data="showFeedStatistic.sheepFoldList" :rules="rules" <el-table :data="showFeedStatistic.sheepFoldList" :rules="rules"
@ -231,6 +239,7 @@
const openModel = ref('') const openModel = ref('')
// //
const isEdit = ref(true) const isEdit = ref(true)
const showFeedStatistic = ref({}) const showFeedStatistic = ref({})
// //
@ -362,9 +371,10 @@
// & // &
function handleFormulaBatchIdChange(row, $event) { function handleFormulaBatchIdChange(row, $event) {
if (row.formulaId && row.formulaBatchId) { if (row.formulaId && row.formulaBatchId && row.feedDate) {
queryParams.value.formulaId = row.formulaId queryParams.value.formulaId = row.formulaId
queryParams.value.formulaBatchId = row.formulaBatchId queryParams.value.formulaBatchId = row.formulaBatchId
queryParams.value.feedDate = row.feedDate
queryParams.value.id = null // ID queryParams.value.id = null // ID
// console.log("", queryParams.value) // console.log("", queryParams.value)
initFeedStatistic(queryParams.value).then(response => { initFeedStatistic(queryParams.value).then(response => {
@ -374,6 +384,13 @@
}) })
} }
} }
function handleDeployDateChange(showFeedStatistic, event) {
//
if (showFeedStatistic.feedDate) {
handleFormulaBatchIdChange(showFeedStatistic, event);
}
}
// //
function handleMaterialView(row) { function handleMaterialView(row) {
showFeedStatistic.value = row showFeedStatistic.value = row