|
|
|
|
|
define(function(require, exports, module) {
|
|
|
var Window = require('system/views/pages/window');
|
|
|
var tpl = require('text!apps/edp/frs/frs002/CopyActRight.tpl');
|
|
|
/**
|
|
|
* [复制权限弹框]
|
|
|
* @param {[type]} dsRole 角色表数据源,用于对角色ComBox进行赋值
|
|
|
*/
|
|
|
function CopyActRight(dsRole) {
|
|
|
this.options = {
|
|
|
title: Store.MSG.FRS002_18, //复制角色
|
|
|
content: tpl,
|
|
|
width: 310,
|
|
|
height: 199,
|
|
|
modal: true,
|
|
|
closed: true,
|
|
|
closable: true,
|
|
|
draggable: true,
|
|
|
maximizable: false,
|
|
|
resizable: false,
|
|
|
data: null
|
|
|
}
|
|
|
this.dsRole = dsRole;
|
|
|
|
|
|
Window.call(this, this.options);
|
|
|
}
|
|
|
inherits(CopyActRight, Window);
|
|
|
|
|
|
CopyActRight.prototype.init = function() {
|
|
|
|
|
|
}
|
|
|
|
|
|
CopyActRight.prototype.open = function() {
|
|
|
Window.prototype.open.call(this);
|
|
|
}
|
|
|
|
|
|
//执行windows窗体上自定义按钮事件
|
|
|
CopyActRight.prototype.customerize = function() {
|
|
|
var self = this;
|
|
|
var rows = null;
|
|
|
if (Store.logOn.userType === '0')
|
|
|
rows = this.dsRole.rows;
|
|
|
else
|
|
|
rows = _.where(self.dsRole.rows, {
|
|
|
'RightCtrlOrgCode': Store.logOn.rightCtrlOrgCode
|
|
|
});
|
|
|
var data = [];
|
|
|
var dataType = []; //存储RoleType
|
|
|
|
|
|
//为源角色和复制到角色的角色combox增加下拉数据
|
|
|
for (var i = 0; i < rows.length; i++) {
|
|
|
var rowRoleID = rows[i]['RoleID'];
|
|
|
var rowRoleCode = rows[i]['RoleCode'];
|
|
|
var rowRoleName = rows[i]["RoleName"];
|
|
|
var rowRoleType = rows[i]["RoleType"];
|
|
|
data.push({
|
|
|
roleCode: rowRoleCode,
|
|
|
roleName: rowRoleCode + '-' + rowRoleName
|
|
|
});
|
|
|
|
|
|
dataType.push({
|
|
|
roleID: rowRoleID,
|
|
|
roleCode: rowRoleCode,
|
|
|
roleName: rowRoleName,
|
|
|
roleType: rowRoleType
|
|
|
});
|
|
|
}
|
|
|
|
|
|
var $sourceRole = this.getElement('.sourceRole');
|
|
|
$sourceRole.combobox('loadData', data);
|
|
|
if (this.dsRole.currentRow['RightCtrlOrgId'] === Store.logOn.rightCtrlOrgId || Store.logOn.userType === '0')
|
|
|
$sourceRole.combobox('setValue', this.dsRole.currentRow['RoleCode']);
|
|
|
|
|
|
var $copyToRole = this.getElement('.copyToRole');
|
|
|
$copyToRole.combobox('loadData', data);
|
|
|
|
|
|
var $isCopyCheckbox = this.getElement('#isOrNotCover_dsRole');
|
|
|
|
|
|
//确定按钮事件
|
|
|
this.getElement('.btnOK').on('click', function(event) {
|
|
|
var selectSourceRole = $sourceRole.combobox('getValue');
|
|
|
var selectCopyToRole = $copyToRole.combobox('getValue');
|
|
|
|
|
|
if (!selectSourceRole) {
|
|
|
Store.messager.warn(Store.MSG.FRS002_19); //源角色不允许为空,请选择。
|
|
|
return;
|
|
|
}
|
|
|
if (!selectCopyToRole) {
|
|
|
Store.messager.warn(Store.MSG.FRS002_20); //目标角色不允许为空,请选择。
|
|
|
return;
|
|
|
}
|
|
|
if (selectSourceRole === selectCopyToRole) {
|
|
|
Store.messager.warn(Store.MSG.FRS002_21); //源角色和目标角色不能相同,请重新选择。
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var sourceRoleID = null;
|
|
|
var sourceRoleType = null;
|
|
|
var CopyToRoleID = null;
|
|
|
var CopyToRoleType = null;
|
|
|
|
|
|
_.each(dataType, function(item, index) {
|
|
|
var roleCode = item['roleCode'];
|
|
|
if (roleCode === selectSourceRole) {
|
|
|
sourceRoleID = item['roleID'];
|
|
|
sourceRoleType = item['roleType'];
|
|
|
}
|
|
|
|
|
|
if (roleCode === selectCopyToRole) {
|
|
|
CopyToRoleID = item['roleID'];
|
|
|
CopyToRoleType = item['roleType'];
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (sourceRoleID === null) {
|
|
|
Store.messager.warn(Store.MSG.FRS002_22); //目标角色输入不正确,请重新选择。
|
|
|
return;
|
|
|
}
|
|
|
if (CopyToRoleID === null) {
|
|
|
Store.messager.warn(Store.MSG.FRS002_23); //源角色输入不正确,请重新选择。
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (sourceRoleType !== CopyToRoleType) {
|
|
|
Store.messager.warn(Store.MSG.FRS002_24); //您所选择的源角色和目标角色的角色类型不一致。
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var isCopyCheckbox = $isCopyCheckbox.prop('checked');
|
|
|
|
|
|
var params = {
|
|
|
plugin: 'proCopyRoleRight',
|
|
|
pluginData: {
|
|
|
ps_SourceRoleId: sourceRoleID,
|
|
|
ps_DestRoleId: CopyToRoleID,
|
|
|
ps_CopyType: isCopyCheckbox ? 0 : 1,
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
Store.services.executeplugin(params, function(isOk, result) {
|
|
|
if (isOk && result.data_Proc.pi_Result === 1) {
|
|
|
Store.messager.tip(Store.MSG.FRS002_25);
|
|
|
if (self.callback) {
|
|
|
self.callback();
|
|
|
}
|
|
|
self.close();
|
|
|
} else {
|
|
|
Store.messager.tip('操作权复制失败!');
|
|
|
self.close();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//取消按钮事件
|
|
|
this.getElement('.btnCancel').on('click', function(event) {
|
|
|
self.close();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return CopyActRight;
|
|
|
}) |