123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- //@ sourceURL=sfy_config.js
- var LODOP; //声明为全局变量
- var printSucess = false;
- var deptNoSucess = false;
- $(function () {
- $(".selectpicker").selectpicker({
- dropuAuto: false
- });
- //延迟触发列表加载,因为一开始打印程序还没有加载成功
- setTimeout('createPrinterList()', 500);
- $.ajax({
- type: "GET",
- contentType: "application/json;charset=UTF-8",
- url: "/thmz/getMzZdDeptNos",
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- dataType: 'json',
- success: function (result) {
- if (result == '401' || result == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (result.code == 0) {
- var arr = result.data;
- if (arr != null && arr.length > 0) {
- var html = "";
- for (var i = 0; i < arr.length; i++) {
- html += "<option value='" + arr[i].code + "'>" + arr[i].name + "</option>";
- }
- $('#deptNoSelect').html(html);
- $('#deptNoSelect').selectpicker('refresh');
- deptNoSucess = true;
- }
- } else {
- errorMesage(result);
- }
- }
- });
- delay(getLastWindowsByCurrentUser);
- /**
- * 提交按钮点击事件
- */
- $("#send").on("click", function (t) {
- $.ajax({
- type: "POST",
- contentType: "application/json;charset=UTF-8",
- url: "/thmz/saveWindows",
- dataType: 'json',
- data: JSON.stringify({
- "deptNo": $("#deptNoSelect").val(),
- "windowsNo": $("#winNo").val(),
- "printIndex": $("#printSelect").val(),
- "cgPrintIndex": $("#printSelect_cg").val(),
- "zyPrintIndex": $("#printSelect_zy").val(),
- "clientIpAddress": $("#client_ip_address").val(),
- "misPosRouterCode": $("#mis_pos_router_code").val()
- }),
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (result) {
- if (result == '401' || result == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (result.code == 0) {
- successMesage(result);
- } else {
- errorMesage(result);
- }
- }
- });
- });
- /**
- * 智能POS终端管理按钮点击事件
- */
- $("#posClientManager").on("click", function (t) {
- window.open("http://172.16.32.201:8080/ccbmis/#");
- // const iframeEle = document.getElementById("posClientManagerDiv");
- // const loadingEle = document.getElementById("posClientManagerLoading");
- // //设置ififrame透明
- // iframeEle.style.opacity = 0;
- // loadingEle.style.display = 'block';
- // $("#posClientManagerDiv").attr("src", "http://172.16.32.201:8080/ccbmis/#");
- // iframeEle.addEventListener('load', function () {
- // // Hide the loading indicator
- // loadingEle.style.display = 'none';
- // // Bring the iframe back
- // iframeEle.style.opacity = 1;
- // });
- // setTimeout(function () {
- // // iframe 重复加载不会触发上述事件
- // loadingEle.style.display = 'none';
- // iframeEle.style.opacity = 1;
- // }, 1000);
- // $("#posClientManagerModal").modal();
- });
- });
- /**
- * 查询当前用户的基础设置
- */
- function getLastWindowsByCurrentUser() {
- /**
- * 查询收费员参数信息
- */
- $.ajax({
- type: "GET",
- contentType: "application/json;charset=UTF-8",
- url: "/thmz/getLastWindowsByCurrentUser",
- dataType: 'json',
- headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
- success: function (result) {
- if (result == '401' || result == 401) {
- window.location.href = '/thmz/login/view'
- return;
- }
- if (result.code == 0) {
- $("#winNo").val(result.data.windowsNo);
- if (result.data.printIndex != null) {
- $('#printSelect').selectpicker('val', result.data.printIndex);
- $('#printSelect').selectpicker('refresh');
- }
- if (result.data.zyPrintIndex != null) {
- $('#printSelect_zy').selectpicker('val', result.data.zyPrintIndex);
- $('#printSelect_zy').selectpicker('refresh');
- }
- if (result.data.cgPrintIndex != null) {
- $('#printSelect_cg').selectpicker('val', result.data.cgPrintIndex);
- $('#printSelect_cg').selectpicker('refresh');
- }
- if (result.data.deptNo != null) {
- $('#deptNoSelect').selectpicker('val', result.data.deptNo);
- $('#deptNoSelect').selectpicker('refresh');
- }
- $("#client_ip_address").val(result.data.clientIpAddress);
- $("#mis_pos_router_code").val(result.data.misPosRouterCode);
- } else {
- errorMesage(result);
- }
- }
- });
- }
- //延迟加载方法
- function delay(callback) {
- if (deptNoSucess && printSucess) {
- callback();
- return;
- } else {
- setTimeout(function () {
- delay(callback)
- }, 100)
- }
- }
- /**
- * 加载打印机列表
- * @constructor
- */
- function createPrinterList() {
- LODOP = getLodop();
- LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "泰和门诊发票打印");
- //获取打印机设备数,用于进行遍历
- var count = LODOP.GET_PRINTER_COUNT();
- var html = "";
- for (var i = 0; i < count; i++) {
- //根据设备序号获取设备名
- var msg = LODOP.GET_PRINTER_NAME(i);
- html += "<option value='" + i + "'>" + msg + "</option>";
- }
- $('#printSelect').html(html);
- $('#printSelect').selectpicker('refresh');
- $('#printSelect_zy').html(html);
- $('#printSelect_zy').selectpicker('refresh');
- $('#printSelect_cg').html(html);
- $('#printSelect_cg').selectpicker('refresh');
- printSucess = true;
- }
|