daily_inspect.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. // $(".btn-add").data("area",["860px","90%"]);
  6. // $(".btn-edit").data("area",["860px","50%"]);
  7. Table.api.init({
  8. extend: {
  9. index_url: 'daily_inspect/index' + location.search,
  10. add_url: 'daily_inspect/add',
  11. // edit_url: 'daily_inspect/edit',
  12. del_url: 'daily_inspect/del',
  13. multi_url: 'daily_inspect/multi',
  14. import_url: 'daily_inspect/import',
  15. table: 'daily_inspect',
  16. }
  17. });
  18. var table = $("#table");
  19. // 初始化表格
  20. table.bootstrapTable({
  21. url: $.fn.bootstrapTable.defaults.extend.index_url,
  22. pk: 'id',
  23. sortName: 'id',
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'order_number', title:'id'},
  28. {field: 'unit_id_text', title: __('检查单位'), operate: 'LIKE'},
  29. {field: 'unit_id1_text', title: __('受检单位'), operate: 'LIKE'},
  30. {field: 'examine_time', title: __('检查时间'), operate: 'LIKE'},
  31. {field: 'peoples_id_text', title: __('受检人员'), operate: 'LIKE'},
  32. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons: [
  33. {
  34. name: '问题整改',
  35. text: '问题整改',
  36. title: '问题整改',
  37. classname: 'btn btn-xs btn-info btn-view btn-dialog ',
  38. icon: 'fa fa-search',
  39. url: 'risk_live/mend',
  40. //extend: 'data-area=\'["1000px","80%"]\'',
  41. // visible: function (row) {
  42. // if (row['state'] == 0) {
  43. // return true;
  44. // } else {
  45. // return false;
  46. // }
  47. // },
  48. refresh: true
  49. }
  50. ], formatter: Table.api.formatter.operate}
  51. ]
  52. ]
  53. });
  54. // 为表格绑定事件
  55. Table.api.bindevent(table);
  56. },
  57. add: function () {
  58. Controller.api.bindevent();
  59. },
  60. edit: function () {
  61. Controller.api.bindevent();
  62. },
  63. api: {
  64. bindevent: function () {
  65. Form.api.bindevent($("form[role=form]"));
  66. }
  67. }
  68. };
  69. return Controller;
  70. });