Commit 20b88ee1 authored by 高宇's avatar 高宇

领用

parent e5cc4531
......@@ -520,6 +520,16 @@ export default {
this.getCodeDict()
},
methods: {
// 判断是否跟列表中的第一个是否相同
isSameMonths(dateArray, data) {
for (let i = 0; i < dateArray.length; i++) {
if (dateArray[i].getMonth() !== data.getMonth()) {
console.log('111')
return false
}
}
return true
},
// 判断日期是否相同
isSameMonthDates(datesArray) {
console.log('datesArray', datesArray)
......@@ -531,7 +541,11 @@ export default {
const firstMonth = datesArray[0].getMonth()
// 遍历数组中的日期,检查月份是否都相同
for (let i = 1; i < datesArray.length; i++) {
console.log('222')
console.log('getMonth', datesArray[i].getMonth())
console.log('firstMonth', firstMonth)
if (datesArray[i].getMonth() !== firstMonth) {
console.log('111')
return false
}
}
......@@ -557,6 +571,18 @@ export default {
})
console.log('i', i)
console.log('number', number)
// 如果选中一个的话,校验是否跟列表中的第一个时间是否相同
if (number === 1) {
var oneCheckTimeList = []
list1.forEach(item => {
oneCheckTimeList.push(new Date(item.rkDate))
})
if (this.isSameMonths(oneCheckTimeList, new Date(list2[0].createDate))) {
return false
} else {
return true
}
}
if (i === number) {
console.log('1false')
return false
......@@ -564,7 +590,7 @@ export default {
list1.forEach(item => {
checkTimeList.push(new Date(item.rkDate))
})
if (this.isSameMonthDates(checkTimeList)) {
if (this.isSameMonths(checkTimeList, new Date(list2[0].createDate))) {
console.log('2false')
return false
} else {
......
......@@ -564,6 +564,16 @@ export default {
this.getList()
},
methods: {
// 判断是否跟列表中的第一个是否相同
isSameMonths(dateArray, data) {
for (let i = 0; i < dateArray.length; i++) {
if (dateArray[i].getMonth() !== data.getMonth()) {
console.log('111')
return false
}
}
return true
},
// 判断日期是否相同
isSameMonthDates(datesArray) {
console.log('datesArray', datesArray)
......@@ -583,7 +593,7 @@ export default {
return true
},
// 符合弹出权限菜单时返回 true,不符合false
condition(list1, list2, number) {
condition(list1, list2, number,time) {
// 所有数据的id的集合
var idList = []
// 前选中的数量id的集合
......@@ -600,17 +610,24 @@ export default {
}
})
})
console.log('list1', list1)
console.log('checkIdList', checkIdList)
console.log('i', i)
console.log('number', number)
if (number === 1) {
var oneCheckTimeList = []
list1.forEach(item => {
oneCheckTimeList.push(new Date(item.rkDate))
})
if (this.isSameMonths(oneCheckTimeList, new Date(time))) {
return false
} else {
return true
}
}
if (i === number) {
return false
} else {
list1.forEach(item => {
checkTimeList.push(new Date(item.rkDate))
})
if (this.isSameMonthDates(checkTimeList)) {
if (this.isSameMonths(checkTimeList, new Date(time))) {
return false
} else {
return true
......@@ -804,8 +821,14 @@ export default {
this.openHandle = true
return this.$message.warning('您选择的设备数据不符合您申请设备的数量')
}
let checkTime = ''
if (this.radio1 === '2'){
checkTime = this.detailApplyList[0].recycleDate
} else if (this.radio1 === '1') {
checkTime = this.detailApplyList[0].createDate
}
// 判断是否弹出权限菜单,true是符合条件,false是不符合条件
if (this.condition(this.canceList, this.detailApplyList, this.singleDetails.pnumber)) {
if (this.condition(this.canceList, this.detailApplyList, this.singleDetails.pnumber,checkTime)) {
this.monthDate = true
this.openHandle = false
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment