Compare commits
No commits in common. "3dc635421e9be732e177ffb3cf773056377f9ad0" and "c6ab4a7a607c5ba2226dc6804a7364103d864fa4" have entirely different histories.
3dc635421e
...
c6ab4a7a60
@ -2,10 +2,36 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="配方编码" prop="formulaId">
|
<el-form-item label="配方编码" prop="formulaId">
|
||||||
<el-input v-model="queryParams.formulaId" placeholder="请输入配方编码" clearable @keyup.enter="handleQuery" />
|
<el-input
|
||||||
|
v-model="queryParams.formulaId"
|
||||||
|
placeholder="请输入配方编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="羊舍" prop="sheepHouseId">
|
<el-form-item label="羊舍" prop="sheepHouseId">
|
||||||
<el-input v-model="queryParams.sheepHouseId" placeholder="请输入羊舍" clearable @keyup.enter="handleQuery" />
|
<el-input
|
||||||
|
v-model="queryParams.sheepHouseId"
|
||||||
|
placeholder="请输入羊舍"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲草班人员" prop="zookeeper">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.zookeeper"
|
||||||
|
placeholder="请输入饲草班人员"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲喂计划日期" prop="planDate">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.planDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择饲喂计划日期">
|
||||||
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
@ -15,19 +41,42 @@
|
|||||||
|
|
||||||
<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:FeedPlan:add']">新增</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['feed:FeedPlan: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
|
||||||
v-hasPermi="['feed:FeedPlan:edit']">修改</el-button>
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['feed:FeedPlan:edit']"
|
||||||
|
>修改</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
<el-button
|
||||||
v-hasPermi="['feed:FeedPlan:remove']">删除</el-button>
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['feed:FeedPlan:remove']"
|
||||||
|
>删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
<el-button
|
||||||
v-hasPermi="['feed:FeedPlan:export']">导出</el-button>
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['feed:FeedPlan:export']"
|
||||||
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -36,48 +85,25 @@
|
|||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="创建日期" align="center" prop="createDate" />
|
<el-table-column label="创建日期" align="center" prop="createDate" />
|
||||||
<el-table-column label="配方编码" align="center" prop="formulaId" />
|
<el-table-column label="配方编码" align="center" prop="formulaId" />
|
||||||
<el-table-column label="批号" align="center" prop="batchId" />
|
|
||||||
<el-table-column label="羊舍" align="center" prop="sheepHouseId">
|
<el-table-column label="羊舍" align="center" prop="sheepHouseId">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ getSheepHouseName(scope.row.sheepHouseId) }}
|
<dict-tag :options="sheep_house_list" :value="scope.row.sheepHouseId"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="羊只数量" align="center" prop="sheepCount" />
|
<el-table-column label="羊只数量" align="center" prop="sheepCount" />
|
||||||
<el-table-column label="日均计划量" align="center" prop="planDailySize" />
|
<el-table-column label="日均计划量" align="center" prop="planDailySize" />
|
||||||
<el-table-column label="上午" prop="materialId" align="center">
|
<el-table-column label="计划量(早)" align="center" prop="planMorningSize" />
|
||||||
<el-table-column label="计划量" align="center" prop="planMorningSize">
|
<el-table-column label="计划总量(早)" align="center" prop="planMorningTotal" />
|
||||||
<template #default="{ row }">
|
<el-table-column label="饲喂比例(早)" align="center" prop="ratioMorning" />
|
||||||
{{ row.planMorningSize ? row.planMorningSize.toFixed(2) : '0.00' }}
|
<el-table-column label="实际量(早)" align="center" prop="actualMorningSize" />
|
||||||
</template>
|
<el-table-column label="计划量(中)" align="center" prop="planNoonSize" />
|
||||||
</el-table-column>
|
<el-table-column label="计划总量(中)" align="center" prop="planNoonTotal" />
|
||||||
<!-- <el-table-column label="计划总量" align="center" prop="planMorningTotal" /> -->
|
<el-table-column label="实际量(中)" align="center" prop="actualNoonSize" />
|
||||||
<el-table-column label="实际量" align="center" prop="actualMorningSize" />
|
<el-table-column label="饲喂比例(中)" align="center" prop="ratioNoon" />
|
||||||
</el-table-column>
|
<el-table-column label="计划量(下)" align="center" prop="planAfternoonSize" />
|
||||||
<el-table-column label="中午" prop="materialId" align="center">
|
<el-table-column label="计划总量(下)" align="center" prop="planAfternoonTotal" />
|
||||||
<el-table-column label="计划量" align="center" prop="planNoonSize">
|
<el-table-column label="实际量(下)" align="center" prop="actualAfternoonSize" />
|
||||||
<template #default="{ row }">
|
<el-table-column label="饲喂比例(下)" align="center" prop="ratioAfternoon" />
|
||||||
{{ row.planNoonSize ? row.planNoonSize.toFixed(2) : '0.00' }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<!-- <el-table-column label="计划总量" align="center" prop="planNoonTotal" /> -->
|
|
||||||
<el-table-column label="实际量" align="center" prop="actualNoonSize" />
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="下午" prop="materialId" align="center">
|
|
||||||
<el-table-column label="计划量" align="center" prop="planAfternoonSize">
|
|
||||||
<template #default="{ row }">
|
|
||||||
{{ row.planAfternoonSize ? row.planAfternoonSize.toFixed(2) : '0.00' }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<!-- <el-table-column label="计划总量" align="center" prop="planAfternoonTotal" /> -->
|
|
||||||
<el-table-column label="实际量" align="center" prop="actualAfternoonSize" />
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="饲喂比例(%)" align="center" prop="ratioTotal">
|
|
||||||
<el-table-column label="上午" align="center" prop="ratioMorning" />
|
|
||||||
<el-table-column label="中午" align="center" prop="ratioNoon" />
|
|
||||||
<el-table-column label="下午" align="center" prop="ratioAfternoon" />
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="计划饲喂总量" align="center" prop="planFeedTotal" />
|
<el-table-column label="计划饲喂总量" align="center" prop="planFeedTotal" />
|
||||||
<el-table-column label="饲草班人员" align="center" prop="zookeeper" />
|
<el-table-column label="饲草班人员" align="center" prop="zookeeper" />
|
||||||
<el-table-column label="饲喂计划日期" align="center" prop="planDate" width="180">
|
<el-table-column label="饲喂计划日期" align="center" prop="planDate" width="180">
|
||||||
@ -88,67 +114,64 @@
|
|||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<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="Edit" @click="handleUpdate(scope.row)"
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['feed:FeedPlan:edit']">修改</el-button>
|
||||||
v-hasPermi="['feed:FeedPlan:edit']">修改</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['feed:FeedPlan:remove']">删除</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['feed:FeedPlan:remove']">删除</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
<pagination
|
||||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改饲喂计划对话框 -->
|
<!-- 添加或修改饲喂计划对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
<el-form ref="FeedPlanRef" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="FeedPlanRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="配方编码" prop="formulaId">
|
<el-form-item label="配方编码" prop="formulaId">
|
||||||
<!-- <el-input v-model="form.formulaId" placeholder="请输入配方编码" /> -->
|
<el-input v-model="form.formulaId" placeholder="请输入配方编码" />
|
||||||
<el-select v-model="form.formulaId" filterable placeholder="请选择配方编码" style="width: 100%"
|
|
||||||
@change="handleFormulaIdChange(form, $event)">
|
|
||||||
<el-option v-for="item in formulaIdDict" :key="item.value" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="批号" prop="batchId">
|
|
||||||
<!-- <el-input v-model="form.batchId" placeholder="请输入批号" /> -->
|
|
||||||
<el-select v-model="form.batchId" filterable placeholder="请选择配方批号" style="width: 100%">
|
|
||||||
<el-option v-for="item in formulaBatchDict" :key="item.value" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="羊舍" prop="sheepHouseId">
|
<el-form-item label="羊舍" prop="sheepHouseId">
|
||||||
<!-- <el-input v-model="form.sheepHouseId" placeholder="请输入羊舍" /> -->
|
<el-input v-model="form.sheepHouseId" placeholder="请输入羊舍" />
|
||||||
<el-select v-model="form.sheepHouseId" filterable placeholder="请选择羊舍" style="width: 100%">
|
|
||||||
<el-option v-for="item in sheepFolderDict" :key="item.value" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="日均计划量" prop="planDailySize">
|
<el-form-item label="日均计划量" prop="planDailySize">
|
||||||
<el-input v-model="form.planDailySize" placeholder="请输入日均计划量" />
|
<el-input v-model="form.planDailySize" placeholder="请输入日均计划量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="比例 (%)">
|
<el-form-item label="饲喂比例(早)" prop="ratioMorning">
|
||||||
<div style="display: flex; gap: 10px;">
|
<el-input v-model="form.ratioMorning" placeholder="请输入饲喂比例(早)" />
|
||||||
<el-input v-model="form.ratioMorning" placeholder="早上比例" style="width: 100px;" />
|
|
||||||
<el-input v-model="form.ratioNoon" placeholder="中午比例" style="width: 100px;" />
|
|
||||||
<el-input v-model="form.ratioAfternoon" placeholder="下午比例" style="width: 100px;" />
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="饲草班人员" prop="Zookeeper">
|
<el-form-item label="实际量(早)" prop="actualMorningSize">
|
||||||
|
<el-input v-model="form.actualMorningSize" placeholder="请输入实际量(早)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="实际量(中)" prop="actualNoonSize">
|
||||||
|
<el-input v-model="form.actualNoonSize" placeholder="请输入实际量(中)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲喂比例(中)" prop="ratioNoon">
|
||||||
|
<el-input v-model="form.ratioNoon" placeholder="请输入饲喂比例(中)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="实际量(下)" prop="actualAfternoonSize">
|
||||||
|
<el-input v-model="form.actualAfternoonSize" placeholder="请输入实际量(下)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲喂比例(下)" prop="ratioAfternoon">
|
||||||
|
<el-input v-model="form.ratioAfternoon" placeholder="请输入饲喂比例(下)" />
|
||||||
|
</el-form-item>
|
||||||
|
<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="planDate">
|
<el-form-item label="饲喂计划日期" prop="planDate">
|
||||||
<el-date-picker clearable v-model="form.planDate" type="date" value-format="YYYY-MM-DD"
|
<el-date-picker clearable
|
||||||
placeholder="请选择计划饲喂时间">
|
v-model="form.planDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择饲喂计划日期">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div v-if="title === '修改饲喂计划'">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-divider content-position="left">配方详情</el-divider>
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
<el-form-item label="实际饲喂量">
|
</el-form-item>
|
||||||
<div style="display: flex; gap: 10px;">
|
|
||||||
<el-input v-model="form.actualMorningSize" placeholder="早上" style="width: 100px;" />
|
|
||||||
<el-input v-model="form.actualNoonSize" placeholder="中午" style="width: 100px;" />
|
|
||||||
<el-input v-model="form.actualAfternoonSize" placeholder="下午" style="width: 100px;" />
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
</div>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@ -161,258 +184,164 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="FeedPlan">
|
<script setup name="FeedPlan">
|
||||||
import { listFeedPlan, getFeedPlan, delFeedPlan, addFeedPlan, updateFeedPlan } from "@/api/feed/FeedPlan"
|
import { listFeedPlan, getFeedPlan, delFeedPlan, addFeedPlan, updateFeedPlan } from "@/api/feed/FeedPlan"
|
||||||
import { listFormulaManagement } from "@/api/feed/FormulaManagement";
|
|
||||||
import { listSheepfold } from "@/api/produce/manage_sheep/trans_group.js";
|
|
||||||
import { get } from "@vueuse/core";
|
|
||||||
const { proxy } = getCurrentInstance()
|
|
||||||
|
|
||||||
const FeedPlanList = ref([])
|
const { proxy } = getCurrentInstance()
|
||||||
const open = ref(false)
|
|
||||||
const loading = ref(true)
|
|
||||||
const showSearch = ref(true)
|
|
||||||
const ids = ref([])
|
|
||||||
const single = ref(true)
|
|
||||||
const multiple = ref(true)
|
|
||||||
const total = ref(0)
|
|
||||||
const title = ref("")
|
|
||||||
|
|
||||||
const data = reactive({
|
const FeedPlanList = ref([])
|
||||||
form: {},
|
const open = ref(false)
|
||||||
queryParams: {
|
const loading = ref(true)
|
||||||
pageNum: 1,
|
const showSearch = ref(true)
|
||||||
pageSize: 10,
|
const ids = ref([])
|
||||||
formulaId: null,
|
const single = ref(true)
|
||||||
sheepHouseId: null,
|
const multiple = ref(true)
|
||||||
},
|
const total = ref(0)
|
||||||
rules: {
|
const title = ref("")
|
||||||
formulaId: [
|
|
||||||
{ required: true, message: "配方编码不能为空", trigger: "blur" }
|
const data = reactive({
|
||||||
],
|
form: {},
|
||||||
batchId: [
|
queryParams: {
|
||||||
{ required: true, message: "批号不能为空", trigger: "blur" }
|
pageNum: 1,
|
||||||
],
|
pageSize: 10,
|
||||||
sheepHouseId: [
|
formulaId: null,
|
||||||
{ required: true, message: "羊舍不能为空", trigger: "blur" }
|
sheepHouseId: null,
|
||||||
],
|
zookeeper: null,
|
||||||
planDailySize: [
|
planDate: null,
|
||||||
{ required: true, message: "日均计划量不能为空", trigger: "blur" }
|
},
|
||||||
],
|
rules: {
|
||||||
}
|
formulaId: [
|
||||||
|
{ required: true, message: "配方编码不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
sheepHouseId: [
|
||||||
|
{ required: true, message: "羊舍不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
planDailySize: [
|
||||||
|
{ required: true, message: "日均计划量不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询饲喂计划列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listFeedPlan(queryParams.value).then(response => {
|
||||||
|
FeedPlanList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
})
|
})
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
|
||||||
|
|
||||||
const formulaIdDict = ref([]) // 配方编码字典
|
|
||||||
// 用于存储配方批号列表
|
|
||||||
const formulaBatchMap = ref([])
|
|
||||||
const formulaBatchDict = ref([]) // 配方批号字典(过滤后)
|
|
||||||
const sheepFolderDict = ref([]) // 羊舍字典
|
|
||||||
// 用于存储羊舍名称的字典
|
|
||||||
const sheepNameDict = ref({})
|
|
||||||
|
|
||||||
// 获取配方编码 & 配方批号 字典
|
|
||||||
function getFormulaDict() {
|
|
||||||
listFormulaManagement().then(response => {
|
|
||||||
formulaIdDict.value = response.rows.map(item => ({
|
|
||||||
label: item.formulaId,
|
|
||||||
value: item.formulaId
|
|
||||||
}))
|
|
||||||
// 清空配方批号字典
|
|
||||||
formulaBatchMap.value = []
|
|
||||||
|
|
||||||
// 遍历每个配方列表,提取子配方中的批号
|
|
||||||
response.rows.forEach(item => {
|
|
||||||
if (item.subFormulaList) {
|
|
||||||
item.subFormulaList.forEach(subItem => {
|
|
||||||
formulaBatchMap.value.push({
|
|
||||||
label: subItem.batchId,
|
|
||||||
value: subItem.batchId,
|
|
||||||
formulaId: item.formulaId // 关联配方ID
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理配方编码变化
|
|
||||||
function handleFormulaIdChange(row, value) {
|
|
||||||
// 清空配方批号字典
|
|
||||||
if (!value) {
|
|
||||||
formulaBatchDict.value = []
|
|
||||||
} else {
|
|
||||||
// 根据选择的formulaId筛选batchId
|
|
||||||
formulaBatchDict.value = formulaBatchMap.value;
|
|
||||||
formulaBatchDict.value = formulaBatchDict.value.filter(item => item.formulaId === value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重新设置批号为第一个
|
|
||||||
if (formulaBatchDict.value.length > 0) {
|
|
||||||
row.batchId = formulaBatchDict.value[0].value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSheepfoldDict() {
|
|
||||||
listSheepfold().then(response => {
|
|
||||||
sheepFolderDict.value = response.rows.map(item => ({
|
|
||||||
label: item.sheepfoldName,
|
|
||||||
value: item.id
|
|
||||||
}))
|
|
||||||
sheepNameDict.value = response.rows.map(item => ({
|
|
||||||
label: item.id,
|
|
||||||
value: item.sheepfoldName
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据id获取羊舍名称
|
|
||||||
function getSheepHouseName(id) {
|
|
||||||
const dictItem = sheepFolderDict.value.find(item => item.value === id)
|
|
||||||
return dictItem ? dictItem.label : id
|
|
||||||
}
|
|
||||||
|
|
||||||
// 羊舍ID与名称转换函数:输入可以是 ID 或 羊舍名称
|
|
||||||
function getSheepHouseId(inputValue, sheepNameDict) {
|
|
||||||
if (!inputValue) return '';
|
|
||||||
|
|
||||||
// 输入是纯数字,直接返回
|
|
||||||
if (/^\d+$/.test(inputValue)) {
|
|
||||||
return inputValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 输入是名称,返回对应的 id
|
|
||||||
const match = sheepNameDict.find(item => item.value === inputValue);
|
|
||||||
return match ? match.label : '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
/** 查询饲喂计划列表 */
|
// 表单重置
|
||||||
function getList() {
|
function reset() {
|
||||||
loading.value = true
|
form.value = {
|
||||||
listFeedPlan(queryParams.value).then(response => {
|
createDate: null,
|
||||||
FeedPlanList.value = response.rows
|
formulaId: null,
|
||||||
total.value = response.total
|
sheepHouseId: null,
|
||||||
loading.value = false
|
sheepCount: null,
|
||||||
})
|
planDailySize: null,
|
||||||
}
|
planMorningSize: null,
|
||||||
|
planMorningTotal: null,
|
||||||
// 取消按钮
|
ratioMorning: null,
|
||||||
function cancel() {
|
actualMorningSize: null,
|
||||||
open.value = false
|
planNoonSize: null,
|
||||||
reset()
|
planNoonTotal: null,
|
||||||
}
|
actualNoonSize: null,
|
||||||
|
ratioNoon: null,
|
||||||
// 表单重置
|
planAfternoonSize: null,
|
||||||
function reset() {
|
planAfternoonTotal: null,
|
||||||
form.value = {
|
actualAfternoonSize: null,
|
||||||
createDate: null,
|
ratioAfternoon: null,
|
||||||
formulaId: null,
|
planFeedTotal: null,
|
||||||
batchId: null,
|
zookeeper: null,
|
||||||
sheepHouseId: null,
|
planDate: null,
|
||||||
sheepCount: null,
|
remark: null
|
||||||
planDailySize: null,
|
|
||||||
ratioMorning: null,
|
|
||||||
ratioNoon: null,
|
|
||||||
ratioAfternoon: null,
|
|
||||||
planMorningSize: null,
|
|
||||||
planMorningTotal: null,
|
|
||||||
actualMorningSize: null,
|
|
||||||
planNoonSize: null,
|
|
||||||
planNoonTotal: null,
|
|
||||||
actualNoonSize: null,
|
|
||||||
planAfternoonSize: null,
|
|
||||||
planAfternoonTotal: null,
|
|
||||||
actualAfternoonSize: null,
|
|
||||||
planFeedTotal: null,
|
|
||||||
zookeeper: null,
|
|
||||||
planDate: null,
|
|
||||||
remark: null
|
|
||||||
}
|
|
||||||
proxy.resetForm("FeedPlanRef")
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
function handleQuery() {
|
|
||||||
queryParams.value.pageNum = 1
|
|
||||||
// 如果羊舍ID是名称,则转换为ID
|
|
||||||
queryParams.value.sheepHouseId = getSheepHouseId(queryParams.value.sheepHouseId, sheepNameDict.value);
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
function resetQuery() {
|
|
||||||
proxy.resetForm("queryRef")
|
|
||||||
handleQuery()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 多选框选中数据
|
|
||||||
function handleSelectionChange(selection) {
|
|
||||||
ids.value = selection.map(item => item.createDate)
|
|
||||||
single.value = selection.length != 1
|
|
||||||
multiple.value = !selection.length
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
function handleAdd() {
|
|
||||||
reset()
|
|
||||||
open.value = true
|
|
||||||
title.value = "添加饲喂计划"
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
function handleUpdate(row) {
|
|
||||||
reset()
|
|
||||||
const _createDate = row.createDate || ids.value
|
|
||||||
getFeedPlan(_createDate).then(response => {
|
|
||||||
form.value = response.data
|
|
||||||
open.value = true
|
|
||||||
title.value = "修改饲喂计划"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 提交按钮 */
|
|
||||||
function submitForm() {
|
|
||||||
proxy.$refs["FeedPlanRef"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (form.value.createDate != null) {
|
|
||||||
updateFeedPlan(form.value).then(response => {
|
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
|
||||||
open.value = false
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
addFeedPlan(form.value).then(response => {
|
|
||||||
proxy.$modal.msgSuccess("新增成功")
|
|
||||||
open.value = false
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
function handleDelete(row) {
|
|
||||||
const _createDates = row.createDate || ids.value
|
|
||||||
proxy.$modal.confirm('是否确认删除饲喂计划编号为"' + _createDates + '"的数据项?').then(function () {
|
|
||||||
return delFeedPlan(_createDates)
|
|
||||||
}).then(() => {
|
|
||||||
getList()
|
|
||||||
proxy.$modal.msgSuccess("删除成功")
|
|
||||||
}).catch(() => { })
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
function handleExport() {
|
|
||||||
proxy.download('feed/FeedPlan/export', {
|
|
||||||
...queryParams.value
|
|
||||||
}, `FeedPlan_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
}
|
||||||
|
proxy.resetForm("FeedPlanRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
getList()
|
getList()
|
||||||
// 获取配方编码字典
|
}
|
||||||
getFormulaDict()
|
|
||||||
// 获取羊舍字典
|
/** 重置按钮操作 */
|
||||||
getSheepfoldDict()
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.createDate)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加饲喂计划"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _createDate = row.createDate || ids.value
|
||||||
|
getFeedPlan(_createDate).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改饲喂计划"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["FeedPlanRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.createDate != null) {
|
||||||
|
updateFeedPlan(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addFeedPlan(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _createDates = row.createDate || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除饲喂计划编号为"' + _createDates + '"的数据项?').then(function() {
|
||||||
|
return delFeedPlan(_createDates)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('feed/FeedPlan/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `FeedPlan_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
</script>
|
</script>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
<el-table v-loading="loading" :data="FormulaManagementList">
|
<el-table v-loading="loading" :data="FormulaManagementList">
|
||||||
<!-- 表中表展示子配方 -->
|
<!-- 表中表展示子配方 -->
|
||||||
<el-table-column type="expand" @expand-change="handleExpandChange">
|
<el-table-column type="expand" @expand-change="handleExpandChange">
|
||||||
<template #default="props">
|
<template #default="props">
|
||||||
<el-table :data="props.row.subFormulaList" style="width: 100%">
|
<el-table :data="props.row.subFormulaList" style="width: 100%">
|
||||||
<el-table-column label="批号" align="center" prop="batchId" />
|
<el-table-column label="批号" align="center" prop="batchId" />
|
||||||
@ -148,18 +148,11 @@
|
|||||||
<el-table :data="showFormulaManagementList.sgFormulaList" stripe border style="width: 100%" max-height="300">
|
<el-table :data="showFormulaManagementList.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="原料名称" prop="materialName" />
|
||||||
<el-table-column label="名称" prop="materialName" align="center"/>
|
|
||||||
<el-table-column label="类型" align="center" prop="isGranular">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :options="material_type" :value="scope.row.isGranular" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="比例" align="center" prop="ratio" />
|
<el-table-column label="比例" align="center" prop="ratio" />
|
||||||
<el-table-column label="类型" prop="isSupplement" align="center">
|
<el-table-column label="类型" prop="isGranular" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="materialType" :value="scope.row.isSupplement" />
|
<dict-tag :options="materialType" :value="scope.row.isGranular" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -172,7 +165,7 @@
|
|||||||
<el-col :span="12" v-if="!isView">
|
<el-col :span="12" v-if="!isView">
|
||||||
<el-form-item label="配方编号" prop="formulaId">
|
<el-form-item label="配方编号" prop="formulaId">
|
||||||
<el-input v-model="showFormulaManagementList.formulaId" placeholder="请输入配方编号"
|
<el-input v-model="showFormulaManagementList.formulaId" placeholder="请输入配方编号"
|
||||||
:disabled="!FormulaIdEditable" />
|
:disabled="!FormulaIdEditable"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -227,33 +220,24 @@
|
|||||||
:row-class-name="rowSgFormulaListDetailIndex" @selection-change="handleSgFormulaListDetailSelectionChange"
|
:row-class-name="rowSgFormulaListDetailIndex" @selection-change="handleSgFormulaListDetailSelectionChange"
|
||||||
ref="swPresDetail" border stripe>
|
ref="swPresDetail" border stripe>
|
||||||
<el-table-column label="序号" align="center" prop="index" width="60" />
|
<el-table-column label="序号" align="center" prop="index" width="60" />
|
||||||
<el-table-column label="原料" prop="materialId" align="center">
|
<el-table-column label="原料" prop="materialId">
|
||||||
<el-table-column label="名称" align="center">
|
<template #default="scope">
|
||||||
<template #default="scope">
|
<el-select v-model="scope.row.materialId" filterable placeholder="请选择原料" style="width: 100%"
|
||||||
<el-select v-model="scope.row.materialId" filterable placeholder="请选择原料" style="width: 100%"
|
@change="handleMaterialChange(scope.row, $event)">
|
||||||
@change="handleMaterialChange(scope.row, $event)">
|
<el-option v-for="item in materials" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
<el-option-group v-for="group in groupedMaterials" :key="group.label" :label="group.label">
|
</el-select>
|
||||||
<el-option v-for="item in group.options" :key="item.value" :label="item.label"
|
</template>
|
||||||
:value="item.value" />
|
|
||||||
</el-option-group>
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="类型" align="center" prop="isGranular">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :options="material_type" :value="scope.row.isGranular" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="比例" prop="dosage" align="center">
|
|
||||||
|
<el-table-column label="比例" prop="dosage">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input-number v-model="scope.row.ratio" placeholder="请输入比例" :min="0" :precision="1"
|
<el-input-number v-model="scope.row.ratio" placeholder="请输入比例" :min="0" :precision="1"
|
||||||
controls-position="right" />
|
controls-position="right" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="类型" prop="isSupplement" align="center">
|
<el-table-column label="类型" prop="isGranular">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-select v-model="scope.row.isSupplement" placeholder="请选择类型">
|
<el-select v-model="scope.row.isGranular" placeholder="请选择类型">
|
||||||
<el-option v-for="item in materialType" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item in materialType" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
@ -313,12 +297,9 @@ const FormulaIdEditable = ref(false)
|
|||||||
const materials = ref([])
|
const materials = ref([])
|
||||||
// 原料类型
|
// 原料类型
|
||||||
const materialType = [
|
const materialType = [
|
||||||
{ value: '1', label: '补饲原料' },
|
{ value: '1', label: '颗粒料' },
|
||||||
{ value: '0', label: '原料' }
|
{ value: '0', label: '其他' }
|
||||||
]
|
]
|
||||||
// 原料类型字典
|
|
||||||
const { material_type } = proxy.useDict('material_type')
|
|
||||||
console.log("material_type: ", material_type);
|
|
||||||
const useStaus = [
|
const useStaus = [
|
||||||
{ value: '1', label: '启用' },
|
{ value: '1', label: '启用' },
|
||||||
{ value: '0', label: '停用' }
|
{ value: '0', label: '停用' }
|
||||||
@ -600,8 +581,6 @@ function handleMaterialChange(row, selectedValue) {
|
|||||||
if (selectedItem) {
|
if (selectedItem) {
|
||||||
// materialName 也在 row 中
|
// materialName 也在 row 中
|
||||||
row.materialName = selectedItem.label;
|
row.materialName = selectedItem.label;
|
||||||
row.isGranular = selectedItem.isGranular; // 更新 isGranular
|
|
||||||
row.isSupplement = selectedItem.isSupplement; // 更新 isSupplement
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,7 +633,7 @@ function handleFormulaDetailUpdate(row) {
|
|||||||
showFormulaManagementList.value = {}
|
showFormulaManagementList.value = {}
|
||||||
}
|
}
|
||||||
formulaListOpen.value = true
|
formulaListOpen.value = true
|
||||||
title.value = "修改配方"
|
title.value = "修改处方"
|
||||||
isView.value = false
|
isView.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -701,42 +680,12 @@ function getMaterials() {
|
|||||||
console.log("获取原料列表:", response)
|
console.log("获取原料列表:", response)
|
||||||
materials.value = response.rows.map(item => ({
|
materials.value = response.rows.map(item => ({
|
||||||
value: item.materialId,
|
value: item.materialId,
|
||||||
label: item.materialName,
|
label: item.materialName
|
||||||
isGranular: item.isGranular,
|
|
||||||
isSupplement: "0" // 默认补饲原料为 0
|
|
||||||
}))
|
}))
|
||||||
console.log("原料列表:", materials.value)
|
console.log("原料列表:", materials.value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ================== 分组下拉列表部分 ======================== */
|
|
||||||
const groupedMaterials = ref([]) // 存储分组后的原料数据
|
|
||||||
|
|
||||||
// 从后端获取数据并按isGranular分组
|
|
||||||
function getGroupMaterials() {
|
|
||||||
listMaterial(materialQueryParams).then(response => {
|
|
||||||
console.log("获取原料列表:", response)
|
|
||||||
|
|
||||||
// 根据material_type分组数据
|
|
||||||
const groups = material_type.value.map(type => ({
|
|
||||||
label: type.label,
|
|
||||||
options: []
|
|
||||||
}))
|
|
||||||
|
|
||||||
// 遍历原料数据,根据isGranular字段分组
|
|
||||||
response.rows.forEach(item => {
|
|
||||||
const group = groups.find(group => group.label === material_type.value.find(type => type.value === item.isGranular).label)
|
|
||||||
group.options.push({
|
|
||||||
value: item.materialId,
|
|
||||||
label: item.materialName
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
// 将分组后的数据赋值给groupedMaterials
|
|
||||||
groupedMaterials.value = groups
|
|
||||||
console.log("分组后的原料列表:", groupedMaterials.value)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子表多选回调
|
* 子表多选回调
|
||||||
@ -765,6 +714,4 @@ function handleExport() {
|
|||||||
getList()
|
getList()
|
||||||
// 加载原料列表
|
// 加载原料列表
|
||||||
getMaterials()
|
getMaterials()
|
||||||
// 加载分组原料列表
|
|
||||||
getGroupMaterials()
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user