tdcaccount.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form','vue', 'component', 'ELEMENT'], function ($, undefined, Backend, Table, Form, Vue, component, ELEMENT) {
  2. var id = '';
  3. var Controller = {
  4. index: function () {
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'tdcaccount/index',
  9. add_url: 'tdcaccount/add',
  10. del_url: 'tdcaccount/del',
  11. table: 'tdcaccount',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'id',
  20. search:false,
  21. commonSearch: false,
  22. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. {field: 'account_id', title: __('商品库账号ID')},
  27. {field: 'createtime', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  28. {field: 'updatetime', title: __('更新时间'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  29. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  30. ]
  31. ]
  32. });
  33. $(function () {
  34. $(document).on('click', ".layui-layer-close", function () {
  35. //刷新页面
  36. console.log(1);
  37. table.bootstrapTable('refresh');
  38. });
  39. });
  40. // 为表格绑定事件
  41. Table.api.bindevent(table);
  42. },
  43. add: function () {
  44. Controller.api.bindevent();
  45. },
  46. edit: function () {
  47. Controller.api.bindevent();
  48. },
  49. api: {
  50. bindevent: function () {
  51. Form.api.bindevent($("form[role=form]"));
  52. },
  53. }
  54. };
  55. return Controller;
  56. });