From 0552bde02a9f07f52bcff9a044b9de3e64f868be Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期三, 19 十一月 2025 16:43:38 +0800
Subject: [PATCH] 1.生产报工、质量管理页面优化

---
 pages/zlgl/xjjy1.vue |  565 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 565 insertions(+), 0 deletions(-)

diff --git a/pages/zlgl/xjjy1.vue b/pages/zlgl/xjjy1.vue
new file mode 100644
index 0000000..319854b
--- /dev/null
+++ b/pages/zlgl/xjjy1.vue
@@ -0,0 +1,565 @@
+<template>
+	<view>
+		<page-nav title="宸℃妫�楠�"></page-nav>
+
+		<view v-if="processArr.length===0">
+			<div class="sacnBody">
+				<div class="scanImg" @click="topScanClick"></div>
+				<div class="scanText">鎵弿宸ュ簭浠诲姟鐮�</div>
+			</div>
+		</view>
+
+
+		<view v-if="processArr.length!==0" class="mainContent" style="height: 1340rpx;overflow: auto">
+			<view>
+				<u-gap height="10" bgColor="#eff0f1"></u-gap>
+				<view class="head" style="height: 386rpx;overflow: auto;">
+					<view class="head_block">
+						<view class="head_left">
+							<view class="head_bar"></view>
+							<view class="head_title" style="font-weight: bolder;">
+								宸ュ崟淇℃伅
+							</view>
+						</view>
+					</view>
+
+					<view class="marginLeft20 marginRight20">
+						<view class="marginBottom20" style="display: flex;">
+							<view class="flex_column titleFont">
+								<view>鍗曟嵁缂栧彿锛�</view>
+								<view>鐗╂枡缂栫爜锛�</view>
+								<view>鐗╂枡鍚嶇О锛�</view>
+								<view>鐗╂枡瑙勬牸锛�</view>
+								<view>宸ュ簭缂栫爜锛�</view>
+								<view>宸ュ簭鍚嶇О锛�</view>
+							</view>
+							<view class="flex_column contentFont">
+								<view>{{processObj.wo_code}}</view>
+								<view>{{processObj.partcode}}</view>
+								<view>{{processObj.partname}}</view>
+								<view>{{processObj.partspec?processObj.partspec:'/'}}</view>
+								<view>{{processObj.stepcode}}</view>
+								<view>{{processObj.stepname}}</view>
+							</view>
+						</view>
+					</view>
+				</view>
+
+				<u-gap height="10" bgColor="#eff0f1"></u-gap>
+
+				<view class="head" style="height: 290rpx;overflow: auto;">
+					<view class="head_block">
+						<view class="head_left">
+							<view class="head_bar"></view>
+							<view class="head_title" style="font-weight: bolder;">
+								璐ㄦ鏂规
+							</view>
+						</view>
+					</view>
+
+					<view class="marginLeft20 marginRight20">
+						<view class="marginBottom20" style="display: flex;">
+							<view class="flex_column titleFont">
+								<view>鏂规鍚嶇О锛�</view>
+								<view>鎶芥牱鏂瑰紡锛�</view>
+								<view>鎶ュ伐鏁伴噺锛�</view>
+								<view>鏍锋湰鏁伴噺锛�</view>
+							</view>
+							<view class="flex_column contentFont">
+								<view>{{processObj.checkstandname}}</view>
+								<view>{{processObj.sampmethod==='FIXED'?'鍥烘椂鎶芥':'姣斾緥鎶芥'}}</view>
+								<view>{{processObj.good_qty}}</view>
+
+
+								<u-number-box inputWidth='50' v-model="processObj.sampscare" min='1'
+									:max='processObj.good_qty' class="contentFont"
+									@change="samplesChange"></u-number-box>
+							</view>
+						</view>
+					</view>
+				</view>
+
+
+				<u-gap height="10" bgColor="#eff0f1"></u-gap>
+				<view class="head" style="">
+					<view class="head_block">
+						<view class="head_left">
+							<view class="head_bar"></view>
+							<view class="head_title" style="font-weight: bolder;">
+								妫�楠岄」鐩�
+							</view>
+						</view>
+					</view>
+
+
+					<view class="marginBottom20 marginTop10"
+						style="display: flex;justify-content: space-around;align-items: center;">
+						<u-button type="primary" :disabled="checkNumber===1" @click="preTo"
+							style="width: 160rpx;height: 60rpx;" plain text="涓婁竴浠�"></u-button>
+						<view style="">{{checkNumber}}/{{processObj.sampscare}}</view>
+						<u-button type="primary"
+							:disabled="checkNumber===processObj.sampscare||processArr%processArr.filter(i=>i.isPlain!=='').length===0"
+							@click="nextTo" style="width: 160rpx;height: 60rpx; " plain text="涓嬩竴浠�"></u-button>
+					</view>
+
+					<u-gap height="6" style="width: 96%;margin-left: 2%;" bgColor="#eff0f1"></u-gap>
+
+
+					<view class="marginLeft20 marginRight20 marginTop20" style="margin-bottom: 132rpx;">
+						<view class="marginBottom20 flex_column" v-for="(item,index) in processArr"
+							v-if="item.checkNumber===checkNumber" :key="item.name+index+checkNumber">
+
+
+							<view class="flex_between marginLeft20 ">
+								<view class="titleFont">{{item.name}}</view>
+
+								<view class="contentFont" v-if="item.numberjudge==='N'"
+									style="display: flex;width: 280rpx;">
+
+									<u-button type="success" style="width: 130rpx;margin-left: 10%;height: 56rpx;"
+										shape="circle" @click="item.isPlain=true;$forceUpdate()" :plain='!item.isPlain'
+										text="鍚堟牸"></u-button>
+									<!-- :disabled="item.required==='Y'&&!item.real_value" -->
+
+									<u-button type="warning" style="width: 130rpx;margin-left: 4%;height: 56rpx;"
+										shape="circle" :plain='item.isPlain' @click="item.isPlain=false;$forceUpdate()"
+										text="涓嶅悎鏍�"></u-button>
+									<!-- :disabled="item.required==='Y'&&!item.real_value" -->
+
+								</view>
+
+							</view>
+
+							<view class="flex_between marginLeft20 ">
+								<view class="flex_column titleFont">
+									<view v-if="item.standvalue">鏍囧噯鍊�</view>
+									<view v-if="item.uppervalue">涓婇檺鍊�</view>
+									<view v-if="item.lowervalue">涓嬮檺鍊�</view>
+								</view>
+								<view class="flex_column titleFont marginRight20">
+									<view v-if="item.standvalue">{{item.standvalue}}</view>
+									<view v-if="item.uppervalue">{{item.uppervalue}}</view>
+									<view v-if="item.lowervalue">{{item.lowervalue}}</view>
+								</view>
+							</view>
+
+							<view class="titleFont marginLeft20 marginRight20">
+								<view v-if="item.stepcheckitem_desc">鎻忚堪 {{item.stepcheckitem_desc}}</view>
+							</view>
+
+							<view class="flex_between marginLeft20  marginTop10 marginBottom20">
+								<view class="titleFont  " style="display: flex;align-items: center;"
+									v-if="item.numberjudge==='Y'">
+									<view class="titleFont marginRight20">
+										瀹炴祴鍊�
+									</view>
+
+									<view class="inputClass " style="width:40%;">
+										<u--input style="" :adjustPosition='false' placeholder="璇疯緭鍏�" border="surround"
+											v-model="item.real_value" @change='val=>realValueBlur(val,item)'></u--input>
+									</view>
+
+									<view style="display: flex;width: 280rpx;margin-left: 12rpx;">
+										<u-button type="success" style="width: 130rpx;margin-left: 10%;height: 56rpx;"
+											shape="circle" @click="item.isPlain=true;$forceUpdate()"
+											:disabled="item.required==='Y'&&!item.real_value" :plain='!item.isPlain'
+											text="鍚堟牸"></u-button>
+
+
+										<u-button type="warning" style="width: 130rpx;margin-left: 4%;height: 56rpx;"
+											shape="circle" :plain='item.isPlain'
+											:disabled="item.required==='Y'&&!item.real_value"
+											@click="item.isPlain=false;$forceUpdate()" text="涓嶅悎鏍�"></u-button>
+									</view>
+								</view>
+
+							</view>
+
+							<!-- <view class=" marginLeft20 marginRight20 marginTop10">
+								<view class="titleFont"> 鎻忚堪锛歿{item.stepcheckitem_desc}}</view>
+							</view>
+							<view class=" marginLeft20 marginRight20 marginTop10 marginBottom20"
+								style="display: flex;align-items: center;">
+								<view class="contentFont"> 澶囨敞锛�</view>
+								<view class="inputClass " style="">
+									<u--input style="" placeholder="璇疯緭鍏�" border="surround"
+										v-model="item.stepcheckitem_remark"></u--input>
+								</view>
+							</view> -->
+
+							<u-gap height="6"
+								v-if="(index+1)%processArr.map(i=>i.checkNumber===1).filter(i=>i).length!==0"
+								style="width: 96%;margin-left: 2%;" bgColor="#eff0f1"></u-gap>
+
+						</view>
+					</view>
+
+				</view>
+
+
+
+
+			</view>
+		</view>
+
+		<view class="footer" v-if="processArr.length!==0">
+			<u-button v-if="processArr.length!==0" type="primary" size='large'
+				:disabled="!(processArr.filter(i=>i.isPlain==='').length===0)" :hairline="true" @click="navigateTo"
+				text="涓嬩竴姝�"></u-button>
+		</view>
+
+
+
+	</view>
+</template>
+
+
+<script>
+	import {
+		MesOrderStepCheckSearch,
+		MesOrderStepCheckItemList
+	} from '../../config/api.js';
+
+	export default {
+		onLoad(option) {
+			this.getStepCheckSearch(option.orderstep)
+		},
+
+		onPullDownRefresh() {
+			setTimeout(() => {
+				this.init(() => {
+					uni.stopPullDownRefresh();
+				})
+			}, 1000);
+		},
+
+		data() {
+			return {
+
+				processObj: {
+					// wocode: '',
+					// partcode: '',
+					// partname: '',
+					// partspec: '',
+					// stepcode: '',
+					// stepname: '',
+					// checkstandcode: '',
+					// checkstandname: '',
+					// check_type: '',
+					// sampmethod: '', // FIXED(鍥烘椂鎶芥)  SCARE(姣斾緥鎶芥)
+					// sampscare: '',
+					// qualitystatus: '',
+					// good_qty: '', // 鎸囩殑鎶ュ伐鏁伴噺
+					// sampleqty: '',
+					// goodqty: '', // 鍚堟牸鏁伴噺
+					// ngqty: '', // 涓嶈壇鏁伴噺
+				}, //宸ュ簭妫�楠屽璞�
+				processArr: [], //宸ュ簭妫�楠屾暟缁�
+
+
+				checkNumber: 1, //妫�楠岄」鐩腑鐨勬楠屾暟閲�  鐜板湪澶勪簬绗嚑涓�
+			}
+		},
+		created() {
+
+		},
+		mounted() {
+			this.init()
+
+			// this.getStepCheckSearch('MO-2024-01-0004_2;101')
+
+		},
+		methods: {
+			init() {
+				uni.stopPullDownRefresh();
+			},
+
+			async getStepCheckSearch(orderstepqrcode) {
+				console.log('鎵ц浜�')
+				// 妫�楠屾柟寮廎irstCheck锛堥妫�锛� PatroCheck(宸℃) EndCheck(瀹屽伐妫�)
+				const data = {
+					// 'MO-2023-05-0003_1;Step06'
+					orderstepqrcode,
+					checktype: 'PatroCheck',
+					// stu_torgcode: uni.getStorageSync('stu_torgcode')
+				}
+				// const res = await MesOrderStepCheckSearch(this.global.formatData(data))
+				const res = await MesOrderStepCheckSearch(data)
+
+
+				if (res.code === '200') {
+					this.processObj = {
+						wo_code: res.data.labcont[0].wo_code,
+						partcode: res.data.labcont[0].partcode,
+						partname: res.data.labcont[0].partname,
+						partspec: res.data.labcont[0].partspec,
+						stepcode: res.data.labcont[0].stepcode,
+						stepname: res.data.labcont[0].stepname,
+						good_qty: res.data.labcont[0].good_qty,
+						checkstandcode: res.data.chekstand[0].checkstandcode,
+						checkstandname: res.data.chekstand[0].checkstandname,
+						sampmethod: res.data.chekstand[0].sampmethod,
+						sampscare: res.data.chekstand[0].sampmethod === 'FIXED' ? res.data.chekstand[0].sampscare :
+							Math.ceil(res.data.labcont[0].good_qty * res.data.chekstand[0].sampscare / 100)
+					}
+
+					this.processObj.sampscare = this.processObj.sampscare <= this.processObj.good_qty ? this.processObj
+						.sampscare : this.processObj.good_qty
+
+
+					await this.getStepCheckItemList(this.processObj.checkstandcode)
+
+				} else {
+					setTimeout(() => {
+						uni.navigateBack({
+							delta: 1, //杩斿洖灞傛暟锛�1鍒欎笂椤�   
+						})
+					}, 1000)
+				}
+			},
+
+			async getStepCheckItemList(checkstandcode) {
+				const data = {
+					checkstandcode
+				}
+				const res = await MesOrderStepCheckItemList(data)
+
+				this.processArr = []
+
+				for (var i = 0; i < this.processObj.sampscare; i++) {
+					res.data.forEach(j => {
+						this.processArr.push({
+							checkNumber: i + 1,
+							stepcheckitem_seq: j.stepcheckitem_seq,
+							name: j.name,
+							code: j.code,
+							standvalue: j.standvalue,
+							lowervalue: j.lowervalue,
+							uppervalue: j.uppervalue,
+							real_value: j.real_value,
+							unit: j.unit,
+							stepcheckitem_desc: j.stepcheckitem_desc,
+							stepcheckitem_remark: '',
+							isPlain: '',
+							required: j.required, //鏄惁蹇呭~
+							numberjudge: j.numberjudge, //鏁板�煎垽鏂�
+						})
+					})
+				}
+
+
+			},
+
+			// 鏍锋湰鏁伴噺鍊兼敼鍙樻椂
+			samplesChange(val) {
+
+				console.log(val.value)
+				const t = this.processArr.filter(i => i.checkNumber === 1)
+				let len = this.processArr.length / t.length
+
+				// 浠舵暟鍑忓皯鏃�
+				if (val.value < this.processArr.length / t.length) {
+					this.processArr.reverse()
+					const a = this.processArr.splice(0, t.length * (len - val.value))
+					this.processArr.reverse()
+					if (this.checkNumber > val.value) {
+						this.checkNumber = val.value
+					}
+				}
+
+
+				// 浠舵暟鍙樺鏃�
+				if (val.value > this.processArr.length / t.length) {
+
+					for (var i = val.value; i > len; i--) {
+						t.forEach(j => {
+							this.processArr.push({
+								checkNumber: i,
+								stepcheckitem_seq: j.stepcheckitem_seq,
+								name: j.name,
+								code: j.code,
+								standvalue: j.standvalue,
+								lowervalue: j.lowervalue,
+								uppervalue: j.uppervalue,
+								real_value: '',
+								unit: j.unit,
+								stepcheckitem_desc: j.stepcheckitem_desc,
+								stepcheckitem_remark: '',
+								isPlain: '',
+								required: j.required, //鏄惁蹇呭~
+								numberjudge: j.numberjudge, //鏁板�煎垽鏂�
+							})
+						})
+					}
+
+					this.processArr.sort((a, b) => a.checkNumber - b.checkNumber)
+
+				}
+
+				// console.log(this.processArr, 1)
+				// console.log(this.processArr.length, 1)
+				this.$forceUpdate()
+			},
+
+
+			// 涓婁竴浠�
+			preTo() {
+				if (this.checkNumber > 1) {
+					this.checkNumber--
+				}
+			},
+
+			//涓嬩竴浠�
+			nextTo() {
+				if (this.checkNumber < this.processObj.sampscare) {
+					this.checkNumber++
+				}
+				this.$forceUpdate()
+			},
+
+
+			// 瀹炴祴鍊艰緭鍏ユ椂澶辩劍鐘舵��
+			realValueBlur(val, item) {
+				console.log(val === '', item)
+
+
+				if (val.value !== '') {
+					if (item.numberjudge === 'Y') { //濡傛灉闇�瑕佽繘琛屾暟鍊煎垽鏂�
+
+						if (item.uppervalue === '' && item.lowervalue === '') { //涓婇檺鍊间负绌猴紝涓嬮檺鍊间负绌�
+							if (parseFloat(val) === parseFloat(item.standvalue)) {
+								item.isPlain = true
+							} else {
+								item.isPlain = false
+							}
+						}
+
+
+						if (item.uppervalue !== '' && item.lowervalue !== '') { //涓婇檺鍊间笉涓虹┖锛屼笅闄愬�间笉涓虹┖
+							if (parseFloat(val) >= parseFloat(item.lowervalue) && parseFloat(val) <=
+								parseFloat(item.uppervalue)) {
+								item.isPlain = true
+							} else {
+								item.isPlain = false
+							}
+						}
+
+
+						if (item.uppervalue !== '' && item.lowervalue === '') { //涓婇檺鍊间笉涓虹┖锛屼笅闄愬�间负绌�
+							if (parseFloat(val) <= parseFloat(item.uppervalue)) {
+								item.isPlain = true
+							} else {
+								item.isPlain = false
+							}
+						}
+
+						if (item.uppervalue === '' && item.lowervalue !== '') { //涓婇檺鍊间负绌猴紝涓嬮檺鍊间笉涓虹┖
+							if (parseFloat(val) >= parseFloat(item.lowervalue)) {
+								item.isPlain = true
+							} else {
+								item.isPlain = false
+							}
+						}
+
+					}
+				}
+
+
+				if (val === '') {
+					item.isPlain = ''
+				}
+				// this.$forceUpdate()
+			},
+
+
+
+			// 涓嬩竴姝�
+			navigateTo() {
+				// 璁$畻OK鍊�
+				let goodqty = 0;
+				for (var i = 0; i < this.processObj.sampscare; i++) {
+					let flag = this.processArr.filter(j => j.checkNumber === i + 1).every(j => j.isPlain)
+					if (flag) {
+						goodqty++
+					}
+				}
+
+
+				uni.navigateTo({
+					url: './xjjy2?processObj=' + JSON.stringify(this.processObj) +
+						'&processArr=' + JSON.stringify(this.processArr) + '&goodqty=' + goodqty
+				});
+
+
+			},
+
+			// 鎵爜
+			topScanClick() {
+				let that = this;
+
+				uni.scanCode({
+					onlyFromCamera: true,
+					// scanType: ['barCode', 'qrCode'],
+					scanType: ['qrCode'],
+					success: function(res) {
+						console.log('鏉$爜绫诲瀷锛�' + res.scanType);
+						console.log('鏉$爜鍐呭锛�' + res.result);
+						that.getStepCheckSearch(res.result)
+						// that.scanContent = res.result;
+						// let flag = false
+						// that.processArr.forEach(item => {
+						// 	if (item.hbarcode === res.result) {
+						// 		flag = true
+						// 	}
+						// })
+						// if (flag) {
+						// 	that.$u.toast('姝ゆ潯鐮佸凡鎵弿锛屽凡鍦ㄥ垪琛ㄤ腑锛�')
+						// } else {
+						// 	//澶勭悊鎵爜浜嬩欢
+						// 	// that.getStepCheckSearch(that.scanContent);
+						// }
+					},
+					complete: function(res) {
+
+					},
+					fail: function(res) {
+						console.log('鏉$爜绫诲瀷锛�' + res.scanType);
+						console.log('鏉$爜鍐呭锛�' + res.result);
+					}
+
+				});
+			},
+
+			fromSubmitData() {
+				this.processObj = {}
+				this.processArr = []
+				this.checkNumber = 1
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import url('@/style/global.css');
+
+	::v-deep .uicon-arrow-left>span {
+		display: block;
+	}
+
+	::v-deep .u-input {
+		padding: 6rpx 18rpx !important;
+	}
+
+	::v-deep .u-number-box__minus {
+		height: 50rpx !important;
+	}
+
+	::v-deep .u-number-box__input {
+		height: 50rpx !important;
+
+	}
+
+	::v-deep .u-number-box__plus {
+		height: 50rpx !important;
+	}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3