define(function(require, exports, module) { var Biz = require('system/base/biz'); // var MSG = require('../../../../locale/{lang}/sos_frs'); // _.extend(Store.MSG,MSG); function CateBiz(vm) { Biz.call(this, vm); }; inherits(CateBiz, Biz); CateBiz.prototype.beforeRefresh = function() { var isOk = this.super('beforeRefresh'); return isOk; }; CateBiz.prototype.beforeFieldEdit = function(dataSrc, dr, dc) { var self = this; var isPreSet = dataSrc.currentRow['IsPreSet'] if (isPreSet === '1') { if (dc.fieldName === 'TypeCode' || dc.fieldName === 'TypeName') { return false; } } return this.super('beforeFieldEdit'); }; CateBiz.prototype.beforeEdit = function() { var self = this; var currentRow = self.dsMaster.currentRow; if (currentRow === null) return false; if (currentRow["IsPreSet"] === '1' && currentRow["ContentDefType"] === '0') { Store.messager.warn(Store.MSG.FRS111_01); //系统预置并且内容定义方式为不可自定义的分类类型内容,不允许修改。 return false; } return this.super('beforeEdit'); } CateBiz.prototype.afterEdit = function() { this.super('afterEdit'); var self = this; var currentRow = self.dsMaster.currentRow; if (currentRow === null) return false; this.view.setOptions(self.dsDetail,{ editable: true, enableAddRow: true }); if (currentRow['ContentDefType'] === '0') { this.view.setOptions(self.dsDetail,{ editable: false, enableAddRow: false }); Store.messager.warn(Store.MSG.FRS111_02); //分类类型内容为不可自定义,不允许操作分类类型内容。 return false; } } CateBiz.prototype.dataColumnValidate = function(dataSrc, dr, dc, value) { var self = this; if (dataSrc.uiObjCode === 'tFrsCateType' && dataSrc.currentRow !== null && dc.fieldName === 'ContentDefType') { if (value === '0') { this.view.setOptions(self.dsDetail,{ editable: false, enableAddRow: false }); Store.messager.warn(Store.MSG.FRS111_03); //分类类型内容为不可定义,不允许操作分类类型内容。 return false; } if (value === '1') { this.view.setOptions(self.dsDetail,{ editable: true, enableAddRow: true }); } } var detailCurRow = this.getDataSrc('dsDetail').currentRow; if (detailCurRow !== null) { if (dataSrc.uiObjCode === 'tFrsCateContent' && dc.fieldName === 'TypeCode' && value !== null) { var maxLength = self.dsMaster.currentRow["ContentCodeMaxLen"]; if (value.length > maxLength) { detailCurRow.setColumnError('TypeCode', Store.MSG.FRS111_04); //内容编码长度不允许超过设置的最大长度 return false; } } } return this.super('dataColumnValidate'); } CateBiz.prototype.beforeDeleteRow = function(dataSrc, dataRow) { var isPreSet = dataRow['IsPreSet']; if (isPreSet !== null && isPreSet === '1') { Store.messager.warn(Store.MSG.FRS111_05); //预置的分类类型内容,不允许删除。 return false; } return this.super('beforeDeleteRow'); } return CateBiz; })