dialogApp.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. define(function (require) {
  2. return function (context) {
  3. var $dlg, $form;
  4. //获取平台列表
  5. function getSysList() {
  6. var _datas = [];
  7. $.yvan.ajax({
  8. url: api('/sys/system/query'),
  9. data: {status: 1},
  10. method: 'post',
  11. async: false,
  12. success: function (data) {
  13. if (data.data != null && data.data != undefined) {
  14. for (var i = 0; i < data.data.length; i++) {
  15. _datas.push({
  16. "id": data.data[i].sysId,
  17. "text": data.data[i].sysName
  18. })
  19. }
  20. }
  21. }
  22. });
  23. return _datas;
  24. }
  25. return {
  26. xtype: 'dialog',
  27. dialogId: 'dialogApp',
  28. title: '应用程序信息',
  29. width: 650,
  30. height: 400,
  31. onOpen: function () {
  32. $dlg = $(this);
  33. if (context.isEdit) {
  34. $.yvan.ajax({
  35. loadingMask: false,
  36. url: api('/sys/sysApp/getById'),
  37. type: 'GET',
  38. data: {
  39. appId: context.appId
  40. },
  41. success: function (data) {
  42. $dlg.find('form');
  43. if (!isNotNull(data) || !isNotNull(data.data)) {
  44. return;
  45. }
  46. $form.formSet(data.data);
  47. }
  48. });
  49. } else {
  50. $form.formSet({
  51. beActive: 'Y',
  52. status: 1,
  53. sysId: context.sysId
  54. });
  55. }
  56. },
  57. center: {
  58. items: {
  59. xtype: 'formgroup',
  60. onRender: function () {
  61. $form = $(this);
  62. },
  63. items: [{name: 'appId', xtype: 'hidden'},
  64. [{
  65. name: 'sysId',
  66. label: '所属平台',
  67. xtype: 'yvselect',
  68. required: true,
  69. width: 350,
  70. //disabled: context.isEdit ? "disabled" : "",
  71. data: getSysList()
  72. }],
  73. {name: 'appName', label: '程序名称', required: true, span: 2},
  74. [{name: 'appCode', label: '程序编码', required: true, span: 2}],
  75. [{
  76. name: 'appType', label: '程序类型', xtype: 'yvselect', required: true,
  77. data: $.yvan.bizDict('appType').combo()
  78. }, {
  79. name: 'status', label: '启用状态', xtype: 'yvselect', required: true,
  80. data: $.yvan.bizDict('status').combo()
  81. }],
  82. [{name: 'appExe', label: '文件名'}, {name: 'appKey', label: 'key'}],
  83. {name: 'appDesp', label: '文件描述', span: 2, height: '90px', multiline: true},
  84. ]
  85. }
  86. },
  87. buttons: [
  88. {
  89. text: "保存", iconCls: "fa fa-save", onClick: function () {
  90. $.yvan.postForm($form, {
  91. url: (context.isEdit ? api('/sys/sysApp/update') : api('/sys/sysApp/insert')),
  92. success: function () {
  93. $.yvan.msg('保存成功');
  94. $dlg.window('close');
  95. if ($.type(context.confirm) === 'function') {
  96. context.confirm();
  97. }
  98. },
  99. error: function (data) {
  100. }
  101. });
  102. }
  103. }, {
  104. text: "关闭", iconCls: "fa fa-times", onClick: function () {
  105. $dlg.dialog('close');
  106. }
  107. }
  108. ]
  109. };
  110. };
  111. });