public_property.js 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area",["1000px","450px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'public_property/index' + location.search,
  9. add_url: 'public_property/add',
  10. edit_url: 'public_property/edit',
  11. del_url: 'public_property/del',
  12. multi_url: 'public_property/multi',
  13. import_url: 'public_property/import',
  14. table: 'public_property',
  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: __('Id')},
  27. {field: 'unit_id_text', title: __('Unit_id')},
  28. {field: 'name', title: __('Name'), operate: 'LIKE'},
  29. {field: 'version', title: __('Version'), operate: 'LIKE'},
  30. {field: 'quantity', title: __('Quantity')},
  31. {field: 'price', title: __('Price'), operate:'BETWEEN'},
  32. {field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
  33. {field: 'equip_time', title: __('Equip_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  34. {field: 'people_id_text', title: __('People_id')},
  35. {field: 'acquire', title: __('Acquire'), operate: 'LIKE'},
  36. {field: 'quality', title: __('Quality'), operate: 'LIKE'},
  37. {field: 'address', title: __('Address'), operate: 'LIKE'},
  38. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  39. {field: 'createtime', title: __('Createtime'), operate: 'LIKE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. //{field: 'updatetime', title: __('Updatetime'), operate: 'LIKE'},
  41. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons: [
  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: 'public_property/details',
  49. extend: 'data-area=\'["1100px","80%"]\'',
  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",["1000px","450px"]);
  60. })
  61. },
  62. add: function () {
  63. Controller.api.bindevent();
  64. $("#c-people_id").data("params", function (obj) {
  65. var unit_id = $('#J_unitselect').val();
  66. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  67. });
  68. },
  69. edit: function () {
  70. Controller.api.bindevent();
  71. $("#c-people_id").data("params", function (obj) {
  72. var unit_id = $('#J_unitselect').val();
  73. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  74. });
  75. },
  76. api: {
  77. bindevent: function () {
  78. Form.api.bindevent($("form[role=form]"));
  79. }
  80. }
  81. };
  82. return Controller;
  83. });