synthesis.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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: 'user/synthesis/index' + location.search + "&ids=" + Config.ids,
  8. table: 'user_synthesis',
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'id',
  16. sortName: 'id',
  17. columns: [
  18. [
  19. {checkbox: true},
  20. {field: 'users.address', title: __('User_id')},
  21. {field: 'num', title: __('Num')},
  22. {field: 'note', title: __('详情订单ID'), align: 'left', formatter:function (value, row, index) {
  23. //console.log(JSON.parse(value.replace(/"/g, '"')),"======");
  24. var note = Object.values(JSON.parse(value.replace(/"/g, '"')))
  25. var str = "";
  26. note.forEach(function(item,index){
  27. str += "<p>" + JSON.stringify(item[0].new_order) + "</p>";
  28. });
  29. return str;
  30. }
  31. },
  32. ]
  33. ]
  34. });
  35. // 为表格绑定事件
  36. Table.api.bindevent(table);
  37. },
  38. api: {
  39. bindevent: function () {
  40. Form.api.bindevent($("form[role=form]"));
  41. }
  42. }
  43. };
  44. return Controller;
  45. });