فهرست منبع

时间段筛选

wangxin 6 ماه پیش
والد
کامیت
607e5561da

+ 70 - 38
pages/factoryInspection/index.vue

@@ -6,16 +6,23 @@
 			<!-- <uni-icons type="scan" size="24" /> -->
 		</view>
 
-		<view class="time-controls" style="margin-top: 10rpx;">
-			<uni-section title="检查日期:" type="square" class="uni-row sta">
-				<input v-model="startTime" type="date" @input="timeSizer" />
-			</uni-section>
+		<view class="time-controls"
+			style="margin-top: 10rpx;display: flex;margin-right: 0px;background-color: #ffffff;">
+			<view class="uni-row sta">
+				<span style="align-items: center;display: flex;font-size: 16px;margin-left: 12rpx;">检查日期:</span>
+				<view class="uni-row" style="flex: 1;width: 100%;">
+					<input v-model="startTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+					<span style="align-items: center;display: flex;">—</span>
+					<input v-model="endTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+				</view>
+			</view>
 		</view>
 		<view class="uni-row" style="margin-top: 10rpx;">
 			<view class="scan-btn " style="min-height: 80rpx;" @click.stop="handleAddOnSiteInspection">新增出厂检</view>
-			<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;margin-left: 24rpx;" @click.stop="handleScan">扫码</view>
+			<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;margin-left: 24rpx;"
+				@click.stop="handleScan">扫码</view>
 		</view>
-		
+
 		<view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
 			@click="handleSelection(item)">
 			<view class="lot-code uni-row">
@@ -82,6 +89,7 @@
 	const inspecionList = ref([]); //时间后筛选数组
 	const original = ref([]); //原始数组
 	const startTime = ref(new Date().toISOString().split("T")[0])
+	const endTime = ref(new Date().toISOString().split("T")[0])
 	const pageSize = ref(10)
 	const pageNum = ref(1)
 	const status = ref(true)
@@ -120,29 +128,29 @@
 		// 	}
 		// });
 	})
-	onReachBottom(()=>{
-			console.log(status.value)
-			if(status.value) {
+	onReachBottom(() => {
+		console.log(status.value)
+		if (status.value) {
 			pageNum.value += 1
 			quer.value.pageNum = pageNum.value
 			quer.value.pageSize = pageSize.value
-			getProcessInspecionList(quer.value).then(res =>{
-			 const existingIds = new Set(inspecionList.value.map(item => item.id));
-			
-			  // 过滤出那些不在 existingIds 中的项,即新数据
-			  const newRows = res.rows.filter(row => !existingIds.has(row.id));
-			
-			  // 如果有新数据,将其添加到 listData
-			  if (newRows.length > 0) {
-				inspecionList.value = inspecionList.value.concat(newRows);
-				original.value = original.value.concat(newRows);
-			  } else {
-				// 如果没有新数据,更新状态表示没有更多数据
-				status.value = false;
-			  }
+			getProcessInspecionList(quer.value).then(res => {
+				const existingIds = new Set(inspecionList.value.map(item => item.id));
+
+				// 过滤出那些不在 existingIds 中的项,即新数据
+				const newRows = res.rows.filter(row => !existingIds.has(row.id));
+
+				// 如果有新数据,将其添加到 listData
+				if (newRows.length > 0) {
+					inspecionList.value = inspecionList.value.concat(newRows);
+					original.value = original.value.concat(newRows);
+				} else {
+					// 如果没有新数据,更新状态表示没有更多数据
+					status.value = false;
+				}
 			})
-			}
-		})
+		}
+	})
 
 	/***************************** 定义了一些方法 *****************************/
 
@@ -156,24 +164,48 @@
 		pageNum.value = 1
 		quer.value.startTime = startTime.value;
 		quer.value.type = "factoryInspection"
+		quer.value.endTime = endTime.value;
 		quer.value.pageNum = pageNum.value
 		quer.value.pageSize = pageSize.value
-		getProcessInspecionList(quer.value).then(res => {
-			console.log("res", res);
-			if (res.code == 200) {
-				original.value = res.rows;
-				inspecionList.value = res.rows;
-				uni.hideLoading();
-			}
-		});
+		if (!checkTime(quer.value.startTime, quer.value.endTime)) {
+
+			uni.showToast({
+				icon: 'none',
+				title: "开始日期不能大于结束日期",
+				duration: 2000
+			})
+		} else {
+			getProcessInspecionList(quer.value).then(res => {
+				console.log("res", res);
+				if (res.code == 200) {
+					original.value = res.rows;
+					inspecionList.value = res.rows;
+					uni.hideLoading();
+				}
+			});
+		}
+
 	}
+
 	function handleSearch() {
 		pageNum.value = 1
 		status.value = true
 		getList()
 	}
+
+
+	//判断开始时间是否大于结束时间
+	function checkTime(time1, time2) {
+		let date1 = new Date(startTime.value);
+		let date2 = new Date(endTime.value);
+		if (date1 > date2) {
+			return false
+		}
+		return true
+	}
+
 	function delable(item) {
-		if(store.userInfo.roles.some(item =>item.roleKey == 'factoryInspection')) {
+		if (store.userInfo.roles.some(item => item.roleKey == 'factoryInspection')) {
 			return true
 		}
 		return false
@@ -211,7 +243,7 @@
 							})
 						}
 					})
-	
+
 				} else if (res.cancel) {
 					uni.showToast({
 						title: '已取消',
@@ -253,8 +285,8 @@
 			);
 		} else {
 			// 测试时用
-				quer.value.keyword = ""
-				getList()
+			quer.value.keyword = ""
+			getList()
 		}
 	}
 
@@ -407,7 +439,7 @@
 		align-items: center;
 		justify-content: center;
 		border-radius: 8rpx;
-		flex:1;
+		flex: 1;
 	}
 
 	.daywork-item {

+ 69 - 38
pages/firstInspection/index.vue

@@ -6,16 +6,23 @@
 			<!-- <uni-icons type="scan" size="24" /> -->
 		</view>
 
-		<view class="time-controls" style="margin-top: 10rpx;">
-			<uni-section title="检查日期:" type="square" class="uni-row sta">
-				<input v-model="startTime" type="date" @input="timeSizer" />
-			</uni-section>
+		<view class="time-controls"
+			style="margin-top: 10rpx;display: flex;margin-right: 0px;background-color: #ffffff;">
+			<view class="uni-row sta">
+				<span style="align-items: center;display: flex;font-size: 16px;margin-left: 12rpx;">检查日期:</span>
+				<view class="uni-row" style="flex: 1;width: 100%;">
+					<input v-model="startTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+					<span style="align-items: center;display: flex;">—</span>
+					<input v-model="endTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+				</view>
+			</view>
 		</view>
 		<view class="uni-row" style="margin-top: 10rpx;">
 			<view class="scan-btn " style="min-height: 80rpx;" @click.stop="handleAddFirstInspection">新增首件检</view>
-			<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;margin-left: 24rpx;" @click.stop="handleScan">扫码</view>
+			<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;margin-left: 24rpx;"
+				@click.stop="handleScan">扫码</view>
 		</view>
-		
+
 		<view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
 			@click="handleSelection(item)">
 			<view class="lot-code uni-row">
@@ -82,6 +89,7 @@
 	const inspecionList = ref([]); //时间后筛选数组
 	const original = ref([]); //原始数组
 	const startTime = ref(new Date().toISOString().split("T")[0])
+	const endTime = ref(new Date().toISOString().split("T")[0])
 	const pageSize = ref(10)
 	const pageNum = ref(1)
 	const status = ref(true)
@@ -120,29 +128,29 @@
 		// 	}
 		// });
 	})
-	onReachBottom(()=>{
-			console.log(status.value)
-			if(status.value) {
+	onReachBottom(() => {
+		console.log(status.value)
+		if (status.value) {
 			pageNum.value += 1
 			quer.value.pageNum = pageNum.value
 			quer.value.pageSize = pageSize.value
-			getProcessInspecionList(quer.value).then(res =>{
-			 const existingIds = new Set(inspecionList.value.map(item => item.id));
-			
-			  // 过滤出那些不在 existingIds 中的项,即新数据
-			  const newRows = res.rows.filter(row => !existingIds.has(row.id));
-			
-			  // 如果有新数据,将其添加到 listData
-			  if (newRows.length > 0) {
-				inspecionList.value = inspecionList.value.concat(newRows);
-				original.value = original.value.concat(newRows);
-			  } else {
-				// 如果没有新数据,更新状态表示没有更多数据
-				status.value = false;
-			  }
+			getProcessInspecionList(quer.value).then(res => {
+				const existingIds = new Set(inspecionList.value.map(item => item.id));
+
+				// 过滤出那些不在 existingIds 中的项,即新数据
+				const newRows = res.rows.filter(row => !existingIds.has(row.id));
+
+				// 如果有新数据,将其添加到 listData
+				if (newRows.length > 0) {
+					inspecionList.value = inspecionList.value.concat(newRows);
+					original.value = original.value.concat(newRows);
+				} else {
+					// 如果没有新数据,更新状态表示没有更多数据
+					status.value = false;
+				}
 			})
-			}
-		})
+		}
+	})
 
 	/***************************** 定义了一些方法 *****************************/
 	// 新增出厂检
@@ -153,11 +161,13 @@
 			url: '/pages/firstInspection/reviewScan'
 		})
 	}
+
 	function handleSearch() {
 		pageNum.value = 1
 		status.value = true
 		getList()
 	}
+
 	function getList() {
 		uni.showLoading({
 			title: '加载中'
@@ -165,19 +175,41 @@
 		//quer.value.creatorId = store.userInfo.userId;
 		pageNum.value = 1
 		quer.value.deptId = store.curDeptDetails.deptId
+		quer.value.endTime = endTime.value;
 		quer.value.startTime = startTime.value;
 		quer.value.type = "firstArticleInspection"
 		quer.value.pageNum = pageNum.value
 		quer.value.pageSize = pageSize.value
-		getProcessInspecionList(quer.value).then(res => {
-			console.log("res", res);
-			if (res.code == 200) {
-				original.value = res.rows;
-				inspecionList.value = res.rows;
-				uni.hideLoading();
-			}
-		});
+		if (!checkTime(quer.value.startTime, quer.value.endTime)) {
+
+			uni.showToast({
+				icon: 'none',
+				title: "开始日期不能大于结束日期",
+				duration: 2000
+			})
+		} else {
+			getProcessInspecionList(quer.value).then(res => {
+				console.log("res", res);
+				if (res.code == 200) {
+					original.value = res.rows;
+					inspecionList.value = res.rows;
+					uni.hideLoading();
+				}
+			});
+		}
+
 	}
+
+	//判断开始时间是否大于结束时间
+	function checkTime(time1, time2) {
+		let date1 = new Date(startTime.value);
+		let date2 = new Date(endTime.value);
+		if (date1 > date2) {
+			return false
+		}
+		return true
+	}
+
 	function delable(item) {
 		if (item.creatorId === store.userInfo.userId) {
 			return true
@@ -217,7 +249,7 @@
 							})
 						}
 					})
-	
+
 				} else if (res.cancel) {
 					uni.showToast({
 						title: '已取消',
@@ -259,8 +291,8 @@
 			);
 		} else {
 			// 测试时用
-				quer.value.keyword = ""
-				getList()
+			quer.value.keyword = ""
+			getList()
 		}
 	}
 
@@ -326,7 +358,6 @@
 		}
 		unfitInfos.value.push(info)
 	}
-
 </script>
 
 <style lang="scss">
@@ -405,7 +436,7 @@
 		align-items: center;
 		justify-content: center;
 		border-radius: 8rpx;
-		flex:1;
+		flex: 1;
 	}
 
 	.daywork-item {

+ 132 - 99
pages/instrumentRoomInspection/index.vue

@@ -6,51 +6,58 @@
 			<!-- <uni-icons type="scan" size="24" /> -->
 		</view>
 
-		<view class="time-controls" style="margin-top: 10rpx;">
-			<uni-section title="检查日期:" type="square" class="uni-row sta">
-				<input v-model="startTime" type="date" @input="timeSizer" />
-			</uni-section>
+		<view class="time-controls"
+			style="margin-top: 10rpx;display: flex;margin-right: 0px;background-color: #ffffff;">
+			<view class="uni-row sta">
+				<span style="align-items: center;display: flex;font-size: 16px;margin-left: 12rpx;">检查日期:</span>
+				<view class="uni-row" style="flex: 1;width: 100%;">
+					<input v-model="startTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+					<span style="align-items: center;display: flex;">—</span>
+					<input v-model="endTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+				</view>
+			</view>
 		</view>
-		<view class="uni-row" style="margin-top: 10rpx;">
-			<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;" @click.stop="handleScan">扫码</view>
+	</view>
+	<view class="uni-row" style="margin-top: 10rpx;">
+		<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;" @click.stop="handleScan">扫码</view>
+	</view>
+	<view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
+		@click="handleSelection(item)">
+		<view class="lot-code uni-row">
+			<text>批次号:{{ item.lotCode }}</text>
+			<text :style="selectType(item)">{{ selectText(item) }}</text>
+			<text v-if="delable(item)" class="fa fa-trash" style="font-size: 16; color: red;"
+				@click.stop="deleteItem(item)"></text>
+			<text v-else class="fa fa-trash" style="font-size: 16; color: white;"></text>
 		</view>
-		<view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
-			@click="handleSelection(item)">
-			<view class="lot-code uni-row">
-				<text>批次号:{{ item.lotCode }}</text>
-				<text :style="selectType(item)">{{ selectText(item) }}</text>
-				<text v-if="delable(item)" class="fa fa-trash" style="font-size: 16; color: red;"
-					@click.stop="deleteItem(item)"></text>
-				<text v-else class="fa fa-trash" style="font-size: 16; color: white;"></text>
+		<view class="info">
+			<view class="info-row uni-row">
+				<view class="label">检查箱号:</view>
+				<view class="value">{{ item.carrierCode }}</view>
+				<view class="label">检察员:</view>
+				<view class="value">{{ item.technicianName }}</view>
 			</view>
-			<view class="info">
-				<view class="info-row uni-row">
-					<view class="label">检查箱号:</view>
-					<view class="value">{{ item.carrierCode }}</view>
-					<view class="label">检察员:</view>
-					<view class="value">{{ item.technicianName }}</view>
-				</view>
-				<view class="info-row uni-row">
-					<view class="label">检查数量:</view>
-					<view class="value">{{ item.examiningNum }}</view>
-					<view class="label">不良品量:</view>
-					<view class="value">{{ item.disqualificationNum }}</view>
-				</view>
-				<view class="info-row uni-row">
-					<view class="label">产品描述:</view>
-					<view class="value">{{ item.productDescription }}</view>
-				</view>
-				<view class="info-row uni-row">
-					<view class="label">检测载具:</view>
-					<view class="value">{{ item.inspectionCarrierCode }}
-						{{ item.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
-					</view>
-					<button class="reporting-tag" size="mini" type="primary"
-						@click.stop="changeCheckCarrier(item)">检测载具</button>
+			<view class="info-row uni-row">
+				<view class="label">检查数量:</view>
+				<view class="value">{{ item.examiningNum }}</view>
+				<view class="label">不良品量:</view>
+				<view class="value">{{ item.disqualificationNum }}</view>
+			</view>
+			<view class="info-row uni-row">
+				<view class="label">产品描述:</view>
+				<view class="value">{{ item.productDescription }}</view>
+			</view>
+			<view class="info-row uni-row">
+				<view class="label">检测载具:</view>
+				<view class="value">{{ item.inspectionCarrierCode }}
+					{{ item.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
 				</view>
+				<button class="reporting-tag" size="mini" type="primary"
+					@click.stop="changeCheckCarrier(item)">检测载具</button>
 			</view>
 		</view>
 	</view>
+
 </template>
 
 <script setup>
@@ -79,8 +86,8 @@
 	} from '@/store/index.js'
 	const keyword = ref('')
 	const inspecionList = ref([]); //时间后筛选数组
-	
 	const startTime = ref(new Date().toISOString().split("T")[0])
+	const endTime = ref(new Date().toISOString().split("T")[0])
 	const shouldCallList = ref(false)
 	const pageSize = ref(10)
 	const pageNum = ref(1)
@@ -104,60 +111,60 @@
 
 	/***************************** 页面生命周期函数 *****************************/
 	onShow(() => {
-		console.log(inspecionList.value,15151)
+		console.log(inspecionList.value, 15151)
 		inspecionList.value = []
 		shouldCallList.value = false
-		    const instance = getCurrentInstance().proxy;
-		    const eventChannel = instance.getOpenerEventChannel();
-	// 声明一个变量来保存 setTimeout 的 ID
-	let timeoutId;
-	
-	// 监听 'inspectionChamberInfo' 事件
-	eventChannel.on('inspectionChamberInfo', function(data) {
-	  console.log("Event received with data:", data);
-	  
-	  // 事件触发时取消 setTimeout
-	  clearTimeout(timeoutId);
-	
-	  // 更新状态
-	  quer.value.inspectionChamberId = data.data;
-	  shouldCallList.value = true;
-	
-	  // 事件触发时执行的逻辑
-	  getList();
-	});
-	
-	// 设置 setTimeout,在没有接收到事件的情况下调用 getList
-	timeoutId = setTimeout(() => {
-	  if (!shouldCallList.value) {
-	    console.log("777 - No event received, calling getList");
-	    getList();
-	  }
-	}, 1000); // 例如,1 秒后执行
+		const instance = getCurrentInstance().proxy;
+		const eventChannel = instance.getOpenerEventChannel();
+		// 声明一个变量来保存 setTimeout 的 ID
+		let timeoutId;
+
+		// 监听 'inspectionChamberInfo' 事件
+		eventChannel.on('inspectionChamberInfo', function(data) {
+			console.log("Event received with data:", data);
+
+			// 事件触发时取消 setTimeout
+			clearTimeout(timeoutId);
+
+			// 更新状态
+			quer.value.inspectionChamberId = data.data;
+			shouldCallList.value = true;
+
+			// 事件触发时执行的逻辑
+			getList();
+		});
+
+		// 设置 setTimeout,在没有接收到事件的情况下调用 getList
+		timeoutId = setTimeout(() => {
+			if (!shouldCallList.value) {
+				console.log("777 - No event received, calling getList");
+				getList();
+			}
+		}, 1000); // 例如,1 秒后执行
 	})
-	onReachBottom(()=>{
-			console.log(status.value)
-			if(status.value) {
+	onReachBottom(() => {
+		console.log(status.value)
+		if (status.value) {
 			pageNum.value += 1
 			quer.value.pageNum = pageNum.value
 			quer.value.pageSize = pageSize.value
-			getProcessInspecionList(quer.value).then(res =>{
-			 const existingIds = new Set(inspecionList.value.map(item => item.id));
-			
-			  // 过滤出那些不在 existingIds 中的项,即新数据
-			  const newRows = res.rows.filter(row => !existingIds.has(row.id));
-			
-			  // 如果有新数据,将其添加到 listData
-			  if (newRows.length > 0) {
-				inspecionList.value = inspecionList.value.concat(newRows);
-				original.value = original.value.concat(newRows);
-			  } else {
-				// 如果没有新数据,更新状态表示没有更多数据
-				status.value = false;
-			  }
+			getProcessInspecionList(quer.value).then(res => {
+				const existingIds = new Set(inspecionList.value.map(item => item.id));
+
+				// 过滤出那些不在 existingIds 中的项,即新数据
+				const newRows = res.rows.filter(row => !existingIds.has(row.id));
+
+				// 如果有新数据,将其添加到 listData
+				if (newRows.length > 0) {
+					inspecionList.value = inspecionList.value.concat(newRows);
+					original.value = original.value.concat(newRows);
+				} else {
+					// 如果没有新数据,更新状态表示没有更多数据
+					status.value = false;
+				}
 			})
-			}
-		})
+		}
+	})
 
 	/***************************** 定义了一些方法 *****************************/
 
@@ -167,25 +174,50 @@
 		});
 		pageNum.value = 1
 		quer.value.startTime = startTime.value;
+		quer.value.endTime = endTime.value;
 		// quer.value.deptId = store.curDeptDetails.deptId
 		quer.value.type = "instrumentRoomInspection"
 		quer.value.pageNum = pageNum.value
 		quer.value.pageSize = pageSize.value
-		getProcessInspecionList(quer.value).then(res => {
-			console.log("res", res);
-			if (res.code == 200) {
-				inspecionList.value = res.rows;
-				console.log(1111111)
-				uni.hideLoading();
-			}
-		});
-		uni.hideLoading();
+		if (!checkTime(quer.value.startTime, quer.value.endTime)) {
+
+			uni.showToast({
+				icon: 'none',
+				title: "开始日期不能大于结束日期",
+				duration: 2000
+			})
+		} else {
+			getProcessInspecionList(quer.value).then(res => {
+				console.log("res", res);
+				if (res.code == 200) {
+					inspecionList.value = res.rows;
+					console.log(1111111)
+					uni.hideLoading();
+				}
+			});
+			uni.hideLoading();
+		}
+
+
+	}
+
+
+	//判断开始时间是否大于结束时间
+	function checkTime(time1, time2) {
+		let date1 = new Date(startTime.value);
+		let date2 = new Date(endTime.value);
+		if (date1 > date2) {
+			return false
+		}
+		return true
 	}
+
 	function handleSearch() {
 		pageNum.value = 1
 		status.value = true
 		getList()
 	}
+
 	function delable(item) {
 		if (item.creatorId === store.userInfo.userId) {
 			return true
@@ -209,7 +241,7 @@
 							})
 						}
 					})
-	
+
 				} else if (res.cancel) {
 					uni.showToast({
 						title: '已取消',
@@ -267,8 +299,8 @@
 			);
 		} else {
 			// 测试时用
-				quer.value.keyword = ""
-				getList()
+			quer.value.keyword = ""
+			getList()
 		}
 	}
 
@@ -406,6 +438,7 @@
 			align-items: center;
 		}
 	}
+
 	.scan-btn {
 		height: 64rpx;
 		color: #ffffff;
@@ -413,7 +446,7 @@
 		align-items: center;
 		justify-content: center;
 		border-radius: 8rpx;
-		flex:1;
+		flex: 1;
 	}
 
 	.daywork-item {

+ 80 - 46
pages/onSiteInspection/index.vue

@@ -1,21 +1,28 @@
 <template>
-	<view class="page-container uni-column" >
+	<view class="page-container uni-column">
 		<view class="search-container uni-row">
 			<input type="text" v-model="quer.keyword" placeholder="请输入关键字" />
 			<view class="btn uni-row" @click="handleSearch">搜索</view>
 			<!-- <uni-icons type="scan" size="24" /> -->
 		</view>
 
-		<view class="time-controls" style="margin-top: 10rpx;">
-			<uni-section title="检查日期:" type="square" class="uni-row sta">
-				<input v-model="startTime" type="date" @input="timeSizer" />
-			</uni-section>
+		<view class="time-controls"
+			style="margin-top: 10rpx;display: flex;margin-right: 0px;background-color: #ffffff;">
+			<view class="uni-row sta">
+				<span style="align-items: center;display: flex;font-size: 16px;margin-left: 12rpx;">检查日期:</span>
+				<view class="uni-row" style="flex: 1;width: 100%;">
+					<input v-model="startTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+					<span style="align-items: center;display: flex;">—</span>
+					<input v-model="endTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+				</view>
+			</view>
 		</view>
 		<view class="uni-row" style="margin-top: 10rpx;">
 			<view class="scan-btn " style="min-height: 80rpx;" @click.stop="handleAddOnSiteInspection">新增巡检</view>
-			<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;margin-left: 24rpx;" @click.stop="handleScan">扫码</view>
+			<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;margin-left: 24rpx;"
+				@click.stop="handleScan">扫码</view>
 		</view>
-		<view class="daywork-item uni-column " id ="data" v-for="(item, index) in inspecionList" :key="index"
+		<view class="daywork-item uni-column " id="data" v-for="(item, index) in inspecionList" :key="index"
 			@click="handleSelection(item)">
 			<view class="lot-code uni-row">
 				<text>批次号:{{ item.lotCode }}</text>
@@ -42,12 +49,12 @@
 					<view class="value">{{ item.productDescription }}</view>
 				</view>
 				<view class="info-row uni-row">
-				<view class="label">检测载具:</view>
-				<view class="value">{{ item.inspectionCarrierCode }}
-					{{ item.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
-				</view>
-				<button class="reporting-tag" size="mini" type="primary"
-					@click.stop="changeCheckCarrier(item)">检测载具</button>
+					<view class="label">检测载具:</view>
+					<view class="value">{{ item.inspectionCarrierCode }}
+						{{ item.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
+					</view>
+					<button class="reporting-tag" size="mini" type="primary"
+						@click.stop="changeCheckCarrier(item)">检测载具</button>
 				</view>
 			</view>
 		</view>
@@ -82,6 +89,7 @@
 	const inspecionList = ref([]); //时间后筛选数组
 	const original = ref([]); //原始数组
 	const startTime = ref(new Date().toISOString().split("T")[0])
+	const endTime = ref(new Date().toISOString().split("T")[0])
 	const pageSize = ref(10)
 	const pageNum = ref(1)
 	const status = ref(true)
@@ -123,34 +131,36 @@
 
 	/***************************** 定义了一些方法 *****************************/
 
-	onReachBottom(()=>{
+	onReachBottom(() => {
 		console.log(status.value)
-		if(status.value) {
-		pageNum.value += 1
-		quer.value.pageNum = pageNum.value
-		quer.value.pageSize = pageSize.value
-		getProcessInspecionList(quer.value).then(res =>{
-		 const existingIds = new Set(inspecionList.value.map(item => item.id));
-		
-		  // 过滤出那些不在 existingIds 中的项,即新数据
-		  const newRows = res.rows.filter(row => !existingIds.has(row.id));
-		
-		  // 如果有新数据,将其添加到 listData
-		  if (newRows.length > 0) {
-		    inspecionList.value = inspecionList.value.concat(newRows);
-			original.value = original.value.concat(newRows);
-		  } else {
-		    // 如果没有新数据,更新状态表示没有更多数据
-		    status.value = false;
-		  }
-		})
+		if (status.value) {
+			pageNum.value += 1
+			quer.value.pageNum = pageNum.value
+			quer.value.pageSize = pageSize.value
+			getProcessInspecionList(quer.value).then(res => {
+				const existingIds = new Set(inspecionList.value.map(item => item.id));
+
+				// 过滤出那些不在 existingIds 中的项,即新数据
+				const newRows = res.rows.filter(row => !existingIds.has(row.id));
+
+				// 如果有新数据,将其添加到 listData
+				if (newRows.length > 0) {
+					inspecionList.value = inspecionList.value.concat(newRows);
+					original.value = original.value.concat(newRows);
+				} else {
+					// 如果没有新数据,更新状态表示没有更多数据
+					status.value = false;
+				}
+			})
 		}
 	})
+
 	function handleSearch() {
 		pageNum.value = 1
 		status.value = true
 		getList()
 	}
+
 	function getList() {
 		uni.showLoading({
 			title: '加载中'
@@ -158,18 +168,42 @@
 		pageNum.value = 1
 		quer.value.startTime = startTime.value;
 		quer.value.deptId = store.curDeptDetails.deptId
+		quer.value.endTime = endTime.value;
 		quer.value.type = "patrolInspection"
 		quer.value.pageNum = pageNum.value
 		quer.value.pageSize = pageSize.value
-		getProcessInspecionList(quer.value).then(res => {
-			console.log("res", res);
-			if (res.code == 200) {
-				original.value = res.rows;
-				inspecionList.value = res.rows;
-				uni.hideLoading();
-			}
-		});
+		if (!checkTime(quer.value.startTime, quer.value.endTime)) {
+
+			uni.showToast({
+				icon: 'none',
+				title: "开始日期不能大于结束日期",
+				duration: 2000
+			})
+		} else {
+			getProcessInspecionList(quer.value).then(res => {
+				console.log("res", res);
+				if (res.code == 200) {
+					original.value = res.rows;
+					inspecionList.value = res.rows;
+					uni.hideLoading();
+				}
+			});
+		}
+
+	}
+
+
+	//判断开始时间是否大于结束时间
+	function checkTime(time1, time2) {
+		let date1 = new Date(startTime.value);
+		let date2 = new Date(endTime.value);
+		if (date1 > date2) {
+			return false
+		}
+		return true
 	}
+
+
 	function delable(item) {
 		if (item.creatorId === store.userInfo.userId) {
 			return true
@@ -193,7 +227,7 @@
 							})
 						}
 					})
-	
+
 				} else if (res.cancel) {
 					uni.showToast({
 						title: '已取消',
@@ -207,7 +241,7 @@
 		// uni.showToast({
 		// 	title: "检测载具方法未完成"
 		// })
-	
+
 		// uni.$once('refreshProcessInspection', () => {
 		// })
 		const openItem = {
@@ -257,8 +291,8 @@
 			);
 		} else {
 			// 测试时用
-				quer.value.keyword = ""
-				getList()
+			quer.value.keyword = ""
+			getList()
 		}
 	}
 
@@ -400,7 +434,7 @@
 		align-items: center;
 		justify-content: center;
 		border-radius: 8rpx;
-		flex:1;
+		flex: 1;
 	}
 
 	.daywork-item {

+ 72 - 41
pages/outsourcedInspection/index.vue

@@ -6,17 +6,24 @@
 			<!-- <uni-icons type="scan" size="24" /> -->
 		</view>
 
-		<view class="time-controls" style="margin-top: 10rpx;">
-			<uni-section title="检查日期:" type="square" class="uni-row sta">
-				<input v-model="startTime" type="date" @input="timeSizer" />
-			</uni-section>
+		<view class="time-controls"
+			style="margin-top: 10rpx;display: flex;margin-right: 0px;background-color: #ffffff;">
+			<view class="uni-row sta">
+				<span style="align-items: center;display: flex;font-size: 16px;margin-left: 12rpx;">检查日期:</span>
+				<view class="uni-row" style="flex: 1;width: 100%;">
+					<input v-model="startTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+					<span style="align-items: center;display: flex;">—</span>
+					<input v-model="endTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
+				</view>
+			</view>
 		</view>
-	<view class="uni-row" style="margin-top: 10rpx;">
+		<view class="uni-row" style="margin-top: 10rpx;">
 			<view class="scan-btn " style="min-height: 80rpx;" @click.stop="handleAddOutsourcedInspection">新增外协检查
 			</view>
-			<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;margin-left: 24rpx;" @click.stop="handleScan">扫码</view>
+			<view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;margin-left: 24rpx;"
+				@click.stop="handleScan">扫码</view>
 		</view>
-		
+
 		<view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
 			@click="handleSelection(item)">
 			<view class="lot-code uni-row">
@@ -91,7 +98,8 @@
 	const keywords = ref('')
 	const inspecionList = ref([]); //时间后筛选数组
 	const original = ref([]); //原始数组
-	const startTime = ref(new Date().toISOString().split('T')[0])
+	const startTime = ref(new Date().toISOString().split("T")[0])
+	const endTime = ref(new Date().toISOString().split("T")[0])
 	const userId = ref(store.userInfo.userId)
 	const pageSize = ref(10)
 	const pageNum = ref(1)
@@ -118,27 +126,27 @@
 		getList();
 		getP2();
 	})
-	onReachBottom(()=>{
+	onReachBottom(() => {
 		console.log(status.value)
-		if(status.value) {
-		pageNum.value += 1
-		quer.value.pageNum = pageNum.value
-		quer.value.pageSize = pageSize.value
-		getOutsourcedInspection(quer.value).then(res =>{
-		 const existingIds = new Set(inspecionList.value.map(item => item.id));
-		
-		  // 过滤出那些不在 existingIds 中的项,即新数据
-		  const newRows = res.rows.filter(row => !existingIds.has(row.id));
-		
-		  // 如果有新数据,将其添加到 listData
-		  if (newRows.length > 0) {
-		    inspecionList.value = inspecionList.value.concat(newRows);
-			original.value = original.value.concat(newRows);
-		  } else {
-		    // 如果没有新数据,更新状态表示没有更多数据
-		    status.value = false;
-		  }
-		})
+		if (status.value) {
+			pageNum.value += 1
+			quer.value.pageNum = pageNum.value
+			quer.value.pageSize = pageSize.value
+			getOutsourcedInspection(quer.value).then(res => {
+				const existingIds = new Set(inspecionList.value.map(item => item.id));
+
+				// 过滤出那些不在 existingIds 中的项,即新数据
+				const newRows = res.rows.filter(row => !existingIds.has(row.id));
+
+				// 如果有新数据,将其添加到 listData
+				if (newRows.length > 0) {
+					inspecionList.value = inspecionList.value.concat(newRows);
+					original.value = original.value.concat(newRows);
+				} else {
+					// 如果没有新数据,更新状态表示没有更多数据
+					status.value = false;
+				}
+			})
 		}
 	})
 
@@ -151,20 +159,43 @@
 		pageNum.value = 1
 		quer.value.startTime = startTime.value;
 		quer.value.isAuto = 0
+		quer.value.endTime = endTime.value;
 		quer.value.type = "outsourcedInspector"
 		quer.value.pageNum = pageNum.value
 		quer.value.pageSize = pageSize.value
-		getOutsourcedInspection(quer.value).then(res => {
-			console.log("res", res);
-			if (res.code == 200) {
-				original.value = res.rows;
-				inspecionList.value = res.rows;
-				// timeSizer();
-				uni.hideLoading();
-				// uni.hideLoading();
-			}
-		});
+		if (!checkTime(quer.value.startTime, quer.value.endTime)) {
+
+			uni.showToast({
+				icon: 'none',
+				title: "开始日期不能大于结束日期",
+				duration: 2000
+			})
+		} else {
+			getOutsourcedInspection(quer.value).then(res => {
+				console.log("res", res);
+				if (res.code == 200) {
+					original.value = res.rows;
+					inspecionList.value = res.rows;
+					// timeSizer();
+					uni.hideLoading();
+					// uni.hideLoading();
+				}
+			});
+		}
 	}
+
+
+	//判断开始时间是否大于结束时间
+	function checkTime(time1, time2) {
+		let date1 = new Date(startTime.value);
+		let date2 = new Date(endTime.value);
+		if (date1 > date2) {
+			return false
+		}
+		return true
+	}
+
+
 	function handleSearch() {
 		pageNum.value = 1
 		status.value = true
@@ -227,8 +258,8 @@
 			);
 		} else {
 			// 测试时用
-				quer.value.keyword = ""
-				getList()
+			quer.value.keyword = ""
+			getList()
 		}
 	}
 
@@ -449,7 +480,7 @@
 		align-items: center;
 		justify-content: center;
 		border-radius: 8rpx;
-		flex:1;
+		flex: 1;
 	}
 
 	.daywork-item {