examine.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area", ["620px", "360px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'examine/index' + location.search,
  9. add_url: 'examine/add',
  10. // edit_url: 'examine/edit',
  11. // del_url: 'examine/del',
  12. multi_url: 'examine/multi',
  13. import_url: 'examine/import',
  14. table: 'examine',
  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: 'class_id_text', title: __('人员类别')},
  30. {field: 'job', title: __('工作岗位')},
  31. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons: [
  32. {
  33. name: '添加体检信息',
  34. text: '添加体检信息',
  35. title: '添加体检信息',
  36. classname: 'btn btn-xs btn-info btn-view btn-dialog ',
  37. icon: 'fa fa-search',
  38. url: 'examine_details/add',
  39. extend: 'data-area=\'["800px","600px"]\'',
  40. refresh: true
  41. },
  42. {
  43. name: '查看',
  44. text: '查看',
  45. title: '查看',
  46. classname: 'btn btn-xs btn-info btn-view btn-dialog ',
  47. icon: 'fa fa-search',
  48. url: 'examine_details/details',
  49. extend: 'data-area=\'["800px","600px"]\'',
  50. refresh: true
  51. }
  52. ], formatter: Table.api.formatter.operate}
  53. ]
  54. ]
  55. });
  56. // 为表格绑定事件
  57. Table.api.bindevent(table);
  58. table.on('post-body.bs.table', function () {
  59. $(".btn-editone").data("area", ["730px", "360px"]);
  60. })
  61. },
  62. add: function () {
  63. Controller.api.bindevent();
  64. $("#c-people_id").data("eSelect", function(){
  65. $.get('examine/huoq',{id:$("#c-people_id").val()},function(res){
  66. $('#c-job').val(res.data.job);
  67. $('#c-class_id').val(res.data.class_id);
  68. //console.log(res);
  69. });
  70. //后续操作
  71. });
  72. $("#c-people_id").data("params", function (obj) {
  73. var unit_id = $('#J_unitselect').val();
  74. return {
  75. "custom[unit_id][0]": "in",
  76. "custom[unit_id][1]": unit_id
  77. };
  78. });
  79. },
  80. // edit: function () {
  81. // Controller.api.bindevent();
  82. // $("#c-people_id").data("params", function (obj) {
  83. // var unit_id = $('#J_unitselect').val();
  84. // return {
  85. // "custom[unit_id][0]": "in",
  86. // "custom[unit_id][1]": unit_id
  87. // };
  88. // });
  89. // },
  90. api: {
  91. bindevent: function () {
  92. Form.api.bindevent($("form[role=form]"));
  93. }
  94. }
  95. };
  96. return Controller;
  97. });