入库管理导入功能

This commit is contained in:
zzyuan 2025-07-18 14:26:13 +08:00
parent 149ba8b0e8
commit 90c8899d5c
1 changed files with 138 additions and 2 deletions

View File

@ -51,6 +51,7 @@
</div>
<div style="display: flex;align-items: center;">
<el-button type="primary" plain @click="addMaterial">添加货品</el-button>
<el-button type="primary" plain @click="importPurchaseOrder">导入采购订单</el-button>
<el-button type="danger" plain @click="delMaterial">删除</el-button>
</div>
</div>
@ -180,6 +181,57 @@
<el-button @click="openDialog=false"> </el-button>
</div>
</el-dialog>
<!-- 导入 -->
<el-dialog title="导入采购订单" :visible.sync="openImportDialog" width="60%" append-to-body >
<div style="width: 100%;height:600px;">
<el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-width="100px">
<el-form-item label="采购单号" prop="orderGoodsCode">
<el-input v-model="queryParams2.orderGoodsCode" 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" height="500">
<!-- <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="orderGoodsCode" :show-overflow-tooltip="true" />
<el-table-column label="采购订单标题" align="center" prop="orderGoodsCode" :show-overflow-tooltip="true"/>
<el-table-column label="采购总金额(元" align="center" prop="orderAmount" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope">
<span>{{ (scope.row.orderAmount/100).toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column label="供应商" align="center" prop="supplierName" :show-overflow-tooltip="true" />
<el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text"
@click="confirmImport(scope.row)" v-if="scope.row.orderStatus==2"
>导入</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total2>0"
:total="total2"
:page.sync="queryParams2.pageNum"
:limit.sync="queryParams2.pageSize"
@pagination="getList2"
/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="openImportDialog=false"> </el-button>
<el-button @click="openImportDialog=false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -188,6 +240,7 @@ import { imgUpLoadTwo } from '@/api/system/upload'
import { systemAreaTreeApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getMaterialListApi,drpWareHousePageApi,supplierPageApi } from "@/api/foodManage/stockManage";
import { getWarehouseInInfoApi,addWarehouseInApi,editWarehouseInApi } from "@/api/foodManage/stockManage";
import { purchaseOrderPageApi,getPurchaseOrderInfoApi } from "@/api/foodManage/purchaseManage";
export default {
name: "WarehouseInEdit",
dicts: [],
@ -258,6 +311,18 @@ export default {
tableListData: [],//-
batchChosenMaterial:[],//--
noMaterial:false,
//
openImportDialog:false,
queryParams2: { // --
pageNum: 1,
pageSize: 10,
orderGoodsCode:null
},
loading2:false,
total2: 0, //
tableListData2: [],//-
importRow:{},//--
materialDetailsData: [],//-
};
},
@ -313,6 +378,10 @@ export default {
getAreaTreeData() {
systemAreaTreeApi({}).then((response) => {
this.treeAreaOptions = response.data;
if(this.treeAreaOptions.length>0){
this.$set(this.baseInfo,"areaId",this.getFirstChild(this.treeAreaOptions[0]).id)
this.handleAreaChange()
}
});
},
getFirstChild(node) {
@ -331,7 +400,9 @@ export default {
getWareHouseData() {
drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => {
this.wareHouseOptions = response.rows||[];
this.$set(this.baseInfo,'warehouseId',null)
if(this.wareHouseOptions.length>0){
this.$set(this.baseInfo,"warehouseId",this.wareHouseOptions[0].warehouseId)
}
});
},
/** 查询供应商下拉结构 */
@ -547,7 +618,72 @@ export default {
}
});
},
//
importPurchaseOrder(){
if(this.baseInfo.areaId!=undefined||this.baseInfo.warehouseId!=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.resetForm("queryForm2");
this.handleQuery2();
},
/** 查询列表 */
getList2() {
this.loading2 = true;
let param = {
"pageSize": this.queryParams2.pageSize,
"pageNum": this.queryParams2.pageNum,
"orderGoodsCode": this.queryParams2.orderGoodsCode,
"orderStatus":2,
"areaId": this.baseInfo.areaId,
"warehouseId": this.baseInfo.warehouseId,
"supplierId": this.baseInfo.deliverySupplierId,
}
purchaseOrderPageApi(param).then(response => {
this.tableListData2 = response.rows;
this.total2 = Number(response.total);
this.loading2 = false;
});
},
confirmImport(row){
console.log(row)
this.importRow = row;
let param = {
orderGoodsId:this.importRow.orderGoodsId
}
getPurchaseOrderInfoApi(param).then((response) => {
this.materialDetailsData = response.data.orderGoodsDetailList||[];
this.$modal.confirm('是否确认导入采购订单?').then(()=>{
if(this.materialDetailsData.length>0){
this.materialList = this.materialDetailsData;
this.materialList.forEach(item=>{
this.$set(item,"unitPrice",Number(item.singlePrice)/100)
this.$set(item,"purNum",item.orderNum)
})
// this.baseInfo.relateOrderGoodsId = this.importRow.orderGoodsCode;
// this.$set(this.baseInfo,"remark","")
setTimeout(()=>{
this.openImportDialog=false
},500)
}else{
this.$modal.msgError("采购订单明细无货品!");
}
}).catch(() => {});
});
},
//
formatDate(date) {
// YYYY-MM-DD