生产计划详情展示

This commit is contained in:
zzyuan 2025-07-16 09:57:57 +08:00
parent 576e266a02
commit 3aaec65899
2 changed files with 136 additions and 137 deletions

View File

@ -1,44 +1,18 @@
<template>
<div style="padding: 10px;background: #E5EBF6;min-height: 830px;">
<div style="background: #FFF;padding: 10px;border-radius: 10px;margin-bottom: 20px;">
<el-descriptions style="margin-bottom: 20px;" title="采购计划状态" :column="4" size="medium" border>
<el-descriptions-item>
<template slot="label">提交状态</template>
<span v-if="baseInfo.status==1">待发布</span>
<span v-if="baseInfo.status==2">已发布</span>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">提交时间</template>
{{ baseInfo.createTime }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">提交人</template>
{{ baseInfo.createBy }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">审批状态</template>
<span v-if="baseInfo.approveStatus==1">待审批</span>
<span v-if="baseInfo.approveStatus==2">审批中</span>
<span v-if="baseInfo.approveStatus==3">审批同意</span>
<span v-if="baseInfo.approveStatus==4">审批拒绝</span>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">审批时间</template>
{{ baseInfo.approveTime }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">审批人</template>
{{ baseInfo.approveBy }}
</el-descriptions-item>
</el-descriptions>
<div style="background: #FFF;padding: 10px;border-radius: 10px;margin-bottom: 20px;">
<el-descriptions style="margin-bottom: 20px;" title="基本信息" :column="4" size="medium" border>
<el-descriptions-item>
<template slot="label">采购计划单号</template>
{{baseInfo.planCode}}
<template slot="label">生产计划单号</template>
{{baseInfo.productionPlanCode}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">采购时间</template>
{{ baseInfo.purchaseDate }}
<template slot="label">生产计划名称</template>
{{baseInfo.productionPlanName}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">生产计划时间</template>
{{ this.dateRange[0] }}{{ this.dateRange[1] }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">所属区域</template>
@ -51,56 +25,40 @@
<el-descriptions-item>
<template slot="label">所属档口</template>
{{ baseInfo.stallName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">采购预算金额</template>
{{ (baseInfo.purchaseBudgetTotal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">操作人</template>
{{ baseInfo.updateBy }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">备注</template>
{{ baseInfo.remark }}
</el-descriptions-item>
</el-descriptions>
</div>
<div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;">
<div style="width: 100%;display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;">
<div>
货品信息
</div>
</div>
<div style="width: 100%;height: 400px;overflow-y: auto;">
<el-table v-loading="loading" :data="materialList" ref="multipleTable" height="380" :row-key="(row)=>{return row.materialId}" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="50" align="center" :reserve-selection="true" /> -->
<el-table-column label="序号" align="center" width="80" type="index" />
<!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> -->
<el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" />
<el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
<!-- <template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span>
</template> -->
</el-table-column>
<el-table-column label="参考价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ (scope.row.unitPrice).toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column label="采购数量" align="center" prop="purchaseNum" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="预计采购金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.purchaseNum*scope.row.unitPrice }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"></el-table-column>
</el-table>
<el-descriptions-item v-if="baseInfo.productionPlanType==1">
<template slot="label">是否重复</template>
<span v-if="baseInfo.ifRepeat==1">多天重复</span>
<span v-if="baseInfo.ifRepeat==2">多天不重复</span>
</el-descriptions-item>
</el-descriptions>
<el-row class="mb8" v-if="baseInfo.ifRepeat==2||baseInfo.productionPlanType==2">
<el-col :span="1">
<span style="font-weight: bold;color: #606266;font-size: 14px;">日期</span>
</el-col>
<el-col :span="23">
<el-radio-group v-model="dateRangeRadio" @change="choseDateRadio">
<el-radio :label="item.applyDate" v-for="(item,index) in dateRangeList" :key="index" style="font-size: 14px;margin-bottom: 10px;">{{ item.applyDateStr }}</el-radio>
</el-radio-group>
</el-col>
</el-row>
</div>
<div style="width: 100%;height: 480px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;">
<div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;display: flex;" >
<el-card class="dishes-card" v-for="item in detailList" :key="item.mealtimeType">
<div slot="header">
<span>{{item.mealtimeName}}</span>
</div>
<div class="body-card">
<div v-for="dish in item.dishesList" :key="dish.dishesId" style="width: 100%;display: flex;justify-content: space-between;align-items: center;">
<span>{{dish.dishesName}}</span>
<span>{{dish.dishesNum}}</span>
</div>
</div>
<div class="bottom-card">
</div>
</el-card>
</div>
</div>
<div style="width: 100%;height: 80px;padding: 10px;background: #FFF;border-radius: 10px;display: flex;align-items: center;justify-content: center;">
@ -111,7 +69,7 @@
</template>
<script>
import { getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage";
import { getProductionPlanInfoApi } from "@/api/foodManage/purchaseManage";
export default {
name: "ProductionPlanDetail",
dicts: [],
@ -120,13 +78,7 @@ export default {
productionPlanRowData:{},//
loading:false,
loadingBtn:false,
baseInfo: {
contractTitle:undefined,
contractType:undefined,
areaId:undefined,
canteenId:undefined,
dateRange:[],
},
baseInfo: {},
//
baseRules: {
contractTitle: [
@ -143,35 +95,19 @@ export default {
],
contractSigningTime: [
{ required: true, message: "签订日期不能为空", trigger: "change" }
],
dateRange: [
{ required: true, message: "合同生效周期不能为空", trigger: "change" }
]
},
treeAreaOptions:[],
canteenOptions:[],
supplierOptions:[],
stallOptions:[],
},
dateRange:[],
pickerOptions: {
disabledDate(v) {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
}
},
materialList:[],
openDialog:false,
materialTreeOptions:[],
//
queryParams: {
pageNum: 1,
pageSize: 10,
},
//
total: 0,
//
tableListData: [],
batchChosenMaterial:[],
noMaterial:false,
dateRangeList:[],
dateRangeIndex:0,
dateRangeRadio:"",
detailList:[],
resDetailList:[],
};
},
created() {
@ -185,9 +121,6 @@ export default {
if(newId){
this.productionPlanRowData = JSON.parse(newId)
this.getContractInfo()
}else{
this.baseInfo={}
this.materialList=[]
}
},
},
@ -200,26 +133,92 @@ export default {
},
getContractInfo(){
console.log(this.productionPlanRowData)
let param = {
let param = {
planId:this.productionPlanRowData.planId
}
//
getPurchasePlanInfoApi(param).then((response) => {
getProductionPlanInfoApi(param).then((response) => {
this.baseInfo = response.data;
this.materialList = this.baseInfo.purchasePlanDetailList;
this.materialList.forEach(item=>{
this.$set(item,"unitPrice",Number(item.unitPrice)/100)
})
// getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => {
// this.canteenOptions=response.rows||[];
// this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId)
// });
// getStallByCanteenApi({ canteenId:this.baseInfo.canteenId }).then((response) => {
// this.stallOptions=response.rows||[]
// this.$set(this.baseInfo,"stallId",this.baseInfo.stallId)
// });
this.resDetailList = response.data.productionPlanDetailVOList;
this.dateRange=[this.resDetailList[0].detailDate,this.resDetailList[this.resDetailList.length-1].detailDate]
this.dateRangeList = this.getDateRange(this.dateRange[0],this.dateRange[1])
this.dateRangeIndex = 0
this.dateRangeRadio = this.formatDate(this.dateRange[0]);
for (let i = 0; i < this.resDetailList.length; i++) {
this.dateRangeList.forEach(item=>{
if(this.resDetailList[i].detailDate==item.applyDate){
item.detailList.forEach(subItem=>{
if(this.resDetailList[i].mealtimeType==subItem.mealtimeType){
this.$set(this.resDetailList[i],'dishesNum',this.resDetailList[i].dishesNum)
subItem.dishesList.push(this.resDetailList[i])
}
})
}
})
}
this.detailList = this.dateRangeList[0].detailList;
// if(e==1){//
// this.dateRangeIndex = 0
// this.detailList = this.dateRangeList[0].detailList;
// }else{
// let index = this.dateRangeList.findIndex(v=>v.applyDate==this.dateRangeRadio)
// this.dateRangeIndex = index
// this.detailList = this.dateRangeList[index].detailList;
// }
});
},
},
//-
choseDateRadio(e){
let index = this.dateRangeList.findIndex(v=>v.applyDate==this.dateRangeRadio)
this.dateRangeIndex = index
this.detailList = this.dateRangeList[index].detailList;
},
//-
getDateRange(startDate, endDate) {
let start = new Date(startDate);
let end = new Date(endDate)
let dateArray = [];
while (start <= end) {
//
var days = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
var dayOfWeek = start.getDay();
let obj = {
applyDate:this.formatDate(start),
applyWeek:dayOfWeek,
applyDateStr:this.formatDate(start)+" "+days[dayOfWeek],
detailList:[
{
mealtimeType:"1",
mealtimeName:"早餐",
dishesList:[]
},
{
mealtimeType:"2",
mealtimeName:"午餐",
dishesList:[]
},
{
mealtimeType:"3",
mealtimeName:"下午茶",
dishesList:[]
},
{
mealtimeType:"4",
mealtimeName:"晚餐",
dishesList:[]
},
{
mealtimeType:"5",
mealtimeName:"夜宵",
dishesList:[]
}
]
}
dateArray.push(obj); // YYYY-MM-DD
start.setDate(start.getDate() + 1); // 1
}
return dateArray;
},
//
handleSelectionChange(selection) {
// this.batchIds1 = selection.map(item => item.tradeId)

View File

@ -2,8 +2,8 @@
<div style="padding: 10px;background: #E5EBF6;min-height: 830px;">
<div style="background: #FFF;padding: 10px;border-radius: 10px;margin-bottom: 20px;">
<el-form :model="baseInfo" ref="baseInfo" :rules="baseRules" size="medium" :inline="true" label-width="110px">
<!-- <el-form-item label="生产计划单号" prop="planCode">
<el-input v-model="baseInfo.planCode" placeholder="生产计划单号自动生成" disabled maxlength="20" clearable style="width: 240px"/>
<!-- <el-form-item label="生产计划单号" prop="productionPlanCode">
<el-input v-model="baseInfo.productionPlanCode" placeholder="生产计划单号自动生成" disabled maxlength="20" clearable style="width: 240px"/>
</el-form-item> -->
<el-form-item label="生产计划名称" prop="productionPlanName">
<el-input v-model="baseInfo.productionPlanName" placeholder="请输入生产计划名称" maxlength="20" clearable style="width: 240px"/>
@ -170,7 +170,7 @@
</div>
<div class="dialog-right">
<el-table :data="dishesTableList" height="620">
<el-table-column label="菜品编号" align="center" prop="dishesNum" />
<!-- <el-table-column label="菜品编号" align="center" prop="dishesNum" /> -->
<el-table-column label="菜品名称" align="center" prop="dishesName" />
<el-table-column label="所属食堂" align="center" prop="canteenName" />
<el-table-column label="规格" align="center" prop="sizeType">
@ -353,7 +353,7 @@ export default {
this.dateRangeIndex = 0
this.dateRangeRadio = this.formatDate(this.dateRange[0]);
if(this.dialogType==1){
for (let i = 0; i < this.resDetailList.length; i++) {
for (let i = 0; i < this.resDetailList.length; i++) {
this.dateRangeList.forEach(item=>{
if(this.resDetailList[i].detailDate==item.applyDate){
item.detailList.forEach(subItem=>{