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.3 KiB
117 lines
3.3 KiB
4 years ago
|
|
||
|
define(function (require, exports, module) {
|
||
|
let Window = require('system/views/pages/window');
|
||
|
let tpl = require('text!./copy-right.tpl');
|
||
|
let SingleWindow = require('system/views/pages/singlewindow/singlewindow.js')
|
||
|
|
||
|
function CopyUserRight(curUser, 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.curUser = curUser
|
||
|
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-user')
|
||
|
self.$desUser = this.getElement('.des-user')
|
||
|
self.$desUserName = this.getElement('.des-user-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 v = $(e.data.target).textbox('getValue');
|
||
|
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;
|
||
|
})
|