添加批量删除推广限制功能

master
ELF 5 years ago
parent 69b09c582f
commit dc85bdb631

@ -168,7 +168,7 @@ class PromoteLimitRuleController extends ThinkController
'op_type' => 2,
'key' => $id,
'op_name' => '删除会长推广限制',
'url' => U('PresidentDeposit/records', ['id' => $id]),
'url' => U('PresidentDeposit/delete', ['id' => $id]),
'menu' => '推广员-推广员管理-推广限制-删除推广限制'
]);
@ -178,6 +178,31 @@ class PromoteLimitRuleController extends ThinkController
]);
}
public function batchDelete()
{
$ids = I('ids', []);
if (count($ids) == 0) {
$this->ajaxReturn([
'status' => 0,
'message' => '无选中项'
]);
}
M('promote_limit_rules', 'tab_')->where(['id' => ['in', $ids]])->delete();
addOperationLog([
'op_type' => 2,
'key' => implode(',', $ids),
'op_name' => '批量删除会长推广限制',
'url' => U('PresidentDeposit/batchDelete', ['ids' => implode(',', $ids)]),
'menu' => '推广员-推广员管理-推广限制-批量删除推广限制'
]);
$this->ajaxReturn([
'status' => 1,
'message' => '删除成功'
]);
}
public function getPromotesByCompany()
{
$companyId = I('company_id', 0);

@ -75,6 +75,7 @@
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PromoteLimitRule/records')}">搜索</a>
<a class="sch-btn" href="{:U('PromoteLimitRule/edit')}">添加</a>
<a class="sch-btn" href="javascript:;" id="batch-delete-btn">删除</a>
</div>
<!-- <div class="input-list">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>12,),I('get.')))}">导出</a>
@ -179,6 +180,27 @@
$("#search").click();
}
})
$('#batch-delete-btn').on({
click: function() {
var ids = getIds();
$.ajax({
url: '{:U("batchDelete")}',
type: 'post',
dataType: 'json',
data: {ids: ids},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
function getIds() {
var ids = [];
$('.ids:checked').each(function() {

Loading…
Cancel
Save