From e85be75bc6ce542b57d1e5f2dddae82ba92ea8c3 Mon Sep 17 00:00:00 2001 From: zhaocheng <578322713@qq.com> Date: Fri, 9 Sep 2022 12:35:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B8=85=E9=99=A4=E7=94=B5?= =?UTF-8?q?=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Index.php | 26 ++++++++++++++++++++++++++ app/view/index/index.html | 21 +++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/app/controller/Index.php b/app/controller/Index.php index 2f7fa0e..36ec575 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -258,6 +258,32 @@ class Index extends BaseController return json($this->json_data); } + /** + * 批量删除 + * @return Json + * @throws \Exception + */ + public function phoneReset() + { + // + $params = array_filter($this->request->param()); + $params_1 = $params; + unset($params_1['car_phone_empty'], $params['data_check'], $params['car_frame_check']); + if (empty($params_1)) { + $this->json_data['code'] = 0; + $this->json_data['msg'] = '搜索条件不能为空'; + return json($this->json_data); + } + $map = $this->getQueryCondition($params); + if($this->model->where($map)->update(['car_phone' => ''])){ + $this->json_data['msg'] = '请求成功'; + }else { + $this->json_data['code'] = 0; + $this->json_data['msg'] = '请求失败'; + } + return json($this->json_data); + } + /** * @param $id * @return Json diff --git a/app/view/index/index.html b/app/view/index/index.html index 656af34..4eb54b9 100644 --- a/app/view/index/index.html +++ b/app/view/index/index.html @@ -36,6 +36,7 @@ 重置条件 +
@@ -348,10 +349,13 @@ delete param_a['car_phone_empty']; delete param_a['car_frame_check']; delete param_a['data_check']; - if (Object.values(param_a).filter(data => data).length > 0) + if (Object.values(param_a).filter(data => data).length > 0) { $('#deletes-btn').css('display', 'inline-block') - else + $('#reset-car-phone').css('display', 'inline-block') + } else { $('#deletes-btn').css('display', 'none') + $('#reset-car-phone').css('display', 'none') + } }); $('#deletes-btn').on('click', function () { layer.confirm('真的删除行么', function(index){ @@ -366,6 +370,19 @@ }); }); }); + $('#reset-car-phone').on('click', function () { + layer.confirm('确认执行删除车主电话并继续', function(index){ + layer.close(index); + index = layer.load(); + //向服务端发送删除指令 + $.post('{:url("/index/phoneReset/")}', $('.layui-colla-content').find(':input').serialize(), function (ret) { + layer.close(index); + layer.msg(ret.msg, function () { + layui.table.reload('carInfo'); + }); + }); + }); + }); }); function task_create(type,id = 0){