12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- define(function (require) {
- return function (context) {
- var $dlg, $form;
- return {
- xtype: 'dialog',
- dialogId: 'dialogRole',
- title: '角色基本属性',
- width: 610,
- height: 250,
- onOpen: function () {
- $dlg = $(this);
- if (context.isEdit) {
- $.yvan.ajax({
- loadingMask: false,
- url: api('/sys/role/getById'),
- type: 'GET',
- data: {
- roleId: context.roleId
- },
- success: function (data) {
- $dlg.find('form');
- $form.formSet(data.data);
- }
- });
- } else {
- $form.formSet({
- beActive: 'Y'
- });
- }
- },
- center: {
- items: {
- xtype: 'formgroup',
- onRender: function () {
- $form = $(this);
- },
- items: [
- [
- {name: 'roleId', xtype: 'hidden'},
- {name: 'roleName', label: '角色名称', required: true, ff: 500},
- {
- name: 'beActive', label: '启用状态', xtype: 'yvselect', required: true, data: [
- {id: 'Y', text: '启用'},
- {id: 'N', text: '禁用'},
- {id: 'D', text: '删除'}
- ]
- }
- ], [
- {name: 'roleDes', label: '角色描述', span: 2},
- ]
- ]
- }
- },
- buttons: [
- {
- text: "提交", iconCls: "fa fa-save", onClick: function () {
- $.yvan.postForm($form, {
- url: (context.isEdit ? api('/sys/role/update') : api('/sys/role/insert')),
- success: function () {
- $.yvan.msg('操作成功');
- if (context.isEdit) {
- $dlg.window('close');
- }
- if ($.type(context.confirm) === 'function') {
- context.confirm();
- }
- },
- error: function (data) {
- }
- });
- }
- }, {
- text: "关闭", iconCls: "fa fa-times", onClick: function () {
- $dlg.dialog('close');
- }
- }
- ]
- };
- };
- });
|