Fn(dateAr) { for (let k in dateAr) { if (!this.judege(k)) { return false } } return true }, judege(idx) { let dateAr = this.sellerTimeJson for (let k in dateAr) { if (idx !== k) { if (dateAr[k].sellerStartTime <= dateAr[idx].sellerStartTime && dateAr[k].sellerEndTime > dateAr[idx].sellerStartTime) { return false } if (dateAr[k].sellerStartTime < dateAr[idx].sellerEndTime && dateAr[k].sellerEndTime >= dateAr[idx].sellerEndTime) { return false } } } return true },
let ishasCopy = _this.Fn(this.sellerTimeJson) console.log(ishasCopy) if (!ishasCopy) { this.$message({ message: '请检查营业时间是否有重叠或结束时间是否大于开始时间!', type: 'warning', }) this.subLoading = false return }
this.sellerTimeJson=[{
sellerStartTime:"08:00", sellerEndTime:"09:00"},
{
sellerStartTime:"07:00", sellerEndTime:"09:00"}
]
标签:return,重叠,sellerEndTime,dateAr,js,idx,时间段,false,sellerStartTime From: https://www.cnblogs.com/shuihanxiao/p/17482740.html