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.
116 lines
3.2 KiB
116 lines
3.2 KiB
4 years ago
|
|
||
|
define(function (require, exports, module) {
|
||
|
let Window = require('system/views/pages/window');
|
||
|
let tpl = require('text!./copy-role-right.tpl');
|
||
|
let SingleWindow = require('system/views/pages/singlewindow/singlewindow.js')
|
||
|
|
||
|
function CopyUserRight(curRole, funCode) {
|
||
|
this.options = {
|
||
|
title: '复制用户组权限',
|
||
|
content: tpl,
|
||
|
width: 400,
|
||
|
height: 390,
|
||
|
modal: true,
|
||
|
closed: true,
|
||
|
closable: true,
|
||
|
draggable: true,
|
||
|
maximizable: false,
|
||
|
resizable: false,
|
||
|
data: null
|
||
|
}
|
||
|
this.curRole = curRole
|
||
|
this.funCode = funCode
|
||
|
Window.call(this, this.options)
|
||
|
}
|
||
|
inherits(CopyUserRight, Window);
|
||
|
|
||
|
CopyUserRight.prototype.init = function () {
|
||
|
|
||
|
}
|
||
|
|
||
|
CopyUserRight.prototype.open = function () {
|
||
|
Window.prototype.open.call(this);
|
||
|
}
|
||
|
|
||
|
CopyUserRight.prototype.customerize = function () {
|
||
|
let self = this;
|
||
|
|
||
|
self.$srcUser = this.getElement('.src-role')
|
||
|
self.$desUser = this.getElement('.des-role')
|
||
|
self.$desUserName = this.getElement('.des-role-name');
|
||
|
self.$btnOk = this.getElement('.btn-oK')
|
||
|
self.$btnCancel = this.getElement('.btn-cancel')
|
||
|
|
||
|
self.$srcUser.textbox({
|
||
|
label: '复制用户',
|
||
|
readonly: true,
|
||
|
value: `${self.curUser.UserCode}-${self.curUser.UserName}`
|
||
|
})
|
||
|
|
||
|
self.$desUser.textbox({
|
||
|
label: '目标用户',
|
||
|
icons: [{
|
||
|
iconCls: 'icon-search',
|
||
|
handler: function (e) {
|
||
|
let win = new SingleWindow({
|
||
|
funcCode: self.funCode,
|
||
|
uiObjCode: '2002',
|
||
|
callback: (row) => {
|
||
|
self.desUserId = row.UserID
|
||
|
self.$desUser.textbox('setValue', row.UserCode)
|
||
|
self.$desUserName.textbox('setValue', row.UserName)
|
||
|
}
|
||
|
})
|
||
|
|
||
|
win.open()
|
||
|
}
|
||
|
}]
|
||
|
})
|
||
|
|
||
|
self.$desUserName.textbox({
|
||
|
label: '用户名称'
|
||
|
})
|
||
|
|
||
|
self.$btnOk.linkbutton({
|
||
|
onClick: () => {
|
||
|
self.handleOk()
|
||
|
}
|
||
|
})
|
||
|
|
||
|
self.$btnCancel.linkbutton({
|
||
|
onClick: () => {
|
||
|
self.close()
|
||
|
}
|
||
|
})
|
||
|
|
||
|
}
|
||
|
|
||
|
CopyUserRight.prototype.handleOk = function () {
|
||
|
const self = this
|
||
|
|
||
|
self.desUserId = Number(self.desUserId)
|
||
|
if (self.desUserId === self.curUser.UserID) {
|
||
|
this.close()
|
||
|
return
|
||
|
}
|
||
|
|
||
|
let params = {
|
||
|
plugin: 'copyRightPlugin',
|
||
|
pluginData: {
|
||
|
srcUserId: this.curUser.UserID,
|
||
|
desUserId: this.desUserId,
|
||
|
userCode: this.$desUser.textbox('getValue'),
|
||
|
userName: this.$desUserName.textbox('getValue')
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Store.services.executeplugin(params, function (isOk, result) {
|
||
|
if (isOk) {
|
||
|
Store.messager.tip('用户权限复制成功!');
|
||
|
self.close();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
return CopyUserRight;
|
||
|
})
|