瀏覽代碼

对接打印页面

gongwencan 4 月之前
父節點
當前提交
24e19d7fd3
共有 6 個文件被更改,包括 65 次插入41 次删除
  1. 1 1
      config/index.js
  2. 1 1
      src/api/PrintQueueApi.js
  3. 2 2
      src/components/DialogTagApplyOrderExport.vue
  4. 3 3
      src/entries/PrintQueue.js
  5. 16 16
      src/mock/index.js
  6. 42 18
      src/views/PrintQueue.vue

+ 1 - 1
config/index.js

@@ -13,7 +13,7 @@ module.exports = {
     proxyTable: {
       '/api': {
         // target: 'http://192.168.255.64:7003/',
-        target: 'http://192.168.1.12:7003/',
+        target: 'http://192.168.1.4:7003/',
       }
     },
 

+ 1 - 1
src/api/PrintQueueApi.js

@@ -17,7 +17,7 @@ class PrintQueueApi extends BaseCurdApi {
     })
 
     constructor () {
-      super('/print/queue')
+      super('/print/management')
     }
 }
 

+ 2 - 2
src/components/DialogTagApplyOrderExport.vue

@@ -4,14 +4,14 @@
     append-to-body
     width="297mm"
   >
-    <pdf-exporter ref="pdfExporter" class="flex column layout-gap" style="min-height:100%;height:600px;margin:0 calc(var(--layout-gap) * -1);padding:var(--layout-gap);color:#000000;">
+    <pdf-exporter ref="pdfExporter" class="flex column layout-gap" style="min-height:100%;margin:0 calc(var(--layout-gap) * -1);padding:var(--layout-gap);color:#000000;">
       <LogoImageView width="150"></LogoImageView>
       <div class="text-center" style="font-size:16px;font-weight:600;">标签需求订单</div>
       <div class="flex valign-center">
         <div>订单编号:</div>
         <VueBarcode v-if="data && data.orderNo" :value="data.orderNo" format="CODE128" :height="40" :font-size="14"></VueBarcode>
       </div>
-      <div style="width:100%;max-height:206px; overflow-y:auto;">
+      <div style="width:100%;">
         <table cellspacing="0" cellpadding="0" border="0" class="origin-table">
           <colgroup>
             <col />

+ 3 - 3
src/entries/PrintQueue.js

@@ -4,9 +4,9 @@ import BaseCurdEntry from './BaseCurdEntry'
 export default class PrintQueue extends BaseCurdEntry {
   id
 
-  orderNo
+  goodsName
 
-  materialName
+  materialCode
 
   tagTypeName
 
@@ -20,7 +20,7 @@ export default class PrintQueue extends BaseCurdEntry {
 
   number
 
-  status
+  printStatusName
 
   static get $$name () {
     return 'PrintQueue'

+ 16 - 16
src/mock/index.js

@@ -164,20 +164,20 @@ Mock.mock(/\/tag\/code\/qr/, 'get', {
 //   }
 // })
 
-Mock.mock(/\/print\/queue\/page/, 'post', {
-  type: 'success',
-  data: {
-    'count|10-40': 1,
-    'list|1-20': [{
-      id: '1804064389245816833',
-      orderNo: '1804064389245816833',
-      'materielName|1': ['低压熔断器', '螺栓垫圈'],
-      serialNumberRange: ['0000001', '000800'],
-      'providerName|1': ['人民电器集团有限公司', '上海东生供用电器材厂', '上海辉电电力设备工程有限公司'],
-      'tagTypeName|1': ['高性能不干胶标签', '柔性抗金属标签', '扎带标签'],
-      number: 123,
-      'status|1': [0, 1, 2, 3, 4]
-    }]
-  }
-})
+// Mock.mock(/\/print\/queue\/page/, 'post', {
+//   type: 'success',
+//   data: {
+//     'count|10-40': 1,
+//     'list|1-20': [{
+//       id: '1804064389245816833',
+//       orderNo: '1804064389245816833',
+//       'materielName|1': ['低压熔断器', '螺栓垫圈'],
+//       serialNumberRange: ['0000001', '000800'],
+//       'providerName|1': ['人民电器集团有限公司', '上海东生供用电器材厂', '上海辉电电力设备工程有限公司'],
+//       'tagTypeName|1': ['高性能不干胶标签', '柔性抗金属标签', '扎带标签'],
+//       number: 123,
+//       'status|1': [0, 1, 2, 3, 4]
+//     }]
+//   }
+// })
 export default Mock

+ 42 - 18
src/views/PrintQueue.vue

@@ -35,15 +35,15 @@
                 fixed
               ></el-table-column>
               <el-table-column
-                label="申请订单编号"
-                prop="orderNo"
-                min-width="160"
+                label="商品名称"
+                prop="goodsName"
+                min-width="200"
                 header-align="center"
                 align="center"
               ></el-table-column>
               <el-table-column
-                label="物料名称"
-                prop="materielName"
+                label="物料编码"
+                prop="materielCode"
                 min-width="130"
                 header-align="center"
                 align="center"
@@ -65,7 +65,7 @@
               <el-table-column
                 label="流水号范围"
                 prop="formatSerialNumberRange"
-                min-width="120"
+                min-width="200"
                 header-align="center"
                 align="center"
               ></el-table-column>
@@ -78,7 +78,7 @@
               ></el-table-column>
               <el-table-column
                 label="打印状态"
-                prop="status"
+                prop="printStatusName"
                 min-width="100"
                 header-align="center"
                 align="center"
@@ -91,10 +91,10 @@
               >
                 <template v-slot="{ row }">
                   <div class="flex center layout-gap">
-                    <!-- 0=打印完成 1= 等待打印 2=正在打印 3=暂停 4=打印失败-->
-                    <edit-button :data="row" icon="el-icon-circle-close" :on-click="onCancelPrintBtnClick" :disabled="row.status === 0">取消</edit-button>
-                    <edit-button v-if="row.status === 3" :data="row" icon="el-icon-video-play" :on-click="onContinuePrintBtnClick">继续</edit-button>
-                    <edit-button v-else :disabled="row.status !== 2" :data="row" icon="el-icon-video-pause" :on-click="onPausePrintBtnClick">暂停</edit-button>
+                    <!-- 1正在打印 2暂停状态 4报错状态 12打印头抬起 -1未知状态 1000打印完毕 1001排队中 -->
+                    <edit-button :data="row" icon="el-icon-circle-close" :disabled="row.printStatus === 1000" :on-click="onCancelPrintBtnClick">取消</edit-button>
+                    <edit-button v-if="row.printStatus === 2 || row.printStatus === 4 || row.printStatus === 12 || row.printStatus === -1" :data="row" icon="el-icon-video-play" :on-click="onContinuePrintBtnClick">继续</edit-button>
+                    <edit-button v-else :disabled="row.printStatus === 1000" :data="row" icon="el-icon-video-pause" :on-click="onPausePrintBtnClick">暂停</edit-button>
                   </div>
                 </template>
               </el-table-column>
@@ -133,7 +133,7 @@ export default {
     startTimer () {
       this.timerId = setInterval(() => {
         this.loadList()
-      }, 10000)
+      }, 5000)
     },
 
     clearTimer () {
@@ -144,18 +144,42 @@ export default {
     },
 
     onCancelPrintBtnClick (data) {
-      this.$$request(this.$$api.cancelPrint, data[this.$$Target.$$idProp]).then(data => {
-        this.loadList()
+      this.$$request(this.$$api.cancelPrint, data[this.$$Target.$$idProp]).then((flag) => {
+        if (flag) {
+          this.$notify({
+            title: '成功',
+            message: '操作成功',
+            type: 'success',
+            position: 'bottom-right'
+          })
+          this.loadList()
+        }
       }).catch(console.error).finally(() => {})
     },
     onPausePrintBtnClick (data) {
-      this.$$request(this.$$api.pausePrint, data[this.$$Target.$$idProp]).then(data => {
-        this.loadList()
+      this.$$request(this.$$api.pausePrint, data[this.$$Target.$$idProp]).then((flag) => {
+        if (flag) {
+          this.$notify({
+            title: '成功',
+            message: '操作成功',
+            type: 'success',
+            position: 'bottom-right'
+          })
+          this.loadList()
+        }
       }).catch(console.error).finally(() => {})
     },
     onContinuePrintBtnClick (data) {
-      this.$$request(this.$$api.continuePrint, data[this.$$Target.$$idProp]).then(data => {
-        this.loadList()
+      this.$$request(this.$$api.continuePrint, data[this.$$Target.$$idProp]).then((flag) => {
+        if (flag) {
+          this.$notify({
+            title: '成功',
+            message: '操作成功',
+            type: 'success',
+            position: 'bottom-right'
+          })
+          this.loadList()
+        }
       }).catch(console.error).finally(() => {})
     }
   }