【新增】代理商品池添加批量删除功能。

This commit is contained in:
jianweie code
2023-05-12 23:25:48 +08:00
parent 279e19ebb4
commit 104ccca605
3 changed files with 53 additions and 0 deletions

View File

@@ -390,6 +390,27 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
#endregion
#region ============================================================
// POST: Api/CoreCmsAgentGoods/DoBatchDelete/10,11,20
/// <summary>
/// 批量删除
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("批量删除")]
public async Task<AdminUiCallBack> DoBatchDelete([FromBody] FMArrayIntIds entity)
{
var jm = new AdminUiCallBack();
var bl = await _agentGoodsServices.DeleteByIdsAsync(entity.id);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
#endregion
}
}

View File

@@ -282,6 +282,13 @@
<param name="entity"></param>
<returns></returns>
</member>
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAgentGoodsController.DoBatchDelete(CoreCms.Net.Model.FromBody.FMArrayIntIds)">
<summary>
批量删除
</summary>
<param name="entity"></param>
<returns></returns>
</member>
<member name="T:CoreCms.Net.Web.Admin.Controllers.CoreCmsAgentGradeController">
<summary>
代理商等级设置表

View File

@@ -49,6 +49,7 @@
<script type="text/html" id="LAY-app-CoreCmsAgentGoods-pagebar">
<div class="layui-inline">
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i></button>
<button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="batchDelete"><i class="layui-icon layui-icon-delete"></i></button>
</div>
</script>
@@ -188,6 +189,9 @@
case 'addData':
doCreate();
break;
case 'batchDelete':
doBatchDelete(checkStatus);
break;
};
});
//监听工具条
@@ -392,6 +396,27 @@
});
}
//执行批量删除
function doBatchDelete(checkStatus) {
var checkData = checkStatus.data;
if (checkData.length === 0) {
return layer.msg('请选择要删除的数据');
}
layer.confirm('确定删除吗?删除后将无法恢复。',
function (index) {
var delidsStr = [];
layui.each(checkData,
function (index, item) {
delidsStr.push(item.id);
});
coreHelper.Post("Api/CoreCmsAgentGoods/DoBatchDelete", { id: delidsStr }, function (e) {
if (debug) { console.log(e); } //开启调试返回数据
table.reloadData('LAY-app-CoreCmsAgentGoods-tableBox');
layer.msg(e.msg);
});
});
}
//监听 表格复选框操作
layui.form.on('switch(switch_isEnable)', function (obj) {