process.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * 报销管理管理初始化
  3. */
  4. var Process = {
  5. id: "ProcessTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. Process.initColumn = function () {
  14. return [
  15. {field: 'selectItem', radio: true},
  16. {title: '任务id', field: 'id', visible: true, align: 'center', valign: 'middle'},
  17. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
  18. {title: '金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
  19. {title: '创建时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
  20. {title: '申请人', field: 'assignee', visible: true, align: 'center', valign: 'middle'},
  21. {
  22. title: '操作', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) {
  23. if (row.selfFlag == true) {
  24. return '<button type="button" class="btn btn-primary button-margin" onclick="Process.pass(' + row.id + ')" id=""><i class="fa fa-edit"></i>&nbsp;通过</button>' +
  25. '<button type="button" class="btn btn-danger button-margin" onclick="Process.unPass(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i>&nbsp;不通过</button>';
  26. } else {
  27. return '<button type="button" class="btn btn-primary button-margin" onclick="Process.pass(' + row.id + ')" id=""><i class="fa fa-edit"></i>&nbsp;通过</button>';
  28. }
  29. }
  30. }
  31. ];
  32. };
  33. /**
  34. * 通过审核
  35. */
  36. Process.pass = function (id) {
  37. var ajax = new $ax(Feng.ctxPath + "/process/pass", function (data) {
  38. Feng.success("审核成功!");
  39. Process.table.refresh();
  40. }, function (data) {
  41. Feng.error("审核失败!" + data.responseJSON.message + "!");
  42. });
  43. ajax.set("taskId", id);
  44. ajax.start();
  45. };
  46. /**
  47. * 未通过审核
  48. */
  49. Process.unPass = function (id) {
  50. var ajax = new $ax(Feng.ctxPath + "/process/unPass", function (data) {
  51. Feng.success("审核成功!");
  52. Process.table.refresh();
  53. }, function (data) {
  54. Feng.error("审核失败!" + data.responseJSON.message + "!");
  55. });
  56. ajax.set("taskId", id);
  57. ajax.start();
  58. };
  59. /**
  60. * 查询报销管理列表
  61. */
  62. Process.search = function () {
  63. var queryData = {};
  64. queryData['condition'] = $("#condition").val();
  65. Process.table.refresh({query: queryData});
  66. };
  67. $(function () {
  68. var defaultColunms = Process.initColumn();
  69. var table = new BSTable(Process.id, "/process/list", defaultColunms);
  70. table.setPaginationType("client");
  71. Process.table = table.init();
  72. });