瀏覽代碼

Merge remote-tracking branch 'origin/master'

guoyujia 1 年之前
父節點
當前提交
eca7326a42

+ 19 - 11
components/dialog-end-work/dialog-end-work.vue

@@ -261,21 +261,26 @@
 	}
 
 	function handlePreFinishReporting() {
-		console.log("44")
 		//投产数
 		let number = store.dayworkInfo.processQualifiedNum == 0 ? store.dayworkInfo.productionQuantity : store.dayworkInfo
 			.processQualifiedNum;
 		workInfo.value.prodNum = number
-		console.log("合格量", (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value))
-		let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(2);
-		percent = Math.ceil(percent * 100) / 100;
-		console.log("percent", lotPreSumQualifiedNum.value);
+
+		let max = parseInt(number * 1.03);
+		// max = parseInt(String(max).split("."));
+		console.log("maxawdjkkaljdalkw", max);
+		let sunm = parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value; //计算总合格数
+		let percent = (sunm / number) * 100; //合格率
+
+		percent = Math.ceil(percent * 100) / 100; //只入不舍
+		console.log("合格量", percent)
+		// let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(2);
+
 		let num = 103;
 		// 填入数大于剩余量情况
 		if (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number > 0) {
 			// 判断当前是否为首序
 			if (isFirstOrder.value) {
-				percent = ((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number) / number) * 100;
 				uni.showModal({
 					title: '提示',
 
@@ -306,15 +311,16 @@
 		console.log(store.isPreProcess)
 		//投产数
 		let number = workInfo.value.prodNum;
-		let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(2);
+		let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(
+			2);
 		let num = 103;
 		if (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number > 0) {
 			if (isFirstOrder.value) {
-				percent = ((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number) / number) * 100;
-				percent = Math.ceil(percent * 100) / 100;
+				if (percent == 103) {
+					percent = 103.1
+				}
 				uni.showModal({
 					title: '提示',
-
 					content: `合格数总量超出投入量${percent}%,是否继续保存?`,
 					success: function(res) {
 						if (res.confirm) {
@@ -336,7 +342,9 @@
 					}
 				})
 			} else {
-				percent = Math.ceil(percent * 100) / 100;
+				if (percent == num) {
+					percent = 103.01
+				}
 				if (percent > num) {
 					uni.showToast({
 						icon: 'none',

+ 1 - 2
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: ""
 		};
@@ -101,7 +100,7 @@
 		} else if (store.userInfo.roles.some(item => item.roleId == 124) && store.userInfo.roles.length == 1) {
 			showTurn.value = true;
 			showOther.value = false;
-		} else if (store.userInfo.roles.some(item => item.roleId == 128) && store.userInfo.roles.length == 1) {
+		} else if (store.userInfo.roles.some(item => item.roleId == 128)) {
 			showInspector.value = true
 			showOther.value = true;
 		} else {

+ 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;

+ 36 - 18
pages/sortBatchReporting/index.vue

@@ -10,11 +10,11 @@
 			</view>
 		</view>
 		<view class="list-title uni-row">
-			<text class="label">是否正常批次</text><text>是</text>
-			<switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" />
-			<text>否</text>
+			<text class="label">是否正常批次</text>
+			<text>{{ normalStatus ? '是' : '否' }}</text>
+			<switch class="switch" :checked="normalStatus" @change="switchChange" color="rgba(255,85,85,1)" />
 		</view>
-		<view class="scroll-container">
+		<view class="scroll-container" style="padding-bottom: 150rpx;">
 			<view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
 				<text>暂无批次</text>
 			</view>
@@ -205,6 +205,7 @@
 	})
 
 	function reflush() {
+		normalStatus.value = true;
 		init(store.planDetails.id);
 	}
 
@@ -274,6 +275,7 @@
 	}
 
 	function handleToreportingForWork(item) {
+		uni.$once("formBack", () => handleSearch())
 		uni.navigateTo({
 			url: "/pages/sorting/form",
 			success: function(res) {
@@ -312,21 +314,21 @@
 		selectProduction.value.open(normalStatus.value);
 	}
 
-	function switchChange(event) {
-		//异常批
-		if (event.detail.value) {
-			listData.value = tempList.value.filter(item => {
-				return item.isWasteRecycling == 1 || item.isAmend == 1;
-			});
-			normalStatus.value = 1
-		} else {
-			listData.value = tempList.value.filter(item => {
-				return item.isWasteRecycling == 0 && item.isAmend == 0;
-			});
-			normalStatus.value = 0
-		}
+	// function switchChange(event) {
+	// 	//异常批
+	// 	if (event.detail.value) {
+	// 		listData.value = tempList.value.filter(item => {
+	// 			return item.isWasteRecycling == 1 || item.isAmend == 1;
+	// 		});
+	// 		normalStatus.value = 1
+	// 	} else {
+	// 		listData.value = tempList.value.filter(item => {
+	// 			return item.isWasteRecycling == 0 && item.isAmend == 0;
+	// 		});
+	// 		normalStatus.value = 0
+	// 	}
 
-	}
+	// }
 
 	function handleScanCode() {
 		// 引入原生插件
@@ -447,6 +449,22 @@
 		reflush();
 	}
 
+	function switchChange(event) {
+		console.log(event)
+		//异常批
+		if (normalStatus.value) {
+			listData.value = tempList.value.filter(item => {
+				return item.isWasteRecycling == 1 || item.isAmend == 1;
+			});
+			normalStatus.value = false
+		} else {
+			listData.value = tempList.value.filter(item => {
+				return item.isWasteRecycling == 0 && item.isAmend == 0;
+			});
+			normalStatus.value = true
+		}
+	}
+	
 	function handleCancelTurnover(data) {
 		turnoverDelete(data).then(res => {
 			if (res.code == 200) {

+ 32 - 21
pages/sorting/form.vue

@@ -16,13 +16,14 @@
 		<!-- 不合格信息 -->
 		<view class="title unfit-title uni-row">
 			<text>不合格信息</text>
-			<view class="add-btn" @click="handleAddUnfit">添加</view>
+			<view v-if="Number(dayworkItem.status) < 3" class="add-btn" @click="handleAddUnfit">添加</view>
 		</view>
 		<view class="unfit-container">
 			<view class="unfit-item-container uni-column" v-for="(item, index) in unfitInfos" :key="index">
 				<view class="title uni-row">
 					<text>检查标准-{{ item.checkStandard }}</text>
-					<uni-icons v-if="Number(dayworkItem.status) < 3" type="trash" size="24" color="#fc6565" @click="handleDelUnfit(index)" />
+					<uni-icons v-if="Number(dayworkItem.status) < 3" type="trash" size="24" color="#fc6565"
+						@click="handleDelUnfit(index)" />
 				</view>
 				<!-- <view class="standard">检查标准:{{ item.checkStandard }}</view> -->
 				<view class="result uni-row">
@@ -60,10 +61,12 @@
 		<view class="daywork-container">
 			<view class="result uni-row">
 				<view class="label">合格量</view>
-				<input v-if="Number(dayworkItem.status) < 3" type="number" placeholder="请输入合格量" v-model="dayworkItem.qualifiedNum" />
+				<input v-if="Number(dayworkItem.status) < 3" type="number" placeholder="请输入合格量"
+					v-model="dayworkItem.qualifiedNum" />
 				<span v-else>{{ dayworkItem.qualifiedNum }}</span>
 				<view class="label" style="text-align: right; padding-right: 24rpx">废品量</view>
-				<input v-if="Number(dayworkItem.status) < 3" type="number" placeholder="请输入废品量" v-model="dayworkItem.rejectNum" />
+				<input v-if="Number(dayworkItem.status) < 3" type="number" placeholder="请输入废品量"
+					v-model="dayworkItem.rejectNum" />
 				<span v-else>{{ dayworkItem.rejectNum }}</span>
 			</view>
 			<view class="remark uni-row">
@@ -144,7 +147,10 @@
 			console.log(res)
 			if (res.code === 200) {
 				dayworkItem.value = res.data
-				dayworkItem.value.qualifiedNum = res.data.prodNum
+				console.log(dayworkItem.value)
+				if (dayworkItem.value.qualifiedNum === 0 && dayworkItem.value.rejectNum === 0) {
+					dayworkItem.value.qualifiedNum = res.data.prodNum
+				}
 				consultations.value = res.data.consults
 				unfitInfos.value = res.data.rejectList
 			} else {
@@ -156,16 +162,18 @@
 		})
 	}
 	const addUnfitInfo = (data) => {
-		const info = {
-			inspectionInstructionId: data.id,
-			title: data.title,
-			standard: data.standard,
-			checkStandard: data.standard,
-			type: data.type,
-			reason: '',
-			number: 1
+		console.log(data)
+		if (data.index > unfitInfos.value.length) {
+			const info = {
+				inspectionInstructionId: data.id,
+				title: data.title,
+				standard: data.standard,
+				checkStandard: data.standard,
+				type: data.type,
+				reason: ''
+			}
+			unfitInfos.value.push(info)
 		}
-		unfitInfos.value.push(info)
 	}
 	const addConsultation = (data) => {
 		const info = {
@@ -212,7 +220,8 @@
 			success: (res) => {
 				// 通过eventChannel向被打开页面传送数据
 				res.eventChannel.emit('acceptDataFromOpenerPage', {
-					data: dayworkItem.value
+					data: dayworkItem.value,
+					index: unfitInfos.value.length
 				})
 			}
 		})
@@ -285,15 +294,15 @@
 	const rejectNumberChange = () => {
 		let sumReject = 0
 		unfitInfos.value.forEach(v => {
-			sumReject += Number(v.rejectNum)
+			sumReject += v.rejectNum == null ? 0 : Number(v.rejectNum)
 		})
 		dayworkItem.value.rejectNum = sumReject
-		dayworkItem.value.qualifiedNum = dayworkItem.value.prodNum - dayworkItem.value.rejectNum
+		dayworkItem.value.qualifiedNum = dayworkItem.value.prodNum - sumReject
 		console.log(dayworkItem.value)
 	}
-	
+
 	const validHandle = () => {
-		for(let i = 0; i < unfitInfos.value.length; i++) {
+		for (let i = 0; i < unfitInfos.value.length; i++) {
 			const e = unfitInfos.value[i]
 			if (e.rejectNum == null || e.rejectNum == 0) {
 				uni.showToast({
@@ -303,7 +312,7 @@
 				return false
 			}
 		}
-		
+
 		if (!dayworkItem.value.qualifiedNum) {
 			uni.showToast({
 				icon: 'none',
@@ -322,7 +331,7 @@
 		if (!validHandle()) {
 			return
 		}
-		
+
 		const saveData = {
 			rejectList: unfitInfos.value,
 			consult: consultations.value,
@@ -332,6 +341,7 @@
 			qualifiedNum: dayworkItem.value.qualifiedNum,
 			remark: dayworkItem.value.remark
 		}
+		console.log(saveData)
 		finish(saveData).then(res => {
 			if (res.code === 200) {
 				uni.navigateBack()
@@ -358,6 +368,7 @@
 		}
 		update(saveData).then(res => {
 			if (res.code === 200) {
+				uni.$emit("formBack")
 				uni.navigateBack()
 			} else {
 				uni.showToast({

+ 4 - 1
pages/sorting/options.vue

@@ -60,6 +60,7 @@
 	// 分选标准
 	const optionList2 = ref([])
 	const dayworkItem = ref({})
+	const index = ref(0)
 	onMounted(() => {
 		const instance = getCurrentInstance().proxy
 		const eventChannel = instance.getOpenerEventChannel();
@@ -69,6 +70,7 @@
 			// 传入当前报工信息 通过当前报工的产品和工序获取检查指导书和分选标准
 			if (data && data.data) {
 				dayworkItem.value = data.data
+				index.value = data.index
 				loadInspection({
 					technologicalProcessId: dayworkItem.value.technologicalProcessId,
 					processId: dayworkItem.value.processId
@@ -139,7 +141,8 @@
 			id: data.id,
 			title: data.title,
 			standard: data.standard,
-			type: data.type
+			type: data.type,
+			index: index.value + 1
 		})
 		uni.navigateBack()
 	}