|
@@ -174,7 +174,7 @@
|
|
|
filterable
|
|
filterable
|
|
|
multiple-limit="3"
|
|
multiple-limit="3"
|
|
|
:placeholder=" readonly ? '' : '请选择调班班次'"
|
|
:placeholder=" readonly ? '' : '请选择调班班次'"
|
|
|
- @change="vaildBanci($event, scope.row, scope.$index)"
|
|
|
|
|
|
|
+ @change="vaildBanci($event, scope.row, beforeDateList, 'before')"
|
|
|
>
|
|
>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in scope.row.beforeShiftList"
|
|
v-for="item in scope.row.beforeShiftList"
|
|
@@ -262,7 +262,7 @@
|
|
|
filterable
|
|
filterable
|
|
|
multiple-limit="3"
|
|
multiple-limit="3"
|
|
|
:placeholder=" readonly ? '' : '请选择目标班次'"
|
|
:placeholder=" readonly ? '' : '请选择目标班次'"
|
|
|
- @change="vaildBanci($event, scope.row, scope.$index)"
|
|
|
|
|
|
|
+ @change="vaildBanci($event, scope.row, afterDateList, 'after')"
|
|
|
>
|
|
>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in scope.row.afterShiftList"
|
|
v-for="item in scope.row.afterShiftList"
|
|
@@ -447,6 +447,8 @@ export default {
|
|
|
const sql = 'select * from t_adjustment_detail where status_ in ( "待审核", "审核中", "待审批") and parent_id_ in (select id_ from t_adjustment where schedule_id_ = ' + scheduleId + ' )'
|
|
const sql = 'select * from t_adjustment_detail where status_ in ( "待审核", "审核中", "待审批") and parent_id_ in (select id_ from t_adjustment where schedule_id_ = ' + scheduleId + ' )'
|
|
|
const res = await self.$common.request('sql', sql) // 获取当前审核状态中的申请单数据
|
|
const res = await self.$common.request('sql', sql) // 获取当前审核状态中的申请单数据
|
|
|
self.blockList = self.getBlockResult(res.variables.data || [], 'default')
|
|
self.blockList = self.getBlockResult(res.variables.data || [], 'default')
|
|
|
|
|
+ // 清除列表中被申请数据
|
|
|
|
|
+ this.vaildExpireData(self.blockList)
|
|
|
},
|
|
},
|
|
|
clearSchedule () { // 清空操作 清空排班数据
|
|
clearSchedule () { // 清空操作 清空排班数据
|
|
|
this.formData.adjustList = []
|
|
this.formData.adjustList = []
|
|
@@ -509,35 +511,36 @@ export default {
|
|
|
/** 校验数据中有无日期过期或班次被锁定数据,有则清空该条数据
|
|
/** 校验数据中有无日期过期或班次被锁定数据,有则清空该条数据
|
|
|
*
|
|
*
|
|
|
* @param dateList 已经过滤的数据
|
|
* @param dateList 已经过滤的数据
|
|
|
- */
|
|
|
|
|
- vaildExpireData (dateList) {
|
|
|
|
|
|
|
+ * */
|
|
|
|
|
+ vaildExpireData (blockList) {
|
|
|
this.formData.adjustList.forEach((adjustItem) => {
|
|
this.formData.adjustList.forEach((adjustItem) => {
|
|
|
- const beforeDateObj = dateList.find((date) => date.value === adjustItem.beforeDate)
|
|
|
|
|
- const afterDateObj = dateList.find((date) => date.value === adjustItem.afterDate)
|
|
|
|
|
- if (beforeDateObj && beforeDateObj.disabled) {
|
|
|
|
|
- this.$message.warning('调班日期【' + adjustItem.beforeDate + '】已过期或已被申请,请重新选择')
|
|
|
|
|
- adjustItem.beforeDate = ''
|
|
|
|
|
- adjustItem.beforeAdjust = []
|
|
|
|
|
- } else if (afterDateObj && afterDateObj.disabled) {
|
|
|
|
|
- this.$message.warning('目标日期【' + adjustItem.afterDate + '】已过期或已被申请,请重新选择')
|
|
|
|
|
- adjustItem.afterDate = ''
|
|
|
|
|
- adjustItem.afterAdjust = []
|
|
|
|
|
- } else {
|
|
|
|
|
- // 校验beforeAdjust中的数据是否在对应dateList数据的banci中
|
|
|
|
|
- adjustItem.beforeAdjust.forEach((banciValue) => {
|
|
|
|
|
- const beforeDateMatch = dateList.find((date) => date.value === adjustItem.beforeDate && date.banci.includes(banciValue))
|
|
|
|
|
- if (beforeDateMatch) {
|
|
|
|
|
- this.$message.warning('调班班次【' + banciValue + '】已被申请,请重新选择')
|
|
|
|
|
- adjustItem.beforeAdjust = adjustItem.beforeAdjust.filter(item => item !== banciValue)
|
|
|
|
|
|
|
+ const createBy = adjustItem.createBy
|
|
|
|
|
+ if (blockList[createBy]) {
|
|
|
|
|
+ const blockListForUser = blockList[createBy] // 锁定数据中用户数据
|
|
|
|
|
+ const beforeDate = adjustItem.beforeDate
|
|
|
|
|
+ blockListForUser.forEach((blockEntry) => {
|
|
|
|
|
+ if (blockEntry.value === beforeDate) {
|
|
|
|
|
+ const banci = blockEntry.banci
|
|
|
|
|
+ if (adjustItem.beforeAdjust.includes(banci)) {
|
|
|
|
|
+ const nameObj = this.scheduleInfo.scheduleShift.find(obj => obj.alias === banci)
|
|
|
|
|
+ this.$message.warning(adjustItem.beforeDate + '调班班次【' + nameObj?.name + '】已被申请,请重新选择')
|
|
|
|
|
+ adjustItem.beforeAdjust = adjustItem.beforeAdjust.filter(item => item !== banci)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- // 校验afterAdjust中的数据是否在对应dateList数据的banci中
|
|
|
|
|
- adjustItem.afterAdjust.forEach((banciValue) => {
|
|
|
|
|
- const afterDateMatch = dateList.find((date) => date.value === adjustItem.afterDate && date.banci.includes(banciValue))
|
|
|
|
|
- if (afterDateMatch) {
|
|
|
|
|
- this.$message.warning('目标班次【' + banciValue + '】已被申请,请重新选择')
|
|
|
|
|
- adjustItem.afterAdjust = adjustItem.afterAdjust.filter(item => item !== banciValue)
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ const party = adjustItem.party
|
|
|
|
|
+ if (blockList[party]) {
|
|
|
|
|
+ const blockListForUser = blockList[party] // 锁定数据中用户数据
|
|
|
|
|
+ const afterDate = adjustItem.afterDate
|
|
|
|
|
+ blockListForUser.forEach((blockEntry) => {
|
|
|
|
|
+ if (blockEntry.value === afterDate) {
|
|
|
|
|
+ const banci = blockEntry.banci
|
|
|
|
|
+ if (adjustItem.afterAdjust.includes(banci)) {
|
|
|
|
|
+ const nameObj = this.scheduleInfo.scheduleShift.find(obj => obj.alias === banci)
|
|
|
|
|
+ this.$message.warning(adjustItem.afterDate + '目标班次【' + nameObj?.name + '】已被申请,请重新选择')
|
|
|
|
|
+ adjustItem.afterAdjust = adjustItem.afterAdjust.filter(item => item !== banci)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -547,8 +550,9 @@ export default {
|
|
|
// 校验调班那天是否有重复班次
|
|
// 校验调班那天是否有重复班次
|
|
|
if (this.reScheduleValue === 'diaoban' && chooseArr.length > 0) {
|
|
if (this.reScheduleValue === 'diaoban' && chooseArr.length > 0) {
|
|
|
const duplicateElements = [] // 用户重复班次数组
|
|
const duplicateElements = [] // 用户重复班次数组
|
|
|
|
|
+ const userAfterData = this.beforeDateList.find(obj => obj.value === row.afterDate)
|
|
|
row.afterAdjust.some(element => {
|
|
row.afterAdjust.some(element => {
|
|
|
- if (row.beforeShiftList.find(item => item.alias === element)) {
|
|
|
|
|
|
|
+ if (userAfterData.banci.includes(element)) {
|
|
|
duplicateElements.push(element)
|
|
duplicateElements.push(element)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -563,8 +567,9 @@ export default {
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
const partyElements = []// 目标人员重复班次数组
|
|
const partyElements = []// 目标人员重复班次数组
|
|
|
|
|
+ const partyBeforeData = this.afterDateList.find(obj => obj.value === row.beforeDate)
|
|
|
row.beforeAdjust.some(element => {
|
|
row.beforeAdjust.some(element => {
|
|
|
- if (row.afterShiftList.find(item => item.alias === element)) {
|
|
|
|
|
|
|
+ if (partyBeforeData.banci.includes(element)) {
|
|
|
partyElements.push(element)
|
|
partyElements.push(element)
|
|
|
}
|
|
}
|
|
|
return false
|
|
return false
|
|
@@ -576,7 +581,7 @@ export default {
|
|
|
}).filter(Boolean).join(', ')
|
|
}).filter(Boolean).join(', ')
|
|
|
// 把该重复元素从目标班次删除
|
|
// 把该重复元素从目标班次删除
|
|
|
row.beforeAdjust = row.beforeAdjust.filter(item => !partyElements.includes(item))
|
|
row.beforeAdjust = row.beforeAdjust.filter(item => !partyElements.includes(item))
|
|
|
- this.$message.warning(row.afterDate + '目标人员已有【' + val + '】班次,不能作为调班班次!')
|
|
|
|
|
|
|
+ this.$message.warning(row.beforeDate + '目标人员已有【' + val + '】班次,不能作为调班班次!')
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -646,11 +651,11 @@ export default {
|
|
|
const filterBList = bList[filterid] || []
|
|
const filterBList = bList[filterid] || []
|
|
|
const { startDate } = this.scheduleInfo
|
|
const { startDate } = this.scheduleInfo
|
|
|
// 将日期在今天之前的排班也锁定
|
|
// 将日期在今天之前的排班也锁定
|
|
|
- dateList.forEach((el) => {
|
|
|
|
|
- if (this.equalDate(el.value)) {
|
|
|
|
|
- el.disabled = true
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // dateList.forEach((el) => {
|
|
|
|
|
+ // if (this.equalDate(el.value)) {
|
|
|
|
|
+ // el.disabled = true
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
filterBList.forEach((el) => {
|
|
filterBList.forEach((el) => {
|
|
|
const index = this.getDays(startDate, el.value)
|
|
const index = this.getDays(startDate, el.value)
|
|
|
if (dateList[index].value === el.value && dateList[index].disabled !== true) {
|
|
if (dateList[index].value === el.value && dateList[index].disabled !== true) {
|
|
@@ -675,9 +680,12 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
console.log('已过滤日期班次:', dateList)
|
|
console.log('已过滤日期班次:', dateList)
|
|
|
- this.vaildExpireData(dateList) // 检验有无过期数据
|
|
|
|
|
return dateList
|
|
return dateList
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param data 被锁定的数据
|
|
|
|
|
+ * @param type 类型区分是初始化时还是编辑中,因为初始化数据的字段和编辑行的不一致
|
|
|
|
|
+ */
|
|
|
getBlockResult (data, type) {
|
|
getBlockResult (data, type) {
|
|
|
if (data.length < 1) {
|
|
if (data.length < 1) {
|
|
|
return {}
|
|
return {}
|