dialogDictList.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. define(function (require) {
  2. return function (context) {
  3. var $dlg;
  4. return {
  5. xtype: 'dialog',
  6. dialogId: 'dialogDictList',
  7. title: '添加字典详情',
  8. width: 360,
  9. height: 400,
  10. onOpen: function () {
  11. $dlg = $(this);
  12. $dlg.formSet(context.row);
  13. },
  14. center: {
  15. items: {
  16. xtype: 'form',
  17. items: [
  18. [{name: 'dictCode', xtype: 'hidden'}],
  19. [{label: '字典内容', name: 'dictList', required: true}],
  20. [{label: '字典值', name: 'dictValue', required: true}],
  21. [{label: '自定义1', name: 'udf1'}],
  22. [{label: '自定义2', name: 'udf2'}],
  23. [{label: '自定义3', name: 'udf3'}]
  24. ]
  25. }
  26. },
  27. buttons: [
  28. {
  29. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  30. $dlg.window('close');
  31. }
  32. },
  33. {
  34. text: '保存', iconCls: 'fa fa-save', onClick: function () {
  35. var newData = $dlg.formGet();
  36. if (newData.dictValue == null || newData.dictValue === '') {
  37. $.yvan.msg('字典值必填');
  38. return;
  39. }
  40. if (newData.dictList == null || newData.dictList === '') {
  41. $.yvan.msg('字典内容必填');
  42. return
  43. }
  44. $.yvan.ajax({
  45. url: api('/sys/dict/addList'),
  46. contentType: 'application/json; charset=utf-8',
  47. data: JSON.stringify(newData),
  48. method: 'post',
  49. success: function (data) {
  50. $.yvan.msg(data.msg);
  51. $dlg.window('close');
  52. context.confirm();
  53. },
  54. error: function (data) {
  55. $.yvan.msg(data.msg);
  56. }
  57. })
  58. }
  59. }
  60. ]
  61. }
  62. }
  63. });