var taskId;
$(function() {
taskId = localStorage.getItem("taskId");
getbaseList();
$("#baseForm").keydown(function(e) {
keycode = e.which || e.keyCode;
if (keycode == 13) {
getbaseList(1);
}
});
});
function getbaseList(init) {
if (init == 1)$(".pageNum").val(1);
JY.Model.loading();
JY.Ajax.doRequest( "baseForm", bonuspath + '/backstage/inputQrcode/findQrcodeByTaskId', {taskId:taskId},
function(data) {
$("#baseTable tbody").empty();
var obj = data.obj;
var list = obj.list;
var results = list.results;
var permitBtn = obj.permitBtn;
var pageNum = list.pageNum, pageSize = list.pageSize, totalRecord = list.totalRecord;
var html = "";
if (results != null && results.length > 0) {
var leng = (pageNum - 1) * pageSize;
for (var i = 0; i < results.length; i++) {
var l = results[i];
html += "
";
html += "| " + (i + leng + 1) + " | ";
html += ""+ JY.Object.notEmpty(l.maType) + " | ";
html += ""+ JY.Object.notEmpty(l.maModel) + " | ";
html += ""+ JY.Object.notEmpty(l.qrCodeNum) + " | ";
if(l.checkStatus == 4 || l.checkStatus =='4'){
html += "待生成二维码 | ";
}else if(l.checkStatus == 5 || l.checkStatus =='5'){
html += "待下载二维码 | ";
}else{
html += "已完成 | ";
}
html += rowFunction(l.taskId,l.maModelId,l.qrCodeNum,l.checkStatus,l.maVender);
html += "
";
}
$("#baseTable tbody").append(html);
JY.Page.setPage("baseForm", "pageing", pageSize,pageNum, totalRecord, "getbaseList");
} else {
html += "| 没有相关数据 |
";
$("#baseTable tbody").append(html);
$("#pageing ul").empty();// 清空分页
}
JY.Model.loadingClose();
}
);
}
function rowFunction(id,maTypeId,machineNums,batchStatus,maVender) {
var h = "";
h += "";
h += "";
if(batchStatus == 4){
h += " ";
}
if(batchStatus != 4){
h += " ";
}
h += " ";
h += "";
h += " | ";
return h;
}
function gen(id,maTypeId,machineNums,maVender){
JY.Model.confirm("确认生成吗?", function() {
JY.Ajax.doRequest(null, bonuspath + '/backstage/qrcode/insert', {
taskId : id,
maModel:maTypeId,
nums:machineNums,
venderName:maVender,
flag:"1"
}, function(data) {
JY.Model.info(data.resMsg, function() {
getbaseList(1);
});
});
});
}
function down(id,maTypeId,machineNums){
window.location.href=bonuspath +"/backstage/qrcode/downloadPhoto?taskId="+taskId+"&maModel="+maTypeId+"&flag=1";
getbaseList(1);
}