baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
@@ -0,0 +1,770 @@
|
||||
<template>
|
||||
<view class="print-content-class">
|
||||
<view>
|
||||
<p>打印机服务器地址</p>
|
||||
<XflSelect :list="printServerList" :listOrigin="printServerList" :showItemNum="5" @change="printServerListChange"
|
||||
:clearable="false" :isCanInput="false" :defaultSelectText="defaultPrintServerName"
|
||||
ref="printServerList" style="height: 64rpx; margin-top: 16rpx;">
|
||||
</XflSelect>
|
||||
</view>
|
||||
<view>
|
||||
<p>打印机</p>
|
||||
<view style="display: flex; align-items: center;">
|
||||
<XflSelect :list="printList" :listOrigin="printList" :showItemNum="5" @change="printListChange"
|
||||
:clearable="false" :isCanInput="false" :defaultSelectText="defaultPrintName"
|
||||
ref="printList" style="height: 64rpx; margin-top: 16rpx;">
|
||||
</XflSelect>
|
||||
<image src="./refresh.png" style="margin-left: 20rpx; height: 60rpx; width: 60rpx;
|
||||
margin-top: 16rpx; flex-shrink: 0; flex-grow: 0;" @tap="getPrintList()" />
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<p>打印模板</p>
|
||||
<XflSelect :list="templateList" :listOrigin="templateList" :showItemNum="5" @change="templateListChange"
|
||||
:clearable="false" :isCanInput="false" ref="templateList"
|
||||
:defaultSelectText="defaultPrintTemplateFNumber" style="height: 64rpx; margin-top: 16rpx;">
|
||||
</XflSelect>
|
||||
</view>
|
||||
|
||||
<button class="button-class" @tap="setDefaultPrint()">保存打印设置</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapMutations
|
||||
} from 'vuex';
|
||||
|
||||
import XflSelect from '../xfl-select/xfl-select.vue';
|
||||
const macAddress = require('@/common/MacAddress.js');
|
||||
|
||||
let _self;
|
||||
|
||||
export default {
|
||||
components: {
|
||||
XflSelect
|
||||
},
|
||||
|
||||
props: {
|
||||
prgkey:
|
||||
{
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
printInfo:
|
||||
{
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
orgId:
|
||||
{
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
baseUrl:
|
||||
{
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
templateList: [],
|
||||
printList: [],
|
||||
printServerList: [],
|
||||
defaultPrintServerName: "",
|
||||
defaultPrintName: "",
|
||||
defaultPrintTemplateFNumber: "",
|
||||
printConfig: null,
|
||||
myRequestIp: "",
|
||||
myRequestPort: "",
|
||||
printServerTemp: null
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
localOrgId() {
|
||||
return this.orgId;
|
||||
},
|
||||
localPrintInfo() {
|
||||
return this.printInfo;
|
||||
},
|
||||
...mapState(['userInfo'])
|
||||
},
|
||||
|
||||
beforeMount() {
|
||||
_self = this;
|
||||
|
||||
if (this.prgkey) {
|
||||
let printInfos = uni.getStorageSync(this.prgkey + '_DEFAULT_PRINT');
|
||||
if (printInfos) {
|
||||
this.defaultPrintServerName = printInfos.defaultPrintServerName;
|
||||
this.defaultPrintTemplateFNumber = printInfos.defaultPrintTemplateFNumber;
|
||||
this.defaultPrintName = printInfos.defaultPrintName;
|
||||
}
|
||||
}
|
||||
|
||||
_self.getPrintByDevice();
|
||||
},
|
||||
|
||||
methods: {
|
||||
printServerListChange({newVal, oldVal, index, orignItem}){
|
||||
_self.$refs.printList.selectText = "";
|
||||
_self.defaultPrintName = "";
|
||||
_self.printList = new Array();
|
||||
_self.$refs.templateList.selectText = "";
|
||||
_self.defaultPrintTemplateFNumber = "";
|
||||
_self.templateList = new Array();
|
||||
|
||||
_self.defaultPrintServerName = orignItem.value;
|
||||
_self.printServerTemp = orignItem;
|
||||
|
||||
_self.$refs.printList.selectText = _self.printServerTemp.printList[0].value;
|
||||
_self.defaultPrintName = _self.printServerTemp.printList[0].value;
|
||||
_self.printList = _self.printServerTemp.printList;
|
||||
_self.$refs.templateList.selectText = _self.printServerTemp.templateList[0].value;
|
||||
_self.defaultPrintTemplateFNumber = _self.printServerTemp.templateList[0].value;
|
||||
_self.templateList = _self.printServerTemp.templateList;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
|
||||
printListChange({newVal, oldVal, index, orignItem}){
|
||||
this.defaultPrintName = orignItem.value;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
|
||||
templateListChange({newVal, oldVal, index, orignItem}){
|
||||
this.defaultPrintTemplateFNumber = orignItem.value;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
|
||||
getPrintByDevice: function() {
|
||||
let userID = this.userInfo.token;
|
||||
if (_self.prgkey == 'STK_SellPicking') _self.prgkey = 'STK_PICKTAST';
|
||||
if (_self.prgkey == 'STK_PICKTAST') _self.prgkey = 'STK_PICKTAST_MO';
|
||||
console.log(_self.prgkey);
|
||||
let requestParams = {
|
||||
"prgkey": _self.prgkey,
|
||||
"IsUsedMac": false,
|
||||
};
|
||||
|
||||
this.systemParameter = uni.getStorageSync('systemParameter');
|
||||
let deviceSwitch = this.systemParameter.deviceSwitch;
|
||||
if (deviceSwitch) {
|
||||
requestParams.PhoneMAC = "1111";
|
||||
requestParams.IsUsedMac = true;
|
||||
|
||||
if(!macAddress.address) {
|
||||
uni.showModal({
|
||||
content: "获取mac地址失败",
|
||||
showCancel:false,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
}
|
||||
else if (res.cancel) {
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
requestParams.PhoneMAC = macAddress.address();
|
||||
}
|
||||
}
|
||||
|
||||
let organizationSwitch = this.systemParameter.organizationSwitch;
|
||||
if (organizationSwitch) {
|
||||
requestParams.OrgID = this.orgId;
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
icon:'loading',
|
||||
title:'加载中……',
|
||||
mask:true
|
||||
});
|
||||
|
||||
this.$request.get('/SysConfigData/SysPrintIteam',{
|
||||
params:requestParams
|
||||
}).then(res => {
|
||||
// "[{"FIPID":"192.168.0.191","FPortNumber":"8081",
|
||||
// "PrintSetingData":[{"FPrintName":"ZDesigner ZT210-200dpi ZPL","FMould":"PA12"}]}]"
|
||||
uni.hideLoading();
|
||||
let printConfig = res;
|
||||
_self.$refs.printServerList.selectText = "";
|
||||
_self.printServerList = new Array();
|
||||
_self.$refs.printList.selectText = "";
|
||||
_self.printList = new Array();
|
||||
_self.$refs.templateList.selectText = "";
|
||||
_self.templateList = new Array();
|
||||
|
||||
printConfig.forEach(
|
||||
function(el){
|
||||
if(el.FIPIF && el.FPORTNUMBER) {
|
||||
el.value = el.FIPIF + ":" + el.FPORTNUMBER;
|
||||
}
|
||||
else if(el.FIPIF && !el.FPORTNUMBER) {
|
||||
el.value = el.FIPIF + ":" + "8081";
|
||||
}
|
||||
|
||||
let printServerAddFlag = true;
|
||||
_self.printServerList.forEach(
|
||||
function(item){
|
||||
if (item.value == el.value) {
|
||||
printServerAddFlag = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
if (printServerAddFlag) {
|
||||
_self.printServerList.push(
|
||||
{
|
||||
value: el.value,
|
||||
printList: [],
|
||||
templateList: [],
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
_self.printServerList.forEach(
|
||||
function(item){
|
||||
if (item.value == el.value) {
|
||||
let printAddFlag = true;
|
||||
item.printList.forEach(
|
||||
function(print){
|
||||
if (print.value == el.FPRINTNAME) {
|
||||
printAddFlag = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
if (printAddFlag) {
|
||||
item.printList.push({value:el.FPRINTNAME});
|
||||
}
|
||||
|
||||
let templateAddFlag = true;
|
||||
item.templateList.forEach(
|
||||
function(template){
|
||||
if (template.value == el.FMOULD) {
|
||||
templateAddFlag = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
if (templateAddFlag) {
|
||||
item.templateList.push({value:el.FMOULD});
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
if (_self.defaultPrintServerName) {
|
||||
_self.$refs.printServerList.selectText = _self.defaultPrintServerName;
|
||||
let printServerAddFlag = true;
|
||||
_self.printServerList.forEach(
|
||||
function(item){
|
||||
if (item.value == _self.defaultPrintServerName) {
|
||||
printServerAddFlag = false;
|
||||
_self.printServerTemp = item;
|
||||
}
|
||||
}
|
||||
);
|
||||
if (printServerAddFlag) {
|
||||
_self.printServerTemp = {
|
||||
value: _self.defaultPrintServerName,
|
||||
printList: [],
|
||||
templateList: [],
|
||||
};
|
||||
_self.printServerList.push(_self.printServerTemp);
|
||||
}
|
||||
|
||||
if (_self.defaultPrintName) {
|
||||
_self.$refs.printList.selectText = _self.defaultPrintName;
|
||||
let printAddFlag = true;
|
||||
if (_self.printServerTemp && _self.printServerTemp.printList) {
|
||||
_self.printServerTemp.printList.forEach(
|
||||
function(item){
|
||||
if (item.value == _self.defaultPrintName) {
|
||||
printAddFlag = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (printAddFlag) {
|
||||
_self.printServerTemp.printList.push({value:_self.defaultPrintName});
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
_self.defaultPrintName = _self.printServerList[0].printList[0].value;
|
||||
_self.$refs.printList.selectText = _self.printServerList[0].printList[0].value;
|
||||
}
|
||||
|
||||
if (_self.defaultPrintTemplateFNumber) {
|
||||
_self.$refs.templateList.selectText = _self.defaultPrintTemplateFNumber;
|
||||
let tempAddFlag = true;
|
||||
if (_self.printServerTemp && _self.printServerTemp.templateList) {
|
||||
_self.printServerTemp.templateList.forEach(
|
||||
function(item){
|
||||
if (item.value == _self.defaultPrintTemplateFNumber) {
|
||||
tempAddFlag = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (tempAddFlag) {
|
||||
_self.printServerTemp.templateList.push({value:_self.defaultPrintTemplateFNumber});
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
_self.defaultPrintTemplateFNumber = _self.printServerList[0].templateList[0].value;
|
||||
_self.$refs.templateList.selectText = _self.printServerList[0].templateList[0].value;
|
||||
}
|
||||
|
||||
_self.printList = _self.printServerTemp.printList;
|
||||
_self.templateList = _self.printServerTemp.templateList;
|
||||
}
|
||||
else {
|
||||
_self.printServerTemp = _self.printServerList[0];
|
||||
_self.defaultPrintServerName = _self.printServerList[0].value;
|
||||
_self.$refs.printServerList.selectText = _self.printServerList[0].value;
|
||||
|
||||
_self.printList = _self.printServerList[0].printList;
|
||||
_self.defaultPrintName = _self.printServerList[0].printList[0].value;
|
||||
_self.$refs.printList.selectText = _self.printServerList[0].printList[0].value;
|
||||
|
||||
_self.templateList = _self.printServerList[0].templateList;
|
||||
_self.defaultPrintTemplateFNumber = _self.printServerList[0].templateList[0].value;
|
||||
_self.$refs.templateList.selectText = _self.printServerList[0].templateList[0].value;
|
||||
}
|
||||
|
||||
this.$forceUpdate();
|
||||
})
|
||||
.catch(err => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
|
||||
printBarcode:function(barcodeArray){
|
||||
|
||||
if (!barcodeArray || barcodeArray.length == 0) {
|
||||
if (_self.prgkey == "UN_Packaging") {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "无箱码可以打印",
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
|
||||
if (_self.prgkey == "UN_DelPackaging") {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "无箱码可以打印",
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
|
||||
if (_self.prgkey == "STK_BARCODESPLIT") {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "当前无已拆分条码",
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
|
||||
if (_self.prgkey == "STK_BARCODESMERGE") {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "无合并条码可以打印",
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "无打印内容",
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if((!_self.defaultPrintServerName) || (_self.defaultPrintServerName.length==0) || (_self.defaultPrintServerName == "请选择")){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择打印服务器!",
|
||||
duration: 3500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if((!_self.defaultPrintName) || (_self.defaultPrintName.length==0) || (_self.defaultPrintName == "请选择")){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择打印机!",
|
||||
duration: 3500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if((!_self.defaultPrintTemplateFNumber) || (_self.defaultPrintTemplateFNumber.length==0)
|
||||
|| (_self.defaultPrintTemplateFNumber == "请选择")){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择打印模板!",
|
||||
duration: 3500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if((!_self.localOrgId) || (_self.localOrgId.length==0)
|
||||
|| (_self.localOrgId == "请选择")){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择组织!",
|
||||
duration: 3500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
let requestPort = uni.getStorageSync("requestPort");
|
||||
let dBAlise = uni.getStorageSync("dbAlise");
|
||||
let userName = uni.getStorageSync("userName");
|
||||
|
||||
let sendMsg = {};
|
||||
//数据类型 0=打印机信息;1=条码信息
|
||||
sendMsg.Type = 1;
|
||||
//URL
|
||||
sendMsg.URL = this.baseUrl;
|
||||
//端口
|
||||
sendMsg.Port = requestPort;
|
||||
//账套
|
||||
sendMsg.DBAias = dBAlise;
|
||||
// 用户
|
||||
sendMsg.UserID = userName;
|
||||
// 组织
|
||||
sendMsg.OrgID = _self.localOrgId;
|
||||
// 单据编号
|
||||
sendMsg.TranType = _self.prgkey;
|
||||
// 打印模板
|
||||
sendMsg.FMOULD = _self.defaultPrintTemplateFNumber;
|
||||
// 打印机名称
|
||||
sendMsg.FPRINTNAME = _self.defaultPrintName;
|
||||
// 条码信息
|
||||
sendMsg.FBarcode = barcodeArray;
|
||||
|
||||
uni.showLoading({
|
||||
title:" 正在连接打印机.... "
|
||||
});
|
||||
|
||||
let printServerIp = _self.$refs.printServerList.selectText;
|
||||
let printServerUrl = "ws://" + printServerIp;
|
||||
uni.connectSocket({url:printServerUrl});
|
||||
uni.onSocketOpen(
|
||||
function(){
|
||||
let sendMsgStr = JSON.stringify(sendMsg);
|
||||
uni.sendSocketMessage({ data: sendMsgStr });
|
||||
}
|
||||
);
|
||||
|
||||
uni.onSocketMessage(function(res){
|
||||
const strMsg = res.data;
|
||||
let msg = JSON.parse(strMsg);
|
||||
|
||||
if (msg.Message) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: msg.Message,
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "打印失败,打印服务未反馈信息!",
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
uni.closeSocket();
|
||||
});
|
||||
|
||||
uni.onSocketError(function(res){
|
||||
uni.hideLoading();
|
||||
uni.closeSocket();
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "打印失败,连接中断,请确认当前网络状态或者打印服务状态!",
|
||||
duration: 3500,
|
||||
});
|
||||
});
|
||||
|
||||
uni.onSocketClose(function(res){
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
|
||||
printMESLable:function(barcodeArray,FMOULD){
|
||||
if (!barcodeArray || barcodeArray.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if((!_self.defaultPrintServerName) || (_self.defaultPrintServerName.length==0) || (_self.defaultPrintServerName == "请选择")){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择打印服务器!",
|
||||
duration: 3500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if((!_self.defaultPrintName) || (_self.defaultPrintName.length==0) || (_self.defaultPrintName == "请选择")){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择打印机!",
|
||||
duration: 3500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if((!_self.defaultPrintTemplateFNumber) || (_self.defaultPrintTemplateFNumber.length==0)
|
||||
|| (_self.defaultPrintTemplateFNumber == "请选择")){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择打印模板!",
|
||||
duration: 3500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if((!_self.localOrgId) || (_self.localOrgId.length==0)
|
||||
|| (_self.localOrgId == "请选择")){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择组织!",
|
||||
duration: 3500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
let requestPort = uni.getStorageSync("requestPort");
|
||||
let dBAlise = uni.getStorageSync("dbAlise");
|
||||
let userName = uni.getStorageSync("userName");
|
||||
|
||||
let sendMsg = {};
|
||||
//数据类型 0=打印机信息;1=条码信息
|
||||
sendMsg.Type = 1;
|
||||
//URL
|
||||
sendMsg.URL = this.baseUrl;
|
||||
//端口
|
||||
sendMsg.Port = requestPort;
|
||||
//账套
|
||||
sendMsg.DBAias = dBAlise;
|
||||
// 用户
|
||||
sendMsg.UserID = userName;
|
||||
// 组织
|
||||
sendMsg.OrgID = _self.localOrgId;
|
||||
// 单据编号
|
||||
sendMsg.TranType = _self.prgkey;
|
||||
// 打印模板
|
||||
sendMsg.FMOULD = FMOULD;
|
||||
// 打印机名称
|
||||
sendMsg.FPRINTNAME = _self.defaultPrintName;
|
||||
// 条码信息
|
||||
sendMsg.FBarcode = barcodeArray;
|
||||
|
||||
uni.showLoading({
|
||||
title:" 正在连接打印机.... "
|
||||
});
|
||||
|
||||
let printServerIp = _self.$refs.printServerList.selectText;
|
||||
let printServerUrl = "ws://" + printServerIp;
|
||||
uni.connectSocket({url:printServerUrl});
|
||||
uni.onSocketOpen(
|
||||
function(){
|
||||
let sendMsgStr = JSON.stringify(sendMsg);
|
||||
uni.sendSocketMessage({ data: sendMsgStr });
|
||||
}
|
||||
);
|
||||
|
||||
uni.onSocketMessage(function(res){
|
||||
const strMsg = res.data;
|
||||
let msg = JSON.parse(strMsg);
|
||||
|
||||
if (msg.Message) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: msg.Message,
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "打印失败,打印服务未反馈信息!",
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
uni.closeSocket();
|
||||
});
|
||||
|
||||
uni.onSocketError(function(res){
|
||||
uni.hideLoading();
|
||||
uni.closeSocket();
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "打印失败,连接中断,请确认当前网络状态或者打印服务状态!",
|
||||
duration: 3500,
|
||||
});
|
||||
});
|
||||
|
||||
uni.onSocketClose(function(res){
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
|
||||
getPrintList: function(){
|
||||
let _self = this;
|
||||
if((!_self.defaultPrintServerName) || (_self.defaultPrintServerName.length==0) || (_self.defaultPrintServerName == "请选择")){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择打印服务器!",
|
||||
duration: 3500,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
let requestPort = uni.getStorageSync("requestPort");
|
||||
let dBAlise = uni.getStorageSync("dbAlise");
|
||||
let userName = uni.getStorageSync("userName");
|
||||
|
||||
let sendMsg = {};
|
||||
//数据类型 0=打印机信息;1=条码信息
|
||||
sendMsg.Type = 0;
|
||||
|
||||
uni.showLoading({
|
||||
title:"正在刷新打印机.... "
|
||||
});
|
||||
|
||||
let printServerIp = _self.$refs.printServerList.selectText;
|
||||
let printServerUrl = "ws://" + printServerIp;
|
||||
let socketCode = 1;
|
||||
uni.connectSocket({url:printServerUrl});
|
||||
uni.onSocketOpen(
|
||||
function(){
|
||||
let sendMsgStr = JSON.stringify(sendMsg);
|
||||
uni.sendSocketMessage({ data: sendMsgStr });
|
||||
}
|
||||
);
|
||||
|
||||
uni.onSocketMessage(function(res){
|
||||
const strMsg = res.data;
|
||||
let msg = JSON.parse(strMsg);
|
||||
let remotePrintList = msg.Data.PRINTLIST;
|
||||
if (remotePrintList && remotePrintList.length >= 1) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "刷新打印机成功!",
|
||||
duration: 3500,
|
||||
});
|
||||
|
||||
remotePrintList.forEach(
|
||||
function(remotePrint) {
|
||||
let printAddFlag = true;
|
||||
_self.printList.forEach(
|
||||
function(item){
|
||||
if (item.value == remotePrint) {
|
||||
printAddFlag = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
if (printAddFlag) {
|
||||
_self.printServerTemp.printList.push({value:remotePrint});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "刷新打印机失败,打印服务未返回打印机列表!",
|
||||
duration: 3500,
|
||||
});
|
||||
}
|
||||
|
||||
uni.closeSocket();
|
||||
});
|
||||
|
||||
uni.onSocketError(function(res){
|
||||
uni.hideLoading();
|
||||
uni.closeSocket();
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "刷新打印机失败,连接中断,请确认当前网络状态或者打印服务状态!",
|
||||
duration: 3500,
|
||||
});
|
||||
});
|
||||
|
||||
uni.onSocketClose(function(res){
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
|
||||
setDefaultPrint: function() {
|
||||
uni.setStorageSync(
|
||||
this.prgkey + '_DEFAULT_PRINT',
|
||||
{
|
||||
defaultPrintServerName: this.defaultPrintServerName,
|
||||
defaultPrintName: this.defaultPrintName,
|
||||
defaultPrintTemplateFNumber: this.defaultPrintTemplateFNumber,
|
||||
}
|
||||
);
|
||||
|
||||
uni.showToast({
|
||||
icon: "success",
|
||||
title: "保存成功",
|
||||
duration: 3500,
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.print-content-class{
|
||||
margin-top: 32rpx;
|
||||
margin-left: 32rpx;
|
||||
margin-right: 32rpx;
|
||||
}
|
||||
|
||||
p{
|
||||
width:250rpx;
|
||||
height:36rpx;
|
||||
font-size:28rpx;
|
||||
font-family:Helvetica;
|
||||
color:rgba(51,51,51,1);
|
||||
line-height:36rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.button-class{
|
||||
height:80rpx;
|
||||
line-height:80rpx;
|
||||
border-radius:4rpx;
|
||||
font-size:32rpx;
|
||||
margin-top: 32rpx;
|
||||
background-color: #4662FF;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.button-class{
|
||||
height:80rpx;
|
||||
line-height:80rpx;
|
||||
border-radius:4rpx;
|
||||
font-size:32rpx;
|
||||
margin-top: 32rpx;
|
||||
background-color: #4662FF;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
</style>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Reference in new issue
Block a user