From 1be6eb74c6c42322be779da75bc7c06c9a4d1946 Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Wed, 4 Dec 2024 09:49:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/dealStringArray.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/utils/dealStringArray.js b/src/utils/dealStringArray.js index 12b962a..970dfac 100644 --- a/src/utils/dealStringArray.js +++ b/src/utils/dealStringArray.js @@ -45,6 +45,8 @@ export const transfer = (val, arr, isAvailableArr) => { let timeSlotArr = [] let numberRangeArr = [] + let cnt = 0 + let k = 0 for (var i = 0; i < val.length; i ++ ) { for (var j = 0; j < val[i].length; j ++ ) { if(isNotValid(arr[i][j])) { @@ -56,10 +58,27 @@ export const transfer = (val, arr, isAvailableArr) => { newArr[i].timeSlot = "00:00-00:00" newArr[i].numberRange = "(0,0)" newArr[i].isAvailable = 0 + k ++ + cnt ++ }else{ newArr[i].timeSlot = timeSlotArr.join(';') newArr[i].numberRange = numberRangeArr.join(';') newArr[i].isAvailable = isAvailableArr[i] ? 1 : 0 + if(!isAvailableArr[i]) k ++ + } + if(cnt == 4) { + ElMessage({ + type: 'error', + message: '至少得有一个预约时间段' + }) + return ; + } + if(k == 4) { + ElMessage({ + type: 'error', + message: '至少有一天可以预约' + }) + return ; } timeSlotArr = [] numberRangeArr = []