Andy 4 năm trước cách đây
mục cha
commit
d4f9018eb3

+ 1 - 1
src/views/OrderMannage/BusinessOrderlist/edit.vue

@@ -3486,7 +3486,7 @@ export default {
       let total_line = 0;
       this.wood_title_count.map((v) => {
         v.measure_str.map((w) => {
-          total_line += w.num;
+          total_line += w.num*1;
         });
       });
       // 线条合计放进统计

+ 55 - 26
src/views/ProductionOrderList/ProductionsOrder/Decorationlist.vue

@@ -223,6 +223,14 @@
         </Form>
       </Modal>
     </FullPage>
+    <Modal
+      class-name="vertical-center-modal-PL"
+      v-model="test_modal"
+      title="打印内容"
+      @on-ok="test_run_print(test_url,test_content)"
+    >
+      <Input type="textarea" v-model="test_content" :rows='40' />
+    </Modal>
   </div>
 </template>
 
@@ -237,6 +245,9 @@ export default {
   },
   data() {
     return {
+      test_url:'',
+      test_modal: false,
+      test_content: null,
       list: [
         {
           title: "楼幢",
@@ -658,6 +669,7 @@ export default {
     this.getOptions();
     // const wxsoect = new WebSocket("ws://localhost:8080");
     // this.wxsoect = wxsoect;
+    // console.log("this.wxsoect :>> ", this.wxsoect);
     // wxsoect.onopen = function(evt) {
     //   console.log(`已成功打开`);
     // };
@@ -1016,9 +1028,27 @@ export default {
         },
       });
     },
+    test_run_print(url, data) {
+      let sub_data = JSON.parse(data)
+      sub_data.printparams = JSON.stringify(sub_data.printparams)
+      $.ajax({
+        type: "post",
+        url,
+        data:sub_data,
+        dataType: "json",
+        timeout: 5000,
+        success: function(result) {
+          if (result.retval == "0") {
+            this.$Message.success("发送成功");
+          } else {
+            this.$Message.error("发送失败,返回结果:" + result.msg);
+          }
+        },
+      });
+    },
     handlePrintChips(contents) {
       let data = {};
-      let url = "http://192.168.1.110:888/postek/print";
+      let url = "http://192.168.1.112:888/postek/print";
       data.reqParam = "1";
       let printparamsJsonArray = [];
       let IP = "192.168.1.58";
@@ -1028,11 +1058,11 @@ export default {
       printparamsJsonArray.push({ PTK_ClearBuffer: "" });
       printparamsJsonArray.push({ PTK_SetDirection: "B" });
       printparamsJsonArray.push({ PTK_SetPrintSpeed: "4" });
-      printparamsJsonArray.push({ PTK_SetDarkness: "10" }); 
+      printparamsJsonArray.push({ PTK_SetDarkness: "10" });
       printparamsJsonArray.push({
-        PTK_SetLabelHeight: 75 + "," + 2 + ",0,false",
+        PTK_SetLabelHeight: 236 + "," + 24 + ",0,false",
       });
-      printparamsJsonArray.push({ PTK_SetLabelWidth: 10 });
+      printparamsJsonArray.push({ PTK_SetLabelWidth: 873 });
       contents.map((content) => {
         const printContent_l1 = `项目:${content.client_name} 图号:${content.url_number} 区域:${content.house}号楼-${content.layer}层${content.number_detail}`;
         printparamsJsonArray.push({
@@ -1061,16 +1091,15 @@ export default {
         printparamsJsonArray.push({ PTK_PrintLabel: "1,1" });
       });
       printparamsJsonArray.push({ PTK_CloseConnect: "" });
-      data.printparams = JSON.stringify(printparamsJsonArray);
+      data.printparams = printparamsJsonArray
+      // data.printparams = JSON.stringify(printparamsJsonArray);
+      this.test_content = JSON.stringify(data);
+      this.test_url = url
+      this.test_modal = true
       // $.ajax({
       //   type: "post",
       //   url,
       //   data,
-      //   headers: {
-      //     "Access-Control-Allow-Origin": "*",
-      //     "Access-Control-Allow-Methods": "POST",
-      //     "Access-Control-Allow-Headers": "x-requested-with,content-type",
-      //   },
       //   dataType: "json",
       //   timeout: 5000,
       //   success: function(result) {
@@ -1081,19 +1110,19 @@ export default {
       //     }
       //   },
       // });
-      axios
-        .post(url, data)
-        .then((result) => {
-          console.log(result.msg);
-          if (result.retval == "0") {
-            this.$Message.success("发送成功");
-          } else {
-            this.$Message.error("发送失败,返回结果:" + result.msg);
-          }
-        })
-        .catch((err) => {
-          this.$Message.error("请求失败,请重试" + err.msg);
-        });
+      // axios
+      //   .post(url, data)
+      //   .then((result) => {
+      //     console.log(result);
+      //     if (result.retval == "0") {
+      //       this.$Message.success("发送成功");
+      //     } else {
+      //       this.$Message.error("发送失败,返回结果:" + result.msg);
+      //     }
+      //   })
+      //   .catch((err) => {
+      //     this.$Message.error("请求失败,请重试" + err.msg);
+      //   });
     },
     handleConnectPrinter() {
       let data = {};
@@ -1229,9 +1258,9 @@ export default {
     //   st.send("ClosePort");
     // },
     printChip(rows) {
-      if (this.wxsoect.readyState != 1) {
-        return this.$Message.error("打印机未正常连接,请检查");
-      }
+      // if (this.wxsoect.readyState != 1) {
+      //   return this.$Message.error("打印机未正常连接,请检查");
+      // }
       this.axios("/api/get_sub_part", { params: { id: rows.id } }).then(
         (res) => {
           if (res.code == 200) {

+ 1 - 0
vue.config.js

@@ -30,6 +30,7 @@ module.exports = {
             },
             '/postek/print': {
                 target: 'http://192.168.1.110:888',
+                ws: true, // proxy websockets
                 changeOrigin: true,
                 // pathRewrite: {
                 //     '^/postek': '', // rewrite path