From d36edfd7cae6047ab5f4558e7071778a2a29a58a Mon Sep 17 00:00:00 2001 From: nrd <1059938559@qq.com> Date: Tue, 17 Aug 2021 11:45:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=AE=A2=E6=88=BF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=20=E7=BC=96=E8=BE=91=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HMS/src/main/webapp/WEB-INF/jsp/houseList.jsp | 71 ++++++++++++------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/HMS/src/main/webapp/WEB-INF/jsp/houseList.jsp b/HMS/src/main/webapp/WEB-INF/jsp/houseList.jsp index 6978255..73c4e48 100644 --- a/HMS/src/main/webapp/WEB-INF/jsp/houseList.jsp +++ b/HMS/src/main/webapp/WEB-INF/jsp/houseList.jsp @@ -368,31 +368,54 @@ $('#houseEditFloorId').val(data.floorId); $('#houseEditState').val(data.state); }, yes: function (index, layero) { - $.ajax({ - url: "house/updateOneHouse", - dataType: "json", - data: { - houseId: $('#houseEditId').val(), - houseName: $('#houseEditName').val(), - amount: $('#houseEditAmount').val(), - price: $('#houseEditPrice').val(), - floorId: $('#houseEditFloorId').val(), - state: $('#houseEditState').val() - }, - success: function (data) { - if (data.code === 200) { - layer.msg("房间信息" + data.message, {icon: 1, time: 3000}, function () { - layer.close(index); - location.reload(); - }); - } else { - layer.msg("房间信息" + data.message + "请重试", {icon: 2, time: 3000}); + let houseEditId = $('#houseEditId').val(); + let houseEditName = $('#houseEditName').val(); + let houseEditAmount = $('#houseEditAmount').val(); + let houseEditPrice = $('#houseEditPrice').val(); + let houseEditFloorId = $('#houseEditFloorId').val(); + let houseEditState = $('#houseEditState').val(); + if (houseEditId.length == 0) { + layer.msg("房间ID不能为空!", {icon: 2, time: 3000}); + } else if (houseEditName.length === 0) { + layer.msg("房间名不能为空!", {icon: 2, time: 3000}); + } else if (houseEditAmount.length === 0) { + layer.msg("入住人数不能为空!", {icon: 2, time: 3000}); + } else if (houseEditPrice.length === 0) { + layer.msg("客房金额不能为空!", {icon: 2, time: 3000}); + } else if (houseEditFloorId.length === 0) { + layer.msg("楼层不能为空!", {icon: 2, time: 3000}); + } else if (houseEditState.length === 0) { + layer.msg("客房状态不能为空!", {icon: 2, time: 3000}); + } else if (houseEditId.length !== 0 && houseEditName.length !== 0 && houseEditAmount.length !== 0 && houseEditPrice.length !== 0 && houseEditFloorId.length !== 0 && houseEditState.length !== 0) { + + $.ajax({ + url: "house/updateOneHouse", + dataType: "json", + data: { + houseId: $('#houseEditId').val(), + houseName: $('#houseEditName').val(), + amount: $('#houseEditAmount').val(), + price: $('#houseEditPrice').val(), + floorId: $('#houseEditFloorId').val(), + state: $('#houseEditState').val() + }, + success: function (data) { + if (data.code === 200) { + layer.msg("房间信息" + data.message, {icon: 1, time: 3000}, function () { + layer.close(index); + location.reload(); + }); + } else { + layer.msg("房间信息" + data.message + "请重试", {icon: 2, time: 3000}); + } + }, + error: function (err) { + layer.msg('服务器走丢啦!', {icon: 7, time: 3000}); } - }, - error: function (err) { - layer.msg('服务器走丢啦!', {icon: 7, time: 3000}); - } - }); + }); + } else { + layer.msg("请先填写完整信息!", {icon: 2, time: 3000}); + } } }); break; -- GitLab