From 9ed322f9d53258ea0ee1254343767d7e5ea4635e Mon Sep 17 00:00:00 2001
From: zzyuan <781948537@qq.com>
Date: Mon, 11 Aug 2025 17:46:05 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=A2=E4=BB=B7=E5=AF=BC=E5=85=A5=E9=87=87?=
 =?UTF-8?q?=E8=B4=AD=E8=AE=A1=E5=88=92=EF=BC=8C=E5=87=BA=E5=BA=93=E5=AF=BC?=
 =?UTF-8?q?=E5=85=A5=E9=A2=86=E6=96=99=E5=8D=95=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 .../purchaseManage/goodsInquiry/edit.vue      | 195 +++++++++++++++++-
 .../stockManage/warehouseOut/edit.vue         |  35 ++--
 vue.config.js                                 |   4 +-
 3 files changed, 218 insertions(+), 16 deletions(-)
diff --git a/src/views/foodManage/purchaseManage/goodsInquiry/edit.vue b/src/views/foodManage/purchaseManage/goodsInquiry/edit.vue
index a48a1dbe..d2084076 100644
--- a/src/views/foodManage/purchaseManage/goodsInquiry/edit.vue
+++ b/src/views/foodManage/purchaseManage/goodsInquiry/edit.vue
@@ -71,6 +71,7 @@
                 
                 
                     添加货品
+                    导入采购计划
                     删除
                 
             
@@ -179,6 +180,71 @@
                 取 消
             
         
+
+        
+        
+            
+                
  
+                    
+                        
+                        
+                    
+                    
+                        
+                    
+
+                    
+                        搜索
+                        重置
+                    
+                
+                
+                
+                    
+                    
+                        
+                        {{(queryParams2.pageNum - 1) * queryParams2.pageSize + scope.$index + 1}}
+                        
+                     
+                     
+                      
+                     
+                       
+                      
+                
+                
 
+                
+            
 
+            
+         
     
 
 
@@ -187,6 +253,7 @@ import { imgUpLoadTwo } from '@/api/system/upload'
 import { systemAreaTreeApi } from "@/api/base/stall";
 import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/stockManage";
 import { getGoodsInquiryInfoApi,addGoodsInquiryApi,editGoodsInquiryApi } from "@/api/foodManage/purchaseManage";
+import { purchasePlanPageApi,getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage";
 export default {
     name: "GoodsInquiryEdit",
     dicts: [],
@@ -257,6 +324,46 @@ export default {
         tableListData: [],//货品弹窗-货品表格数据
         batchChosenMaterial:[],//货品弹窗-货品表格-选中的货品数组
         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]);
+                }
+            }]
+        },
 
       };
     },
@@ -603,8 +710,94 @@ export default {
                     }
                 }
             });
+        }, 
+        //导入
+        importPurchasePlan(){
+            if(this.baseInfo.areaId!=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.queryParams2 = {
+                pageNum: 1,
+                pageSize: 10, 
+            }
+            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,
+            }
+            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,"purNum",item.purchaseNum)
+                    })
+                    this.baseInfo.purchasePlanCode = this.importRow.planCode; 
+                    this.$set(this.baseInfo,"remark","导入采购计划")
+                    setTimeout(()=>{ 
+                        this.openImportDialog=false
+                    },500) 
+                }).catch(() => {}); 
+            }else{
+                this.$modal.msgError("采购计划明细无货品");
+            }
+        },
+        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) {
             // 格式化为 YYYY-MM-DD
diff --git a/src/views/foodManage/stockManage/warehouseOut/edit.vue b/src/views/foodManage/stockManage/warehouseOut/edit.vue
index 234489ef..65d622f2 100644
--- a/src/views/foodManage/stockManage/warehouseOut/edit.vue
+++ b/src/views/foodManage/stockManage/warehouseOut/edit.vue
@@ -75,7 +75,7 @@
                     
                     
                         
-                            
+                            
                         
                       
                 
@@ -426,16 +426,25 @@ export default {
         },
         confirmChosen(){
             if(this.batchChosenMaterial.length>0){
-                this.loading = true
-                let items = [...this.materialList,...this.batchChosenMaterial] 
-                let uniqueItems = items.filter((item, index, array) => {
-                    return array.findIndex((t) => (t.materialId === item.materialId)) === index;
-                });
-                this.materialList = uniqueItems; 
-                setTimeout(()=>{
-                    this.loading = false
-                    this.openDialog=false
-                },500) 
+                this.loading = true 
+                if(this.baseInfo.fetchMaterialId&&this.baseInfo.fetchMaterialId!=""){
+                    this.$modal.confirm('是否确认覆盖货品明细?').then(() => {
+                        this.baseInfo.fetchMaterialId = null
+                        this.materialList = this.batchChosenMaterial
+                        this.loading = false
+                        this.openDialog=false
+                    }).catch(() => {});
+                }else{
+                    let items = [...this.materialList,...this.batchChosenMaterial] 
+                    let uniqueItems = items.filter((item, index, array) => {
+                        return array.findIndex((t) => (t.materialId === item.materialId)) === index;
+                    });
+                    this.materialList = uniqueItems;
+                    setTimeout(()=>{
+                        this.loading = false
+                        this.openDialog=false
+                    },500) 
+                }
             } 
         },
         //保存草稿
@@ -608,11 +617,11 @@ export default {
         confirmImport(){ 
             if(this.materialDetailsData.length>0){
                 this.$modal.confirm('是否确认覆盖货品明细?').then(() => {
-                    this.materialList = this.materialDetailsData; 
+                    this.materialList=this.materialDetailsData; 
                     // this.materialList.forEach(item=>{
                     //     this.$set(item,"orderNum",item.purchaseNum)
                     // })
-                    // this.baseInfo.purchasePlanCode = this.importRow.planCode; 
+                    this.baseInfo.fetchMaterialId = this.importRow.fetchMaterialId; 
                     this.$set(this.baseInfo,"remark","导入领料单")
                     setTimeout(()=>{ 
                         this.openImportDialog=false
diff --git a/vue.config.js b/vue.config.js
index d7c3df52..3ceb2128 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -36,8 +36,8 @@ module.exports = {
             // detail: https://cli.vuejs.org/config/#devserver-proxy
             [process.env.VUE_APP_BASE_API]: {
                 // target: `http://192.168.2.75:48380`,//旭
-                target: `http://192.168.0.244:48380`,//测试
-                // target: `http://192.168.0.176:48380`,//刘鑫
+                // target: `http://192.168.0.244:48380`,//测试
+                target: `http://192.168.0.176:48380`,//刘鑫
                 // target: `http://192.168.0.44:48380`,//测试
                 // target: `http://192.168.0.176:48380`,//
                 changeOrigin: true,