wangxin 1 년 전
부모
커밋
2fa5ac34b0
2개의 변경된 파일78개의 추가작업 그리고 15개의 파일을 삭제
  1. 0 1
      pages/dashboard/index.vue
  2. 78 14
      pages/processInspection/index.vue

+ 0 - 1
pages/dashboard/index.vue

@@ -90,7 +90,6 @@
 	const showSizing = ref(false)
 
 	onLoad(() => {
-		console.log("gabwlhjkdb lakjwhdnkj;lawnbd;kjlawbjd", store);
 		userInfo.value = store.userInfo || {
 			nickName: ""
 		};

+ 78 - 14
pages/processInspection/index.vue

@@ -5,6 +5,13 @@
 			<view class="btn uni-row" @click="getList">搜索</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>
+
 		<view class="scan-btn uni-row" style="min-height: 80rpx;" @click.stop="handleAddProcessInspection">新增序检</view>
 		<view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
 			@click="handleSelection(item)">
@@ -43,6 +50,10 @@
 		getProcessInspecionList,
 		getLotInfo
 	} from '@/api/business/processInspection.js'
+	import {
+		timestampToTime,
+		toHHmmss
+	} from '@/utils/common.js'
 	import {
 		onLoad,
 		onReady,
@@ -53,7 +64,9 @@
 		store
 	} from '@/store/index.js'
 	const keywords = ref('')
-	const inspecionList = ref([])
+	const inspecionList = ref([]); //时间后筛选数组
+	const original = ref([]); //原始数组
+	const startTime = ref(new Date().toISOString().split('T')[0])
 
 	const range = [{
 		value: 0,
@@ -77,33 +90,48 @@
 		uni.showLoading({
 			title: '加载中'
 		});
-		console.log("store", store.userInfo);
 		quer.value.userId = store.userInfo.userId;
+
 		getProcessInspecionList(quer.value).then(res => {
 			console.log("res", res);
 			if (res.code == 200) {
-				inspecionList.value = res.rows;
+				original.value = res.rows;
+				timeSizer();
 				uni.hideLoading();
+				// uni.hideLoading();
 			}
 
 		});
 	})
 
 	/***************************** 定义了一些方法 *****************************/
-	function getList() {
 
-		uni.showLoading({
-			title: '加载中'
-		});
-		quer.value.keyword = keywords.value
-		getProcessInspecionList(quer.value).then(res => {
-			console.log("res", res);
-			if (res.code == 200) {
-				inspecionList.value = res.rows;
-				uni.hideLoading();
-			}
 
+	//时间筛选
+	function timeSizer() {
+		inspecionList.value = filterSameDayItems(original.value, startTime.value);
+	}
+
+	// 筛选函数
+	const filterSameDayItems = (inspectionList, startTime) => {
+
+		// 使用filter方法筛选出与startTime同一天的元素
+		const filteredList = inspectionList.filter(item => {
+			// 将数组中每个元素的date属性转换为不包含时分秒的字符串
+			const itemDateString = item.createTime.split(' ')[0];
+			// 比较两个日期字符串是否相同
+			return itemDateString === startTime;
 		});
+		return filteredList;
+	};
+
+
+	function isSameDate(date1, date2) {
+		// 使用Date对象的toISOString()方法来格式化日期,并去除时分秒部分
+		const formatDate = (date) => date.toISOString().split('T')[0];
+
+		// 比较两个日期的年月日部分是否相同
+		return formatDate(date1) === formatDate(date2);
 	}
 
 	//查看序捡详情
@@ -158,6 +186,42 @@
 </script>
 
 <style lang="scss">
+	.time-controls {
+		.title {
+			margin: 20% auto 40% auto;
+
+			.first {
+				font-size: 48rpx;
+				margin: 0 auto;
+			}
+
+			.second {
+				color: red;
+				font-size: 24rpx;
+				margin: 10rpx auto 0 auto;
+			}
+		}
+
+		.sta {
+			justify-content: center;
+			align-items: center;
+
+			input {
+				border: 1rpx solid gray;
+				border-radius: 8rpx;
+				width: 400rpx;
+				height: 64rpx;
+			}
+		}
+
+		button {
+			width: 78%;
+			background-color: #1684fc;
+			color: white;
+			margin: 0 auto;
+		}
+	}
+
 	.page-container {
 		height: 100%;
 		background-color: #ececec;