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.
117 lines
3.7 KiB
117 lines
3.7 KiB
define(function (require, exports, module) {
|
|
let BaseBiz = require('apps/rht/base/rhtBiz');
|
|
let rhtComm = require('apps/rht/comm/rhtComm');
|
|
let Service = require('./bas0402service');
|
|
/**
|
|
* 控制按钮的可用
|
|
* @param opCode 按钮编码
|
|
* @return [description]
|
|
*/
|
|
|
|
function Biz(vm) {
|
|
//继承第一步,构造继承
|
|
BaseBiz.call(this, vm);
|
|
vm.remark = ''
|
|
}
|
|
|
|
//继承第二步,方法继承
|
|
inherits(Biz, BaseBiz);
|
|
|
|
Biz.prototype.initCompleted = function () {
|
|
this.super('initCompleted');
|
|
let self = this;
|
|
self.dsMaster.defaultOrder='FlCode';
|
|
this.dsMaster.serverBiz = 'flBiz'
|
|
};
|
|
|
|
//新增行后处理,默认值已经处理
|
|
Biz.prototype.afterNewRow = function (dataSrc, newRow) {
|
|
let masterRow = this.dsMaster.currentRow;
|
|
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
|
|
if(TypeUtil.toString(masterRow.FlCode) === "") {
|
|
this.dsDetail.deleteRow(this.dsDetail.currentRow)
|
|
Store.messager.tip('分类类型编码不能为空。');
|
|
return false;
|
|
}
|
|
if(TypeUtil.toString(masterRow.FlName) === "") {
|
|
this.dsDetail.deleteRow(this.dsDetail.currentRow)
|
|
Store.messager.tip('分类类型名称不能为空。');
|
|
return false;
|
|
}
|
|
}
|
|
return this.super('afterNewRow', dataSrc, newRow);
|
|
};
|
|
|
|
Biz.prototype.beforeDelete = function () {
|
|
self = this;
|
|
let curRow = this.dsMaster.currentRow;
|
|
if (curRow) {
|
|
if (curRow.IsSet==='1'){
|
|
Store.messager.tip('系统预置分类,不允许删除。');
|
|
return false;
|
|
}
|
|
}
|
|
return this.super('beforeDelete');
|
|
};
|
|
|
|
// Biz.prototype.beforeEdit = function () {
|
|
// self = this;
|
|
// let curRow = this.dsMaster.currentRow;
|
|
// if (curRow) {
|
|
// if (curRow.IsSet==='1'){
|
|
// Store.messager.tip('系统预置分类,不允许删除。');
|
|
// return false;
|
|
// }
|
|
// }
|
|
// return this.super('beforeDelete');
|
|
// };
|
|
|
|
Biz.prototype.beforeDeleteRow = function (dataSrc, dataRow) {
|
|
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
|
|
let LxType = TypeUtil.toString(dataRow['LxType']);
|
|
if (LxType === "0") {
|
|
Store.messager.tip('系统预置内容,不允许删除!');
|
|
return false;
|
|
}
|
|
}
|
|
return this.super('beforeDeleteRow');
|
|
};
|
|
|
|
Biz.prototype.beforeFieldEdit = function (ds, dr, dc) {
|
|
if (ds.uiObjCode === this.dsDetail.uiObjCode) {
|
|
let LxType = TypeUtil.toString(dr['LxType']);
|
|
if (LxType === "0") {
|
|
Store.messager.tip('系统预置内容,不允许编辑!');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
return this.super('beforeFieldEdit', ds, dr, dc);
|
|
};
|
|
|
|
Biz.prototype.beforeSave = function () {
|
|
let detailRows = this.dsDetail.rows;
|
|
let lxCode = '';
|
|
let flag = true;
|
|
detailRows.forEach(v => {
|
|
lxCode = v['LxCode'];
|
|
let count = 0
|
|
detailRows.forEach(k => {
|
|
if(lxCode === k['LxCode']) {
|
|
count++;
|
|
}
|
|
});
|
|
if(count > 1) {
|
|
flag = false;
|
|
}
|
|
});
|
|
if(!flag) {
|
|
Store.messager.tip('明细类型编码' + lxCode + '重复');
|
|
return false;
|
|
}
|
|
return this.super('beforeSave');
|
|
}
|
|
|
|
return Biz;
|
|
}); |