{"version":3,"sources":["webpack:///./src/view/masterData/custPage/scanToPrintWindow.vue?dfac","webpack:///src/view/masterData/custPage/scanToPrintWindow.vue","webpack:///./src/view/masterData/custPage/scanToPrintWindow.vue?5989","webpack:///./src/view/masterData/custPage/scanToPrintWindow.vue","webpack:///./src/view/masterData/custPage/webSocketPrint.js","webpack:///./node_modules/@babel/runtime/regenerator/index.js","webpack:///./src/view/masterData/custPage/scanToPrintWindow.vue?e26d"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","attrs","title","visible","showWindows","width","maskClosable","footer","zIndex","on","cancel","closeWindow","span","staticStyle","display","align-items","font-size","font-weight","margin-right","_v","_s","$t","keyup","$event","type","indexOf","_k","keyCode","key","print","model","value","callback","$$v","orderNo","expression","click","size","change","clickPrint","isCheckedPrint","clickPdf","isCheckedPdf","staticRenderFns","scanToPrintWindowvue_type_script_lang_js_","components","data","printMode","ip","printers","methods","isValidJSON","str","JSON","parse","e","getPrinters","that","window","ws","WebSocket","onopen","send","onmessage","evt","msg","printerServer","onclose","show","event","_this","params","ajax","get","url","SCANTOPRINT","then","res","code","i","length","errorMsg","printerName","console","log","printerNames","split","j","k","name","webSocketPrint","urlList","$message","warning","_i","open","target","select","_webSocketPrint2","_asyncToGenerator","regenerator_default","a","mark","_callee","port","index","dateLength","oldFileBytes","part","fileBytes","wrap","_context","prev","next","Math","ceil","substring","lenght","fileIndex","fileCount","custPage_webSocketPrint","doPrint2","stringify","success","t0","stop","_x","_x2","_x3","_x4","_x5","_x6","apply","arguments","getUserIP","onNewIP","MyPeerConnection","RTCPeerConnection","mozRTCPeerConnection","webkitRTCPeerConnection","pc","iceServers","noop","localIPs","ipRegex","iterateIP","createDataChannel","createOffer","sdp","forEach","line","match","setLocalDescription","catch","reason","onicecandidate","ice","candidate","mounted","_this2","custPage_scanToPrintWindowvue_type_script_lang_js_","component","Object","componentNormalizer","__webpack_exports__","__webpack_require__","r","connectSocket","printData","socket","addEventListener","onerror","message","doPrint","connectSocket2","Promise","resolve","reject","close","module","exports","_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_scanToPrintWindow_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0__","_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_index_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_scanToPrintWindow_vue_vue_type_style_index_0_lang_css___WEBPACK_IMPORTED_MODULE_0___default","n"],"mappings":"mKAAA,IAAAA,EAAA,WAA0B,IAAAC,EAAAC,KAAaC,EAAAF,EAAAG,eAA0BC,EAAAJ,EAAAK,MAAAD,IAAAF,EAAwB,OAAAE,EAAA,WAAqBE,YAAA,cAAAC,MAAA,CAAiCC,MAAA,gBAAAC,QAAAT,EAAAU,YAAAC,MAAA,MAAAC,cAAA,EAAAC,OAAA,KAAAC,OAAA,IAA+GC,GAAA,CAAKC,OAAAhB,EAAAiB,cAA0B,CAAAb,EAAA,SAAAA,EAAA,SAA0BG,MAAA,CAAOW,KAAA,KAAW,CAAAd,EAAA,OAAYe,YAAA,CAAaC,QAAA,OAAAC,cAAA,WAAyC,CAAAjB,EAAA,QAAae,YAAA,CAAaG,YAAA,OAAAC,cAAA,OAAAC,eAAA,SAA+D,CAAAxB,EAAAyB,GAAAzB,EAAA0B,GAAA1B,EAAA2B,GAAA,oBAAAvB,EAAA,SAAuDG,MAAA,CAAOW,KAAA,KAAW,CAAAd,EAAA,WAAgBe,YAAA,CAAaR,MAAA,QAAeI,GAAA,CAA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qH,WAS1BC,QAAQ,SAAUrE,EAAKgE,GACnB7K,KAAK4K,cAAc/D,EAAKgE,IAI5B/C,SAAS,SAAUjB,EAAKgE,GACpB,OAAQ7K,KAAKmL,eAAetE,EAAKgE,IAIrCM,eAAe,SAAStE,EAAKgE,GACzB,OAAO,IAAIO,QAAQ,SAACC,EAASC,GACzB,IAAIR,EAAS,KACb,IACIA,EAAS,IAAI7G,UAAU,kBAAoB4C,GAC3CiE,EAAOC,iBAAiB,OAAQ,WAE5BM,MAEJP,EAAO5G,OAAS,SAASQ,GACrBc,QAAQC,IAAI,WACZqF,EAAO3G,KAAK0G,IAGhBC,EAAOE,QAAU,SAASpH,GAEtBkH,EAAOS,QAEPD,EAAO,0BAGXR,EAAO1G,UAAY,SAASM,KAI5BoG,EAAOtG,QAAU,SAASE,KAG5B,MAAOd,GAGL0H,EAAO1H,EAAEqH,oCCxGzBO,EAAAC,QAAiBf,EAAQ,2CCAzB,IAAAgB,EAAAhB,EAAA,QAAAiB,EAAAjB,EAAAkB,EAAAF,GAAyfC,EAAG","file":"js/chunk-2c25cd19.3a79a4a5.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('a-modal',{staticClass:\"print_class\",attrs:{\"title\":'Scan to Print',\"visible\":_vm.showWindows,\"width\":\"40%\",\"maskClosable\":false,\"footer\":null,\"zIndex\":99},on:{\"cancel\":_vm.closeWindow}},[_c('a-row',[_c('a-col',{attrs:{\"span\":22}},[_c('div',{staticStyle:{\"display\":\"flex\",\"align-items\":\"center\"}},[_c('span',{staticStyle:{\"font-size\":\"14px\",\"font-weight\":\"bold\",\"margin-right\":\"12px\"}},[_vm._v(_vm._s(_vm.$t('orderRef'))+\":\")]),_c('a-col',{attrs:{\"span\":16}},[_c('a-input',{staticStyle:{\"width\":\"100%\"},on:{\"keyup\":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,\"enter\",13,$event.key,\"Enter\")){ return null; }return _vm.print($event)}},model:{value:(_vm.orderNo),callback:function ($$v) {_vm.orderNo=$$v},expression:\"orderNo\"}})],1),_c('a-col',{attrs:{\"span\":3}},[_c('a-button',{staticClass:\"mg5\",attrs:{\"type\":\"primary\"},on:{\"click\":function($event){return _vm.print($event)}}},[_vm._v(_vm._s(_vm.$t('pubGicSet.Print')))])],1)],1)])],1),_c('a-row',[_c('a-col',{attrs:{\"span\":20}},[_c('div',{staticStyle:{\"display\":\"flex\",\"align-items\":\"center\"}},[_c('a-col',{attrs:{\"span\":1}},[_c('a-checkbox',{attrs:{\"size\":\"small\"},on:{\"change\":_vm.clickPrint},model:{value:(_vm.isCheckedPrint),callback:function ($$v) {_vm.isCheckedPrint=$$v},expression:\"isCheckedPrint\"}})],1),_c('a-col',{attrs:{\"span\":3}},[_c('span',{staticStyle:{\"font-size\":\"12px\",\"font-weight\":\"bold\"}},[_vm._v(\"Print\")])])],1)])],1),_c('a-row',[_c('a-col',{attrs:{\"span\":20}},[_c('div',{staticStyle:{\"display\":\"flex\",\"align-items\":\"center\"}},[_c('a-col',{attrs:{\"span\":1}},[_c('a-checkbox',{attrs:{\"size\":\"small\"},on:{\"change\":_vm.clickPdf},model:{value:(_vm.isCheckedPdf),callback:function ($$v) {_vm.isCheckedPdf=$$v},expression:\"isCheckedPdf\"}})],1),_c('a-col',{attrs:{\"span\":3}},[_c('span',{staticStyle:{\"font-size\":\"12px\",\"font-weight\":\"bold\"}},[_vm._v(\"PDF\")])])],1)])],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\n \r\n \r\n \r\n \r\n \r\n
{{$t('orderRef')}}:\r\n \r\n
\r\n \r\n \r\n
\r\n {{$t('pubGicSet.Print')}}\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n
\r\n Print\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n
\r\n PDF\r\n \r\n
\r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n","import mod from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./scanToPrintWindow.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./scanToPrintWindow.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./scanToPrintWindow.vue?vue&type=template&id=1904ce42&\"\nimport script from \"./scanToPrintWindow.vue?vue&type=script&lang=js&\"\nexport * from \"./scanToPrintWindow.vue?vue&type=script&lang=js&\"\nimport style0 from \"./scanToPrintWindow.vue?vue&type=style&index=0&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","\r\nexport default {\r\n connectSocket:function(port,printData){\r\n let socket = null;\r\n try {\r\n socket = new WebSocket('ws://localhost:'+port);\r\n socket.addEventListener(\"open\",function () {\r\n console.log(\"链接成功。。\");\r\n });\r\n socket.onopen = function(event)\r\n {\r\n console.log(\"llws连接!\");\r\n //设置打印机\r\n //var pmCode = '11112222';\r\n //var getPrinterConfigCmd = \"{\\\"requestID\\\":\\\"\"+pmCode+\"\\\",\\\"verson\\\":\\\"1.0\\\",\\\"cmd\\\":\\\"getPrinterConfig\\\",\\\"printer\\\":\\\"HP LaserJet Professional M1213nf MFP\\\"}\";\r\n //socket.send(getPrinterConfigCmd);\r\n\r\n /* let request = {\r\n cmd: \"print\",\r\n requetID: \"12345678901234567890\",\r\n version: \"1.0\",\r\n task: {\r\n taskID: \"1\",\r\n preview: false,\r\n printer: \"\",\r\n documents: [\r\n {\r\n documentID: \"SF1343815116549\",\r\n contents: [\r\n //电子面单部分\r\n printData\r\n ]\r\n }\r\n ]\r\n }\r\n };*/\r\n //socket 发送\r\n socket.send(printData);\r\n };\r\n\r\n socket.onerror = function(e) {\r\n console.log(\"llws连接错误!\");\r\n };\r\n // 监听消息\r\n socket.onmessage = function(event)\r\n {\r\n console.log('Client received a message',event);\r\n };\r\n // 监听Socket的关闭\r\n socket.onclose = function(event)\r\n {\r\n console.log('Client notified socket has closed',event);\r\n };\r\n }catch (e) {\r\n console.log(e.message);\r\n }finally {\r\n /* if(null!=socket){\r\n socket.close();\r\n }*/\r\n }\r\n\r\n },\r\n\r\n doPrint:function (port,printData) {\r\n this.connectSocket(port,printData);\r\n\r\n },\r\n\r\n doPrint2:function (port,printData) {\r\n return this.connectSocket2(port,printData);\r\n },\r\n\r\n\r\n connectSocket2:function(port,printData){\r\n return new Promise((resolve, reject) => {\r\n let socket = null;\r\n try {\r\n socket = new WebSocket('ws://localhost:' + port);\r\n socket.addEventListener(\"open\", function() {\r\n // console.log(\"链接成功。。\");\r\n resolve(); // 连接成功时 resolve\r\n });\r\n socket.onopen = function(event) {\r\n console.log(\"llws连接!\");\r\n socket.send(printData);\r\n };\r\n\r\n socket.onerror = function(e) {\r\n // console.log(\"连接错误!\");\r\n socket.close(); // 发生错误时关闭连接\r\n // console.info('BBBB')\r\n reject(\"PRINTER_NOT_CONNECTED\"); // 发生错误时 reject\r\n };\r\n // 监听消息\r\n socket.onmessage = function(event) {\r\n // console.log('Client received a message', event);\r\n };\r\n // 监听Socket的关闭\r\n socket.onclose = function(event) {\r\n // console.log('Client notified socket has closed', event);\r\n };\r\n } catch (e) {\r\n // console.info('AAAA')\r\n // console.log(e.message);\r\n reject(e.message); // 发生异常时 reject\r\n }\r\n });\r\n },\r\n\r\n}\r\n\r\n\r\n\r\n","module.exports = require(\"regenerator-runtime\");\n","import mod from \"-!../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../../node_modules/css-loader/index.js??ref--6-oneOf-1-1!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./scanToPrintWindow.vue?vue&type=style&index=0&lang=css&\"; export default mod; export * from \"-!../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../../node_modules/css-loader/index.js??ref--6-oneOf-1-1!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./scanToPrintWindow.vue?vue&type=style&index=0&lang=css&\""],"sourceRoot":""}