123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'feedback_business/index' + location.search,
- add_url: 'feedback_business/add',
- edit_url: 'feedback_business/edit',
- del_url: 'feedback_business/del',
- multi_url: 'feedback_business/multi',
- import_url: 'feedback_business/import',
- table: 'feedback_business',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- search:false,
- searchFormVisible:true,
- columns: [
- [
- //{checkbox: true},
- {field: 'id', title: __('ID')},
- {field: 'type', title: __('Type'),searchList:{1:'个人',2:'公司'},formatter:Table.api.formatter.label},
- {field: 'name', title: __('Name')},
- {field: 'for', title: __('For'),searchList: {1:'直播合作',2:'学习直播',3:'卡商合作'},formatter:Table.api.formatter.label},
- {field: 'has_exp', title: __('Has_exp'),searchList: {1:'有',0:'无'},formatter:Table.api.formatter.label},
- {field: 'phone', title: __('手机号')},
- {field: 'is_read',title:'是否已读',searchList: {0:'未读',1:'已读'},formatter: Table.api.formatter.label},
- {field: 'create_time', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
- buttons:[
- {
- name:'detail',
- title:'设为已读',
- text: __('设为已读'),
- classname: 'btn btn-xs btn-danger btn-ajax',
- url: 'feedback_business/edit?a=1',
- visible:(row)=>{
- return row.is_read===0 && table.data('operate-read')
- },
- success(){
- $('.btn-refresh').trigger('click')
- }
- }
- ]
- }
- ]
- ]
- });
- // 为表格绑定事件
- 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;
- });
|