consume_due.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area",["1000px","775px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'consume_due/index' + location.search,
  9. multi_url: 'consume_due/multi',
  10. import_url: 'consume_due/import',
  11. table: 'consume_due',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'id',
  20. columns: [
  21. [
  22. {checkbox: true},
  23. {field: 'order_number', title: __('序号')},
  24. //{field: 'number', title: __('入库编号')},
  25. {field: 'durg_archives_id_text', title: __('耗材名称')},
  26. {field: 'durg_brand', title: __('品牌'), operate: 'LIKE'},
  27. {field: 'specifications', title: __('规格'), operate: 'LIKE'},
  28. {field: 'manufacturer', title: __('生产厂商'), operate: 'LIKE'},
  29. {field: 'unit_id_text', title: __('单位'), operate: 'LIKE'},
  30. {field: 'store_house_text', title: __('库房'), operate: 'LIKE'},
  31. {field: 'place', title: __('入库位置'), operate: 'LIKE'},
  32. {field: 'put_in', title: __('入库数量')},
  33. {field: 'surplus', title: __('剩余库存')},
  34. //{field: 'source', title: __('Source'), operate: 'LIKE'},
  35. //{field: 'remarks', title: __('Remarks'), operate: 'LIKE'},
  36. {field: 'overduedate', title: __('过期时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  37. //{field: 'admin_id_text', title: __('Admin_id')},
  38. //{field: 'put_time', title: __('Put_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  39. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons:
  40. [
  41. {
  42. name: '销毁',
  43. text: '销毁',
  44. title: '销毁',
  45. icon: 'fa',
  46. confirm: '您确定要销毁吗?',
  47. classname: 'btn btn-xs btn-info btn-ajax',
  48. refresh:true,
  49. url: function(row){return 'consume_due/ruin?ids='+row.id;},
  50. visible: function (row) {
  51. if (row['status'] == 0) {
  52. return true;
  53. } else {
  54. return false;
  55. }
  56. },
  57. },
  58. {
  59. name: '已销毁',
  60. text: '已销毁',
  61. title: '已销毁',
  62. icon: 'fa',
  63. classname: 'btn btn-xs btn-info',
  64. visible: function (row) {
  65. if (row['status'] == 1) {
  66. return true;
  67. } else {
  68. return false;
  69. }
  70. },
  71. },
  72. ], formatter: Table.api.formatter.operate}
  73. ]
  74. ]
  75. });
  76. // 为表格绑定事件
  77. Table.api.bindevent(table);
  78. table.on('post-body.bs.table', function () {
  79. $(".btn-editone").data("area", ["1000px", "690px"]);
  80. })
  81. },
  82. api: {
  83. bindevent: function () {
  84. Form.api.bindevent($("form[role=form]"));
  85. }
  86. }
  87. };
  88. return Controller;
  89. });