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.

150 lines
5.0 KiB

define(function (require, exports, module) {
//引入业务类基类
let BaseBiz = require('apps/rht/base/rhtBiz');
//引入业务服务
let Service = require('./pri10020204service');
/**
* 定义业务类对象
* @param vm 界面相关ViewModule
*/
function Biz(vm) {
//继承第一步,构造继承
BaseBiz.call(this, vm);
}
//继承第二步,方法继承
inherits(Biz, BaseBiz);
//明细行单行提交触发的校验
Biz.prototype.dataRowValidate = function (dataSrc, dr) {
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
let JdRate = TypeUtil.toFloat(dr['JdRate']);
if (JdRate <= 0) {
return "加点配送价加点率必须大于零!";
}
}
return true;
};
/**
* @description 数据发生变化时调用
* @param dataSrc 数据集
* @param dr 数据行
* @param dc 数据列
*/
Biz.prototype.fieldChanged = function (dataSrc, dr, dc) {
let self = this;
let currentRow = self.dsMaster.currentRow;
if (currentRow === null) return false;
if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) {
switch (dc.fieldName) {
case 'JgZcCode':
this.fieldChangedJgZcCode(dataSrc, dr, dc);
break;
}
}
this.super('fieldChanged');
};
//JgZcCode 字段变化执行事件
Biz.prototype.fieldChangedJgZcCode = function (dataSrc, dr, dc) {
let JgZcCode = TypeUtil.toString(dr['JgZcCode']);
if (JgZcCode.length > 0){
let ret= Service.getSlideMenuData("DoOnMasterRule","JgZcCode",JgZcCode,"","","","");
if (ret.result === 1) {
if (ret.data != null) {
dr.setColumnValue('ZcType', ret.data.ZcType);
dr.setColumnValue('PriceType', ret.data.PriceType);
dr.setColumnValue('ZcMode', ret.data.ZcMode);
dr.setColumnValue('Remark', ret.data.Remark);
dr.setColumnText('OrgCode', ret.data.OrgCode);
dr.setColumnValue('OrgName', ret.data.OrgName);
}
}
}
return true;
};
//按钮事件控制
Biz.prototype.doOp = function (opCode) {
let self = this;
if (opCode == 'isok') {
let ds = self.dsMaster;
let sType = "0";
this.onAccount(self, ds, sType);
}
if (opCode == 'islose') {
let ds = self.dsMaster;
let sType = "1";
this.onAccount(self, ds, sType);
}
};
//按钮事件
Biz.prototype.onAccount = function (biz, ds, sType) {
let dsrow=ds.currentRow;
let JgZcCode = dsrow ? TypeUtil.toString(dsrow['JgZcCode']) : '';
let ret= Service.getSlideMenuData("actExecute","UAccount",JgZcCode,sType,Store.logOn.userId,Store.logOn.userCode,Store.logOn.userName);
if (ret.result === 1) {
if (sType == "0")
Store.messager.tip("生效成功!");
else
Store.messager.tip("失效成功!");
biz.dsMaster.updateRow();
}
else
{
Store.messager.err("操作失败!"+ret.message);
return false;
}
return true;
};
//控制主界面按钮状态
Biz.prototype.getOpEnabled = function (opCode) {
let isOk = this.super('getOpEnabled', opCode);
if (!isOk) return false;
let curRow = this.dsMaster.currentRow;
if (opCode == 'edit') {
let OrgCode = curRow ? TypeUtil.toString(curRow['OrgCode']) : '';
let IsAcCount = curRow ? TypeUtil.toString(curRow['IsAcCount']) : '';
if (!curRow)
return false;
if (OrgCode != Store.logOn.orgCode)
return false;
if (IsAcCount != "0")
return false;
}
if (opCode == 'delete') {
let OrgCode = curRow ? TypeUtil.toString(curRow['OrgCode']) : '';
let IsAcCount = curRow ? TypeUtil.toString(curRow['IsAcCount']) : '';
if (!curRow)
return false;
if (OrgCode != Store.logOn.orgCode)
return false;
if (IsAcCount != "0")
return false;
}
if (opCode == 'isok') {
let IsAcCount = curRow ? TypeUtil.toString(curRow['IsAcCount']) : '';
if (!curRow)
return false;
if (IsAcCount != "0")
return false;
}
if (opCode == 'islose') {
let IsAcCount = curRow ? TypeUtil.toString(curRow['IsAcCount']) : '';
if (!curRow)
return false;
if (IsAcCount != "1")
return false;
}
return true;
};
return Biz;
});