teaching_plan.js 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area",["988px","676px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'teaching_plan/index' + location.search,
  9. add_url: 'teaching_plan/add',
  10. edit_url: 'teaching_plan/edit',
  11. del_url: 'teaching_plan/del',
  12. multi_url: 'teaching_plan/multi',
  13. import_url: 'teaching_plan/import',
  14. table: 'teaching_plan',
  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. columns: [
  24. [
  25. {checkbox: true},
  26. {field: 'order_number', title: __('Id')},
  27. {field: 'title', title: __('Title'), operate: 'LIKE'},
  28. {field: 'type', title: __('Type'), searchList: {"文档":__('文档'),"专题":__('专题')}, formatter: Table.api.formatter.normal},
  29. {field: 'unit_id_text', title: __('Unit_id')},
  30. {field: 'people_id_text', title: __('People_id')},
  31. {field: 'address', title: __('Address'), operate: 'LIKE'},
  32. {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  33. {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  34. {field: 'join_number', title: __('Join_number')},
  35. {field: 'no_join_number', title: __('No_join_number')},
  36. //{field: 'people_ids_text', title: __('People_ids'), operate: 'LIKE'},
  37. //{field: 'file', title: __('File'), operate: false},
  38. {field: 'file_name', title: __('File_name'), operate: 'LIKE'},
  39. {field: 'write_time', title: __('记录时间'), operate: 'LIKE'},
  40. //{field: 'updatetime', title: __('Updatetime'), operate: 'LIKE'},
  41. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons: [
  42. {
  43. name: '下载',
  44. text: '下载',
  45. title: '下载',
  46. classname: 'btn btn-xs btn-info btn-view ',
  47. icon: 'fa fa-search',
  48. url: 'teaching_plan/download',
  49. refresh: true
  50. }
  51. ], formatter: Table.api.formatter.operate}
  52. ]
  53. ]
  54. });
  55. // 为表格绑定事件
  56. Table.api.bindevent(table);
  57. table.on('post-body.bs.table',function(){
  58. $(".btn-editone").data("area",["988px","676px"]);
  59. })
  60. },
  61. add: function () {
  62. Controller.api.bindevent();
  63. $("#c-people_ids,#c-people_id").data("params", function (obj) {
  64. var unit_id = $('#J_unitselect').val();
  65. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  66. });
  67. $("#faupload-file").data("upload-success", function(data, ret){
  68. //这里进行后续操作
  69. $('#c-file_name').val(data.name);
  70. });
  71. },
  72. edit: function () {
  73. Controller.api.bindevent();
  74. $("#c-people_ids,#c-people_id").data("params", function (obj) {
  75. var unit_id = $('#J_unitselect').val();
  76. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  77. });
  78. $("#faupload-file").data("upload-success", function(data, ret){
  79. //这里进行后续操作
  80. $('#c-file_name').val(data.name);
  81. });
  82. },
  83. api: {
  84. bindevent: function () {
  85. Form.api.bindevent($("form[role=form]"));
  86. }
  87. }
  88. };
  89. return Controller;
  90. });