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.
95 lines
3.6 KiB
95 lines
3.6 KiB
|
|
define(function (require, exports, module) {
|
|
//引入业务类基类
|
|
let BaseBiz = require('apps/rht/base/rhtBiz');
|
|
let rhtComm = require('apps/rht/comm/rhtComm');
|
|
|
|
//引入业务服务
|
|
let Service = require('./stk180101service');
|
|
|
|
/**
|
|
* 定义业务类对象
|
|
* @param vm 界面相关ViewModule
|
|
*/
|
|
function Biz(vm) {
|
|
//继承第一步,构造继承
|
|
BaseBiz.call(this, vm);
|
|
}
|
|
|
|
//继承第二步,方法继承
|
|
inherits(Biz, BaseBiz);
|
|
|
|
let OrgType = rhtComm.GetOrgType(Store.logOn.orgCode);
|
|
|
|
//新增行后处理,默认值已经处理
|
|
Biz.prototype.afterNewRow = function (dataSrc, newRow) {
|
|
this.super('afterNewRow', dataSrc, newRow);
|
|
if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) {
|
|
let InOrgCode = rhtComm.GetInOrgCode(Store.logOn.orgCode).message;
|
|
newRow.setColumnValue('OrgCode',InOrgCode);
|
|
newRow.setColumnValue('AtOrgCode',InOrgCode);
|
|
newRow.setColumnValue('CkType',"1");
|
|
}
|
|
|
|
};
|
|
//保存前校验 计算主表合计数量等字段
|
|
Biz.prototype.beforeSave = function () {
|
|
let curRow = this.dsMaster.currentRow;
|
|
if(curRow){
|
|
let OrgCode = curRow["OrgCode"];
|
|
let AreaCtrl = curRow["AreaCtrl"];
|
|
if ((OrgType !== "1001") && (OrgType !== "1002")){
|
|
if ((this.dsDetail.rows.length > 0) || (AreaCtrl == "1")){
|
|
curRow.setColumnError("OrgCode", "门店不允许设置存储范围!");
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (OrgCode != Store.logOn.orgCode) {
|
|
if ((this.dsDetail.rows.length > 0) || (AreaCtrl == "1")){
|
|
curRow.setColumnError("OrgCode", "门店不允许设置存储范围!");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
return this.super('beforeSave');
|
|
};
|
|
|
|
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) {
|
|
if (dc.fieldName === 'CkType'){
|
|
let CkType = currentRow['CkType'];
|
|
let OldCkType = currentRow._origin['CkType'];
|
|
let InOrgCode = rhtComm.GetInOrgCode(Store.logOn.orgCode).message;
|
|
if (CkType == "0"){
|
|
let ret= Service.getSlideMenuData("DoOnMasterRule","CkType",CkType,InOrgCode,"","","");
|
|
if (ret.result === 1) {
|
|
if (ret.data != null) {
|
|
dr.setColumnValue('CkType', OldCkType);
|
|
currentRow.setColumnError('CkType','当前连锁组织已经设置卖场!')
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
dr.setColumnText('OrgCode', InOrgCode);
|
|
dr.setColumnText('AtOrgCode', InOrgCode);
|
|
}
|
|
}
|
|
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
|
|
if (dc.fieldName === 'DataType'){
|
|
dr.setColumnValue('PluId', "0");
|
|
dr.setColumnValue('PluCode', "");
|
|
dr.setColumnValue('PluName', "");
|
|
}
|
|
}
|
|
};
|
|
|
|
return Biz;
|
|
}); |