{"title":"修改","inframe":false,"hidden":false,"roles":{},"pageLink":"","children":[{"configs":{"serverScript":"var data = app.get(),\n  roles = ['default'],\n  userRoleRows = Wb.decode(data.roleGrid);\n\nif (data.USER_ID == 'admin' && !Wb.find(userRoleRows, 'ROLE_ID', 'admin')) {\n  Wb.error('不能取消默认管理员帐户的管理员权限。');\n}\napp.run('select 1 from WB_USER where USER_NAME={?USER_NAME?} and USER_ID<>{?USER_ID?}', {\n  errorText: '用户名称 \"' + data.USER_NAME + '\" 已经存在。'\n});\napp.set({\n  PASSWORD: Encrypter.getMD5(data.PASSWORD)\n});\napp.run('update WB_USER set USER_NAME={?nvarchar.USER_NAME?},DISPLAY_NAME={?nvarchar.DISPLAY_NAME?}' +\n  (data.PASSWORD.equals('******') ? '' : ',PASSWORD={?varchar.PASSWORD?}') +\n  ',STATUS={?numeric.STATUS?},EMAIL={?varchar.EMAIL?} where USER_ID={?varchar.#USER_ID?}', {\n    transaction: 'start'\n  }\n);\n\n//更新WB_USER_ROLE\napp.run('delete from WB_USER_ROLE where USER_ID={?USER_ID?}');\nWb.each(userRoleRows, function(rec) {\n  rec.USER_ID = data.USER_ID;\n  roles.push(rec.ROLE_ID);\n});\nrequest.setAttribute('create', Wb.encode(userRoleRows));\napp.update({\n  tableName: 'WB_USER_ROLE'\n});\n//更新session\ncom.wb.common.Session.updateSession(data.USER_ID, roles, data.STATUS == 1);","itemId":"module"},"children":[],"type":"module","expanded":true}],"iconCls":""}