采购计划接口对接

This commit is contained in:
zzyuan 2025-07-03 11:19:15 +08:00
parent 3c0320ec87
commit 3606291a95
5 changed files with 209 additions and 209 deletions

View File

@ -155,9 +155,9 @@ export const constantRoutes = [
meta: { title: '计划详情', icon: '' }
},
{
path: 'plaEdit',
path: 'planEdit',
component: () => import('@/views/foodManage/purchaseManage/purchasePlan/edit'),
name: 'PlaEdit',
name: 'PlanEdit',
meta: { title: '计划新增/编辑', icon: '' }
},
]

View File

@ -253,7 +253,7 @@ export default {
//
baseRules: {
contractTitle: [
{ required: true, message: "菜谱名称不能为空", trigger: "blur" }
{ required: true, message: "合同标题不能为空", trigger: "blur" }
],
areaId: [
{ required: true, message: "所属区域不能为空", trigger: "change" }

View File

@ -1,68 +1,64 @@
<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 style="margin-bottom: 20px;" title="采购计划状态" :column="4" size="medium" border>
<el-descriptions-item>
<template slot="label">合同编号</template>
{{baseInfo.contractCode}}
<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.contractTitle }}
<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>
<el-descriptions style="margin-bottom: 20px;" title="基本信息" :column="4" size="medium" border>
<el-descriptions-item>
<template slot="label">采购单号</template>
{{baseInfo.planCode}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">采购时间</template>
{{ baseInfo.purchaseDate }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">所属区域</template>
{{ baseInfo.areaName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">供应商</template>
{{ baseInfo.supplierName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">配送食堂</template>
<template slot="label">所属食堂</template>
{{ baseInfo.canteenName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">签订日期</template>
{{ baseInfo.contractSigningTime }}
<template slot="label">所属档口</template>
{{ baseInfo.stallName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">合同生效周期</template>
{{ baseInfo.contractStartTime }} - {{ baseInfo.contractEndTime }}
<template slot="label">采购预算金额</template>
{{ (baseInfo.purchaseBudgetTotal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">合同状态</template>
{{ baseInfo.deptName }}
<el-tag size="small" v-if="baseInfo.contractStatus==1">待生效</el-tag>
<el-tag size="small" v-if="baseInfo.contractStatus==2">履行中</el-tag>
<el-tag size="small" v-if="baseInfo.contractStatus==3">已失效</el-tag>
<el-tag size="small" v-if="baseInfo.contractStatus==4">已终止</el-tag>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">合同附件</template>
<div v-for="(item,index) in baseInfo.contractAttachmentList" :key="index">
<a :href="item" download="demo">{{ item }}</a>
</div>
</el-descriptions-item>
</el-descriptions>
<el-descriptions style="margin-bottom: 20px;" title="付款信息" :column="4" size="medium" border>
<el-descriptions-item>
<template slot="label">付款方式</template>
<span v-if="baseInfo.payMoneyStyle==1">一次性付款</span>
<span v-if="baseInfo.payMoneyStyle==2">分期付款</span>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">付款日期</template>
{{ baseInfo.payMoneyDate }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">收款银行</template>
{{ baseInfo.collectMoneyBank }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">收款账户名称</template>
{{ baseInfo.collectMoneyAccountName }}
<template slot="label">操作人</template>
{{ baseInfo.updateBy }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">备注</template>
@ -78,8 +74,8 @@
</div>
</div>
<div style="width: 100%;height: 400px;overflow-y: auto;">
<el-table v-loading="loading" :data="contractMaterialList" 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 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" />
@ -92,15 +88,15 @@
<span v-if="scope.row.salesMode==2">称重</span>
</template> -->
</el-table-column>
<el-table-column label="单价(元)" align="center" prop="singlePrice" :show-overflow-tooltip="true">
<el-table-column label="参考价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ (scope.row.singlePrice/100).toFixed(2) }}</span>
<span>{{ (scope.row.unitPrice).toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="orderNum" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<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.orderNum*scope.row.singlePrice }}</span>
<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>
@ -115,9 +111,7 @@
</template>
<script>
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage";
import { getPurchaseContractInfoApi,addPurchaseContractApi,editPurchaseContractApi,delPurchaseContractApi } from "@/api/foodManage/purchaseManage";
import { getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage";
export default {
name: "PlanDetail",
dicts: [],
@ -164,7 +158,7 @@ export default {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
}
},
contractMaterialList:[],
materialList:[],
openDialog:false,
materialTreeOptions:[],
//
@ -196,22 +190,23 @@ export default {
getContractInfo(){
console.log(this.pageJson)
let param = {
contractId:this.pageJson.contractId
planId:this.pageJson.planId
}
//
getPurchaseContractInfoApi(param).then((response) => {
getPurchasePlanInfoApi(param).then((response) => {
this.baseInfo = response.data;
this.$set(this.baseInfo,'dateRange',[this.baseInfo.contractStartTime,this.baseInfo.contractEndTime])
this.contractMaterialList = this.baseInfo.purchaseContractDetailList;
this.$set(this.baseInfo,"contractAmount",this.baseInfo.contractAmount/100)
getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => {
this.canteenOptions=response.rows||[];
this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId)
});
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
this.supplierOptions = response.rows||[];
this.$set(this.baseInfo,'supplierId',this.baseInfo.supplierId)
});
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)
// });
});
},
//

View File

@ -8,9 +8,9 @@
<el-form-item label="采购时间" prop="purchaseDate">
<el-date-picker
v-model="baseInfo.purchaseDate"
type="date" align="right"
format="yyyy-MM-dd" style="width: 240px;"
:picker-options="pickerOptions" @change="baseInfo.purchaseDate=formatDate(baseInfo.purchaseDate)">
type="datetime" align="right"
format="yyyy-MM-dd HH:mm:ss" style="width: 240px;"
:picker-options="pickerOptions" @change="baseInfo.purchaseDate=formatDateTime(baseInfo.purchaseDate)">
</el-date-picker>
</el-form-item>
<el-form-item label="交货日期" prop="deliverGoodsDate">
@ -21,9 +21,6 @@
:picker-options="pickerOptions" @change="baseInfo.deliverGoodsDate=formatDate(baseInfo.deliverGoodsDate)">
</el-date-picker>
</el-form-item>
<el-form-item label="采购预算" prop="purchaseBudgetTotal">
<el-input v-model="baseInfo.purchaseBudgetTotal" placeholder="请输入合同总金额" maxlength="20" clearable style="width: 240px" @input="(v)=>(baseInfo.purchaseBudgetTotal=v.replace(/[^\d.]/g,''))"/>
</el-form-item>
<el-form-item label="所属区域" prop="areaId">
<el-cascader v-model="baseInfo.areaId"
:options="treeAreaOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
@ -34,17 +31,8 @@
}" @change="handleAreaChange">
</el-cascader>
</el-form-item>
<el-form-item label="供应商" prop="supplierId">
<el-select v-model="baseInfo.supplierId" placeholder="请选择供应商" style="width: 240px;">
<el-option v-for="item in supplierOptions"
:key="item.supplierId"
:label="item.supplierName"
:value="item.supplierId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属食堂" prop="canteenId">
<el-select v-model="baseInfo.canteenId" placeholder="请选择所属食堂" style="width: 240px;">
<el-select v-model="baseInfo.canteenId" placeholder="请选择所属食堂" style="width: 240px;" @change="handleCanteenChange">
<el-option v-for="item in canteenOptions"
:key="item.canteenId"
:label="item.canteenName"
@ -52,6 +40,15 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属档口" prop="stallId">
<el-select v-model="baseInfo.stallId" placeholder="请选择所属档口" style="width: 240px;">
<el-option v-for="item in stallOptions"
:key="item.stallId"
:label="item.stallName"
:value="item.stallId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="baseInfo.remark" placeholder="请输入备注" maxlength="30" clearable style="width: 240px"/>
</el-form-item>
@ -68,7 +65,7 @@
</div>
</div>
<div style="width: 100%;height: 400px;overflow-y: auto;">
<el-table v-loading="loading" :data="contractMaterialList" ref="multipleTable" height="380" :row-key="(row)=>{return row.materialId}" @selection-change="handleSelectionChange">
<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" /> -->
@ -76,25 +73,26 @@
<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="inventoryNum" :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="singlePrice" :show-overflow-tooltip="true">
<el-table-column label="参考价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="scope.row.singlePrice" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.singlePrice=v.replace(/[^\d.]/g,''))"/>
<el-input v-model="scope.row.unitPrice" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.unitPrice=v.replace(/[^\d.]/g,''))"/>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="orderNum" :show-overflow-tooltip="true">
<el-table-column label="采购数量" align="center" prop="purchaseNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model.number="scope.row.orderNum" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.orderNum=v.replace(/[^\d]/g,''))"/>
<el-input v-model.number="scope.row.purchaseNum" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.purchaseNum=v.replace(/[^\d]/g,''))"/>
</template>
</el-table-column>
<el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<el-table-column label="预计采购金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.orderNum*scope.row.singlePrice }}</span>
<span>{{ scope.row.purchaseNum*scope.row.unitPrice }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true">
@ -111,7 +109,7 @@
<el-button @click="jumpList">返回</el-button>
</div>
<!-- 选择-->
<!-- 选择-->
<el-dialog title="选择货品" :visible.sync="openDialog" width="65%" append-to-body >
<div style="width: 100%;height:620px;">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
@ -155,6 +153,7 @@
<span v-if="scope.row.salesMode==2">称重</span>
</template> -->
</el-table-column>
<el-table-column label="库存数量" align="center" prop="inventoryNum" :show-overflow-tooltip="true" />
<el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span>
@ -181,25 +180,23 @@
import { imgUpLoadTwo } from '@/api/system/upload'
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage";
import { getPurchaseContractInfoApi,addPurchaseContractApi,editPurchaseContractApi,delPurchaseContractApi } from "@/api/foodManage/purchaseManage";
import { getPurchasePlanInfoApi, addPurchasePlanApi, editPurchasePlanApi } from "@/api/foodManage/purchaseManage";
export default {
name: "PlaEdit",
name: "PlanEdit",
dicts: [],
data() {
return {
pageJson:{},//
loading:false,
loadingBtn:false,
baseInfo: {
contractTitle:undefined,
contractType:undefined,
areaId:undefined,
canteenId:undefined,
},
baseInfo: {},
//
baseRules: {
contractTitle: [
{ required: true, message: "菜谱名称不能为空", trigger: "blur" }
purchaseDate: [
{ required: true, message: "采购日期不能为空", trigger: "change" }
],
deliverGoodsDate: [
{ required: true, message: "交货日期不能为空", trigger: "change" }
],
areaId: [
{ required: true, message: "所属区域不能为空", trigger: "change" }
@ -207,23 +204,20 @@ export default {
canteenId: [
{ required: true, message: "所属食堂不能为空", trigger: "change" }
],
supplierId: [
{ required: true, message: "供应商不能为空", trigger: "change" }
],
purchaseDate: [
{ required: true, message: "签订日期不能为空", trigger: "change" }
stallId: [
{ required: true, message: "所属档口不能为空", trigger: "change" }
],
},
treeAreaOptions:[],
canteenOptions:[],
supplierOptions:[],
stallOptions:[],
pickerOptions: {
disabledDate(v) {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
}
},
contractMaterialList:[],//-
materialList:[],//-
batchIds:[],//--
openDialog:false,
materialTreeOptions:[],
@ -249,30 +243,29 @@ export default {
methods: {
//
jumpList() {
const obj = { path: "foodManage/purchaseManage/contractDetail" };
const obj = { path: "foodManage/purchaseManage/planEdit" };
this.$tab.closeOpenPage(obj);
this.$router.replace({ path: "/foodManage/purchaseManage/contractList" }); //
this.$router.replace({ path: "/foodManage/purchaseManage/purchasePlan" }); //
},
getContractInfo(){
console.log(this.pageJson)
let param = {
contractId:this.pageJson.contractId
planId:this.pageJson.planId
}
//
getPurchaseContractInfoApi(param).then((response) => {
getPurchasePlanInfoApi(param).then((response) => {
this.baseInfo = response.data;
this.contractMaterialList = this.baseInfo.purchaseContractDetailList;
this.contractMaterialList.forEach(item=>{
this.$set(item,"singlePrice",Number(item.singlePrice)/100)
this.materialList = this.baseInfo.purchasePlanDetailList;
this.materialList.forEach(item=>{
this.$set(item,"unitPrice",Number(item.unitPrice)/100)
})
this.$set(this.baseInfo,"purchaseBudgetTotal",Number(this.baseInfo.purchaseBudgetTotal)/100)
getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => {
this.canteenOptions=response.rows||[];
this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId)
});
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
this.supplierOptions = response.rows||[];
this.$set(this.baseInfo,'supplierId',this.baseInfo.supplierId)
getStallByCanteenApi({ canteenId:this.baseInfo.canteenId }).then((response) => {
this.stallOptions=response.rows||[]
this.$set(this.baseInfo,"stallId",this.baseInfo.stallId)
});
});
},
@ -280,10 +273,6 @@ export default {
getAreaTreeData() {
systemAreaTreeApi({}).then((response) => {
this.treeAreaOptions = response.data;
// if(this.treeAreaOptions.length>0){
// this.baseInfo.areaId = this.getFirstChild(this.treeAreaOptions[0]).id;
// this.handleAreaChange()
// }
});
},
getFirstChild(node) {
@ -296,7 +285,6 @@ export default {
//-
handleAreaChange(e){
this.getCanteenData()
this.getSupplierData()
},
/** 查询查询食堂下拉结构 */
getCanteenData() {
@ -308,13 +296,21 @@ export default {
this.$set(this.baseInfo,"canteenId",null)
});
},
/** 查询供应商下拉结构 */
getSupplierData() {
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
this.supplierOptions = response.rows||[];
this.$set(this.baseInfo,"supplierId",null)
//-
handleCanteenChange(e){
this.getStallData()
},
/** 查询查询食堂下拉结构 */
getStallData() {
let param= {
canteenId:this.baseInfo.canteenId
}
getStallByCanteenApi(param).then((response) => {
this.stallOptions=response.rows||[]
this.$set(this.baseInfo,"stallId",null)
});
},
/** 查询货品类别下拉树结构 */
getMaterialTree() {
let param = {
@ -335,9 +331,9 @@ export default {
//
delMaterial(){
this.batchIds.forEach(ID=>{
let index = this.contractMaterialList.findIndex(v=>v.materialId==ID)
let index = this.materialList.findIndex(v=>v.materialId==ID)
if(index>-1){
this.contractMaterialList.splice(index,1)
this.materialList.splice(index,1)
}
})
},
@ -384,14 +380,19 @@ export default {
handleSelectionChange2(selection) {
this.batchChosenMaterial = selection;
this.batchChosenMaterial.forEach(item=>{
this.$set(item,"orderNum",0)
this.$set(item,"singlePrice",item.unitPrice/100)
this.$set(item,"purchaseNum",0)
this.$set(item,"unitPrice",item.unitPrice)
})
},
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.contractMaterialList = this.batchChosenMaterial;
this.loading = true;
this.materialList = []
this.batchChosenMaterial.forEach(item=>{
let obj = Object.assign({}, item)
obj.unitPrice = item.unitPrice/100;
this.materialList.push(obj)
})
setTimeout(()=>{
this.loading = false
this.openDialog=false
@ -403,28 +404,30 @@ export default {
this.$refs["baseInfo"].validate(valid => {
if (valid) {
let param = Object.assign({},this.baseInfo);
param.purchaseDate = this.formatDate(this.baseInfo.purchaseDate)
param.purchaseDate = this.formatDateTime(this.baseInfo.purchaseDate)
param.deliverGoodsDate = this.formatDate(this.baseInfo.deliverGoodsDate)
param.purchaseBudgetTotal = this.baseInfo.purchaseBudgetTotal*100;
param.commitStatus=1
param.purchaseContractDetailList = []
param.purchaseBudgetTotal = 0
param.status=1
param.purchasePlanDetailList = []
this.noMaterial = false;
if(this.contractMaterialList.length>0){
this.contractMaterialList.forEach(item=>{
if(item.singlePrice==0 || item.orderNum==0){
if(this.materialList.length>0){
this.materialList.forEach(item=>{
if(item.unitPrice==0 || item.purchaseNum==0){
this.noMaterial = true
}else{
let obj = Object.assign({}, item)
obj.singlePrice = Number(obj.singlePrice)*100
param.purchaseContractDetailList.push(obj)
obj.unitPrice = Number(obj.unitPrice)*100
obj.purchasingBudgetPrice = (Number(obj.unitPrice)*Number(obj.purchaseNum))
param.purchasePlanDetailList.push(obj)
param.purchaseBudgetTotal = param.purchaseBudgetTotal+obj.purchasingBudgetPrice
}
})
}
if(this.noMaterial){
this.$modal.msgError("请输入单价和数量!");
this.$modal.msgError("请输入参考价和采购数量!");
}else{
this.noMaterial = true;
if(this.contractMaterialList.length>0){
if(this.materialList.length>0){
this.noMaterial = false;
}
console.log(param)
@ -432,8 +435,8 @@ export default {
this.$modal.msgError("请添加货品!");
}else{
this.loadingBtn=true;
if (this.baseInfo.contractId != undefined) {
editPurchaseContractApi(param).then((response) => {
if (this.baseInfo.planId != undefined) {
editPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("修改成功");
this.loadingBtn=false
this.jumpList()
@ -441,7 +444,7 @@ export default {
this.loadingBtn=false
});
} else {
addPurchaseContractApi(param).then((response) => {
addPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("保存成功");
this.loadingBtn=false
this.jumpList()
@ -460,28 +463,30 @@ export default {
this.$refs["baseInfo"].validate(valid => {
if (valid) {
let param = Object.assign({},this.baseInfo);
param.purchaseDate = this.formatDate(this.baseInfo.purchaseDate)
param.purchaseDate = this.formatDateTime(this.baseInfo.purchaseDate)
param.deliverGoodsDate = this.formatDate(this.baseInfo.deliverGoodsDate)
param.purchaseBudgetTotal = this.baseInfo.purchaseBudgetTotal*100;
param.commitStatus=2
param.purchaseContractDetailList = []
param.purchaseBudgetTotal = 0
param.status=2
param.purchasePlanDetailList = []
this.noMaterial = false;
if(this.contractMaterialList.length>0){
this.contractMaterialList.forEach(item=>{
if(item.singlePrice==0 || item.orderNum==0){
if(this.materialList.length>0){
this.materialList.forEach(item=>{
if(item.unitPrice==0 || item.purchaseNum==0){
this.noMaterial = true
}else{
let obj = Object.assign({}, item)
obj.singlePrice = Number(obj.singlePrice)*100
param.purchaseContractDetailList.push(obj)
obj.unitPrice = Number(obj.unitPrice)*100
obj.purchasingBudgetPrice = (Number(obj.unitPrice)*Number(obj.purchaseNum))
param.purchasePlanDetailList.push(obj)
param.purchaseBudgetTotal = param.purchaseBudgetTotal+obj.purchasingBudgetPrice
}
})
}
if(this.noMaterial){
this.$modal.msgError("请输入单价和数量!");
this.$modal.msgError("请输入参考价和采购数量!");
}else{
this.noMaterial = true;
if(this.contractMaterialList.length>0){
if(this.materialList.length>0){
this.noMaterial = false;
}
console.log(param)
@ -489,8 +494,8 @@ export default {
this.$modal.msgError("请添加货品!");
}else{
this.loadingBtn=true;
if (this.baseInfo.contractId != undefined) {
editPurchaseContractApi(param).then((response) => {
if (this.baseInfo.planId != undefined) {
editPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("修改成功");
this.loadingBtn=false
this.jumpList()
@ -498,7 +503,7 @@ export default {
this.loadingBtn=false
});
} else {
addPurchaseContractApi(param).then((response) => {
addPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("保存成功");
this.loadingBtn=false
this.jumpList()

View File

@ -79,27 +79,28 @@
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="采购单号" align="center" prop="contractCode" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="采购计划时间" align="center" prop="contractTitle" :show-overflow-tooltip="true" width="120" />
<el-table-column label="所属区域(食堂/档口)" align="center" prop="areaName" :show-overflow-tooltip="true" width="180"/>
<el-table-column label="计划采购货品总数量" align="center" prop="" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="采购预算金额(元)" align="center" prop="" :show-overflow-tooltip="true" width="140"/>
<el-table-column label="计划状态" align="center" prop="status" :show-overflow-tooltip="true" width="100">
<el-table-column label="采购单号" align="center" prop="planCode" :show-overflow-tooltip="true" />
<el-table-column label="采购计划时间" align="center" prop="purchaseDate" :show-overflow-tooltip="true" />
<el-table-column label="所属区域" align="center" prop="areaName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="所属食堂" align="center" prop="canteenName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="所属档口" align="center" prop="stallName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="计划采购货品总数量" align="center" prop="materialTotal" :show-overflow-tooltip="true" />
<el-table-column label="采购预算金额(元)" align="center" prop="purchaseBudgetTotal" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ (scope.row.purchaseBudgetTotal/100).toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column label="计划状态" align="center" prop="status" :show-overflow-tooltip="true" width="110">
<template slot-scope="scope">
<span v-if="scope.row.status==1">待发布</span>
<span v-if="scope.row.status==2">已发布</span>
</template>
</el-table-column>
<!-- <el-table-column label="合同总金额(元)" align="center" prop="contractAmount" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope">
<span>{{ (scope.row.contractAmount/100).toFixed(2) }}</span>
</template>
</el-table-column> -->
<el-table-column label="审批人" align="center" prop="approveBy" :show-overflow-tooltip="true" width="120"/>
<!-- <el-table-column label="审批人" align="center" prop="approveBy" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="审批完成时间" align="center" prop="approveTime" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="负责人" align="center" prop="contractPerson" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="制表人" align="center" prop="" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="制表时间" align="center" prop="" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="负责人" align="center" prop="contractPerson" :show-overflow-tooltip="true" width="120"/>-->
<el-table-column label="制表人" align="center" prop="createBy" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="制表时间" align="center" prop="createTime" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -157,7 +158,6 @@
<script>
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { purchaseContractPageApi,editPurchaseContractApi,delPurchaseContractApi } from "@/api/foodManage/purchaseManage";
import { purchasePlanPageApi, getPurchasePlanInfoApi, addPurchasePlanApi, editPurchasePlanApi, delPurchasePlanApi } from "@/api/foodManage/purchaseManage";
export default {
@ -307,7 +307,7 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.$router.push({ path: "/foodManage/purchaseManage/plaEdit" });
this.$router.push({ path: "/foodManage/purchaseManage/planEdit" });
},
/** 修改按钮操作 */
handleView(row) {
@ -315,7 +315,7 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
this.$router.push({ path: "/foodManage/purchaseManage/plaEdit",query: {pageJson:JSON.stringify(row)} });
this.$router.push({ path: "/foodManage/purchaseManage/planEdit",query: {pageJson:JSON.stringify(row)} });
},
//
cancel() {
@ -350,7 +350,7 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delPurchaseContractApi({contractIds:[row.contractId]});
return delPurchasePlanApi({planIds:[row.planId]});
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
@ -361,7 +361,7 @@ export default {
let param = Object.assign({},row);
this.loadingBtn=true
param.commitStatus=2
editPurchaseContractApi(param).then((response) => {
editPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("提交成功");
this.getList()
this.loadingBtn=false