people_examination.js 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area",["820px","90%"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'people_examination/index' + location.search,
  9. add_url: 'people_examination/add',
  10. edit_url: 'people_examination/edit',
  11. del_url: 'people_examination/del',
  12. multi_url: 'people_examination/multi',
  13. import_url: 'people_examination/import',
  14. table: 'people_examination',
  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. sortOrder:'desc',//默认排序方式
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'order_number', title: __('Id')},
  28. //{field: 'people_id', title: __('People_id')},
  29. {field: 'c_name', title: '政审对象名称'},
  30. {field: 'admin_id_text', title: __('Admin_id')},
  31. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  32. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  33. ]
  34. ]
  35. });
  36. // 为表格绑定事件
  37. Table.api.bindevent(table);
  38. table.on('post-body.bs.table',function(){
  39. $(".btn-editone").data("area",["820px","90%"]);
  40. })
  41. },
  42. add: function () {
  43. Controller.api.bindevent();
  44. $("#c-people_id").data("eSelect", function(){
  45. $.get('People/huoq',{id:$("#c-people_id").val()},function(res){
  46. $('#c-sex').val(res.data.sex_list);
  47. $('#c-name').val(res.data.name);
  48. $('#c-birth_date').val(res.data.birth_date);
  49. $('#c-party_id').val(res.data.party_id);
  50. $('#c-party_id').selectPageRefresh();
  51. $('#c-nation_id').val(res.data.nation_id);
  52. $('#c-nation_id').selectPageRefresh();
  53. $('#c-origin').val(res.data.origin);
  54. $('#c-enlist_date').val(res.data.enlist_date);
  55. $('#c-prize').val(res.data.prize);
  56. $('#c-enlistdesc').val(res.data.readme_file_name);
  57. });
  58. //后续操作
  59. });
  60. },
  61. edit: function () {
  62. Controller.api.bindevent();
  63. $("#c-people_id").data("eSelect", function(){
  64. $.get('People/huoq',{id:$("#c-people_id").val()},function(res){
  65. $('#c-sex').val(res.data.sex_list);
  66. $('#c-name').val(res.data.name);
  67. $('#c-birth_date').val(res.data.birth_date);
  68. $('#c-party_id').val(res.data.party_id);
  69. $('#c-party_id').selectPageRefresh();
  70. $('#c-nation_id').val(res.data.nation_id);
  71. $('#c-nation_id').selectPageRefresh();
  72. $('#c-origin').val(res.data.origin);
  73. $('#c-enlist_date').val(res.data.enlist_date);
  74. $('#c-prize').val(res.data.prize);
  75. $('#c-enlistdesc').val(res.data.readme_file_name);
  76. });
  77. //后续操作
  78. });
  79. },
  80. api: {
  81. bindevent: function () {
  82. Form.api.bindevent($("form[role=form]"));
  83. }
  84. }
  85. };
  86. return Controller;
  87. });