|
|
|
|
|
|
|
|
|
|
|
|
|
|
define(function (require, exports, module) {
|
|
|
|
|
var BaseBiz = require('apps/rht/base/rhtBiz');
|
|
|
|
|
var UApp = require('../../comm/UApp');
|
|
|
|
|
var rhtComm = require('../../comm/rhtComm');
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 控制按钮的可用
|
|
|
|
|
* @param opCode 按钮编码
|
|
|
|
|
* @return [description]
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
var BrandCode;
|
|
|
|
|
var BrandName;
|
|
|
|
|
|
|
|
|
|
function Biz(vm) {
|
|
|
|
|
//继承第一步,构造继承
|
|
|
|
|
BaseBiz.call(this, vm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//继承第二步,方法继承
|
|
|
|
|
inherits(Biz, BaseBiz);
|
|
|
|
|
|
|
|
|
|
Biz.prototype.initCompleted = function () {
|
|
|
|
|
this.super('initCompleted');
|
|
|
|
|
this.dsMaster.serverBiz = 'brandBiz'
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//获取字段值变化,实时刷新界面字段显示值
|
|
|
|
|
Biz.prototype.fieldChanged = function (dataSrc, dr, dc) {
|
|
|
|
|
if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) {
|
|
|
|
|
if (dc.fieldName === 'BrandName')
|
|
|
|
|
{
|
|
|
|
|
var sBrandName = TypeUtil.toString(dr['BrandName']);
|
|
|
|
|
|
|
|
|
|
if (sBrandName === '') return false;
|
|
|
|
|
|
|
|
|
|
var sBrandNamePy= UApp.ChineseMN(sBrandName);
|
|
|
|
|
if( (sBrandNamePy !== "") || (sBrandNamePy !== null))
|
|
|
|
|
{
|
|
|
|
|
dr.setColumnValue('BrandMN',sBrandNamePy);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.super('fieldChanged');
|
|
|
|
|
};
|
|
|
|
|
//保存前数据判断
|
|
|
|
|
Biz.prototype.beforeSave = function () {
|
|
|
|
|
var curRow = this.dsMaster.currentRow;
|
|
|
|
|
if(curRow){
|
|
|
|
|
|
|
|
|
|
var sBrandName = TypeUtil.toString(curRow['BrandName']);
|
|
|
|
|
var sBrandEName = TypeUtil.toString(curRow['BrandEName']);
|
|
|
|
|
var sBrandMN = TypeUtil.toString(curRow['BrandMN']);
|
|
|
|
|
|
|
|
|
|
if ((sBrandName.indexOf(";") !== -1) || (sBrandName.indexOf("\'") !== -1) || (sBrandName.indexOf(";") !== -1) )
|
|
|
|
|
{
|
|
|
|
|
curRow.setColumnError("BrandName","品牌名称含有非法字符\';\'或者\'\'\'!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if ((sBrandEName.indexOf(";") !== -1) || (sBrandEName.indexOf("\'") !== -1) || (sBrandEName.indexOf(";") !== -1) )
|
|
|
|
|
{
|
|
|
|
|
curRow.setColumnError("BrandEName","品牌英文名称含有非法字符\';\'或者\'\'\'!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var reg = new RegExp("[\\u4E00-\\u9FFF]+","g");
|
|
|
|
|
//正则表达式判断是否包含中文
|
|
|
|
|
if(reg.test(sBrandEName))
|
|
|
|
|
{
|
|
|
|
|
curRow.setColumnError("BrandEName","品牌英文名称不能含有中文!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if ((sBrandMN.indexOf(";") !== -1) || (sBrandMN.indexOf("\'") !== -1) ||(sBrandMN.indexOf(";") !==-1) )
|
|
|
|
|
{
|
|
|
|
|
curRow.setColumnError("sBrandMN","品牌助记符含有非法字符\';\'或者\'\'\'!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return this.super('beforeSave');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取变量值,一会删除数据用
|
|
|
|
|
Biz.prototype.beforeDelete = function () {
|
|
|
|
|
var masterRow = this.dsMaster.currentRow;
|
|
|
|
|
BrandCode = TypeUtil.toString(masterRow['BrandCode']);
|
|
|
|
|
BrandName = TypeUtil.toString(masterRow['BrandName']);
|
|
|
|
|
return "确定要删除吗?";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除后记日志
|
|
|
|
|
Biz.prototype.afterDelete = function () {
|
|
|
|
|
|
|
|
|
|
var OrgCode = Store.logOn.orgCode;
|
|
|
|
|
var UserID = Store.logOn.userId;
|
|
|
|
|
var UserCode = Store.logOn.userCode;
|
|
|
|
|
var UserName = Store.logOn.userName;
|
|
|
|
|
var LogPosition = "品牌设置";
|
|
|
|
|
var LogContent = "品牌编码-名称:"+BrandCode+"-"+BrandName+"删除";
|
|
|
|
|
var Computer = "";
|
|
|
|
|
var ComputerInfo = "";
|
|
|
|
|
rhtComm.MWriteOprLog(OrgCode,UserID,UserCode,UserName,Computer,ComputerInfo,LogPosition,LogContent);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Biz;
|
|
|
|
|
});
|