|
|
|
@ -70,8 +70,10 @@ var app = new Vue({ |
|
|
|
formLabelWidth: "120px", |
|
|
|
options: [], |
|
|
|
tags: [], |
|
|
|
isBarCode:false, |
|
|
|
isInit: false, |
|
|
|
versionInit: false, |
|
|
|
isVersion:false, |
|
|
|
isInitApi: false, |
|
|
|
isDraw: false, |
|
|
|
isEditTag: false, |
|
|
|
@ -118,7 +120,7 @@ var app = new Vue({ |
|
|
|
// 初始化型号
|
|
|
|
DrawLableVersionTextParam: { |
|
|
|
"x": 10.0, |
|
|
|
"y": 10.0, |
|
|
|
"y": 8.0, |
|
|
|
"height": 10, |
|
|
|
"width": 50, |
|
|
|
"value": document.getElementById("version").value, |
|
|
|
@ -208,60 +210,8 @@ var app = new Vue({ |
|
|
|
// 初始化打印服务
|
|
|
|
let instance = getInstance(); |
|
|
|
if (!instance) { |
|
|
|
this.$alert('初始化打印服务失败,请重试', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
callback: action => { |
|
|
|
// 关闭当前页
|
|
|
|
var index = parent.layer.getFrameIndex(window.name); |
|
|
|
parent.layer.close(index); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else{ |
|
|
|
getAllPrinters((data) => { |
|
|
|
// 返回值规范化
|
|
|
|
let arrParse = JSON.parse(JSON.stringify(data)); |
|
|
|
if (!arrParse.resultAck.result) { |
|
|
|
this.$alert('打印机获取失败,请重试', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
callback: action => { |
|
|
|
// 关闭当前页
|
|
|
|
var index = parent.layer.getFrameIndex(window.name); |
|
|
|
parent.layer.close(index); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if (isJSON(arrParse.resultAck.info)) { |
|
|
|
// 如果成功获取
|
|
|
|
|
|
|
|
|
|
|
|
// 当前的所有打印设备
|
|
|
|
allPrinters = JSON.parse(arrParse.resultAck.info); |
|
|
|
// 所有名称
|
|
|
|
let allPrintersName = Object.keys(allPrinters); |
|
|
|
// 所有对应值
|
|
|
|
let allPrintersValue = Object.values(allPrinters); |
|
|
|
// 用于存储当前下拉框列表
|
|
|
|
this.options = []; |
|
|
|
// 将其保存到数据中供前端展示
|
|
|
|
for (i = 0; i < allPrintersName.length; i++) { |
|
|
|
// 设置新对象
|
|
|
|
let newopt = {}; |
|
|
|
// 设置标题
|
|
|
|
newopt.label = allPrintersName[i]; |
|
|
|
// 设置值
|
|
|
|
newopt.value = allPrintersValue[i]; |
|
|
|
// 添加对象
|
|
|
|
this.options.push(newopt) |
|
|
|
} |
|
|
|
// 选中打印机(默认选中第一个)
|
|
|
|
selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => { |
|
|
|
// 设置sdk状态为true
|
|
|
|
initSdkStatus = true; |
|
|
|
// 返回值规范化
|
|
|
|
var arrParse = JSON.parse(JSON.stringify(data)); |
|
|
|
if (!arrParse.resultAck.result) { |
|
|
|
// 如果失败
|
|
|
|
this.$alert('打印设备连接失败,请重试', '提示', { |
|
|
|
this.$alert('初始化打印服务失败,请重试', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
callback: action => { |
|
|
|
// 关闭当前页
|
|
|
|
@ -269,13 +219,6 @@ var app = new Vue({ |
|
|
|
parent.layer.close(index); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if (isJSON(arrParse.resultAck.info)) { |
|
|
|
//选择成功,打印机连接成功
|
|
|
|
console.log(data) |
|
|
|
} |
|
|
|
})) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -314,7 +257,16 @@ var app = new Vue({ |
|
|
|
getAllPrinters(data => { |
|
|
|
// 返回结果规范化
|
|
|
|
let arrParse = JSON.parse(JSON.stringify(data)); |
|
|
|
if (isJSON(arrParse.resultAck.info)) { |
|
|
|
if (!arrParse.resultAck.result || arrParse.resultAck.result === 'false') { |
|
|
|
this.$alert('打印机获取失败,请重试', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
callback: action => { |
|
|
|
// 关闭当前页
|
|
|
|
var index = parent.layer.getFrameIndex(window.name); |
|
|
|
parent.layer.close(index); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if (isJSON(arrParse.resultAck.info)) { |
|
|
|
// 获取所有打印设备
|
|
|
|
allPrinters = JSON.parse(arrParse.resultAck.info); |
|
|
|
// 所有设备名称
|
|
|
|
@ -337,7 +289,7 @@ var app = new Vue({ |
|
|
|
selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => { |
|
|
|
// 返回结果规范化
|
|
|
|
var arrParse = JSON.parse(JSON.stringify(data)); |
|
|
|
if (!arrParse.resultAck.result) { |
|
|
|
if (!arrParse.resultAck.result || arrParse.resultAck.result === 'false') { |
|
|
|
this.$alert('打印设备选择失败,请重试', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
callback: action => { |
|
|
|
@ -432,7 +384,7 @@ var app = new Vue({ |
|
|
|
} else { |
|
|
|
// 展示生成按钮
|
|
|
|
this.isInit = true; |
|
|
|
let version = $("#version").val() |
|
|
|
let version = $("#version").val(); |
|
|
|
if ("noMaterial" !== version) { |
|
|
|
this.versionInit = true; |
|
|
|
} |
|
|
|
@ -496,6 +448,7 @@ var app = new Vue({ |
|
|
|
this.tags.push(this.DrawLableVersionTextParam) |
|
|
|
} |
|
|
|
this.dialogDrawLableVersionTextParam = false; |
|
|
|
this.isVersion = true; |
|
|
|
this.isDraw = true |
|
|
|
}, |
|
|
|
// 一维码
|
|
|
|
@ -504,42 +457,17 @@ var app = new Vue({ |
|
|
|
this.DrawLableBarCodeParam.height = Number(this.DrawLableBarCodeParam.height); |
|
|
|
this.DrawLableBarCodeParam.x = Number(this.DrawLableBarCodeParam.x); |
|
|
|
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y); |
|
|
|
if(this.versionInit){ |
|
|
|
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + 10; |
|
|
|
this.DrawLableBarCodeParam.textHeight = Number(this.DrawLableBarCodeParam.textHeight); |
|
|
|
if (this.isVersion) { |
|
|
|
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8); |
|
|
|
} |
|
|
|
this.DrawLableBarCodeParam.name = "条形码"; |
|
|
|
// 发送请求将其变成条形码
|
|
|
|
let req = {}; |
|
|
|
req.qrCode = this.DrawLableBarCodeParam.value; |
|
|
|
req.mcode = $("#materialCode").val(); |
|
|
|
req.type = "qTb"; |
|
|
|
$.ajax({ |
|
|
|
url: "/material/updateQrCodeType", |
|
|
|
type: "post", |
|
|
|
dataType: "json", |
|
|
|
data: JSON.stringify(req), |
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
success: result => { |
|
|
|
|
|
|
|
DrawLableBarCode(this.DrawLableBarCodeParam, res => { |
|
|
|
var arrParse = JSON.parse(JSON.stringify(res)); |
|
|
|
//⼀维码绘制失败,退出绘制
|
|
|
|
if (arrParse.resultAck.result !== 0) { |
|
|
|
this.$message({ // 发起提示
|
|
|
|
message: '绘制失败,请重试', |
|
|
|
type: 'warning' |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
if (this.isEditTag) { |
|
|
|
this.$set(this.tags, this.editIndex, this.DrawLableBarCodeParam); |
|
|
|
} else { |
|
|
|
this.tags.push(this.DrawLableBarCodeParam) |
|
|
|
} |
|
|
|
this.isBarCode = true; |
|
|
|
this.dialogDrawLableBarCodeParam = false; |
|
|
|
this.isDraw = true |
|
|
|
}, |
|
|
|
@ -551,39 +479,17 @@ var app = new Vue({ |
|
|
|
this.DrawLableQrCodeParam.x = Number(this.DrawLableQrCodeParam.x); |
|
|
|
this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y); |
|
|
|
this.DrawLableQrCodeParam.name = "二维码"; |
|
|
|
let req = {}; |
|
|
|
req.qrCode = this.DrawLableQrCodeParam.value; |
|
|
|
req.mcode = $("#materialCode").val(); |
|
|
|
req.type = "bTq"; |
|
|
|
$.ajax({ |
|
|
|
url: "/material/updateQrCodeType", |
|
|
|
type: "post", |
|
|
|
dataType: "json", |
|
|
|
data: JSON.stringify(req), |
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
success: result => { |
|
|
|
|
|
|
|
DrawLableQrCode(this.DrawLableQrCodeParam, res => { |
|
|
|
var arrParse = JSON.parse(JSON.stringify(res)); |
|
|
|
//⼀维码绘制失败,退出绘制
|
|
|
|
if (arrParse.resultAck.result !== 0) { |
|
|
|
this.$message({ // 发起提示
|
|
|
|
message: '绘制失败,请重试', |
|
|
|
type: 'warning' |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (this.isVersion) { |
|
|
|
this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (this.isEditTag) { |
|
|
|
this.$set(this.tags, this.editIndex, this.DrawLableQrCodeParam); |
|
|
|
} else { |
|
|
|
this.tags.push(this.DrawLableQrCodeParam) |
|
|
|
} |
|
|
|
this.dialogDrawLableQrCodeParam = false; |
|
|
|
this.isDraw = true |
|
|
|
this.isDraw = true; |
|
|
|
this.isBarCode = false; |
|
|
|
}, |
|
|
|
DragList(List) { |
|
|
|
List.forEach(res => { |
|
|
|
@ -704,20 +610,19 @@ var app = new Vue({ |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 为了防止打印时未生成对应图像事先初始化
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化画板
|
|
|
|
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => { |
|
|
|
|
|
|
|
|
|
|
|
if (this.dialogDrawLableBarCodeParam) { |
|
|
|
if (this.isBarCode) { |
|
|
|
// 如果打印条形码
|
|
|
|
|
|
|
|
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{ |
|
|
|
if(this.versionInit){ |
|
|
|
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{ |
|
|
|
|
|
|
|
if (this.isVersion) { |
|
|
|
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => { |
|
|
|
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => { |
|
|
|
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => { |
|
|
|
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => { |
|
|
|
// 提交数据
|
|
|
|
var totalCount = parseInt(pageCount) * parseInt(quantityCount); |
|
|
|
@ -736,8 +641,14 @@ var app = new Vue({ |
|
|
|
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); |
|
|
|
}); |
|
|
|
})) |
|
|
|
}) |
|
|
|
})) |
|
|
|
})) |
|
|
|
})) |
|
|
|
} else { |
|
|
|
// 不打印型号
|
|
|
|
|
|
|
|
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => { |
|
|
|
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => { |
|
|
|
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => { |
|
|
|
// 提交数据
|
|
|
|
var totalCount = parseInt(pageCount) * parseInt(quantityCount); |
|
|
|
@ -756,14 +667,17 @@ var app = new Vue({ |
|
|
|
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); |
|
|
|
}); |
|
|
|
})) |
|
|
|
})) |
|
|
|
})) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果打印二维码
|
|
|
|
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{ |
|
|
|
if(this.versionInit){ |
|
|
|
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{ |
|
|
|
|
|
|
|
if (this.isVersion) { |
|
|
|
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => { |
|
|
|
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => { |
|
|
|
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => { |
|
|
|
this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => { |
|
|
|
// 提交数据
|
|
|
|
var totalCount = parseInt(pageCount) * parseInt(quantityCount); |
|
|
|
@ -782,9 +696,14 @@ var app = new Vue({ |
|
|
|
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); |
|
|
|
}); |
|
|
|
})) |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => { |
|
|
|
})) |
|
|
|
})) |
|
|
|
})) |
|
|
|
} |
|
|
|
else { |
|
|
|
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => { |
|
|
|
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => { |
|
|
|
this.DrawLableQrCodeApiDemo(this.DrawLableQrCodeParam, (data => { |
|
|
|
// 提交数据
|
|
|
|
var totalCount = parseInt(pageCount) * parseInt(quantityCount); |
|
|
|
startJob(parseInt(density), parseInt(paperType), parseInt(printMode), totalCount, function (data) { |
|
|
|
@ -802,13 +721,12 @@ var app = new Vue({ |
|
|
|
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); |
|
|
|
}); |
|
|
|
})) |
|
|
|
})) |
|
|
|
})) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
/** |
|
|
|
@ -857,52 +775,68 @@ var app = new Vue({ |
|
|
|
pageIndex++; |
|
|
|
setTimeout(function () { |
|
|
|
// 初始化画板
|
|
|
|
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => { |
|
|
|
|
|
|
|
if (this.dialogDrawLableBarCodeParam) { |
|
|
|
// 添加名称
|
|
|
|
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam,(data)=>{ |
|
|
|
if(self.versionInit){ |
|
|
|
|
|
|
|
if (this.isBarCode) { |
|
|
|
// 如果绘制条形码
|
|
|
|
|
|
|
|
|
|
|
|
if (self.isVersion) { |
|
|
|
// 如果绘制型号
|
|
|
|
|
|
|
|
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => { |
|
|
|
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => { |
|
|
|
// 添加型号
|
|
|
|
self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam,(data)=>{ |
|
|
|
self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam, (data => { |
|
|
|
self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => { |
|
|
|
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); |
|
|
|
})) |
|
|
|
}) |
|
|
|
})) |
|
|
|
})) |
|
|
|
})) |
|
|
|
} else { |
|
|
|
// 如果不绘制型号
|
|
|
|
|
|
|
|
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => { |
|
|
|
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => { |
|
|
|
self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => { |
|
|
|
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); |
|
|
|
})) |
|
|
|
})) |
|
|
|
})) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果绘制二维码
|
|
|
|
|
|
|
|
} else { |
|
|
|
// 添加名称
|
|
|
|
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam,(data)=>{ |
|
|
|
// 如果绘制型号
|
|
|
|
if(self.versionInit){ |
|
|
|
if (self.isVersion) { |
|
|
|
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => { |
|
|
|
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => { |
|
|
|
// 添加型号
|
|
|
|
self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam,(data)=>{ |
|
|
|
self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam, (data => { |
|
|
|
self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => { |
|
|
|
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); |
|
|
|
})) |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
})) |
|
|
|
})) |
|
|
|
})) |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果不绘制型号
|
|
|
|
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => { |
|
|
|
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => { |
|
|
|
self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => { |
|
|
|
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); |
|
|
|
})) |
|
|
|
})) |
|
|
|
})) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}))// 提交数据
|
|
|
|
// 提交数据
|
|
|
|
}, 500); |
|
|
|
} |
|
|
|
}); |
|
|
|
|