| 
					
				 | 
			
			
				@@ -10,6 +10,30 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     :width="960"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <a-spin :spinning="spinning" tip="Loading..."> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <a-card size="small" :bordered="false" class="inventoryCheckingDetail-cont"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <div class="print-cont" v-if="$hasPermissions('B_inventoryCheckingPrint')"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <a-radio-group v-model="printerType"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <a-radio value="NEEDLE">针式</a-radio> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <a-radio value="INK">喷墨</a-radio> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </a-radio-group> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <a-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type="primary" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            class="button-error" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            id="inventoryCheckingDetail-pd-print-btn" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            :disabled="localDataSource.length==0" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @click="handlePrint('pddy')">盘点打印</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <a-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type="primary" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            class="button-info" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            id="inventoryCheckingDetail-sh-print-btn" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            :disabled="localDataSource.length==0" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @click="handlePrint('shdy')">审核打印</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <a-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type="primary" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            class="button-warning" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            id="inventoryCheckingDetail-export-btn" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            :disabled="localDataSource.length==0" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @click="handlePrint('export')">导出Excel</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <a-descriptions size="small" :column="3"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <a-descriptions-item label="盘点单号" :span="3"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             {{ (basicInfoData&&basicInfoData.checkWarehouseNo) || '--' }} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -95,16 +119,22 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </s-table> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </a-card> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </a-spin> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 打印导出 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <print-modal :openModal="openPrintModal" :itemData="basicInfoData" :nowType="nowType" @ok="handleOk" @close="openPrintModal=false" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 打印 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <div id="print"></div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </a-modal> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import moment from 'moment' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { STable } from '@/components' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import printModal from './printModal.vue' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import ProductType from '@/views/common/productType.js' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { checkWarehouseDetailList, checkWarehouseDetail, checkWarehouseDetailCount } from '@/api/checkWarehouse' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { checkWarehouseDetailList, checkWarehouseDetail, checkWarehouseDetailCount, checkWarehouseDetailExport, checkWarehouseDetailPrint, checkWarehouseWarehouse } from '@/api/checkWarehouse' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   name: 'InventoryCheckingDetailModal', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  components: { STable, ProductType }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  components: { STable, ProductType, printModal }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   props: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     openModal: { //  弹框显示状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       type: Boolean, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -137,13 +167,19 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           for (var i = 0; i < data.list.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             data.list[i].no = no + i + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.localDataSource = data.list || [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.disabled = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       basicInfoData: null, //  基本信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       productTotal: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      productType: [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      productType: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      warehouseList: [], //  仓库  下拉数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      localDataSource: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      openPrintModal: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      nowType: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      printerType: 'NEEDLE' //  打印机类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   computed: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -200,6 +236,85 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.queryParam.productTypeSn1 = val[0] ? val[0] : '' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.queryParam.productTypeSn2 = val[1] ? val[1] : '' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.queryParam.productTypeSn3 = val[2] ? val[2] : '' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 仓库下拉数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    getWarehouseList () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      checkWarehouseWarehouse({}).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (res.status == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.warehouseList = res.data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.warehouseList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 打印导出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handlePrint (type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (type == 'export') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.nowType = type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.handleOk() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.nowType = type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.openPrintModal = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handleOk (objs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const _this = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      let params 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      let url = checkWarehouseDetailPrint //  打印 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (this.nowType == 'export') { //  导出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        url = checkWarehouseDetailExport 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        params = { checkWarehouseSn: this.itemSn } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else { //  打印 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        params = JSON.parse(JSON.stringify(objs)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        params.printType = this.printerType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        delete params.type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      _this.spinning = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      url(params).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        _this.spinning = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (res.type == 'application/json') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          var reader = new FileReader() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          reader.addEventListener('loadend', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const obj = JSON.parse(reader.result) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _this.$notification.error({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              message: '提示', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              description: obj.message 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          reader.readAsText(res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (this.nowType == 'export' || this.nowType == 'typeExport') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.download(res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.print(res, objs.type) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    print (data, type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (!data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      document.getElementById('print').innerHTML = '<iframe id="printf" name="printf" src="' + url + '" hidden></iframe>' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (type == 'preview') { //  预览 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        window.open(url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (type == 'print') { //  打印 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        window.frames['printf'].focus() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        window.frames['printf'].print() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    download (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (!data) { return } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const url = window.URL.createObjectURL(new Blob([data])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const link = document.createElement('a') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      link.style.display = 'none' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      link.href = url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const a = moment().format('YYYYMMDDHHmmss') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const fname = '库存盘点' + a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      link.setAttribute('download', fname + '.xlsx') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      document.body.appendChild(link) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      link.click() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   watch: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -211,6 +326,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     isShow (newValue, oldValue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (!newValue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$emit('close') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.printerType = 'NEEDLE' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const _this = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         setTimeout(() => ( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -221,8 +337,20 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     itemSn (newValue, oldValue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (this.isShow && newValue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.getDetail() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getWarehouseList() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<style lang="less"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  .inventoryCheckingDetail-modal{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    .ant-modal-body{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      padding: 0 24px 24px; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    .print-cont{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      text-align: right; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      padding: 5px 0 10px; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</style> 
			 |