超管后台增加一键发送

This commit is contained in:
meimei
2025-04-17 17:36:10 +08:00
parent bf50e4f3a2
commit 9df07e2f23
13 changed files with 707 additions and 1 deletions

View File

@@ -237,11 +237,138 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
edit: function () {
Controller.api.bindevent();
},
massagesindex: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'firmcustomer/index' + location.search,
add_url: 'firmcustomer/add',
edit_url: 'firmcustomer/edit',
del_url: 'firmcustomer/del',
import_url: 'firmcustomer/import',
massagesindex_url: 'firmcustomer/massagesindex'+ location.search,
table: 'firmcustomer',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.massagesindex_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
pageSize: 200,
pageList:[200,300],
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Customer_name'), operate: 'LIKE'},
{field: 'gm_status', title: '发送状态', },
{field: 'send_time', title: '发送时间',},
{field: 'phone', title: __('Phone'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'rel_wx', title: __('Rel_wx'), operate: 'LIKE'},
{field: 'rel_group', title: __('Rel_group'), operate: 'LIKE'},
{field: 'firmstoreprojectstwo.name', title: __('Firmstoreprojectstwo.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firmcustomerorigin.name', title: __('Firmcustomerorigin.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firmtags_ids', title: __('Firmtags_ids'), operate: 'LIKE'},
{field: 'remark', title: __('Remark'), operate: 'LIKE'},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
$('#submitButton').on('click', function () {
// 获取多选的数据
var rows = $('#table').bootstrapTable('getSelections');
var ids = [];
rows.forEach(function (row) {
ids.push(row.id);
});
var url = 'groupmessages/add?ids=' + ids.join(',');
Fast.api.open(url);
});
},
massagesindexnot: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'firmcustomer/index' + location.search,
add_url: 'firmcustomer/add',
edit_url: 'firmcustomer/edit',
del_url: 'firmcustomer/del',
import_url: 'firmcustomer/import',
massagesindexnot_url: 'firmcustomer/massagesindexnot'+ location.search,
table: 'firmcustomer',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.massagesindexnot_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
pageSize: 200,
pageList:[200,300],
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Customer_name'), operate: 'LIKE'},
{field: 'phone', title: __('Phone'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'rel_wx', title: __('Rel_wx'), operate: 'LIKE'},
{field: 'rel_group', title: __('Rel_group'), operate: 'LIKE'},
{field: 'firmstoreprojectstwo.name', title: __('Firmstoreprojectstwo.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firmcustomerorigin.name', title: __('Firmcustomerorigin.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firmtags_ids', title: __('Firmtags_ids'), operate: 'LIKE'},
{field: 'remark', title: __('Remark'), operate: 'LIKE'},
{field: 'responsible_pm', title: __('Responsible_pm'), operate: 'LIKE'},
{field: 'status', title: __('Status'), searchList: {"yes":__('Status yes'),"no":__('Status no')}, formatter: Table.api.formatter.status},
{field: 'admin_id', title: __('责任人'), operate: 'LIKE'},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
$('#submitButton').on('click', function () {
// 获取多选的数据
var mess_id = $('#mess_id').val();
var rows = $('#table').bootstrapTable('getSelections');
var ids = [];
rows.forEach(function (row) {
ids.push(row.id);
});
$.post('groupmessages/addagain', {customer_ids: ids.join(','),mess_id:mess_id}, function (res) {
if (res.code == 1){
layer.msg('发送成功',function (){
location.reload();
},300);
}else {
layer.msg(res.msg);
}
});
});
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
},
};
return Controller;
});

View File

@@ -0,0 +1,85 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'groupmessages/index' + location.search,
add_url: 'groupmessages/add',
edit_url: 'groupmessages/edit',
del_url: 'groupmessages/del',
multi_url: 'groupmessages/multi',
import_url: 'groupmessages/import',
table: 'groupmessages',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'messages_content', title: __('messages_content'),},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'admin_name', title: __('Admin_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons: [
{
name: 'addSendTime',
text: __('已发送客户'),
title: __('已发送客户'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-magic',
url: 'firmcustomer/massagesindex?type=1',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
{
name: 'addSendTime',
text: __('未发送客户'),
title: __('未发送客户'),
classname: 'btn btn-xs btn-danger btn-dialog',
icon: 'fa fa-magic',
url: 'firmcustomer/massagesindexnot?type=1',
callback: function (data) {
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
},
visible: function (row) {
//返回true时按钮显示,返回false隐藏
return true;
}
},
]}
]
]
});
// 为表格绑定事件
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;
});