You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.7 KiB

define(function (require, exports, module) {
let BaseBiz = require('apps/rht/base/rhtBiz');
let rhtComm = require('apps/rht/comm/rhtComm');
let Service = require('./lbl2602service');
/**
* 控制按钮的可用
* @param opCode 按钮编码
* @return [description]
*/
function Biz(vm) {
//继承第一步,构造继承
BaseBiz.call(this, vm);
vm.remark = ''
}
//继承第二步,方法继承
inherits(Biz, BaseBiz);
//按钮事件控制
Biz.prototype.doOp = function (opCode) {
if (opCode == 'prnformat') {
this.onprnformat();
}
};
Biz.prototype.beforeAdd = function () {
self = this;
let ret = Service.getSlideMenuData("actExecute", "CheckFormatCount", "", "", "", "", "");
if (ret.result !== 1) {
Store.messager.err(ret.message);
return false;
}
return this.super('beforeAdd');
};
Biz.prototype.beforeSave = function () {
let curRow = this.dsMaster.currentRow;
if (curRow) {
let ret = Service.getSlideMenuData("actExecute", "FormatSaveCheck", curRow.LblFrtId, curRow.LblFrtName, "", "", "", "");
if (ret.result !== 1) {
Store.messager.tip(ret.message);
return false;
}
if (curRow.IsDefault === '1') {
let ret1 = Service.getSlideMenuData("actExecute", "FindDefault", curRow.LblFrtId, curRow.LblClsCode, "", "", "");
Store.messager.tip(ret1.message);
return false;
}
let LblFrtId = curRow.LblFrtId;
if (LblFrtId===0){
LblFrtId = rhtComm.GetNextId("26003", "1", "");
curRow.setColumnValue('LblFrtId', LblFrtId);
}
//let LblFrtId = rhtComm.GetNextId("26003", "1", "");
//curRow.setColumnValue('LblFrtId', LblFrtId);
}
return this.super('beforeSave');
}
//格式设置
Biz.prototype.onprnformat = function () {
self = this;
if (this.dsMaster.currentRow) {
try {
this.activePrinter(2);
} catch (e) {
console.log(e);
}
}
return true;
};
Biz.prototype.activePrinter = function (mod) {
Store.silent = true;
try {
let row = this.dsMaster.currentRow
let postData = {
uiObjCodes: row.UIObjCode
}
Store.services.getUiObjSchema(postData, function (isOk, data) {
if (!data || !data[row.UIObjCode]) {
Store.messager.warn('未找到对象字典')
return
}
let schemeData = data[row.UIObjCode]
let printData = [
{
uiObjCode: schemeData.uiObjCode,
uiObjName: schemeData.uiObjName,
isMaster: true,
fieldList: []
}]
schemeData.columns.forEach(col => {
printData[0].fieldList.push({
fieldName: col.fieldName,
fieldDes: col.dispName,
dataType: col.dataType,
dataWidth: col.dataWidth,
dataDec: col.dataDec,
hasRefColumn: col.refFieldName ? "1" : "0"
})
})
Store.bizDao.printLabel(row.LblFrtId, mod, printData, null, function (result) {
})
})
return;
} finally {
Store.silent = false
}
}
return Biz;
});