领料单导入采购计划,采购计划生成询价单

This commit is contained in:
zzyuan 2025-08-06 09:06:54 +08:00
parent d0aef87a51
commit 0f1cb53c64
4 changed files with 249 additions and 16 deletions

View File

@ -65,6 +65,7 @@
</div> </div>
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<el-button type="primary" plain @click="addMaterial">添加货品</el-button> <el-button type="primary" plain @click="addMaterial">添加货品</el-button>
<el-button type="primary" plain @click="importPurchasePlan">导入采购计划</el-button>
<el-button type="danger" plain @click="delMaterial">删除</el-button> <el-button type="danger" plain @click="delMaterial">删除</el-button>
</div> </div>
</div> </div>
@ -158,6 +159,71 @@
<el-button @click="openDialog=false"> </el-button> <el-button @click="openDialog=false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 导入 -->
<el-dialog title="导入采购计划" :visible.sync="openImportDialog" width="60%" append-to-body >
<div style="width: 100%;height:650px;">
<el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-width="100px">
<el-form-item label="计划日期">
<el-date-picker
v-model="dateRange"
type="datetimerange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd HH:mm:ss" style="width: 400px"
:default-time="['00:00:00', '23:59:59']"
:picker-options="pickerOptions2" >
</el-date-picker>
</el-form-item>
<el-form-item label="采购计划单号" prop="planCode">
<el-input v-model="queryParams2.planCode" placeholder="请输入采购单号" maxlength="20" clearable style="width: 240px"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery2">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery2">重置</el-button>
</el-form-item>
</el-form>
<!-- :row-key="(row)=>{return row.fetchMaterialId}" @selection-change="handleSelectionChange3" -->
<el-table v-loading="loading2" :data="tableListData2" ref="multipleTable2" highlight-current-row @current-change="handleCurrentChange" height="300">
<!-- <el-table-column type="selection" width="50" align="center" :reserve-selection="true" /> -->
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{(queryParams2.pageNum - 1) * queryParams2.pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<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="canteenName" :show-overflow-tooltip="true" />
<el-table-column label="所属档口" align="center" prop="stallName" :show-overflow-tooltip="true" />
<el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="total2>0"
:total="total2"
:page.sync="queryParams2.pageNum"
:limit.sync="queryParams2.pageSize"
@pagination="getList2"
/>
<div>
<div>采购计划明细</div>
<el-table :data="materialDetailsData" height="250">
<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="purchaseNum" :show-overflow-tooltip="true" />
</el-table>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmImport"> </el-button>
<el-button @click="openImportDialog=false"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -166,6 +232,7 @@ import { imgUpLoadTwo } from '@/api/system/upload'
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getStockMaterialListApi,drpWareHousePageApi } from "@/api/foodManage/pickManage"; import { systemMaterialTreeApi,getStockMaterialListApi,drpWareHousePageApi } from "@/api/foodManage/pickManage";
import { getFetchMaterialInfoApi,addFetchMaterialApi,editFetchMaterialApi } from "@/api/foodManage/pickManage"; import { getFetchMaterialInfoApi,addFetchMaterialApi,editFetchMaterialApi } from "@/api/foodManage/pickManage";
import { purchasePlanPageApi,getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage";
export default { export default {
name: "MaterialPickingEdit", name: "MaterialPickingEdit",
dicts: [], dicts: [],
@ -229,6 +296,46 @@ export default {
tableListData: [],//- tableListData: [],//-
batchChosenMaterial:[],//-- batchChosenMaterial:[],//--
noMaterial:false, noMaterial:false,
//
openImportDialog:false,
queryParams2: { // --
pageNum: 1,
pageSize: 10,
planCode:null
},
loading2:false,
total2: 0, //
tableListData2: [],//-
importRow:{},//--
materialDetailsData: [],//-
dateRange:this.defaultDateRange(),//
pickerOptions2: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const start = new Date();
const end = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
picker.$emit('pick', [start, end]);
}
},{
text: '最近一个月',
onClick(picker) {
const start = new Date();
const end = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
},{
text: '最近三个月',
onClick(picker) {
const start = new Date();
const end = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 91);
picker.$emit('pick', [start, end]);
}
}]
},
}; };
}, },
@ -521,6 +628,81 @@ export default {
} }
}); });
}, },
//
importPurchasePlan(){
if(this.baseInfo.areaId!=undefined||this.baseInfo.canteenId!=undefined||this.baseInfo.stallId!=undefined){
this.openImportDialog=true
this.resetQuery2()
// setTimeout(()=>{
// this.$refs.multipleTable2.clearSelection()
// },300)
}else{
this.$modal.msgError("请先选择区域,食堂,档口");
}
},
/** 搜索按钮操作 */
handleQuery2() {
this.queryParams2.pageNum = 1;
this.getList2();
},
/** 重置按钮操作 */
resetQuery2() {
this.dateRange = this.defaultDateRange()
this.resetForm("queryForm2");
this.handleQuery2();
},
/** 查询列表 */
getList2() {
this.loading2 = true;
let param = {
"pageSize": this.queryParams2.pageSize,
"pageNum": this.queryParams2.pageNum,
"planCode": this.queryParams2.planCode,
"status":2,
"areaId": this.baseInfo.areaId,
"canteenId": this.baseInfo.canteenId,
"stallId": this.baseInfo.stallId
}
if(this.dateRange&&this.dateRange.length>0){
param.startDateTime=this.formatDateTime(this.dateRange[0])
param.endDateTime=this.formatDateTime(this.dateRange[1])
}else{
param.startDateTime=undefined;
param.endDateTime=undefined;
}
purchasePlanPageApi(param).then(response => {
this.tableListData2 = response.rows;
this.total2 = Number(response.total);
this.loading2 = false;
});
},
//
handleCurrentChange(row){
console.log(row)
this.importRow = row;
let param = {
planId:this.importRow.planId
}
getPurchasePlanInfoApi(param).then((response) => {
this.materialDetailsData = response.data.purchasePlanDetailList||[];
});
},
confirmImport(){
if(this.materialDetailsData.length>0){
this.$modal.confirm('是否确认覆盖货品明细?').then(() => {
this.materialList = this.materialDetailsData;
this.materialList.forEach(item=>{
this.$set(item,"fetchNum",item.purchaseNum)
})
// this.baseInfo.purchasePlanCode = this.importRow.planCode;
setTimeout(()=>{
this.openImportDialog=false
},500)
}).catch(() => {});
}else{
this.$modal.msgError("采购计划明细无货品");
}
},
patternValue(row){ patternValue(row){
row.fetchNum = row.fetchNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1') row.fetchNum = row.fetchNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
setTimeout(()=>{ setTimeout(()=>{
@ -529,6 +711,15 @@ export default {
} }
},500) },500)
}, },
defaultDateRange() {
const end = new Date(new Date().toLocaleDateString());
end.setTime(end.getTime() + 24 * 60 * 60 * 1000 -1);
const start = new Date((new Date().toLocaleDateString()));
start.setTime(start.getTime() - 30 * 24 * 60 * 60 * 1000);
this.start = parseInt(start.getTime() / 1000)
this.end = parseInt(end.getTime() / 1000)
return [start, end]
},
// //
formatDate(date) { formatDate(date) {
// YYYY-MM-DD // YYYY-MM-DD

View File

@ -199,7 +199,7 @@ export default {
}, },
treeAreaOptions:[],// treeAreaOptions:[],//
wareHouseOptions:[],// wareHouseOptions:[],//
dateRange:this.defaultDateRange(), dateRange:[],
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [{
text: '最近一周', text: '最近一周',
@ -269,7 +269,7 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = this.defaultDateRange() this.dateRange = []
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },

View File

@ -79,20 +79,20 @@
<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="ifBreakDown" :show-overflow-tooltip="true" width="100"> <el-table-column label="是否生成采购订单" align="center" prop="ifBreakDown" :show-overflow-tooltip="true" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="!scope.row.ifBreakDown"></span> <span v-if="!scope.row.ifBreakDown"></span>
<span v-if="scope.row.ifBreakDown"></span> <span v-if="scope.row.ifBreakDown"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="生产计划单号" align="center" prop="productionPlanId" :show-overflow-tooltip="true" /> <el-table-column label="生产计划单号" align="center" prop="productionPlanId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="采购计划单号" align="center" prop="planCode" :show-overflow-tooltip="true" /> <el-table-column label="采购计划单号" align="center" prop="planCode" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="采购计划时间" align="center" prop="purchaseDate" :show-overflow-tooltip="true" /> <el-table-column label="采购计划时间" align="center" prop="purchaseDate" :show-overflow-tooltip="true" width="160"/>
<el-table-column label="所属区域" align="center" prop="areaName" :show-overflow-tooltip="true" width="120"/> <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="canteenName" :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="stallName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="计划采购货品总数量" align="center" prop="totalNum" :show-overflow-tooltip="true" /> <el-table-column label="计划采购货品总数量" align="center" prop="totalNum" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="采购预算金额(元)" align="center" prop="purchaseBudgetTotal" :show-overflow-tooltip="true"> <el-table-column label="采购预算金额(元)" align="center" prop="purchaseBudgetTotal" :show-overflow-tooltip="true" >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (scope.row.purchaseBudgetTotal/100).toFixed(2) }}</span> <span>{{ (scope.row.purchaseBudgetTotal/100).toFixed(2) }}</span>
</template> </template>
@ -108,30 +108,36 @@
<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="createBy" :show-overflow-tooltip="true" width="100"/> <!-- <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" 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="200" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" v-if="scope.row.status==1" v-if="scope.row.status==1"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
>编辑</el-button> >编辑</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" v-if="scope.row.status==2" v-if="scope.row.status==2"
@click="handleView(scope.row)" @click="handleView(scope.row)"
>详情</el-button> >详情</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" v-if="scope.row.status==2" v-if="scope.row.status==2"
@click="handlePurchaseOrder(scope.row)" @click="handlePurchaseOrder(scope.row)"
>生成采购订单</el-button> >生成采购订单</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" v-if="scope.row.status==1" v-if="scope.row.status==2"
@click="handlePurchaseInquiry(scope.row)"
>生成询价单</el-button>
<el-button
size="mini"
type="text"
v-if="scope.row.status==1"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
>删除</el-button> >删除</el-button>
</template> </template>
@ -165,7 +171,7 @@
<script> <script>
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { purchasePlanPageApi, getPurchasePlanInfoApi, delPurchasePlanApi,addPurchaseOrderApi } from "@/api/foodManage/purchaseManage"; import { purchasePlanPageApi, getPurchasePlanInfoApi, delPurchasePlanApi,addPurchaseOrderApi,addGoodsInquiryApi } from "@/api/foodManage/purchaseManage";
export default { export default {
name: "", name: "",
@ -400,6 +406,42 @@ export default {
}).catch(() => {}); }).catch(() => {});
}); });
},
//
handlePurchaseInquiry(row){
//
getPurchasePlanInfoApi({planId:row.planId}).then((response) => {
var purchasePlanDetailList = response.data.purchasePlanDetailList
this.$modal.confirm('是否确认生成询价单?').then(function() {
let param = {
title:"采购计划生成询价单",
purchasePlanCode:row.planCode,
requestArrivalTime:null,
startTime:null,
endTime:null,
supplierIds:[],
areaId:row.areaId,
canteenId:row.canteenId,
stallId:row.stallId,
linkMan:null,
phone:null,
address:null,
inquiryNotes:"采购计划生成询价单",
detailList:[],
status: 1,
}
purchasePlanDetailList.forEach(item=>{
let obj = Object.assign({}, item)
obj.purNum = Number(item.purchaseNum)
param.detailList.push(obj)
})
return addGoodsInquiryApi(param);//
}).then((res) => {
this.getList();
this.$router.push({ path: "/foodManage/purchaseManage/goodsInquiryEdit",query: {goodsInquiryData:JSON.stringify(res.data)} });
}).catch(() => {});
});
}, },
defaultDateRange() { defaultDateRange() {
const end = new Date(new Date().toLocaleDateString()); const end = new Date(new Date().toLocaleDateString());

View File

@ -202,7 +202,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="采购单号" align="center" prop="orderGoodsCode" :show-overflow-tooltip="true" /> <el-table-column label="采购单号" align="center" prop="orderGoodsCode" :show-overflow-tooltip="true" />
<el-table-column label="采购订单标题" align="center" prop="orderGoodsCode" :show-overflow-tooltip="true"/> <el-table-column label="采购订单标题" align="center" prop="orderTitle" :show-overflow-tooltip="true"/>
<el-table-column label="采购总金额(元" align="center" prop="orderAmount" :show-overflow-tooltip="true" width="120"> <el-table-column label="采购总金额(元" align="center" prop="orderAmount" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (scope.row.orderAmount/100).toFixed(2) }}</span> <span>{{ (scope.row.orderAmount/100).toFixed(2) }}</span>