define(function (require, exports, module) { const Biz = require('system/base/biz'); const CopyRoleRight = require('./copy-role-right'); const RightWin = require('./right-win'); const MultiWindow = require("system/views/pages/multiwindow/multiwindow"); const md5 = window.CryptoJS.md5; function RoleBiz(vm) { Biz.call(this, vm); } inherits(RoleBiz, Biz); RoleBiz.prototype.initialize = function () { const self = this self.setServerBiz('roleBiz') } RoleBiz.prototype.doOp = function (opCode) { this.super('doOp'); const self = this; const currentRow = self.dsMaster.currentRow if (currentRow === null) { Store.messager.tip('请先选择要处理的用户组') return } switch (opCode) { case 'operation': // 操作权 let winRight = new RightWin(currentRow, self.dsMaster.funcCode) winRight.open() break; case 'copy-right': // 复制权限按钮操作事件 let winCopy = new CopyRoleRight(currentRow, self.dsMaster.funcCode); winCopy.open(); break; case 'add-user': // 批量增加用户 handleBatchUsr(self) break; } return true; } function handleBatchUsr(self) { const exists = new Array(); for (let j = 0; j < self.dsGrpUser.rows.length; j++) { exists.push({ 'UserID': self.dsGrpUser.rows[j].UserID }); } const grpCode = self.dsMaster.currentRow['UGrpCode'] const param = { exists: exists, uiObjCode: '2002', biz: self, itreator: function (data) { const newRow = self.dsGrpUser.addRow() newRow.setColumnText("UGrpCode", grpCode) newRow.setColumnText("UserCode", data.UserCode) return true } }; const mywindow = new MultiWindow(param); mywindow.open(); } RoleBiz.prototype.delete = function() { const self = this let content = Store.messager.confirm('用户组删除后不可恢复,确定执行?', function (r) { if (r) { self.dsMaster.delete(); } }); content.parent().find('.messager-button a:eq(1)').focus(); } RoleBiz.prototype.fieldChanged = function (dataSrc, dr, dc) { } RoleBiz.prototype.afterNewRow = function (dataSrc, newRow) { if (dataSrc === this.dsGrpUser) { newRow.setColumnText('UGrpCode', this.dsMaster.currentRow['UGrpCode']) } } RoleBiz.prototype.getOpEnabled = function (opCode) { const self = this; const currentRow = self.dsMaster.currentRow; switch(opCode) { case 'operation': return currentRow && self.isBrowser() case 'copy-right': return currentRow && self.isBrowser() case 'add-user': return self.isEdit() } return this.super('getOpEnabled', opCode); }; return RoleBiz; })