123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- layui.use(['laypage', 'layer', 'table', 'element', 'form'], function () {
- var laypage = layui.laypage //分页
- , layer = layui.layer //弹层
- , table = layui.table //表格
- , element = layui.element //元素操作
- , form = layui.form;
- //第一个实例
- table.render({
- elem: '#emailList'
- , url: '/othermail/collecthomeform' //数据接口
- , method: 'post'
- , page: true //开启分页
- ,height:600
- , text: '数据加载中'
- , limit: 20
- , id: 'actionemail'
- , cols: [[ //表头
- {type: 'numbers'}
- , {field: 'email', title: '邮箱', align: 'center'}
- , {field: 'city_name', title: '区域', align: 'center'}
- , {field: 'name', title: '姓名', align: 'center'}
- , {fixed: 'right', title: '操作', width: 200, align: 'center', toolbar: '#operate'}
- ]]
- });
- //列表操作
- table.on('tool(emailList)', function (obj) {
- var layEvent = obj.event,
- data = obj.data;
- if (layEvent === 'edit') {
- layer.open({
- type: 2,
- title: '修改邮箱',
- area: ['600px', '500px'],
- content: '/othermail/collectedit?id=' + data.id, //iframe的url,no代表不显示滚动条
- end: function () {
- table.reload('actionemail');
- }
- });
- } else if (layEvent === 'del') {
- layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
- $.post('/othermail/collectdel', {'id': data.id}, function (data) {
- layer.msg(data.msg);
- table.reload('actionemail');
- })
- })
- }
- });
- var $ = layui.$, active = {
- addData: function () { //获取选中数据
- layer.open({
- type: 2,
- title: '添加邮箱',
- area: ['600px', '500px'],
- content: '/othermail/collectadd', //iframe的url,no代表不显示滚动条
- end: function () {
- table.reload('actionemail');
- }
- });
- },
- reload: function () {//搜索
- var form = pfgs_serialize($('form'));
- var name = '';
- var email = '';
- if (form.input_house == 'name') {
- name = form.input_house_text;
- } else if (form.input_house == 'email') {
- email = form.input_house_text;
- }
- table.reload('actionemail', {
- where: {
- name: name,
- email: email,
- city: form.input_city,
- },
- page: {
- curr: 1
- }
- }
- )
- },
- };
- $('.demoTable .layui-btn').on('click', function () {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- $('.imputSelect').find('input').removeAttr("readonly");
- //发件人设置
- form.on('submit(tijiao)', function (data) {
- $.post('/othermail/homemailform', {'data': data.field}, function (data) {
- layer.msg(data.msg);
- })
- return false;
- });
- //接受邮件测试
- form.on('submit(add_send_email)', function (data) {
- $.post('/othermail/testemail', {'data': data.field}, function (data) {
- layer.msg(data.msg);
- })
- return false;
- });
- //收件人添加
- form.on('submit(email_tijiao)', function (data) {
- $.post('/othermail/collectaddform', {'data': data.field}, function (data) {
- if (data.data != null) {
- layer.msg(ReturnInfo(data.data), {icon: 5});
- return;
- }
- layer.msg(data.msg);
- })
- return false;
- });
- //收件人修改
- form.on('submit(email_edit)', function (data) {
- $.post('/othermail/collecteditform', {'data': data.field}, function (data) {
- if (data.data != null) {
- layer.msg(ReturnInfo(data.data), {icon: 5});
- return;
- }
- layer.msg(data.msg);
- })
- return false;
- });
- });
|