warehousing_detail.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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: 'warehousing_detail/index' + location.search,
  8. add_url: 'warehousing_detail/add',
  9. edit_url: 'warehousing_detail/edit',
  10. del_url: 'warehousing_detail/del',
  11. multi_url: 'warehousing_detail/multi',
  12. table: 'warehousing_detail',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'id',
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'product_name', title: __('Product_name')},
  25. {field: 'formula', title:'配方名称'},
  26. {field: 'color', title: __('Color')},
  27. {field: 'weight', title: __('Weight')},
  28. {field: 'first_quality', title: __('First_quality')},
  29. {field: 'update', title: __('入库时间'), operate:'RANGE', addclass:'datetimerange'},
  30. {field: 'operate', title: __('Operate'), table: table,
  31. buttons:[{
  32. name:'read',text:'查看',title:'查看',icon:'fa fa-list',classname:'btn btn-xs btn-info btn-fields btn-addtabs',url:'warehousing_detail/read'
  33. }],
  34. events: Table.api.events.operate, formatter: function (value, row, index) {
  35. var that = $.extend({}, this);
  36. $(table).data("operate-del", null); // 列表页面隐藏 .编辑operate-edit - 删除按钮operate-del
  37. $(table).data("operate-edit", null);
  38. that.table = table;
  39. return Table.api.formatter.operate.call(that, value, row, index);
  40. }}
  41. ]
  42. ],
  43. showToggle:false,
  44. showColumns:false,
  45. showExport:false,
  46. searchFormVisible:false,
  47. commonSearch:false,
  48. // search:false,
  49. });
  50. // 为表格绑定事件
  51. Table.api.bindevent(table);
  52. },
  53. add: function () {
  54. Controller.api.bindevent();
  55. },
  56. edit: function () {
  57. Controller.api.bindevent();
  58. },
  59. api: {
  60. bindevent: function () {
  61. Form.api.bindevent($("form[role=form]"));
  62. }
  63. }
  64. };
  65. return Controller;
  66. });