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.
564 lines
26 KiB
564 lines
26 KiB
define(function (require, exports, module) {
|
|
//引入业务类基类
|
|
let BaseBiz = require('apps/rht/base/rhtBiz');
|
|
let rhtService = require('../../base/rhtService');
|
|
let rhtComm = require('apps/rht/comm/rhtComm');
|
|
|
|
//引入业务服务
|
|
let service = require('./sku080211service');
|
|
|
|
/**
|
|
* 定义业务类对象
|
|
* @param vm 界面相关ViewModule
|
|
*/
|
|
function Biz(vm) {
|
|
//继承第一步,构造继承
|
|
BaseBiz.call(this, vm);
|
|
}
|
|
|
|
//继承第二步,方法继承
|
|
inherits(Biz, BaseBiz);
|
|
|
|
Biz.prototype.initCompleted = function () {
|
|
this.super('initCompleted');
|
|
|
|
this.ywChangeByBill = rhtComm.getRhtOptionValue('*','SKU','SKU_YwChangeByBill','0');
|
|
this.productClass = rhtComm.getRhtOptionValue('*','SYS','PRODUCT_CLASS','0');
|
|
this.isPluExStatus = rhtComm.getRhtOptionValue('*','SKU','SKU_IsPluExStatus','0');
|
|
|
|
let ret = service.GetSkuExCtl();
|
|
if(ret.result != 1) {
|
|
Store.messager.err('查询控制权限失败!' + ret.message);
|
|
return false;
|
|
}
|
|
let ctlParams = ret.data;
|
|
|
|
this.isZbCtlPrice = ctlParams.substr(0,1); //总部控制价格
|
|
this.isAqDays = ctlParams.substr(1,1); //安全天数
|
|
this.isCgRate = ctlParams.substr(2,1); //采购系数
|
|
this.isCgMode = ctlParams.substr(3,1); //采购方式
|
|
this.isEconomyCount = ctlParams.substr(4,1); //经济批量
|
|
this.isJhCycle = ctlParams.substr(5,1); //进货周期
|
|
this.isMaxCount = ctlParams.substr(6,1); //最大库存
|
|
this.isMinCount = ctlParams.substr(7,1); //最小库存
|
|
this.isHyPrice = ctlParams.substr(8,1); //会员价
|
|
this.isPfPrice = ctlParams.substr(9,1); //批发价
|
|
this.isPrice = ctlParams.substr(10,1); //售价
|
|
this.isMaxPrice = ctlParams.substr(11,1); //最高售价
|
|
this.isMinPrice = ctlParams.substr(12,1); //最低售价
|
|
this.isMaxHjPrice = ctlParams.substr(13,1); //最高含税进价
|
|
this.isMinHjPrice = ctlParams.substr(14,1); //最低含税进价
|
|
this.isMaxPfPrice = ctlParams.substr(15,1); //最高批发价
|
|
this.isMinPfPrice = ctlParams.substr(16,1); //最低批发价
|
|
this.isMinInCount = ctlParams.substr(17,1); //最小进货量
|
|
this.isPsCycle = ctlParams.substr(18,1); //配送周期
|
|
};
|
|
|
|
//控制主界面按钮状态
|
|
Biz.prototype.getOpEnabled = function (opCode) {
|
|
let self = this;
|
|
let isOk = this.super('getOpEnabled', opCode);
|
|
if (!isOk) return false;
|
|
let curRow = this.dsMaster.currentRow;
|
|
|
|
if (opCode == 'commit') {
|
|
if(!curRow) {
|
|
return false;
|
|
}
|
|
}
|
|
if (opCode == 'acc') {
|
|
if(!curRow) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
|
|
//按钮事件控制
|
|
// Biz.prototype.doOp = function (opCode) {
|
|
// let self = this;
|
|
// if (opCode == 'acc') {
|
|
// let ds = self.dsMaster;
|
|
// this.onAcc(self, ds);
|
|
// }
|
|
// };
|
|
|
|
// //按钮事件
|
|
// Biz.prototype.onAcc = function (biz, ds) {
|
|
// let currentRow = ds.currentRow;
|
|
|
|
// return true;
|
|
// };
|
|
|
|
//添加后执行
|
|
Biz.prototype.afterAdd = function () {
|
|
let defRow = this.dsDetailParaDef.addRow();
|
|
InitDefSku(defRow, this.isZbCtlPrice);
|
|
let masterAdapter = this.view.vm['ep_dsMaster'];
|
|
masterAdapter.setEditorEditable('CzType', true);
|
|
masterAdapter.setEditorEditable('Remark', true);
|
|
this.SetReadOnly('0');
|
|
return this.super('afterAdd');
|
|
};
|
|
|
|
//编辑后执行
|
|
Biz.prototype.afterEdit = function () {
|
|
let defRow = this.dsDetailParaDef.addRow();
|
|
InitDefSku(defRow, this.isZbCtlPrice);
|
|
|
|
defRow.setColumnValue('DepID', this.dsDetailPlu.rows[0].DepID);
|
|
defRow.setColumnValue('DepCode', this.dsDetailPlu.rows[0].DepCode);
|
|
|
|
let masterAdapter = this.view.vm['ep_dsMaster'];
|
|
masterAdapter.setEditorEditable('CzType', true);
|
|
masterAdapter.setEditorEditable('Remark', true);
|
|
|
|
this.SetReadOnly(this.dsMaster.currentRow.czType);
|
|
|
|
return this.super('afterEdit');
|
|
};
|
|
|
|
function InitDefSku(defRow,isZbCtlPrice) {
|
|
let ret = service.GetDefSku();
|
|
if(ret.result != 1) {
|
|
Store.messager.err('初始化默认商品属性失败!' + ret.message);
|
|
return false;
|
|
}
|
|
//defRow.setColumnValue('OrgCode', ret.data.orgcode);
|
|
//defRow.setColumnValue('OrgName', ret.data.orgname);
|
|
defRow.setColumnValue('DepName', ret.data.depname);
|
|
defRow.setColumnValue('DepID', ret.data.depid);
|
|
defRow.setColumnValue('DepCode', ret.data.depcode);
|
|
defRow.setColumnValue('JjMode', ret.data.jjmode);
|
|
defRow.setColumnValue('JhCycle', ret.data.jhcycle);
|
|
defRow.setColumnValue('PsCycle', ret.data.pscycle);
|
|
defRow.setColumnValue('AqDays', ret.data.aqdays);
|
|
defRow.setColumnValue('CgMode', ret.data.cgmode);
|
|
defRow.setColumnValue('MinInCount', ret.data.minincount);
|
|
defRow.setColumnValue('EconomyCount', ret.data.economycount);
|
|
defRow.setColumnValue('MinCount', ret.data.mincount);
|
|
defRow.setColumnValue('MaxCount', ret.data.maxcount);
|
|
defRow.setColumnValue('IsZbPrice', isZbCtlPrice);
|
|
defRow.setColumnValue('IsJh', ret.data.isjh);
|
|
defRow.setColumnValue('IsTh', ret.data.isth);
|
|
defRow.setColumnValue('IsPs', ret.data.isps);
|
|
defRow.setColumnValue('IsJs', ret.data.isjs);
|
|
defRow.setColumnValue('IsSale', ret.data.issale);
|
|
defRow.setColumnValue('IsSaleTh', ret.data.issaleth);
|
|
defRow.setColumnValue('IsCanPresent', ret.data.iscanpresent);
|
|
defRow.setColumnValue('IsPresent', ret.data.ispresent);
|
|
defRow.setColumnValue('IsMinPrice', ret.data.isminprice);
|
|
defRow.setColumnValue('CgRate1', ret.data.cgrate1);
|
|
defRow.setColumnValue('CgRate2', ret.data.cgrate2);
|
|
defRow.setColumnValue('CgRate3', ret.data.cgrate3);
|
|
defRow.setColumnValue('CgRate4', ret.data.cgrate4);
|
|
defRow.setColumnValue('CgRate5', ret.data.cgrate5);
|
|
defRow.setColumnValue('CgRate6', ret.data.cgrate6);
|
|
defRow.setColumnValue('CgRate7', ret.data.cgrate7);
|
|
defRow.setColumnValue('CgRate8', ret.data.cgrate8);
|
|
defRow.setColumnValue('CgRate9', ret.data.cgrate9);
|
|
defRow.setColumnValue('CgRate10', ret.data.cgrate10);
|
|
defRow.setColumnValue('CgRate11', ret.data.cgrate11);
|
|
defRow.setColumnValue('CgRate12', ret.data.cgrate12);
|
|
defRow.setColumnValue('MaxInCountLimit', ret.data.maxincountlimit);
|
|
defRow.setColumnValue('MaxInCount', ret.data.maxincount);
|
|
}
|
|
|
|
/**
|
|
* @description 数据发生变化时调用
|
|
* @param dataSrc 数据集
|
|
* @param dr 数据行
|
|
* @param dc 数据列
|
|
*/
|
|
Biz.prototype.fieldChanged = function (dataSrc, dr, dc) {
|
|
let self = this;
|
|
if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) {
|
|
let currentRow = self.dsMaster.currentRow;
|
|
if (currentRow === null) return false;
|
|
switch (dc.fieldName) {
|
|
case 'CzType':
|
|
this.fieldChangedCzType(dataSrc, dr, dc);
|
|
break;
|
|
}
|
|
}else if (dataSrc.uiObjCode === this.dsDetailPlu.uiObjCode) {
|
|
let currentRow = self.dsDetailPlu.currentRow;
|
|
if (currentRow === null) return false;
|
|
switch (dc.fieldName) {
|
|
case 'PluCode':
|
|
this.fieldChangedPluCode(dataSrc, dr, dc);
|
|
break;
|
|
}
|
|
}else if (dataSrc.uiObjCode === this.dsDetailParaDef.uiObjCode) {
|
|
let currentRow = self.dsDetailParaDef.currentRow;
|
|
if (currentRow === null) return false;
|
|
switch (dc.fieldName) {
|
|
case 'OrgCode':
|
|
this.fieldChangedDefOrgCode(dataSrc, dr, dc);
|
|
break;
|
|
}
|
|
}else if (dataSrc.uiObjCode === this.dsDetailPara.uiObjCode) {
|
|
let currentRow = self.dsDetailPara.currentRow;
|
|
if (currentRow === null) return false;
|
|
switch (dc.fieldName) {
|
|
case 'FieldCode':
|
|
this.fieldChangedFieldCode(dataSrc, dr, dc);
|
|
break;
|
|
case 'FieldValue':
|
|
this.fieldChangedFieldValue(dataSrc, dr, dc);
|
|
break;
|
|
}
|
|
}
|
|
return this.super('fieldChanged');
|
|
};
|
|
|
|
Biz.prototype.fieldChangedCzType = function (dataSrc, dr, dc) {
|
|
let czType = TypeUtil.toString(dr.CzType);
|
|
let detailPluAdapter = this.view.vm['grid_dsDetailPlu'];
|
|
|
|
detailPluAdapter.setColumnEditable('DepCode', czType=='0');
|
|
$('#detail-tab').children().first().tabs(czType=='0' ? 'enableTab' : 'disableTab', 2);
|
|
$('#detail-tab').children().first().tabs(czType=='2' ? 'enableTab' : 'disableTab', 3);
|
|
|
|
this.SetReadOnly(czType);
|
|
}
|
|
|
|
Biz.prototype.SetReadOnly = function (czType) {
|
|
let detailPluAdapter = this.view.vm['grid_dsDetailPlu'];
|
|
let detailParaDefAdapter = this.view.vm['grid_dsDetailParaDef'];
|
|
if(czType == '0') {
|
|
// 总部控制价格
|
|
detailPluAdapter.setColumnEditable('IsZbPrice', this.isZbCtlPrice == '1');
|
|
detailParaDefAdapter.setColumnEditable('IsZbPrice', this.isZbCtlPrice == '1');
|
|
// 安全天数
|
|
detailPluAdapter.setColumnEditable('AqDays', this.isAqDays == '1');
|
|
detailParaDefAdapter.setColumnEditable('AqDays', this.isAqDays == '1');
|
|
// 采购系数
|
|
detailPluAdapter.setColumnEditable('CgRate1', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate2', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate3', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate4', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate5', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate6', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate7', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate8', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate9', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate10', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate11', this.isCgRate == '1');
|
|
detailPluAdapter.setColumnEditable('CgRate12', this.isCgRate == '1');
|
|
|
|
detailParaDefAdapter.setColumnEditable('CgRate1', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate2', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate3', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate4', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate5', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate6', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate7', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate8', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate9', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate10', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate11', this.isCgRate == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgRate12', this.isCgRate == '1');
|
|
|
|
// 采购方式
|
|
detailPluAdapter.setColumnEditable('CgMode', this.isCgMode == '1');
|
|
detailParaDefAdapter.setColumnEditable('CgMode', this.isCgMode == '1');
|
|
// 经济批量
|
|
detailPluAdapter.setColumnEditable('EconomyCount', this.isEconomyCount == '1');
|
|
detailParaDefAdapter.setColumnEditable('EconomyCount', this.isEconomyCount == '1');
|
|
// 进货周期
|
|
detailPluAdapter.setColumnEditable('JhCycle', this.isJhCycle == '1');
|
|
detailParaDefAdapter.setColumnEditable('JhCycle', this.isJhCycle == '1');
|
|
// 最大库存
|
|
detailPluAdapter.setColumnEditable('MaxCount', this.isMaxCount == '1');
|
|
detailParaDefAdapter.setColumnEditable('MaxCount', this.isMaxCount == '1');
|
|
// 最小库存
|
|
detailPluAdapter.setColumnEditable('MinCount', this.isMinCount == '1');
|
|
detailParaDefAdapter.setColumnEditable('MinCount', this.isMinCount == '1');
|
|
// 会员价
|
|
detailPluAdapter.setColumnEditable('HyPrice', this.isHyPrice == '1');
|
|
// 批发价
|
|
detailPluAdapter.setColumnEditable('PfPrice', this.isPfPrice == '1');
|
|
// 售价
|
|
detailPluAdapter.setColumnEditable('Price', this.isPrice == '1');
|
|
// 最高售价
|
|
detailPluAdapter.setColumnEditable('MaxPrice', this.isMaxPrice == '1');
|
|
// 最低售价
|
|
detailPluAdapter.setColumnEditable('MinPrice', this.IsMinPrice == '1');
|
|
// 最高含税进价
|
|
detailPluAdapter.setColumnEditable('MaxHjPrice', this.isMaxHjPrice == '1');
|
|
// 最低含税进价
|
|
detailPluAdapter.setColumnEditable('MinHjPrice', this.isMinHjPrice == '1');
|
|
// 最高批发价
|
|
detailPluAdapter.setColumnEditable('MaxPfPrice', this.isMaxPfPrice == '1');
|
|
// 最低批发价
|
|
detailPluAdapter.setColumnEditable('MinPfPrice', this.isMinPfPrice == '1');
|
|
// 最小进货量
|
|
detailPluAdapter.setColumnEditable('MinInCount', this.isMinInCount == '1');
|
|
detailParaDefAdapter.setColumnEditable('MinInCount', this.isMinInCount == '1');
|
|
//配送周期
|
|
detailPluAdapter.setColumnEditable('PsCycle', this.isPsCycle == '1');
|
|
detailParaDefAdapter.setColumnEditable('PsCycle', this.isPsCycle == '1');
|
|
|
|
detailPluAdapter.setColumnEditable('IsJh', false);
|
|
detailPluAdapter.setColumnEditable('IsTh', false);
|
|
detailPluAdapter.setColumnEditable('IsPs', false);
|
|
detailPluAdapter.setColumnEditable('IsJs', false);
|
|
detailPluAdapter.setColumnEditable('IsSale', false);
|
|
detailPluAdapter.setColumnEditable('IsSaleTh', false);
|
|
detailPluAdapter.setColumnEditable('IsCanPresent', false);
|
|
detailPluAdapter.setColumnEditable('IsPresent', false);
|
|
detailPluAdapter.setColumnEditable('IsMinPrice', false);
|
|
}else {
|
|
detailPluAdapter.setColumnEditable('JhCycle', true);
|
|
detailPluAdapter.setColumnEditable('PsCycle', true);
|
|
detailPluAdapter.setColumnEditable('AqDays', true);
|
|
detailPluAdapter.setColumnEditable('CgMode', true);
|
|
detailPluAdapter.setColumnEditable('MinInCount', true);
|
|
detailPluAdapter.setColumnEditable('EconomyCount', true);
|
|
detailPluAdapter.setColumnEditable('MinCount', true);
|
|
detailPluAdapter.setColumnEditable('MaxCount', true);
|
|
detailPluAdapter.setColumnEditable('IsZbPrice', true);
|
|
detailPluAdapter.setColumnEditable('IsJh', true);
|
|
detailPluAdapter.setColumnEditable('IsTh', true);
|
|
detailPluAdapter.setColumnEditable('IsPs', true);
|
|
detailPluAdapter.setColumnEditable('IsJs', true);
|
|
detailPluAdapter.setColumnEditable('IsSale', true);
|
|
detailPluAdapter.setColumnEditable('IsSaleTh', true);
|
|
detailPluAdapter.setColumnEditable('IsCanPresent', true);
|
|
detailPluAdapter.setColumnEditable('IsPresent', true);
|
|
detailPluAdapter.setColumnEditable('IsMinPrice', true);
|
|
detailPluAdapter.setColumnEditable('CgRate1', true);
|
|
detailPluAdapter.setColumnEditable('CgRate2', true);
|
|
detailPluAdapter.setColumnEditable('CgRate3', true);
|
|
detailPluAdapter.setColumnEditable('CgRate4', true);
|
|
detailPluAdapter.setColumnEditable('CgRate5', true);
|
|
detailPluAdapter.setColumnEditable('CgRate6', true);
|
|
detailPluAdapter.setColumnEditable('CgRate7', true);
|
|
detailPluAdapter.setColumnEditable('CgRate8', true);
|
|
detailPluAdapter.setColumnEditable('CgRate9', true);
|
|
detailPluAdapter.setColumnEditable('CgRate10', true);
|
|
detailPluAdapter.setColumnEditable('CgRate11', true);
|
|
detailPluAdapter.setColumnEditable('CgRate12', true);
|
|
detailPluAdapter.setColumnEditable('PfPrice', true);
|
|
detailPluAdapter.setColumnEditable('HyPrice', true);
|
|
detailPluAdapter.setColumnEditable('Price', true);
|
|
detailPluAdapter.setColumnEditable('MinHjPrice', true);
|
|
detailPluAdapter.setColumnEditable('MaxHjPrice', true);
|
|
detailPluAdapter.setColumnEditable('MinPrice', true);
|
|
detailPluAdapter.setColumnEditable('MaxPrice', true);
|
|
detailPluAdapter.setColumnEditable('MinPfPrice', true);
|
|
detailPluAdapter.setColumnEditable('MaxPfPrice', true);
|
|
}
|
|
}
|
|
|
|
Biz.prototype.fieldChangedPluCode = function (dataSrc, dr, dc) {
|
|
let caType = TypeUtil.toString(this.dsMaster.currentRow.CzType);
|
|
if(caType == '0') {
|
|
if(TypeUtil.toString(this.dsDetailParaDef.currentRow.OrgCode) == '') {
|
|
dr.setColumnError('PluCode', '请先录入模板门店再录入商品!');
|
|
dr.setColumnValue('PluCode', '');
|
|
return false;
|
|
}
|
|
if(TypeUtil.toString(this.dsDetailParaDef.currentRow.DepCode) == '') {
|
|
dr.setColumnError('PluCode', '请先录入模板部门再录入商品!');
|
|
dr.setColumnValue('PluCode', '');
|
|
return false;
|
|
}
|
|
}
|
|
let depId = TypeUtil.toString(this.dsDetailParaDef.currentRow.DepID);
|
|
let depCode = TypeUtil.toString(this.dsDetailParaDef.currentRow.DepCode);
|
|
if(depId == '0') {
|
|
dr.setColumnValue('DepID', '9999');
|
|
dr.setColumnValue('DepCode', '9999');
|
|
}else {
|
|
dr.setColumnValue('DepID', depId);
|
|
dr.setColumnValue('DepCode', depCode);
|
|
}
|
|
dr.setColumnValue('JjMode', this.dsDetailParaDef.currentRow.JjMode);
|
|
dr.setColumnValue('JhCycle', this.dsDetailParaDef.currentRow.JhCycle);
|
|
dr.setColumnValue('PsCycle', this.dsDetailParaDef.currentRow.PsCycle);
|
|
dr.setColumnValue('AqDays', this.dsDetailParaDef.currentRow.AqDays);
|
|
dr.setColumnValue('CgMode', this.dsDetailParaDef.currentRow.CgMode);
|
|
dr.setColumnValue('MinInCount', this.dsDetailParaDef.currentRow.MinInCount);
|
|
dr.setColumnValue('EconomyCount', this.dsDetailParaDef.currentRow.EconomyCount);
|
|
dr.setColumnValue('MinCount', this.dsDetailParaDef.currentRow.MinCount);
|
|
dr.setColumnValue('MaxCount', this.dsDetailParaDef.currentRow.MaxCount);
|
|
dr.setColumnValue('IsZbPrice', this.dsDetailParaDef.currentRow.IsZbPrice);
|
|
dr.setColumnValue('IsJh', this.dsDetailParaDef.currentRow.IsJh);
|
|
dr.setColumnValue('IsTh', this.dsDetailParaDef.currentRow.IsTh);
|
|
dr.setColumnValue('IsPs', this.dsDetailParaDef.currentRow.IsPs);
|
|
dr.setColumnValue('IsJs', this.dsDetailParaDef.currentRow.IsJs);
|
|
dr.setColumnValue('IsSale', this.dsDetailParaDef.currentRow.IsSale);
|
|
dr.setColumnValue('IsSaleTh', this.dsDetailParaDef.currentRow.IsSaleTh);
|
|
dr.setColumnValue('IsCanPresent', this.dsDetailParaDef.currentRow.IsCanPresent);
|
|
dr.setColumnValue('IsPresent', this.dsDetailParaDef.currentRow.IsPresent);
|
|
dr.setColumnValue('IsMinPrice', this.dsDetailParaDef.currentRow.IsMinPrice);
|
|
dr.setColumnValue('CgRate1', this.dsDetailParaDef.currentRow.CgRate1);
|
|
dr.setColumnValue('CgRate2', this.dsDetailParaDef.currentRow.CgRate2);
|
|
dr.setColumnValue('CgRate3', this.dsDetailParaDef.currentRow.CgRate3);
|
|
dr.setColumnValue('CgRate4', this.dsDetailParaDef.currentRow.CgRate4);
|
|
dr.setColumnValue('CgRate5', this.dsDetailParaDef.currentRow.CgRate5);
|
|
dr.setColumnValue('CgRate6', this.dsDetailParaDef.currentRow.CgRate6);
|
|
dr.setColumnValue('CgRate7', this.dsDetailParaDef.currentRow.CgRate7);
|
|
dr.setColumnValue('CgRate8', this.dsDetailParaDef.currentRow.CgRate8);
|
|
dr.setColumnValue('CgRate9', this.dsDetailParaDef.currentRow.CgRate9);
|
|
dr.setColumnValue('CgRate10', this.dsDetailParaDef.currentRow.CgRate10);
|
|
dr.setColumnValue('CgRate11', this.dsDetailParaDef.currentRow.CgRate11);
|
|
dr.setColumnValue('CgRate12', this.dsDetailParaDef.currentRow.CgRate12);
|
|
dr.setColumnValue('MaxInCountLimit', this.dsDetailParaDef.currentRow.MaxInCountLimit);
|
|
dr.setColumnValue('MaxInCount', this.dsDetailParaDef.currentRow.MaxInCount);
|
|
|
|
let pluId = TypeUtil.toString(dr.PluID);
|
|
let ret = service.GetPluEx(pluId);
|
|
if(ret.result != 1) {
|
|
dr.setColumnError('PluCode', '查询商品辅助属性失败!' + ret.message);
|
|
return false;
|
|
}
|
|
if(this.isPfPrice == '1') {
|
|
dr.setColumnValue('PfPrice', ret.data.pfprice);
|
|
}else {
|
|
dr.setColumnValue('PfPrice', 0);
|
|
}
|
|
if(this.isHyPrice == '1') {
|
|
dr.setColumnValue('HyPrice', ret.data.hyprice);
|
|
}else {
|
|
dr.setColumnValue('HyPrice', 0);
|
|
}
|
|
if(this.isPrice == '1') {
|
|
dr.setColumnValue('Price', ret.data.price);
|
|
}else {
|
|
dr.setColumnValue('Price', 0);
|
|
}
|
|
if(this.isMaxPrice == '1') {
|
|
dr.setColumnValue('MaxPrice', ret.data.maxprice);
|
|
}else {
|
|
dr.setColumnValue('MaxPrice', 0);
|
|
}
|
|
if(this.isMinPrice == '1') {
|
|
dr.setColumnValue('MinPrice', ret.data.minprice);
|
|
}else {
|
|
dr.setColumnValue('MinPrice', 0);
|
|
}
|
|
if(this.isMaxHjPrice == '1') {
|
|
dr.setColumnValue('MaxHJPrice', ret.data.maxhjprice);
|
|
}else {
|
|
dr.setColumnValue('MaxHJPrice', 0);
|
|
}
|
|
if(this.isMinHjPrice == '1') {
|
|
dr.setColumnValue('MinHJPrice', ret.data.minhjprice);
|
|
}else {
|
|
dr.setColumnValue('MinHJPrice', 0);
|
|
}
|
|
if(this.isMaxPfPrice == '1') {
|
|
dr.setColumnValue('MaxPfPrice', ret.data.maxpfprice);
|
|
}else {
|
|
dr.setColumnValue('MaxPfPrice', 0);
|
|
}
|
|
if(this.isMinPfPrice == '1') {
|
|
dr.setColumnValue('MinPfPrice', ret.data.minpfprice);
|
|
}else {
|
|
dr.setColumnValue('MinPfPrice', 0);
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
Biz.prototype.fieldChangedDefOrgCode = function (dataSrc, dr, dc) {
|
|
dr.setColumnValue('DepCode', '');
|
|
}
|
|
|
|
Biz.prototype.fieldChangedFieldCode = function (dataSrc, dr, dc) {
|
|
let validChar = TypeUtil.toString(dr.ValidChars);
|
|
let validChars=validChar.split(",");
|
|
if(validChars.length < 1){
|
|
dr.setColumnError('FieldCode', '校验码设置错误!');
|
|
return false;
|
|
}
|
|
for (let i=0;i<validChars.length ;i++ ) {
|
|
let validItem = validChars[i];
|
|
if(validItem.indexOf('..') >= 0) {
|
|
let chars=validItem.split("..");
|
|
if(chars.length != 2) {
|
|
dr.setColumnError('FieldCode', '校验码设置错误!');
|
|
return false;
|
|
}
|
|
if(TypeUtil.toFloat(chars[0]) > TypeUtil.toFloat(chars[1])) {
|
|
dr.setColumnError('FieldCode', '校验码设置错误!');
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
dr.setColumnValue('FieldValue', '');
|
|
}
|
|
|
|
Biz.prototype.fieldChangedFieldValue = function (dataSrc, dr, dc) {
|
|
let validChar = TypeUtil.toString(dr.ValidChars);
|
|
let validChars=validChar.split(",");
|
|
let validStr = '';
|
|
if(validChars.length == 1) {
|
|
let chars=validChars[0].split("..");
|
|
validStr = '/^[' + chars[0] + '-' + chars[1] + ']*$/';
|
|
}else {
|
|
let chars=validChars[0].split("..");
|
|
validStr = '/(^[' + chars[0] + '-' + chars[1] + ']{1,}$)|' + '(^[' + chars[0] + '-' + chars[1] + ']{1,}' + '[' + validChars[1] + ']{1}' + '[' + chars[0] + '-' + chars[1] + ']*$)/';
|
|
}
|
|
|
|
let re = eval(validStr);
|
|
let fieldValue = TypeUtil.toString(dr.FieldValue);
|
|
if (!re.test(fieldValue)) {
|
|
dr.setColumnError('FieldValue', '参数值设置不正确!');
|
|
return false;
|
|
}
|
|
|
|
let fieldWidth = TypeUtil.toFloat(dr.FieldWidth);
|
|
if(fieldValue.length > fieldWidth) {
|
|
dr.setColumnError('FieldValue', '参数长度超长!');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
//保存前
|
|
Biz.prototype.beforeSave = function () {
|
|
let curRow = this.dsMaster.currentRow;
|
|
if(this.dsDetailPlu.rows.length < 1) {
|
|
Store.messager.err('请录入要修改的商品');
|
|
return false;
|
|
}
|
|
if(this.dsDetailOrg.rows.length < 1) {
|
|
Store.messager.err('请录入要调整的门店');
|
|
return false;
|
|
}
|
|
if(curRow.CzType == '0') {
|
|
for(let i = 0; i < this.dsDetailPlu.rows.length; i++) {
|
|
if(TypeUtil.toString(this.dsDetailPlu.rows[i].DepCode) == '') {
|
|
Store.messager.err('商品的主营部门不能设置为空值!');
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
if(curRow.CzType == '2') {
|
|
if(this.dsDetailPara.rows.length < 1) {
|
|
Store.messager.err('请录入要调整的辅助属性');
|
|
return false;
|
|
}
|
|
|
|
if(this.ywChangeByBill == '1') {
|
|
for(let i = 0; i < this.dsDetailPara.rows.length; i++) {
|
|
if(this.dsDetailPara.rows[i].FieldCode == 'IsJh') {
|
|
Store.messager.err('系统设置门店商品业务状态只能通过变更单修改,不允许修改进货属性!');
|
|
return false;
|
|
}
|
|
if(this.dsDetailPara.rows[i].FieldCode == 'IsSale') {
|
|
Store.messager.err('系统设置门店商品业务状态只能通过变更单修改,不允许修改销售属性!');
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.dsDetailParaDef.deleteAll();
|
|
this.dsDetailParaDef.setFollowMaster(false);
|
|
return this.super('beforeSave');
|
|
};
|
|
|
|
return Biz;
|
|
}); |