123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- define(function (require) {
- return function (context) {
- var $dlg, $form, $comb;
- //自动生成助记码
- function onblurCustomerName() {
- $('body').item('menuName').textbox('setValue', $(this).val());
- var customerName = $('body').item('menuName').textbox("getValue");
- if (null != customerName && "" != customerName && undefined != customerName) {
- $('body').item('menuNamePy').val(top.pinyin.getCamelChars(customerName));
- var a = $('body').item('menuNamePy').val();
- $('body').item('menuNamePy').textbox('setValue', a);
- }
- }
- //获取平台列表
- function getDataSysList() {
- var _datas = [];
- $.yvan.ajax({
- url: api('/sys/system/query'),
- data: {status: 1},
- method: 'post',
- async: false,
- success: function (data) {
- if (data.data != null && data.data != undefined) {
- for (var i = 0; i < data.data.length; i++) {
- _datas.push({
- "id": data.data[i].sysId,
- "text": data.data[i].sysName
- })
- }
- }
- }
- });
- return _datas;
- }
- //获取一级菜单列表
- function getDataMenuList() {
- var _datas = [];
- _datas.push({
- "id": "0",
- "text": "一级菜单",
- "selected": true
- });
- var sysId = null;
- if ($form) {
- sysId = $form.formGet().sysId;
- }
- $.yvan.ajax({
- url: api('/sys/menu/queryAll'),
- data: {treeLev: 1, status: 1, sysId: sysId},
- method: 'get',
- async: false,
- success: function (data) {
- if (data.data != null && data.data != undefined) {
- for (var i = 0; i < data.data.length; i++) {
- _datas.push({
- "id": data.data[i].menuId,
- "text": data.data[i].menuName
- })
- }
- }
- }
- });
- return _datas;
- }
- return {
- xtype: 'dialog',
- dialogId: 'dialogMenu',
- title: '维护菜单信息',
- width: 620,
- height: 400,
- onOpen: function () {
- $dlg = $(this);
- if (context.isEdit) {
- $.yvan.ajax({
- loadingMask: false,
- url: api('/sys/menu/queryById'),
- type: 'GET',
- data: {
- menuId: context.menuId
- },
- success: function (data) {
- $dlg.find('form');
- $form.formSet(data.data);
- }
- });
- } else {
- $form.formSet({
- status: '1',
- beActive: 'Y',
- sysId: context.sysId
- });
- }
- },
- center: {
- items: {
- xtype: 'formgroup',
- onRender: function () {
- $form = $(this);
- },
- items: [
- [
- {
- name: 'sysId',
- label: '所属平台',
- xtype: 'yvselect',
- required: true,
- width: 350,
- disabled: context.isEdit ? "disabled" : "",
- data: getDataSysList(),
- onChange: function () {
- $comb.yvselect({'data': getDataMenuList()});
- }
- }
- ],
- [
- {
- name: 'treeUp',
- label: '上级菜单',
- xtype: 'yvselect',
- panelHeight: 220,
- width: 350,
- required: true,
- disabled: context.isEdit ? "disabled" : "",
- data: getDataMenuList(),
- onRender: function () {
- $comb = $(this);
- },
- }
- ],
- [
- {name: 'menuId', label: '菜单ID', xtype: 'hidden'},
- {name: 'menuName', label: '菜单名称', required: true, events: {blur: onblurCustomerName}},
- {name: 'menuNamePy', label: '菜单拼音', xtype: 'hidden'},
- {
- name: 'status',
- label: '启用状态',
- xtype: 'yvselect',
- required: true,
- data: $.yvan.sysDict('status').combo()
- },
- {name: 'menuCode', label: '菜单编码'},
- {
- name: 'menuIcon', label: '图标', xtype: 'yvselect', panelHeight: 200, data: [
- {id: 'fa fa-desktop', text: '桌面'},
- {id: 'fa fa-file-o', text: '文件'},
- {id: 'fa fa-wpforms', text: '日历'},
- {id: 'fa fa-th-list', text: '一级菜单'},
- {id: 'fa fa-list-ul', text: '二级菜单'},
- {id: 'fa fa-bars', text: '列表'},
- {id: 'fa fa-search', text: '搜索'},
- {id: 'fa fa-database', text: '数据库'},
- {id: 'fa fa-history', text: '历史'},
- {id: 'fa fa-globe', text: '地球'},
- {id: 'fa fa-flag', text: '旗帜'},
- {id: 'fa fa-filter', text: '漏斗'},
- {id: 'fa fa-envelope', text: '信封'},
- {id: 'fa fa-diamond', text: '钻石'},
- {id: 'fa fa-cubes', text: '立方体'},
- {id: 'fa fa-coffee', text: '咖啡'},
- {id: 'fa fa-cogs', text: '齿轮组'},
- {id: 'fa fa-cog', text: '齿轮'},
- {id: 'fa fa-cart-plus', text: '购物车'},
- {id: 'fa fa-bell', text: '铃铛'},
- {id: 'fa fa-barcode', text: '长形码'},
- {id: 'fa fa-university', text: '大学'},
- {id: 'fa fa-balance-scale', text: '天秤'},
- {id: 'fa fa-asterisk', text: '雪花'},
- {id: 'fa fa-podcast', text: '广播'},
- {id: 'fa fa-truck', text: '卡车'},
- {id: 'fa fa-shopping-basket', text: '购物栏'},
- {id: 'fa fa-plug', text: '插头'},
- {id: 'fa fa-pie-chart', text: '饼图'},
- {id: 'fa fa-magnet', text: '磁铁'},
- {id: 'fa fa-user-circle', text: '用户'},
- {id: 'fa fa-users', text: '用户组'}
- ]
- },
- {name: 'menuUrl', label: '功能URL', span: 2},
- {name: 'remark', label: '备注', span: 2},
- ]]
- }
- },
- buttons: [
- {
- text: "提交", iconCls: "fa fa-save", onClick: function () {
- $.yvan.postForm($form, {
- url: (context.isEdit ? api('/sys/menu/update') : api('/sys/menu/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');
- }
- }
- ]
- };
- };
- });
|