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.

103 lines
3.7 KiB

4 years ago
define(function (require, exports, module) {
let BaseBiz = require('apps/rht/base/rhtBiz');
let AddWindow = require("./addwindow");
let Service = require('./dst200120service');
/**
* 控制按钮的可用
* @param opCode 按钮编码
* @return [description]
*/
function Biz(vm) {
//继承第一步,构造继承
BaseBiz.call(this, vm);
vm.remark =''
}
//继承第二步,方法继承
inherits(Biz, BaseBiz);
//保存前校验
Biz.prototype.beforeSave = function () {
let masterRow = this.dsMaster.currentRow;
if(masterRow){
let sPsCycleCode = masterRow ? TypeUtil.toString(masterRow['PsCycleCode']) : '';
if (sPsCycleCode.length > 0 ){
sPsCycleCode = sPsCycleCode.toUpperCase();
if (!((sPsCycleCode == "DH") || (sPsCycleCode == "SH") || (sPsCycleCode == "DSH")
|| ((sPsCycleCode.length == 2) && (sPsCycleCode >= "W0") && (sPsCycleCode <= "W6"))
|| ((sPsCycleCode.length == 3) && (sPsCycleCode >= "D01") && (sPsCycleCode <= "D31")))){
Store.messager.err("配送周期码非法,请参照说明设置。");
return false;
}
masterRow.setColumnValue('PsCycleCode', sPsCycleCode);
}
}
return this.super('beforeSave');
};
//按钮事件控制
Biz.prototype.doOp = function (opCode) {
if (opCode == 'pladd') {
this.onpladd();
}
};
//控制主界面按钮状态
Biz.prototype.getOpEnabled = function (opCode) {
let isOk = this.super('getOpEnabled', opCode);
if (!isOk) {
return false;
}
if (opCode == 'pladd'){
if (this.isEdit())
return false;
}
return true;
};
//批量增加事件处理
Biz.prototype.onpladd = function () {
let self = this;
//定义多选窗口界面
let param = {
uiObjCode: '6008',
//serverBiz: 'cn.qdhezheng.rht.app.cou.cou190201.AddSavePlugin',
biz: self,
pk: "OrgCode,EtpCode",
fixQuery: {
'OrgCode': Store.logOn.orgCode,
'EtpAttribute': "1",
'YwStatus': "1"
},
showCheckColumn: true,
enablePager: false,
funcCode: self.FuncCode,
ds: self.dsMaster,
callback: function (rows,sPsCycleCode) {
if (rows.length == 0){
Store.messager.tip("请先选择数据再执行本操作!");
return false;
}
let addDataList = new Array();
for (let j = 0; j < rows.length; j++) {
addDataList.push({
'EtpCode': rows[j].EtpCode,
'EtpName': rows[j].EtpName
});
}
let ret = Service.getSlideMenuData("actExecute","onpladd", addDataList,sPsCycleCode,"","","");
if (ret.result !== 1) {
Store.messager.err(ret.message);
return false;
}
else{
Store.messager.tip(ret.message);
self.opRouter('refresh');
return true;
}
}
};
//new多选窗体 并打开
let myWindow = new AddWindow(param);
myWindow.open();
};
return Biz;
});