Просмотр исходного кода

文印通知,会议室预约时间,项目客户联系人调整

sangwenwei 8 месяцев назад
Родитель
Сommit
5ac5fef5a3

+ 52 - 8
src/views/jy/daily/MeetingRoomForm.vue

@@ -107,7 +107,9 @@
 				},
 				baseKey: '',
 				keyWatch: '',
-				dateList:[]
+				dateList:[],
+				endTime:'',
+				timeSlots:[], //开始时间与结束时间之间的时间点
 			}
 		},
 		MeetingRoom:null,
@@ -294,18 +296,36 @@
 							throw new Error()
 						}
 					}
-					if (this.commonJS.isNotEmpty(this.inputForm.startTime)){
-						console.log('this.dateList',this.dateList)
-						for (let i = 0; i <this.dateList.length ; i++) {
-							if (this.dateList[i].disabled === true && this.dateList[i].value === this.inputForm.startTime){
-								this.loading = false
-								this.$message.error('会议室当前无空余,请选择其他时间')
-								throw new Error()
+					if (this.commonJS.isNotEmpty(this.inputForm.startTime)) {
+						this.calculateEndTime(); // 计算结束时间
+						console.log('this.dateList', this.dateList);
+						console.log('this.endTime', this.endTime);
+						console.log('this.inputForm.startTime', this.inputForm.startTime);
+
+						// 检查时间点
+						for (let i = 0; i < this.dateList.length; i++) {
+							const startTimeDisabled = this.dateList[i].disabled && this.dateList[i].value === this.inputForm.startTime;
+							const endTimeDisabled = this.dateList[i].disabled && this.dateList[i].value === this.endTime;
+
+							if (startTimeDisabled || endTimeDisabled) {
+								this.loading = false;
+								this.$message.error('会议室当前无空余,请选择其他时间');
+								throw new Error();
+							}
+
+							// 检查每个时间点是否被禁用
+							for (const time of this.timeSlots) {
+								if (this.dateList[i].disabled && this.dateList[i].value === time) {
+									this.loading = false;
+									this.$message.error('会议室当前无空余,请选择其他时间');
+									throw new Error();
+								}
 							}
 						}
 					}
 
 
+
 					// 送审  待审核
 					this.inputForm.status = '2'
 				} else if (status === 'agree') {
@@ -487,6 +507,30 @@
 				}
 
 
+			},
+			calculateEndTime() {
+				if (this.inputForm.startTime && this.inputForm.duration) {
+					const startTimeParts = this.inputForm.startTime.split(':');
+					const startHours = parseInt(startTimeParts[0]);
+					const startMinutes = parseInt(startTimeParts[1]);
+					const durationInMinutes = parseInt(this.inputForm.duration) * (this.inputForm.duration === '1' ? 60 : 30);
+
+					// 计算结束时间
+					let totalMinutes = startHours * 60 + startMinutes + durationInMinutes;
+					const endHours = Math.floor(totalMinutes / 60) % 24; // 考虑24小时制
+					const endMinutes = totalMinutes % 60;
+
+					// 格式化结束时间
+					this.endTime = `${endHours.toString().padStart(2, '0')}:${endMinutes.toString().padStart(2, '0')}:00`;
+					// 生成每隔半小时的时间点
+					this.timeSlots = [];
+					for (let m = 0; m <= totalMinutes; m += 30) {
+						const currentTotalMinutes = startHours * 60 + startMinutes + m;
+						const hours = Math.floor(currentTotalMinutes / 60) % 24; // 24小时制
+						const minutes = currentTotalMinutes % 60;
+						this.timeSlots.push(`${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:00`);
+					}
+				}
 			}
 
 		}

+ 3 - 1
src/views/jy/inscription/InscriptionForm.vue

@@ -241,7 +241,9 @@
 					projectList:[],
 					minister:'',
 					examiner:'',
-					approver:''
+					approver:'',
+					projectName:'',
+					no:'',
 				}
 				this.inputForm.id = id
 				console.log('this.inputForm.id', this.inputForm.id)

+ 12 - 1
src/views/jy/project/ProjectEdit.vue

@@ -18,7 +18,7 @@
 											:rules="[
 							   {required: true, message:'请选择合同情况', trigger:'blur'}
                  ]">
-								  <el-radio-group v-model="inputForm.contractStatus" class="ml-4">
+								  <el-radio-group v-model="inputForm.contractStatus" @change="changeStatus" class="ml-4">
 									  <el-radio label="1" size="large">有合同</el-radio> <el-radio label="0" size="large">无合同</el-radio>
 								  </el-radio-group>
 							  </el-form-item>
@@ -885,6 +885,17 @@
 					this.$refs.projectEiaForm.init('view', this.eiaId)
 				}
 			}
+		},
+		changeStatus(){
+			if (this.inputForm.contractStatus ==='0'){
+				this.inputForm.contractId = ''
+				this.inputForm.contractName = ''
+				this.inputForm.clientName = ''
+				this.inputForm.contractNo = ''
+				this.inputForm.contractType = ''
+				this.inputForm.contractTypeFirst = ''
+				this.inputForm.clientList=[]
+			}
 		}
     }
   }