jiancejoblog.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'jiancejoblog/index' + location.search,
  8. add_url: 'jiancejoblog/add',
  9. edit_url: 'jiancejoblog/edit',
  10. del_url: 'jiancejoblog/del',
  11. multi_url: 'jiancejoblog/multi',
  12. import_url: 'jiancejoblog/import',
  13. table: 'jiance_joblog',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'jiance_id', title: __('Jiance_id')},
  29. {field: 'jiance.bianhao', title: __('Jiance.bianhao'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  30. {field: 'project_id', title: __('Project_id')},
  31. {field: 'project.title', title: __('Project.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  32. {field: 'worker_id', title: __('Worker_id')},
  33. {field: 'worker.truename', title: __('Worker.truename'), operate: 'LIKE'},
  34. {field: 'worker.gonghao', title: __('Worker.gonghao'), operate: 'LIKE'},
  35. {field: 'worker.mobile', title: __('Worker.mobile'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  36. {field: 'weizhi', title: __('Weizhi'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  37. {field: 'number', title: __('Number')},
  38. {field: 'hege_status', title: __('Hege_status'), searchList: {"1":__('Hege_status 1'),"2":__('Hege_status 2'),"3":__('Hege_status 3')}, formatter: Table.api.formatter.status},
  39. {field: 'result', title: __('Result'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  40. {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  41. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  42. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  43. ]
  44. ]
  45. });
  46. // 为表格绑定事件
  47. Table.api.bindevent(table);
  48. },
  49. add: function () {
  50. Controller.api.bindevent();
  51. },
  52. edit: function () {
  53. Controller.api.bindevent();
  54. },
  55. api: {
  56. bindevent: function () {
  57. Form.api.bindevent($("form[role=form]"));
  58. }
  59. }
  60. };
  61. return Controller;
  62. });