采购计划接口对接

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: '' } meta: { title: '计划详情', icon: '' }
}, },
{ {
path: 'plaEdit', path: 'planEdit',
component: () => import('@/views/foodManage/purchaseManage/purchasePlan/edit'), component: () => import('@/views/foodManage/purchaseManage/purchasePlan/edit'),
name: 'PlaEdit', name: 'PlanEdit',
meta: { title: '计划新增/编辑', icon: '' } meta: { title: '计划新增/编辑', icon: '' }
}, },
] ]

View File

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

View File

@ -1,74 +1,70 @@
<template> <template>
<div style="padding: 10px;background: #E5EBF6;min-height: 830px;"> <div style="padding: 10px;background: #E5EBF6;min-height: 830px;">
<div style="background: #FFF;padding: 10px;border-radius: 10px;margin-bottom: 20px;"> <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>
<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> <el-descriptions-item>
<template slot="label">合同编号</template> <template slot="label">采购单</template>
{{baseInfo.contractCode}} {{baseInfo.planCode}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">合同标题</template> <template slot="label">采购时间</template>
{{ baseInfo.contractTitle }} {{ baseInfo.purchaseDate }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">所属区域</template> <template slot="label">所属区域</template>
{{ baseInfo.areaName }} {{ baseInfo.areaName }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">供应商</template> <template slot="label">所属食堂</template>
{{ baseInfo.supplierName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">配送食堂</template>
{{ baseInfo.canteenName }} {{ baseInfo.canteenName }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">签订日期</template> <template slot="label">所属档口</template>
{{ baseInfo.contractSigningTime }} {{ baseInfo.stallName }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">合同生效周期</template> <template slot="label">采购预算金额</template>
{{ baseInfo.contractStartTime }} - {{ baseInfo.contractEndTime }} {{ (baseInfo.purchaseBudgetTotal/100).toFixed(2) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">合同状态</template> <template slot="label">操作人</template>
{{ baseInfo.deptName }} {{ baseInfo.updateBy }}
<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>
<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 }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">备注</template> <template slot="label">备注</template>
{{ baseInfo.remark }} {{ baseInfo.remark }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
</div> </div>
<div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;"> <div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;">
@ -78,8 +74,8 @@
</div> </div>
</div> </div>
<div style="width: 100%;height: 400px;overflow-y: auto;"> <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 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" width="80" type="index" />
<!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> --> <!-- <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="materialCode" :show-overflow-tooltip="true" />
@ -92,15 +88,15 @@
<span v-if="scope.row.salesMode==2">称重</span> <span v-if="scope.row.salesMode==2">称重</span>
</template> --> </template> -->
</el-table-column> </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"> <template slot-scope="scope">
<span>{{ (scope.row.singlePrice/100).toFixed(2) }}</span> <span>{{ (scope.row.unitPrice).toFixed(2) }}</span>
</template> </template>
</el-table-column> </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="purchaseNum" :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="" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.orderNum*scope.row.singlePrice }}</span> <span>{{ scope.row.purchaseNum*scope.row.unitPrice }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"></el-table-column> <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"></el-table-column>
@ -114,10 +110,8 @@
</div> </div>
</template> </template>
<script> <script>
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; import { getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage";
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage";
import { getPurchaseContractInfoApi,addPurchaseContractApi,editPurchaseContractApi,delPurchaseContractApi } from "@/api/foodManage/purchaseManage";
export default { export default {
name: "PlanDetail", name: "PlanDetail",
dicts: [], dicts: [],
@ -164,7 +158,7 @@ export default {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000 return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
} }
}, },
contractMaterialList:[], materialList:[],
openDialog:false, openDialog:false,
materialTreeOptions:[], materialTreeOptions:[],
// //
@ -196,22 +190,23 @@ export default {
getContractInfo(){ getContractInfo(){
console.log(this.pageJson) console.log(this.pageJson)
let param = { let param = {
contractId:this.pageJson.contractId planId:this.pageJson.planId
} }
// //
getPurchaseContractInfoApi(param).then((response) => { getPurchasePlanInfoApi(param).then((response) => {
this.baseInfo = response.data; this.baseInfo = response.data;
this.$set(this.baseInfo,'dateRange',[this.baseInfo.contractStartTime,this.baseInfo.contractEndTime]) this.materialList = this.baseInfo.purchasePlanDetailList;
this.contractMaterialList = this.baseInfo.purchaseContractDetailList; this.materialList.forEach(item=>{
this.$set(this.baseInfo,"contractAmount",this.baseInfo.contractAmount/100) this.$set(item,"unitPrice",Number(item.unitPrice)/100)
getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => { })
this.canteenOptions=response.rows||[]; // getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => {
this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId) // 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||[]; // getStallByCanteenApi({ canteenId:this.baseInfo.canteenId }).then((response) => {
this.$set(this.baseInfo,'supplierId',this.baseInfo.supplierId) // 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-form-item label="采购时间" prop="purchaseDate">
<el-date-picker <el-date-picker
v-model="baseInfo.purchaseDate" v-model="baseInfo.purchaseDate"
type="date" align="right" type="datetime" align="right"
format="yyyy-MM-dd" style="width: 240px;" format="yyyy-MM-dd HH:mm:ss" style="width: 240px;"
:picker-options="pickerOptions" @change="baseInfo.purchaseDate=formatDate(baseInfo.purchaseDate)"> :picker-options="pickerOptions" @change="baseInfo.purchaseDate=formatDateTime(baseInfo.purchaseDate)">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="交货日期" prop="deliverGoodsDate"> <el-form-item label="交货日期" prop="deliverGoodsDate">
@ -20,10 +20,7 @@
format="yyyy-MM-dd" style="width: 240px;" format="yyyy-MM-dd" style="width: 240px;"
:picker-options="pickerOptions" @change="baseInfo.deliverGoodsDate=formatDate(baseInfo.deliverGoodsDate)"> :picker-options="pickerOptions" @change="baseInfo.deliverGoodsDate=formatDate(baseInfo.deliverGoodsDate)">
</el-date-picker> </el-date-picker>
</el-form-item> </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-form-item label="所属区域" prop="areaId">
<el-cascader v-model="baseInfo.areaId" <el-cascader v-model="baseInfo.areaId"
:options="treeAreaOptions" :filterable="true" style="width: 240px" :show-all-levels="false" :options="treeAreaOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
@ -33,18 +30,9 @@
value:'id',label:'label' value:'id',label:'label'
}" @change="handleAreaChange"> }" @change="handleAreaChange">
</el-cascader> </el-cascader>
</el-form-item> </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-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" <el-option v-for="item in canteenOptions"
:key="item.canteenId" :key="item.canteenId"
:label="item.canteenName" :label="item.canteenName"
@ -52,6 +40,15 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </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-form-item label="备注" prop="remark">
<el-input v-model="baseInfo.remark" placeholder="请输入备注" maxlength="30" clearable style="width: 240px"/> <el-input v-model="baseInfo.remark" placeholder="请输入备注" maxlength="30" clearable style="width: 240px"/>
</el-form-item> </el-form-item>
@ -68,7 +65,7 @@
</div> </div>
</div> </div>
<div style="width: 100%;height: 400px;overflow-y: auto;"> <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 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" width="80" type="index" />
<!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> --> <!-- <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="materialName" :show-overflow-tooltip="true" />
<el-table-column label="货品类别" align="center" prop="materialTypeName" :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="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"> <el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
<!-- <template slot-scope="scope"> <!-- <template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span> <span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span> <span v-if="scope.row.salesMode==2">称重</span>
</template> --> </template> -->
</el-table-column> </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"> <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> </template>
</el-table-column> </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"> <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> </template>
</el-table-column> </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"> <template slot-scope="scope">
<span>{{ scope.row.orderNum*scope.row.singlePrice }}</span> <span>{{ scope.row.purchaseNum*scope.row.unitPrice }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"> <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true">
@ -111,7 +109,7 @@
<el-button @click="jumpList">返回</el-button> <el-button @click="jumpList">返回</el-button>
</div> </div>
<!-- 选择--> <!-- 选择-->
<el-dialog title="选择货品" :visible.sync="openDialog" width="65%" append-to-body > <el-dialog title="选择货品" :visible.sync="openDialog" width="65%" append-to-body >
<div style="width: 100%;height:620px;"> <div style="width: 100%;height:620px;">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px"> <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> <span v-if="scope.row.salesMode==2">称重</span>
</template> --> </template> -->
</el-table-column> </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"> <el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span> <span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span>
@ -180,50 +179,45 @@
<script> <script>
import { imgUpLoadTwo } from '@/api/system/upload' import { imgUpLoadTwo } from '@/api/system/upload'
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage"; 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 { export default {
name: "PlaEdit", name: "PlanEdit",
dicts: [], dicts: [],
data() { data() {
return { return {
pageJson:{},// pageJson:{},//
loading:false, loading:false,
loadingBtn:false, loadingBtn:false,
baseInfo: { baseInfo: {},
contractTitle:undefined,
contractType:undefined,
areaId:undefined,
canteenId:undefined,
},
// //
baseRules: { baseRules: {
contractTitle: [ purchaseDate: [
{ required: true, message: "菜谱名称不能为空", trigger: "blur" } { required: true, message: "采购日期不能为空", trigger: "change" }
], ],
deliverGoodsDate: [
{ required: true, message: "交货日期不能为空", trigger: "change" }
],
areaId: [ areaId: [
{ required: true, message: "所属区域不能为空", trigger: "change" } { required: true, message: "所属区域不能为空", trigger: "change" }
], ],
canteenId: [ canteenId: [
{ required: true, message: "所属食堂不能为空", trigger: "change" } { required: true, message: "所属食堂不能为空", trigger: "change" }
], ],
supplierId: [ stallId: [
{ required: true, message: "供应商不能为空", trigger: "change" } { required: true, message: "所属档口不能为空", trigger: "change" }
], ],
purchaseDate: [
{ required: true, message: "签订日期不能为空", trigger: "change" }
],
}, },
treeAreaOptions:[], treeAreaOptions:[],
canteenOptions:[], canteenOptions:[],
supplierOptions:[],
stallOptions:[], stallOptions:[],
pickerOptions: { pickerOptions: {
disabledDate(v) { disabledDate(v) {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000 return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
} }
}, },
contractMaterialList:[],//- materialList:[],//-
batchIds:[],//-- batchIds:[],//--
openDialog:false, openDialog:false,
materialTreeOptions:[], materialTreeOptions:[],
@ -249,41 +243,36 @@ export default {
methods: { methods: {
// //
jumpList() { jumpList() {
const obj = { path: "foodManage/purchaseManage/contractDetail" }; const obj = { path: "foodManage/purchaseManage/planEdit" };
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj);
this.$router.replace({ path: "/foodManage/purchaseManage/contractList" }); // this.$router.replace({ path: "/foodManage/purchaseManage/purchasePlan" }); //
}, },
getContractInfo(){ getContractInfo(){
console.log(this.pageJson) console.log(this.pageJson)
let param = { let param = {
contractId:this.pageJson.contractId planId:this.pageJson.planId
} }
// //
getPurchaseContractInfoApi(param).then((response) => { getPurchasePlanInfoApi(param).then((response) => {
this.baseInfo = response.data; this.baseInfo = response.data;
this.contractMaterialList = this.baseInfo.purchaseContractDetailList; this.materialList = this.baseInfo.purchasePlanDetailList;
this.contractMaterialList.forEach(item=>{ this.materialList.forEach(item=>{
this.$set(item,"singlePrice",Number(item.singlePrice)/100) 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) => { getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => {
this.canteenOptions=response.rows||[]; this.canteenOptions=response.rows||[];
this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId) this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId)
}); });
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => { getStallByCanteenApi({ canteenId:this.baseInfo.canteenId }).then((response) => {
this.supplierOptions = response.rows||[]; this.stallOptions=response.rows||[]
this.$set(this.baseInfo,'supplierId',this.baseInfo.supplierId) this.$set(this.baseInfo,"stallId",this.baseInfo.stallId)
}); });
}); });
}, },
// //
getAreaTreeData() { getAreaTreeData() {
systemAreaTreeApi({}).then((response) => { systemAreaTreeApi({}).then((response) => {
this.treeAreaOptions = response.data; this.treeAreaOptions = response.data;
// if(this.treeAreaOptions.length>0){
// this.baseInfo.areaId = this.getFirstChild(this.treeAreaOptions[0]).id;
// this.handleAreaChange()
// }
}); });
}, },
getFirstChild(node) { getFirstChild(node) {
@ -295,9 +284,8 @@ export default {
}, },
//- //-
handleAreaChange(e){ handleAreaChange(e){
this.getCanteenData() this.getCanteenData()
this.getSupplierData() },
},
/** 查询查询食堂下拉结构 */ /** 查询查询食堂下拉结构 */
getCanteenData() { getCanteenData() {
let param= { let param= {
@ -307,14 +295,22 @@ export default {
this.canteenOptions=response.rows||[]; this.canteenOptions=response.rows||[];
this.$set(this.baseInfo,"canteenId",null) this.$set(this.baseInfo,"canteenId",null)
}); });
}, },
/** 查询供应商下拉结构 */ //-
getSupplierData() { handleCanteenChange(e){
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => { this.getStallData()
this.supplierOptions = response.rows||[]; },
this.$set(this.baseInfo,"supplierId",null) /** 查询查询食堂下拉结构 */
}); getStallData() {
}, let param= {
canteenId:this.baseInfo.canteenId
}
getStallByCanteenApi(param).then((response) => {
this.stallOptions=response.rows||[]
this.$set(this.baseInfo,"stallId",null)
});
},
/** 查询货品类别下拉树结构 */ /** 查询货品类别下拉树结构 */
getMaterialTree() { getMaterialTree() {
let param = { let param = {
@ -335,9 +331,9 @@ export default {
// //
delMaterial(){ delMaterial(){
this.batchIds.forEach(ID=>{ 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){ if(index>-1){
this.contractMaterialList.splice(index,1) this.materialList.splice(index,1)
} }
}) })
}, },
@ -384,14 +380,19 @@ export default {
handleSelectionChange2(selection) { handleSelectionChange2(selection) {
this.batchChosenMaterial = selection; this.batchChosenMaterial = selection;
this.batchChosenMaterial.forEach(item=>{ this.batchChosenMaterial.forEach(item=>{
this.$set(item,"orderNum",0) this.$set(item,"purchaseNum",0)
this.$set(item,"singlePrice",item.unitPrice/100) this.$set(item,"unitPrice",item.unitPrice)
}) })
}, },
confirmChosen(){ confirmChosen(){
if(this.batchChosenMaterial.length>0){ if(this.batchChosenMaterial.length>0){
this.loading = true this.loading = true;
this.contractMaterialList = this.batchChosenMaterial; this.materialList = []
this.batchChosenMaterial.forEach(item=>{
let obj = Object.assign({}, item)
obj.unitPrice = item.unitPrice/100;
this.materialList.push(obj)
})
setTimeout(()=>{ setTimeout(()=>{
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false
@ -403,28 +404,30 @@ export default {
this.$refs["baseInfo"].validate(valid => { this.$refs["baseInfo"].validate(valid => {
if (valid) { if (valid) {
let param = Object.assign({},this.baseInfo); 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.deliverGoodsDate = this.formatDate(this.baseInfo.deliverGoodsDate)
param.purchaseBudgetTotal = this.baseInfo.purchaseBudgetTotal*100; param.purchaseBudgetTotal = 0
param.commitStatus=1 param.status=1
param.purchaseContractDetailList = [] param.purchasePlanDetailList = []
this.noMaterial = false; this.noMaterial = false;
if(this.contractMaterialList.length>0){ if(this.materialList.length>0){
this.contractMaterialList.forEach(item=>{ this.materialList.forEach(item=>{
if(item.singlePrice==0 || item.orderNum==0){ if(item.unitPrice==0 || item.purchaseNum==0){
this.noMaterial = true this.noMaterial = true
}else{ }else{
let obj = Object.assign({}, item) let obj = Object.assign({}, item)
obj.singlePrice = Number(obj.singlePrice)*100 obj.unitPrice = Number(obj.unitPrice)*100
param.purchaseContractDetailList.push(obj) obj.purchasingBudgetPrice = (Number(obj.unitPrice)*Number(obj.purchaseNum))
param.purchasePlanDetailList.push(obj)
param.purchaseBudgetTotal = param.purchaseBudgetTotal+obj.purchasingBudgetPrice
} }
}) })
} }
if(this.noMaterial){ if(this.noMaterial){
this.$modal.msgError("请输入单价和数量!"); this.$modal.msgError("请输入参考价和采购数量!");
}else{ }else{
this.noMaterial = true; this.noMaterial = true;
if(this.contractMaterialList.length>0){ if(this.materialList.length>0){
this.noMaterial = false; this.noMaterial = false;
} }
console.log(param) console.log(param)
@ -432,8 +435,8 @@ export default {
this.$modal.msgError("请添加货品!"); this.$modal.msgError("请添加货品!");
}else{ }else{
this.loadingBtn=true; this.loadingBtn=true;
if (this.baseInfo.contractId != undefined) { if (this.baseInfo.planId != undefined) {
editPurchaseContractApi(param).then((response) => { editPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
@ -441,7 +444,7 @@ export default {
this.loadingBtn=false this.loadingBtn=false
}); });
} else { } else {
addPurchaseContractApi(param).then((response) => { addPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("保存成功"); this.$modal.msgSuccess("保存成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
@ -460,28 +463,30 @@ export default {
this.$refs["baseInfo"].validate(valid => { this.$refs["baseInfo"].validate(valid => {
if (valid) { if (valid) {
let param = Object.assign({},this.baseInfo); 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.deliverGoodsDate = this.formatDate(this.baseInfo.deliverGoodsDate)
param.purchaseBudgetTotal = this.baseInfo.purchaseBudgetTotal*100; param.purchaseBudgetTotal = 0
param.commitStatus=2 param.status=2
param.purchaseContractDetailList = [] param.purchasePlanDetailList = []
this.noMaterial = false; this.noMaterial = false;
if(this.contractMaterialList.length>0){ if(this.materialList.length>0){
this.contractMaterialList.forEach(item=>{ this.materialList.forEach(item=>{
if(item.singlePrice==0 || item.orderNum==0){ if(item.unitPrice==0 || item.purchaseNum==0){
this.noMaterial = true this.noMaterial = true
}else{ }else{
let obj = Object.assign({}, item) let obj = Object.assign({}, item)
obj.singlePrice = Number(obj.singlePrice)*100 obj.unitPrice = Number(obj.unitPrice)*100
param.purchaseContractDetailList.push(obj) obj.purchasingBudgetPrice = (Number(obj.unitPrice)*Number(obj.purchaseNum))
param.purchasePlanDetailList.push(obj)
param.purchaseBudgetTotal = param.purchaseBudgetTotal+obj.purchasingBudgetPrice
} }
}) })
} }
if(this.noMaterial){ if(this.noMaterial){
this.$modal.msgError("请输入单价和数量!"); this.$modal.msgError("请输入参考价和采购数量!");
}else{ }else{
this.noMaterial = true; this.noMaterial = true;
if(this.contractMaterialList.length>0){ if(this.materialList.length>0){
this.noMaterial = false; this.noMaterial = false;
} }
console.log(param) console.log(param)
@ -489,8 +494,8 @@ export default {
this.$modal.msgError("请添加货品!"); this.$modal.msgError("请添加货品!");
}else{ }else{
this.loadingBtn=true; this.loadingBtn=true;
if (this.baseInfo.contractId != undefined) { if (this.baseInfo.planId != undefined) {
editPurchaseContractApi(param).then((response) => { editPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
@ -498,7 +503,7 @@ export default {
this.loadingBtn=false this.loadingBtn=false
}); });
} else { } else {
addPurchaseContractApi(param).then((response) => { addPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("保存成功"); this.$modal.msgSuccess("保存成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()

View File

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