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 = []