123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'match/matchvoice/index' + location.search,
- multi_url: 'match/matchvoice/multi',
- import_url: 'match/matchvoice/import',
- table: 'match_voice',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'user.u_id', title: __('User.u_id')},
- {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
- {field: 'matchtype.name', title: __('Matchtype.name'), operate: 'LIKE'},
- {field: 'voice', title: __('Voice'), operate: 'LIKE',
- formatter: function (value, row, index) {
- if (value) {
- return "<audio src='"+row.voice+"' style='width:250px;height:30px;' controls='controls'>Your browser does not support the audio element.</audio>";
- }
- }
- },
- {field: 'voice_time', title: __('Voice_time'), operate:'LIKE'},
- {field: 'voice_detail', title: __('Voice_detail'), operate: 'LIKE'},
- {field: 'best_partner', title: __('Best_partner'), operate: 'LIKE'},
- {field: 'reliability', title: __('Reliability')},
- {field: 'commont', title: __('Commont'), operate: 'LIKE'},
- {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|