company.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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: 'company/index' + location.search,
  8. add_url: 'company/add',
  9. edit_url: 'company/edit',
  10. del_url: 'company/del',
  11. multi_url: 'company/multi',
  12. import_url: 'company/import',
  13. table: 'company',
  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. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'name', title: __('Name'), operate: 'LIKE'},
  29. // {field: 'back_ids', title: __('Back_ids'), operate: 'LIKE'},
  30. // {field: 'service_ids', title: __('Service_ids'), operate: 'LIKE'},
  31. {field: 'service_price', title: __('Service_price')},
  32. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  33. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  34. {field: 'province_name', title: __('Province_name'), operate: 'LIKE'},
  35. {field: 'city_name', title: __('City_name'), operate: 'LIKE'},
  36. {field: 'area_name', title: __('Area_name'), operate: 'LIKE'},
  37. // {field: 'province_id', title: __('Province_id')},
  38. // {field: 'city_id', title: __('City_id')},
  39. // {field: 'area_id', title: __('Area_id')},
  40. {field: 'address', title: __('Address'), operate: 'LIKE'},
  41. // {field: 'longitude', title: __('Longitude'), operate:'BETWEEN'},
  42. // {field: 'latitude', title: __('Latitude'), operate:'BETWEEN'},
  43. {field: 'truename', title: __('Truename'), operate: 'LIKE'},
  44. {field: 'idcard', title: __('Idcard'), operate: 'LIKE'},
  45. // {field: 'idcard_images', title: __('Idcard_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  46. // {field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
  47. // {field: 'bank_branchname', title: __('Bank_branchname'), operate: 'LIKE'},
  48. // {field: 'bank_account', title: __('Bank_account'), operate: 'LIKE'},
  49. // {field: 'bank_card', title: __('Bank_card'), operate: 'LIKE'},
  50. {field: 'company_name', title: __('Company_name'), operate: 'LIKE'},
  51. // {field: 'company_code', title: __('Company_code'), operate: 'LIKE'},
  52. // {field: 'company_registerdate', title: __('Company_registerdate')},
  53. // {field: 'company_address', title: __('Company_address'), operate: 'LIKE'},
  54. // {field: 'company_image', title: __('Company_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  55. // {field: 'rule', title: __('Rule')},
  56. // {field: 'back.name', title: __('Back.name'), operate: 'LIKE'},
  57. // {field: 'service.name', title: __('Service.name'), operate: 'LIKE'},
  58. // {field: 'area.name', title: __('Area.name'), operate: 'LIKE'},
  59. {field: 'status', title: __('Status'), searchList: {"-1":__('Status -1'),"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
  60. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  61. ]
  62. ]
  63. });
  64. // 为表格绑定事件
  65. Table.api.bindevent(table);
  66. },
  67. add: function () {
  68. Controller.api.bindevent();
  69. },
  70. edit: function () {
  71. Controller.api.bindevent();
  72. },
  73. api: {
  74. bindevent: function () {
  75. Form.api.bindevent($("form[role=form]"));
  76. }
  77. }
  78. };
  79. return Controller;
  80. });
  81. $("#c-province_id").data("params", function (obj) {
  82. return {
  83. custom: {pid: 0}
  84. };
  85. });
  86. $("#c-city_id").data("params", function (obj) {
  87. return {
  88. custom: {pid: $("#c-province_id").val()}
  89. };
  90. });
  91. $("#c-area_id").data("params", function (obj) {
  92. return {
  93. custom: {pid: $("#c-city_id").val()}
  94. };
  95. });
  96. $(document).on("change","#c-province_id",function(){
  97. $("#c-city_id").selectPageClear();
  98. $("#c-area_id").selectPageClear();
  99. });
  100. $(document).on("change","#c-city_id",function(){
  101. $("#c-area_id").selectPageClear();
  102. })