mxx пре 3 година
родитељ
комит
a6719cfb03
2 измењених фајлова са 61 додато и 23 уклоњено
  1. 53 22
      public/static/print.html
  2. 8 1
      src/views/houseSelfCollect/acquisitionManagement.vue

+ 53 - 22
public/static/print.html

@@ -2,31 +2,62 @@
 <html>
   <head>
     <meta charset="utf-8">
+    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
     <title></title>
   </head>
   <body>
-    123
+    <div id="app">
+       <el-table :data="tableData" style="width: 500px" :row-class-name="tableRowClassName">
+         <el-table-column prop="waterMin" label="水分下限(%)">
+         </el-table-column>
+         <el-table-column prop="waterMax" label="水分上限(%)">
+         </el-table-column>
+         <el-table-column prop="price1" label="一等单价">
+         </el-table-column>
+         <el-table-column prop="price2" label="二等单价">
+         </el-table-column>
+         <el-table-column prop="price3" label="三等单价">
+         </el-table-column>
+         <el-table-column prop="priceOther" label="等外单价">
+         </el-table-column>
+       </el-table>
+    </div>
   </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 src="https://cdn.jsdelivr.net/npm/vue@2"></script>
+  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
+  <script type="text/javascript">
+    new Vue({
+      el: '#app',
+      data: {
+        tableData: ""
+      },
+      computed: {},
+      methods: {
+  tableRowClassName({
+        row,
+        rowIndex
+      }) {
+        if (rowIndex === 1) {
+          return 'warning-row';
+        } else if (rowIndex === 3) {
+          return 'success-row';
+        }
+        return '';
+      }
+      },
+      mounted() {debugger
+       let _data = localStorage.getItem("pricePrintList")
+        // var _data = decodeURIComponent(this.getQueryVariable("id"))
+        console.log(_data)
+        this.tableData = JSON.parse(_data)
+        window.print()
+        // window.onafterprint = function(event) {
+        //   window.history.back(-1)
+        // };
+      },
+      watch: {
+      }
+    })
   </script>
+
 </html>

+ 8 - 1
src/views/houseSelfCollect/acquisitionManagement.vue

@@ -194,7 +194,14 @@
       },
       print(index,row) {debugger
       // 打印价格对照表
-        window.location.href="../../../static/print.html?data="+JSON.stringify(row)
+     purchasePriceLook({id:row.id}).toPromise().then((response) => {
+            debugger
+            console.log(response.detailPrints)
+            // this.tableData = response.records
+            // this.getList()
+            localStorage.setItem('pricePrintList', JSON.stringify(response.detailPrints));
+            window.location.href="../../../static/print.html"
+          })
       }
     },
   }