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.

88 lines
3.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

define(function (require, exports, module) {
let BaseBiz = require('apps/rht/base/rhtBiz');
let rhtComm = require('apps/rht/comm/rhtComm');
let Service = require('./sys010115service');
function Biz(vm) {
//继承第一步,构造继承
BaseBiz.call(this, vm);
}
//继承第二步,方法继承
inherits(Biz, BaseBiz);
Biz.prototype.beforeAdd = function () {
this.dsMaster.getColumn('OrgCode').set('isEditable',true);
this.dsMaster.getColumn('PosNo').set('isEditable',true);
return this.super('beforeAdd');
};
Biz.prototype.beforeEdit = function () {
this.dsMaster.getColumn('OrgCode').set('isEditable',false);
this.dsMaster.getColumn('PosNo').set('isEditable',false);
return this.super('beforeEdit');
};
//按钮事件控制
Biz.prototype.doOp = function (opCode) {
let self = this;
if (opCode == 'open') {
self.onchgstatus('1');
}
if (opCode == 'close') {
this.onchgstatus('0');
}
};
//控制主界面按钮状态
Biz.prototype.getOpEnabled = function (opCode) {
let isOk = this.super('getOpEnabled', opCode);
if (!isOk) {
return false;
}
let masterRow = this.dsMaster.currentRow;
let sIsEnable = masterRow ? TypeUtil.toString(masterRow['IsEnable']) : '';
if (opCode == 'open'){
if (this.isEdit())
return false;
if (!masterRow)
return false;
if (sIsEnable == '1')
return false;
}
if (opCode == 'close'){
if (this.isEdit())
return false;
if (!masterRow)
return false;
if (sIsEnable == '0')
return false;
}
return true;
};
//改变状态处理
Biz.prototype.onchgstatus = function (optType) {
let masterRow = this.dsMaster.currentRow;
let sOrgCode = masterRow ? TypeUtil.toString(masterRow['OrgCode']) : '';
let sPosNo = masterRow ? TypeUtil.toString(masterRow['PosNo']) : '';
if(masterRow){
let sMsg = '启用';
if (optType == '0'){
sMsg = '停用';
}
if (!Store.confirm("您确定要"+sMsg+sOrgCode+"门店下"+sPosNo+"POS吗")) {
return false;
}
let ret= Service.getSlideMenuData("actExecute","onchgstatus",sOrgCode,sPosNo,optType,"","");
if (ret.result !== 1) {
Store.messager.err(sOrgCode+"门店下"+sPosNo+"POS"+sMsg+"失败!"+ret.message);
return false;
}
else{
this.dsMaster.updateRow();
Store.messager.tip(sOrgCode+"门店下"+sPosNo+"POS"+sMsg+"成功!");
return true;
}
}
return true;
};
return Biz;
});