mxx 3 年 前
コミット
9f5795b8cc

+ 32 - 0
public/static/print.html

@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title></title>
+  </head>
+  <body>
+    123
+  </body>
+  <script>
+    window.onload = function() {debugger
+      var _data = decodeURIComponent(getQueryVariable("data"))
+      _data = JSON.parse(_data)
+      console.log(_data)
+      window.print()
+      window.onafterprint = function(event) {
+
+        window.history.back(-1)
+      };
+    }
+    function getQueryVariable(variable)
+    {
+           var query = window.location.search.substring(1);
+           var vars = query.split("&");
+           for (var i=0;i<vars.length;i++) {
+                   var pair = vars[i].split("=");
+                   if(pair[0] == variable){return pair[1];}
+           }
+           return(false);
+    }
+  </script>
+</html>

+ 1 - 1
src/model/houseSelfCollect/index.js

@@ -42,7 +42,7 @@ export const getPurchasePrice = appRx.get(API_GET_PURCHASEPRICE_MANAGE, errorCat
 //收购管理添加
 export const purchasePriceAdd = appRx.post(API_POST_PURCHASEPRICE_ADD, errorCatcher, errorHandle, filter)
 //收购管理查看
-export const purchasePriceLook = appRx.post(API_GET_PURCHASEPRICE_LOOK, errorCatcher, errorHandle, filter)
+export const purchasePriceLook = appRx.get(API_GET_PURCHASEPRICE_LOOK, errorCatcher, errorHandle, filter)
 //收购管理编辑
 export const purchasePriceEdit = appRx.post(API_POST_PURCHASEPRICE_EDIT, errorCatcher, errorHandle, filter)
 //收购管理删除

+ 6 - 6
src/views/houseSelfCollect/acquisitionManagement.vue

@@ -61,7 +61,8 @@
   import {
     getPurchasePrice,
     selectWarehouseSelf,
-    purchasePriceAllowEdit
+    purchasePriceAllowEdit,
+    purchasePriceLook
   } from '@/model/houseSelfCollect/index'
   import acquisitionManagementAdd from './acquisitionManagementAdd.vue'
   export default {
@@ -136,7 +137,7 @@
             break
           case "查看":
             _query = {
-              data: row,
+              data:JSON.stringify(row),
               type: type
             }
             break
@@ -160,8 +161,6 @@
           this.selectVal = this.warehouseList[0].id
           // this.tableData = response.records
           this.getList()
-
-
         })
       },
       //获取列表数据
@@ -193,8 +192,9 @@
         this.visible = true
         console.log(index, row);
       },
-      print() {
-        window.location.href="../../../static/print.html"
+      print(index,row) {debugger
+      // 打印价格对照表
+        window.location.href="../../../static/print.html?data="+JSON.stringify(row)
       }
     },
   }

+ 22 - 14
src/views/houseSelfCollect/acquisitionManagementAdd.vue

@@ -140,7 +140,8 @@
 </template>
 <script>
   import {
-    purchasePriceAdd
+    purchasePriceAdd,
+    purchasePriceLook
   } from '@/model/houseSelfCollect/index'
   import {
     packList,
@@ -245,19 +246,20 @@
         isEdit: true
       }
     },
-    created() {
-      let _goodsNameList = []
-      this.baseInfoForm.warehouseId = this.$route.query.warehouseId
-      this.baseInfoForm.warehouseName = this.$route.query.warehouseName
-      this.baseInfoForm.compId = this.$route.query.compId
-      this.type = this.$route.query.type
-      console.log(this.baseInfoForm)
-      _goodsNameList = this.$route.query.goodsNameList
-      this.priceList[0].detailList[0].water = this.baseInfoForm.waterMin
-      this.priceList[0].detailList[2].water = this.baseInfoForm.waterBase
-      this.priceList[0].detailList[4].water = this.baseInfoForm.waterMax
+    activated() {
+debugger
       switch (this.$route.query.type) {
         case "新增":
+        let _goodsNameList = []
+        this.baseInfoForm.warehouseId = this.$route.query.warehouseId
+        this.baseInfoForm.warehouseName = this.$route.query.warehouseName
+        this.baseInfoForm.compId = this.$route.query.compId
+        this.type = this.$route.query.type
+        console.log(this.baseInfoForm)
+        _goodsNameList = this.$route.query.goodsNameList
+        this.priceList[0].detailList[0].water = this.baseInfoForm.waterMin
+        this.priceList[0].detailList[2].water = this.baseInfoForm.waterBase
+        this.priceList[0].detailList[4].water = this.baseInfoForm.waterMax
           // 货名
           packList({
               constId: 'CON2'
@@ -284,7 +286,13 @@
         case "编辑":
           break;
         case "查看":
-
+         this.baseInfoForm =JSON.parse(this.$route.query.data)
+       purchasePriceLook({id:this.baseInfoForm.id}).toPromise().then((response) => {
+              debugger
+              console.log(response)
+              // this.tableData = response.records
+              // this.getList()
+            })
           break;
         default:
           break
@@ -509,7 +517,7 @@
 
       //打印
       print() {
-        
+
       },
       // 提交
       submit() {