1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- define(function (require) {
- return function (context) {
- var $dlg, $tree;
- return {
- xtype: 'dialog',
- dialogId: 'dialogRoleMenu',
- title: '分配角色菜单',
- width: 480,
- height: 600,
- onOpen: function () {
- $dlg = $(this);
- $.yvan.ajax({
- loadingMask: false,
- url: api('/sys/sysRole/getMenuBySysIdRoleId'),
- type: 'GET',
- data: {
- operation: context.operation,
- roleId: context.roleId,
- sysId: context.sysId
- },
- success: function (data) {
- $dlg.find('form');
- $dlg.down('tree').tree({
- checkbox: true,
- data: data.data
- }).tree('collapseAll');
- }
- });
- },
- toolbar: {
- xtype: 'toolbar',
- items: [
- {
- text: '全部折叠', onClick: function () {
- $tree.tree('collapseAll');
- }
- }, {
- text: '全部展开', onClick: function () {
- $tree.tree('expandAll');
- }
- }
- ]
- },
- center: {
- css: {'overflow-x': 'hidden'},
- items: {
- onRender: function () {
- $tree = $(this);
- },
- xtype: 'tree',
- css: {'margin': '5px 10px'}
- }
- },
- buttons: [
- {
- text: "提交", iconCls: "fa fa-save", onClick: function () {
- var nodeIds = $tree.tree('getChecked', ['checked', 'indeterminate']).map(function (r) {
- return r.id;
- });
- $.yvan.postJson({
- url: api('/sys/sysRole/saveSysRoleMenu'),
- data: {
- roleId: context.roleId,
- operation: context.operation,
- treedata: nodeIds
- },
- success: function (data) {
- $.yvan.msg('操作成功');
- $dlg.window('close');
- if ($.type(context.confirm) === 'function') {
- context.confirm();
- }
- }
- });
- }
- }, {
- text: "关闭", iconCls: "fa fa-times", onClick: function () {
- $dlg.dialog('close');
- }
- }
- ]
- };
- };
- });
|