| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- define(['jquery', 'table', 'form'], function($, Table, Form) {
- var Controller = {
- items: function() {
- var url = window.location.href;
- var match = url.match(/[?&]id=(\d+)/);
- var id = match ? match[1] : 0;
- Table.init = { table_elem: '#currentTable', table_render_id: 'currentTable' };
- Table.render({
- init: Table.init,
- toolbar: ['refresh'],
- url: 'emailbroadcast/items?id=' + id,
- cols: [[
- {field:'id', width:80, title:'ID', sort:true},
- {field:'subscribe_id', width:100, title:'订阅ID'},
- {field:'email', minWidth:220, title:'邮箱'},
- {field:'lang', width:100, title:'语言'},
- {field:'status', width:100, title:'状态', templet:function(d){ var map={0:'待发送',1:'成功',2:'失败',9:'已跳过'}; return map[d.status] || d.status; }},
- {field:'response_code', width:130, title:'返回码'},
- {field:'response_msg', minWidth:260, title:'返回信息'},
- {field:'retry_count', width:100, title:'重试次数'},
- {field:'send_time', width:170, title:'发送时间', templet:function(d){ return d.send_time ? Table.formatter.datetime.call(this, d.send_time) : '-'; }},
- {field:'createtime', width:170, title:'创建时间', templet: Table.formatter.datetime}
- ]],
- page: {}
- });
- $('#searchBtn').on('click', function() {
- layui.table.reload('currentTable', { where: {
- email: $('#email').val(), status: $('#status').val()
- }, page: {curr: 1} });
- });
- $('#resetBtn').on('click', function() {
- $('#email,#status').val('');
- layui.form.render('select');
- layui.table.reload('currentTable', { where: {}, page: {curr: 1} });
- });
- Table.api.bindevent();
- Form.api.bindevent($('form.layui-form'));
- }
- };
- return Controller;
- });
|