sos_bill.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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: 'sos/sos_bill/index' + location.search,
  8. add_url: 'sos/sos_bill/add',
  9. edit_url: 'sos/sos_bill/edit',
  10. del_url: 'sos/sos_bill/del',
  11. multi_url: 'sos/sos_bill/multi',
  12. import_url: 'sos/sos_bill/import',
  13. table: 'sos_bill',
  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. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. {field: 'sos_id', title: __('Sos_id')},
  27. {field: 'user_id', title: __('User_id')},
  28. {field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
  29. {field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
  30. {field: 'rescue_id', title: __('Rescue_id')},
  31. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  32. {field: 'processtime', title: __('Processtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  33. {field: 'process_remark', title: __('Process_remark'), operate: 'LIKE'},
  34. {field: 'user_phone', title: __('User_phone'), operate: 'LIKE'},
  35. {field: 'user_phone_show', title: __('User_phone_show'), operate: 'LIKE'},
  36. {field: 'rescue_phone', title: __('Rescue_phone'), operate: 'LIKE'},
  37. {field: 'rescue_phone_show', title: __('Rescue_phone_show'), operate: 'LIKE'},
  38. {field: 'channel_number', title: __('Channel_number'), operate: 'LIKE'},
  39. {field: 'confirmtime', title: __('Confirmtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"-1":__('Status -1'),"-2":__('Status -2')}, formatter: Table.api.formatter.status},
  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. $("#c-user_id").data("params", function (obj) {
  51. return {custom: {cid: $("#c-cid").val()}};
  52. });
  53. $("#c-rescue_id").data("params", function (obj) {
  54. return {custom: {cid: $("#c-cid").val()}};
  55. });
  56. Controller.api.bindevent();
  57. },
  58. edit: function () {
  59. $("#c-user_id").data("params", function (obj) {
  60. return {custom: {cid: $("#c-cid").val()}};
  61. });
  62. $("#c-rescue_id").data("params", function (obj) {
  63. return {custom: {cid: $("#c-cid").val()}};
  64. });
  65. Controller.api.bindevent();
  66. },
  67. api: {
  68. bindevent: function () {
  69. Form.api.bindevent($("form[role=form]"));
  70. }
  71. }
  72. };
  73. return Controller;
  74. });