daily_looks.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. $(".btn-add").data("area",["690px","775px"]);
  6. Table.api.init({
  7. extend: {
  8. index_url: 'daily_looks/index' + location.search,
  9. add_url: 'daily_looks/add',
  10. // edit_url: 'daily_looks/edit',
  11. del_url: 'daily_looks/del',
  12. multi_url: 'daily_looks/multi',
  13. import_url: 'daily_looks/import',
  14. table: 'daily_looks',
  15. }
  16. });
  17. var table = $("#table");
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. escape:false,
  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',
  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. table.on('post-body.bs.table',function(){
  57. $(".btn-editone").data("area",["690px","775px"]);
  58. })
  59. },
  60. add: function () {
  61. Controller.api.bindevent();
  62. $("#faupload-file").data("upload-success", function(data, ret){
  63. //这里进行后续操作
  64. $('#c-file_name').val(data.name);
  65. });
  66. },
  67. edit: function () {
  68. Controller.api.bindevent();
  69. $("#faupload-file").data("upload-success", function(data, ret){
  70. //这里进行后续操作
  71. $('#c-file_name').val(data.name);
  72. });
  73. },
  74. api: {
  75. bindevent: function () {
  76. Form.api.bindevent($("form[role=form]"));
  77. }
  78. }
  79. };
  80. return Controller;
  81. });