diagnose.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area", ["730px", "400px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'diagnose/index' + location.search,
  9. add_url: 'diagnose/add',
  10. edit_url: 'diagnose/edit',
  11. del_url: 'diagnose/del',
  12. multi_url: 'diagnose/multi',
  13. import_url: 'diagnose/import',
  14. table: 'diagnose',
  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: __('序号')},
  27. {field: 'unit_id_text', title: __('Unit_id')},
  28. {field: 'people_id_text', title: __('People_id')},
  29. {field: 'address', title: __('Address'), operate: 'LIKE'},
  30. {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  31. {field: 'duration', title: __('Duration'), operate: 'LIKE'},
  32. {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  33. {field: 'illness', title: __('病情')},
  34. {field: 'admin_id_text', title: __('Admin_id')},
  35. {field: 'createtime', title: __('Createtime'), operate: 'LIKE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  36. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  37. ]
  38. ]
  39. });
  40. // 为表格绑定事件
  41. Table.api.bindevent(table);
  42. table.on('post-body.bs.table', function () {
  43. $(".btn-editone").data("area", ["730px", "400px"]);
  44. })
  45. },
  46. add: function () {
  47. Controller.api.bindevent();
  48. $("#c-people_id").data("params", function (obj) {
  49. var unit_id = $('#J_unitselect').val();
  50. return {
  51. "custom[unit_id][0]": "in",
  52. "custom[unit_id][1]": unit_id
  53. };
  54. });
  55. },
  56. edit: function () {
  57. Controller.api.bindevent();
  58. $("#c-people_id").data("params", function (obj) {
  59. var unit_id = $('#J_unitselect').val();
  60. return {
  61. "custom[unit_id][0]": "in",
  62. "custom[unit_id][1]": unit_id
  63. };
  64. });
  65. },
  66. api: {
  67. bindevent: function () {
  68. Form.api.bindevent($("form[role=form]"));
  69. }
  70. }
  71. };
  72. return Controller;
  73. });