matchvoice.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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: 'match/matchvoice/index' + location.search,
  8. multi_url: 'match/matchvoice/multi',
  9. import_url: 'match/matchvoice/import',
  10. table: 'match_voice',
  11. }
  12. });
  13. var table = $("#table");
  14. // 初始化表格
  15. table.bootstrapTable({
  16. url: $.fn.bootstrapTable.defaults.extend.index_url,
  17. pk: 'id',
  18. sortName: 'id',
  19. columns: [
  20. [
  21. {checkbox: true},
  22. {field: 'id', title: __('Id')},
  23. {field: 'user.u_id', title: __('User.u_id')},
  24. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  25. {field: 'matchtype.name', title: __('Matchtype.name'), operate: 'LIKE'},
  26. {field: 'voice', title: __('Voice'), operate: 'LIKE',
  27. formatter: function (value, row, index) {
  28. if (value) {
  29. return "<audio src='"+row.voice+"' style='width:250px;height:30px;' controls='controls'>Your browser does not support the audio element.</audio>";
  30. }
  31. }
  32. },
  33. {field: 'voice_time', title: __('Voice_time'), operate:'LIKE'},
  34. {field: 'voice_detail', title: __('Voice_detail'), operate: 'LIKE'},
  35. {field: 'best_partner', title: __('Best_partner'), operate: 'LIKE'},
  36. {field: 'reliability', title: __('Reliability')},
  37. {field: 'commont', title: __('Commont'), operate: 'LIKE'},
  38. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. ]
  41. ]
  42. });
  43. // 为表格绑定事件
  44. Table.api.bindevent(table);
  45. },
  46. add: function () {
  47. Controller.api.bindevent();
  48. },
  49. edit: function () {
  50. Controller.api.bindevent();
  51. },
  52. api: {
  53. bindevent: function () {
  54. Form.api.bindevent($("form[role=form]"));
  55. }
  56. }
  57. };
  58. return Controller;
  59. });