123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'messages/note/index' + location.search,
- table: 'short_link',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id'),searchable:false},
- {field: 'code', title: __('Code'),searchable:false},
- {field: 'createdAt', title: '发送时间', operate:'RANGE', addclass:'datetimerange'},
- {field: 'overdueTime', title: '存储时间(天)',searchable:false},
- {field: 'phone', title: __('Phone')},
- {field: 'send_message', title:'是否已发送短信',formatter: Controller.api.formatter.send,searchable:false},
- {field: 'source', title: '短信发送时机',searchable:false,formatter: Controller.api.formatter.source},
- // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- formatter: {
- send: function (value) {
- switch (value) {
- case '1':
- return '是';
- case '0':
- return '否';
- default:
- return value;
- }
- },
- source: function (value) {
- switch (value) {
- case '1':
- return '生成检查';
- case '2':
- return '检查信息同步';
- case '3':
- return '报告信息同步';
- default:
- return value;
- }
- },
- }
- }
- };
- return Controller;
- });
|