单个用户删除

This commit is contained in:
fengjh5 2024-04-16 16:38:05 +08:00
parent 0717611f4c
commit 8aad24dc1f
4 changed files with 34 additions and 1 deletions

View File

@ -201,6 +201,15 @@ class User extends CI_Controller
echo json_encode($data); echo json_encode($data);
} }
//单个停用用户
public function deleteUser()
{
$userId = $this->input->post('userId');
$this->tb_user->update(array('enabled' => -99), array('id' => $userId));
$data = array('success' => true, 'msg' => '已经删除用户');
echo json_encode($data);
}
public function userExcel() public function userExcel()
{ {
$this->load->model('dininghall_model'); $this->load->model('dininghall_model');

View File

@ -97,7 +97,7 @@
</div><!-- /.row --> </div><!-- /.row -->
<div class="row col-md-6 upload_div"> <div class="row col-md-6 upload_div">
<p class="file_title">批量停用用户 <a href="<?=site_url("uploadfiles/excle/订餐系统标准版停用用户模板.xlsx")?>" class="btn btn-info btn-xs"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> 模版下载</a></p> <p class="file_title">批量删除用户 <a href="<?=site_url("uploadfiles/excle/订餐系统标准版停用用户模板.xlsx")?>" class="btn btn-info btn-xs"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> 模版下载</a></p>
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
<label class="label_title">导入EXCEL模板</label> <label class="label_title">导入EXCEL模板</label>

View File

@ -454,5 +454,28 @@ $userTypeList = isset($userTypeList) ? $userTypeList : array();
}) })
} }
// 用户删除
function deleteUser(userId,username) {
var userConfirmation = window.confirm(username+"用户删除后将不可恢复,请确认!");
if (userConfirmation) {
// 用户点击了确定
$.post("<?= site_url('user/deleteUser') ?>", {
'userId': userId
}, function(data) {
var data = JSON.parse(data);
if (typeof(data.success) != "undefined") {
$.zui.messager.show(data.msg);
if (data.success) getListByPage(currPage);
}
});
} else {
// 用户点击了取消
$.zui.messager.show("取消了删除操作。");
}
}
</script> </script>

View File

@ -51,6 +51,7 @@ $userList = isset($userList) ? $userList : array();
<?php if ($user['enabled'] == 0) : ?> <?php if ($user['enabled'] == 0) : ?>
<button type="button" class="btn btn-sm btn-primary" onclick="setEnabled(<?= $user['id'] ?>, 1)">恢复</button> <button type="button" class="btn btn-sm btn-primary" onclick="setEnabled(<?= $user['id'] ?>, 1)">恢复</button>
<?php endif; ?> <?php endif; ?>
<button type="button" class="btn btn-sm btn-danger" onclick="deleteUser(<?= $user['id'] ?>, '<?= $user['username'] ?>',0)">删除</button>
</td> </td>
</tr> </tr>
<?php $i++; <?php $i++;