dialogWfStepSort.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. define(function (require) {
  2. return function (context) {
  3. var $dlg, $grid;
  4. // 查询列表
  5. function queryGrid1() {
  6. var queryUrl = '/sys/wfStep/queryAll';// 自行替换此参数
  7. $grid.jqGrid("clearGridData");
  8. $grid.reload({
  9. mtype: 'GET',
  10. url: api(queryUrl),
  11. queryParams: {"wfId": context.wfId, "stepId": context.treeUp, "treeUp": context.treeUp}
  12. });
  13. }
  14. //编辑工具栏
  15. var gridToolbarTitle = '业务流程列表';// 自行替换此参数
  16. var gridToolbar = {
  17. xtype: 'toolbar', title: gridToolbarTitle, items: [
  18. {
  19. text: '上移', iconCls: 'fa fa-arrow-up', onClick: function () {
  20. $grid.moveUp();
  21. }
  22. },
  23. {
  24. text: '下移', iconCls: 'fa fa-arrow-down', onClick: function () {
  25. $grid.moveDown();
  26. }
  27. },
  28. {
  29. text: '保存排序', iconCls: 'fa fa-check-square', onClick: function () {
  30. moveGrid();
  31. }
  32. }
  33. ]
  34. }
  35. //保存排序
  36. function moveGrid() {
  37. var gridData = $grid.jqGrid("getRowData");
  38. var list = [];
  39. for (var i = 0; i < gridData.length; i++) {
  40. list.push(gridData[i].stepId);
  41. }
  42. var treeCode = "";
  43. if (context.treeLev > 1) {
  44. treeCode = context.treeCode.substr(0, 3);
  45. }
  46. saveSort("sysWfStep", list, context.wfId, treeCode);
  47. }
  48. function saveSort(name, ids, sysid, codeup) {
  49. var data = {
  50. "ids": "",
  51. "name": name,
  52. "sysId": sysid,
  53. "codeUp": codeup,
  54. };
  55. for (var i = 0; i < ids.length; i++) {
  56. data.ids += ids[i] + ","
  57. }
  58. data.ids = data.ids.substr(0, data.ids.length - 1);
  59. if (data.ids == "") {
  60. return;
  61. }
  62. $.yvan.ajax({
  63. url: api('/core/app/updateCoreSortCode'),
  64. method: 'post',
  65. data: data,
  66. beforeSend: function () {
  67. $.yvan.progress();
  68. },
  69. success: function () {
  70. $.yvan.msg('操作成功');
  71. $dlg.window('close');
  72. if ($.type(context.confirm) === 'function') {
  73. context.confirm();
  74. }
  75. },
  76. complete: function () {
  77. $.yvan.closep();
  78. }
  79. });
  80. }
  81. return {
  82. xtype: 'dialog',
  83. dialogId: 'dialogWfStepSort',
  84. title: '维护业务流程排序',
  85. width: 900,
  86. height: 650,
  87. onOpen: function () {
  88. $dlg = $(this);
  89. },
  90. center: {
  91. border: false,
  92. items: {
  93. onRender: function () {
  94. $grid = $(this);
  95. queryGrid1();
  96. },
  97. xtype: 'grid',
  98. pagination: false,
  99. idField: "WfStepSort",
  100. toolbar: {
  101. xtype: 'div',
  102. items: [
  103. gridToolbar
  104. ]
  105. },
  106. columns: [[
  107. {title: '步骤ID', field: 'stepId', hidden: true},
  108. {title: '步骤名称', field: 'stepName'},
  109. {title: '步骤编码', field: 'stepCode'},
  110. // {title: '流程名称', field: 'taskType'},
  111. {title: '启用状态', field: 'status', align: 'center', formatter: $.fn.fmatter.statusView}, //增加字典,显示正常
  112. ]]
  113. }
  114. }
  115. };
  116. };
  117. });