| 
					
				 | 
			
			
				@@ -57,7 +57,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 plain 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 icon="el-icon-plus" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 size="mini" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                @click="print(multipleSelection)" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                @click="handleOpen(multipleSelection)" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 v-hasPermi="['windowTicketSales:ticketingCollection:print']" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               >批量打印名票</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </el-col> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -98,7 +98,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <el-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               size="mini" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               type="text" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              @click="print([scope.row])" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              @click="handleOpen([scope.row])" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               v-hasPermi="['windowTicketSales:ticketingCollection:print']" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             >打印门票</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           </template> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -109,12 +109,32 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </el-table> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-dialog 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        title="选择打印机" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        :visible.sync="dialogVisible" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        width="30%" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        :before-close="handleClose"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-form-item label="打印机" prop="region"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-select v-model="ruleForm.region" placeholder="选择打印机"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-option :label="item.deviceName" :key="item.id" :value="item.id" v-for="(item,index) in printList"></el-option> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </el-form> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <span slot="footer" class="dialog-footer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-button @click="dialogVisible = false">取 消</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-button type="primary" :loading="dialogVisibleLoading" @click="print(viewerList)">{{ dialogVisibleLoading?'打印中...':'打印' }}</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </el-dialog> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   <script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import { pageList,printApi } from '@/api/windowTicketSales/ticketingCollection' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  import { pageList as getPrintListApi } from "@/api/device/pda"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     name: "distributionapplication", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     dicts: ['order_form_type','order_status_type'], 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -135,7 +155,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           // pageNum: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           // pageSize: 10, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           // type: undefined 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          orderStatus: 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          orderStatus: "3" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         visibleStatus: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         visibleStatusLoading: false, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -145,11 +165,23 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { required: true, message: '请输入备注', trigger: ['blur','change'] }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { min: 0, max: 50, message: '长度在 0 到 50 个字符', trigger: ['blur','change'] } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        viewerList: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        printList: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dialogVisible: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ruleForm: {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        rules: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          region: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { required: true, message: '请选择打印机', trigger: ['change','blur' ]} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dialogVisibleLoading: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     created() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       //this.getList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      //this.getPrintListApi() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     methods: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       /** 查询列表 */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -216,26 +248,93 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           console.log("val====",val) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.multipleSelection = val; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 打印  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        async print(list = []){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        handleOpen(list=[]){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if(!list||list.length==0) return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           let idList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           list.forEach((item,index)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             idList.push(item.id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           })  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          console.log("isList===",idList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let res = await printApi({viewerList:idList}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(res.code == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.viewerList = idList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.getPrintListApi() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$set(this.ruleForm, 'region', ''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$nextTick(()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.$refs.ruleForm.clearValidate('region') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.dialogVisible = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        handleClose(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.dialogVisible = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /** 查询打印机列表 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        getPrintListApi() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          getPrintListApi({deviceType:5,pageNum: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          pageSize: 999,}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          .then(response => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.printList = response.data.rows; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }).catch((error)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            console.log("error===",error) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /**  选择打印机  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        selectPrint(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              throw new Error(res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 打印  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        async print(list = []){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$refs.ruleForm.validate(async (valid) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (valid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.dialogVisibleLoading = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let res = await printApi({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  viewerList:list, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  source: 2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  deviceId: this.ruleForm.region 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(res.code == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  let url = res.data.linkIp 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  let printInfo = res.data.printInfo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  this.connectPrint(url,printInfo) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  throw new Error(res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } catch (error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.dialogVisible = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.dialogVisibleLoading = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                console.error("error=====",error) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              console.log('error submit!!'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          } catch (error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            console.error("error=====",error) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /**  连接打印机  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        connectPrint(url,data){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          let xhr = new XMLHttpRequest(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          xhr.withCredentials = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          xhr.onreadystatechange = ()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if(xhr.readyState == 4){ // 监听请求完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              if((xhr.status >=200 && xhr.status <300) || xhr.status == 304){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                console.log(xhr.responseText) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.dialogVisible = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.dialogVisibleLoading = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                console.log('请求失败') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.dialogVisible = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.dialogVisibleLoading = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          xhr.open("post", url, true); // 异步请求 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          xhr.setRequestHeader('Content-Type', 'application/json') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          xhr.send(JSON.stringify(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </script> 
			 |