gdtaccount.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form','vue', 'component', 'ELEMENT'], function ($, undefined, Backend, Table, Form, Vue, component, ELEMENT) {
  2. var id = '';
  3. $(document).on("click", ".layui-layer-btn0", function () {
  4. window.location.reload();
  5. });
  6. var Controller = {
  7. index: function () {
  8. $(document).on('click','.layer-open',function () {
  9. Fast.api.open($(this).attr('href'), $(this).data('title')?$(this).data('title'):'配置公共信息', {});
  10. return false;
  11. });
  12. // 初始化表格参数配置
  13. Table.api.init({
  14. extend: {
  15. index_url: 'gdtaccount/index',
  16. add_url: 'gdtaccount/add',
  17. del_url: 'gdtaccount/del',
  18. table: 'gdt_account',
  19. }
  20. });
  21. var table = $("#table");
  22. // 初始化表格
  23. table.bootstrapTable({
  24. url: $.fn.bootstrapTable.defaults.extend.index_url,
  25. pk: 'id',
  26. sortName: 'id',
  27. search:false,
  28. commonSearch: false,
  29. columns: [
  30. [
  31. {checkbox: true},
  32. {field: 'id', title: __('Id')},
  33. {field: 'account_id', title: __('投放账号ID')},
  34. {field: 'updatetime', title: __('绑定时间'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  35. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  36. ]
  37. ]
  38. });
  39. $(function () {
  40. $(document).on('click', ".layui-layer-close", function () {
  41. //刷新页面
  42. table.bootstrapTable('refresh');
  43. });
  44. });
  45. // 为表格绑定事件
  46. Table.api.bindevent(table);
  47. },
  48. add: function () {
  49. Controller.api.bindevent();
  50. },
  51. edit: function () {
  52. Controller.api.bindevent();
  53. },
  54. callbacktime: function () {
  55. Controller.api.bindevent();
  56. },
  57. api: {
  58. bindevent: function () {
  59. Form.api.bindevent($("form[role=form]"));
  60. },
  61. }
  62. };
  63. return Controller;
  64. });