lilei 2 年 前
コミット
ec335e58ff

+ 6 - 10
src/views/salesManagement/receiptPrint/list.vue

@@ -51,7 +51,7 @@
           </a-form>
           <!-- 操作按钮 -->
           <div class="table-operator" v-if="$hasPermissions('B_SkPrint')">
-            <a-button type="primary" @click="handlePlPrint()" class="button-error">批量打印</a-button>
+            <a-button type="primary" :loading="spinning" @click="handlePlPrint()" class="button-error">批量打印</a-button>
             <span style="margin-left: 8px">
               <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
             </span>
@@ -98,15 +98,7 @@
         </s-table>
 
         <!-- 收款打印 -->
-        <commonModal
-          modalTit="收款打印预览"
-          bodyPadding="10px"
-          width="1024px"
-          :showFooter="false"
-          :openModal="showTipModal"
-          @cancel="closeTipModal">
-          <printModel ref="printModel" @cancel="closeTipModal" @printOk="printOk"></printModel>
-        </commonModal>
+        <printModel ref="printModel" @cancel="closeTipModal" @printOk="printOk"></printModel>
         <!-- 打印记录 -->
         <recordModal v-drag ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
         <!-- 操作提示 -->
@@ -229,6 +221,7 @@ export default {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return false
       }
+      this.spinning = true
       const bookSns = []
       rows.map(item => {
         if (bookSns.indexOf(item.bookSn) < 0) {
@@ -255,6 +248,7 @@ export default {
     },
     // 收款打印
     async handlePrint (row, type, list, bookSns) {
+      this.spinning = true
       this.showTipModal = true
       let detailItemUseStr = ''
       let auditInfo = null
@@ -272,6 +266,7 @@ export default {
       })
     },
     printOk () {
+      this.spinning = false
       this.$refs.table.refresh()
     },
     //  时间  change
@@ -301,6 +296,7 @@ export default {
     },
     closeTipModal () {
       this.showTipModal = false
+      this.spinning = false
       this.$refs.printModel.clearData()
     },
     // 打印记录

+ 9 - 6
src/views/salesManagement/receiptPrint/printModel.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- 发货打印 -->
-  <div>
+  <div style="position:absolute;left:-10000px;top:-10000px;height:0;overflow: hidden;">
     <div id="sendGood-print" v-if="financeBookList&&financeBookList.length">
       <div
         v-for="(fcItem,index) in financeBookList"
@@ -76,10 +76,10 @@
         </table>
       </div>
     </div>
-    <div class="btn-box" style="display:flex;align-item:center;justify-content: center;">
+    <!-- <div class="btn-box" style="display:flex;align-item:center;justify-content: center;">
       <a-button @click="handleCommonCancel">取消</a-button>
       <a-button :loading="spinning" type="primary" @click="handleCommonOk">立即打印</a-button>
-    </div>
+    </div> -->
   </div>
 </template>
 
@@ -89,7 +89,7 @@ import moment from 'moment'
 export default {
   data () {
     return {
-      spinning: false,
+      // spinning: false,
       detail: null,
       financeBookList: [],
       printNums: []
@@ -130,10 +130,8 @@ export default {
         htmlStr.push(printCons[i].t)
       }
 
-      _this.spinning = true
       // html, type, callback, printLogParams
       jGPlPrint(htmlStr, 'preview', function (res) {
-        _this.spinning = false
         _this.handleCommonCancel()
         _this.$emit('printOk')
       }, this.printNums, this.financeBookList)
@@ -148,6 +146,11 @@ export default {
           billNo: item.bookNo
         })
       })
+      
+      // 打印预览
+      this.$nextTick(()=>{
+        this.handleCommonOk()
+      })
     },
     handleCommonCancel () {
       this.$emit('cancel')