diff --git a/src/views/modules/scheduling/scheduling.vue b/src/views/modules/scheduling/scheduling.vue index 525ff0a..f405377 100644 --- a/src/views/modules/scheduling/scheduling.vue +++ b/src/views/modules/scheduling/scheduling.vue @@ -52,6 +52,32 @@ export default { itemList1: [], itemList2: [], roleList: [], + pickerOptionsMul: { + disabledDate: (time) => { + // if ( !Array.isArray(this.saveData.selectedDates)) { + // // 如果 selectedDates 是 null 或不是数组,返回默认的禁用逻辑 + // return time.getTime() > new Date().getTime(); + // } + // 禁止选择当前日期之后的时间 + // if (time.getTime() > new Date().getTime()) { + // return true; + // } + if (this.saveData.selectedDates==null){ + return false + } + + // 禁止选择除了已选择的日期之外的其他日期(如果已选择的日期数量达到最大限制) + if (this.saveData.selectedDates.length >= 31) { + // 检查传入的日期是否在已选择的日期数组中 + return !this.saveData.selectedDates.some(date => { + return date.getTime() == time.getTime(); + }); + } + + // 如果没有达到最大限制,允许选择任何日期 + return false; + } + }, queryParams: { site: '', classesCode:'', @@ -66,10 +92,11 @@ export default { purchaseOrderNo:'', isExport:'', exportBy:'', - exportTime:null, - status:'' + exportTime:null }, saveData:{ + selectedDates: [], + insertType:true, checkbox1: false, checkbox2: false }, @@ -80,7 +107,6 @@ export default { dataList: [], dataListHead:[], queryLoading: false, - saveErrorFlag: false, total:0, totalHead:0, queryLineRow:{}, @@ -278,6 +304,11 @@ export default { getPeopleList(){ this.insertSchedulingFlag = true this.recordAddPeoPleFlag = true + //默认查询 角色:机修人员 + let filterList = this.roleList.filter(item => item.roleName === '机修人员') + if (filterList.length > 0) { + this.$set(this.detailData, 'roleId', filterList[0].roleId) + } this.getOperatorList() this.fastAddFlag = true }, @@ -288,11 +319,6 @@ export default { } else { this.detailData.bu = this.saveData.bu } - //默认查询 角色:机修人员 - let filterList = this.roleList.filter(item => item.roleName === '机修人员') - if (filterList.length > 0) { - this.detailData.roleId = filterList[0].roleId - } // 查询人员 await getOperatorList(this.detailData).then(({data}) => { if (data && data.code === 0) { @@ -509,12 +535,18 @@ export default { }, saveScheduling(){ this.saveData = {} + this.$set(this.saveData,'selectedDates',[]) this.peopleList = [] this.classesList2 = [] this.saveSchedulingFlag = true; this.recordAddPeoPleFlag = false }, async saveHeaderFunction(){ + + if (this.saveData.insertType == null || this.saveData.insertType === ''){ + this.$message.warning("请选择新增类型") + return + } if (this.saveData.bu == null || this.saveData.bu === ''){ this.$message.warning("请选择BU") return @@ -523,18 +555,26 @@ export default { this.$message.warning("请选择班次") return } - if (this.saveData.startDate == null || this.saveData.startDate === ''){ - this.$message.warning("请选择开始日期") - return - } - if (this.saveData.endDate == null || this.saveData.endDate === ''){ - this.$message.warning("请选择结束日期") - return - } - if (this.saveData.endDate < this.saveData.startDate){ - this.$message.warning("结束日期不能小于开始日期") - return + if (this.saveData.insertType){ + if (this.saveData.startDate == null || this.saveData.startDate === ''){ + this.$message.warning("请选择开始日期") + return + } + if (this.saveData.endDate == null || this.saveData.endDate === ''){ + this.$message.warning("请选择结束日期") + return + } + if (this.saveData.endDate < this.saveData.startDate){ + this.$message.warning("结束日期不能小于开始日期") + return + } + }else { + if (this.saveData.selectedDates == null || this.saveData.selectedDates.length < 1){ + this.$message.warning("请选择具体日期") + return + } } + this.queryLoading= true; let tempData = { ...this.saveData, @@ -543,17 +583,12 @@ export default { await saveSchedulingHeader(tempData).then(({data})=>{ if (data.code==0){ this.$message.success(data.msg) - this.queryLoading = false - } else { + this.saveSchedulingFlag = false; + }else{ this.$message.error(data.msg) - this.saveErrorFlag = true - this.queryLoading = false } + }).catch(()=>{ }) - if (this.saveErrorFlag){ - return - } - this.saveSchedulingFlag = false; this.queryLoading = false this.handleQuery(); }, @@ -574,6 +609,11 @@ export default { this.itemSelections1 = null this.itemSelections2 = null this.itemList2 = this.peopleList + //默认查询 角色:机修人员 + let filterList = this.roleList.filter(item => item.roleName === '机修人员') + if (filterList.length > 0) { + this.$set(this.detailData, 'roleId', filterList[0].roleId) + } this.getOperatorList() this.fastAddFlag = true }, @@ -812,7 +852,7 @@ export default { - + + + + + + + + + - + 包含周日 + + + + + + 新增