help_ext.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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: 'help/help_ext/index' + location.search,
  8. add_url: 'help/help_ext/add',
  9. edit_url: 'help/help_ext/edit',
  10. del_url: 'help/help_ext/del',
  11. multi_url: 'help/help_ext/multi',
  12. import_url: 'help/help_ext/import',
  13. table: 'help_ext',
  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: 'cid', title: __('Cid')},
  27. {field: 'help_id', title: __('Help_id')},
  28. {field: 'sex', title: __('Sex'), searchList: {"0":__('Sex 0'),"1":__('Sex 1')}, formatter: Table.api.formatter.normal},
  29. {field: 'politics', title: __('Politics'), searchList: {"0":__('Politics 0'),"1":__('Politics 1'),"2":__('Politics 2')}, formatter: Table.api.formatter.normal},
  30. {field: 'birthday', title: __('Birthday'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  31. {field: 'address', title: __('Address'), operate: 'LIKE'},
  32. {field: 'company', title: __('Company'), operate: 'LIKE'},
  33. {field: 'unit_nature', title: __('Unit_nature'), operate: 'LIKE'},
  34. {field: 'monthly_income', title: __('Monthly_income'), operate:'BETWEEN'},
  35. {field: 'annual_household_income', title: __('Annual_household_income'), operate:'BETWEEN'},
  36. {field: 'annual_household_income_average', title: __('Annual_household_income_average'), operate:'BETWEEN'},
  37. {field: 'identity', title: __('Identity'), operate: 'LIKE'},
  38. {field: 'marriage', title: __('Marriage'), searchList: {"0":__('Marriage 0'),"1":__('Marriage 1')}, formatter: Table.api.formatter.normal},
  39. {field: 'medical_insurance', title: __('Medical_insurance'), searchList: {"0":__('Medical_insurance 0'),"1":__('Medical_insurance 1')}, formatter: Table.api.formatter.normal},
  40. {field: 'object_features', title: __('Object_features'), operate: 'LIKE'},
  41. {field: 'reason', title: __('Reason'), operate: 'LIKE'},
  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-help_id").data("params", function (obj) {
  51. return {custom: {cid: $("#c-cid").val()}};
  52. });
  53. Controller.api.bindevent();
  54. },
  55. edit: function () {
  56. $("#c-help_id").data("params", function (obj) {
  57. return {custom: {cid: $("#c-cid").val()}};
  58. });
  59. Controller.api.bindevent();
  60. },
  61. api: {
  62. bindevent: function () {
  63. Form.api.bindevent($("form[role=form]"));
  64. }
  65. }
  66. };
  67. return Controller;
  68. });