dialogWf.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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: 'dialogWf',
  28. title: '业务流程信息',
  29. width: 620,
  30. height: 300,
  31. onOpen: function () {
  32. $dlg = $(this);
  33. if (context.isEdit) {
  34. $.yvan.ajax({
  35. loadingMask: false,
  36. url: api('/sys/wf/getById'),
  37. type: 'GET',
  38. data: {
  39. wfId: context.wfId
  40. },
  41. success: function (data) {
  42. $dlg.find('form');
  43. $form.formSet(data.data);
  44. }
  45. });
  46. } else {
  47. $form.formSet({
  48. status: '1',
  49. sysId: context.sysId
  50. });
  51. }
  52. },
  53. center: {
  54. items: {
  55. xtype: 'formgroup',
  56. onRender: function () {
  57. $form = $(this);
  58. },
  59. items: [
  60. [
  61. {
  62. name: 'sysId',
  63. label: '所属平台',
  64. xtype: 'yvselect',
  65. required: true,
  66. disabled: context.isEdit ? "disabled" : "",
  67. data: getSysList()
  68. },
  69. {
  70. name: 'status',
  71. label: '启用状态',
  72. xtype: 'yvselect',
  73. required: true,
  74. data: $.yvan.sysDict('status').combo()
  75. },
  76. ],
  77. [
  78. {name: 'wfId', xtype: 'hidden'},
  79. {name: 'wfName', label: '流程名称', required: true},
  80. {name: 'wfCode', label: '流程编码', required: true}
  81. ],
  82. [
  83. {
  84. name: 'wfDesp', label: '流程说明', span: 2, height: '60px', multiline: true
  85. }
  86. ]
  87. ]
  88. }
  89. },
  90. buttons: [
  91. {
  92. text: "提交", iconCls: "fa fa-save", onClick: function () {
  93. $.yvan.postForm($form, {
  94. url: (context.isEdit ? api('/sys/wf/update') : api('/sys/wf/insert')),
  95. success: function () {
  96. $.yvan.msg('操作成功');
  97. if (context.isEdit) {
  98. $dlg.window('close');
  99. }
  100. if ($.type(context.confirm) === 'function') {
  101. context.confirm();
  102. }
  103. },
  104. error: function (data) {
  105. }
  106. });
  107. }
  108. }, {
  109. text: "关闭", iconCls: "fa fa-times", onClick: function () {
  110. $dlg.dialog('close');
  111. }
  112. }
  113. ]
  114. };
  115. };
  116. });