From 27cfdbb72202e0d48769814a9fa2d27de1819ade Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 19 十月 2023 16:47:00 +0800
Subject: [PATCH] 1.维修验证 100%

---
 pages/mjgl/wxyz.vue |  628 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 627 insertions(+), 1 deletions(-)

diff --git a/pages/mjgl/wxyz.vue b/pages/mjgl/wxyz.vue
index 02409e3..853589d 100644
--- a/pages/mjgl/wxyz.vue
+++ b/pages/mjgl/wxyz.vue
@@ -1,8 +1,634 @@
 <template>
+	<view>
+		<page-nav title="缁翠慨楠岃瘉"></page-nav>
+
+
+		<view v-show="topContent.length===0">
+			<div class="sacnBody">
+				<div class="boxImg"></div>
+				<div class="scanText">鏆傛棤缁翠慨鍙獙璇�</div>
+			</div>
+		</view>
+
+
+		<view v-show="topContent.length!==0">
+			<view class="mainContent">
+				<view>
+					<u-gap height="10" bgColor="#eff0f1"></u-gap>
+					<view class="head">
+						<view class="head_block">
+							<view class="head_left">
+								<view class="head_bar"></view>
+								<view class="head_title">
+									妯″叿缁翠慨淇℃伅
+								</view>
+							</view>
+
+							<view class="marginRight20">
+								<u-icon name="scan" @click="topScanClick" color="red" size="24"></u-icon>
+							</view>
+
+						</view>
+
+
+						<view :style="{maxHeight:'1200rpx',overflow: 'scroll'}">
+							<view class="marginTop20 marginLeft20 marginRight20 flex_column">
+								<!-- style="padding-bottom:70rpx;"> -->
+								<u-radio-group v-model="radioValue" class="flex_column">
+									<view class="marginBottom20 flex_column" style="width: 100%;"
+										@click="groupChange(item.mouldcode)" v-for="item in topContent"
+										:key="item.mouldcode">
+										<view class="flex_between marginBottom20">
+											<view style="display: flex;">
+												<view class="flex_column titleFont">
+													<view>缁翠慨鍗曞彿锛�</view>
+													<view>妯″叿缂栫爜锛�</view>
+													<view>妯″叿鍚嶇О锛�</view>
+													<view>瑙勬牸鍨嬪彿锛�</view>
+													<view>缁翠慨浜哄憳锛�</view>
+													<view>缁翠慨鏃堕棿锛�</view>
+													<view>鍋滄満缁翠慨锛�</view>
+													<view>鏁呴殰鎻忚堪锛�</view>
+												</view>
+												<view class="flex_column contentFont">
+													<view>{{item.repair_code}}</view>
+													<view>{{item.mouldcode}}</view>
+													<view>{{item.mouldname}}</view>
+													<view>{{item.mouldspec?item.mouldspec:'/'}}</view>
+													<view>{{item.repair_name}}</view>
+													<view>{{item.repair_date}}</view>
+													<view>{{item.is_shutdown==='Y'?'鏄�':'鍚�'}}</view>
+													<view style="width:400rpx;word-wrap:break-word">
+														{{item.failure_descript}}
+													</view>
+												</view>
+											</view>
+											<u-radio size='22' :key="item.mouldcode" :name="item.mouldcode"
+												@change="groupChange(item.mouldcode)" activeColor="red"></u-radio>
+										</view>
+
+
+										<view v-show="!item.arrowType" class="repairDetail">
+											缁翠慨璇︽儏
+										</view>
+										<view class="head" v-show="!item.arrowType" style="padding-bottom: 10rpx;">
+											<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
+												<view class="head_left">
+													<view class="head_bar"></view>
+													<view class="head_title">
+														鏁呴殰鎻忚堪
+													</view>
+												</view>
+											</view>
+											<view style="margin: 0 20rpx; width: 95%;" class="contentFont">
+												{{descMessage}}
+											</view>
+											<view style="display: flex;" v-show="fileList.length!==0">
+												<view v-for="(pic,index) in fileList" :key="index">
+													<view style="margin: 20rpx 0rpx 20rpx 20rpx;position: relative;">
+														<!-- 										<u-icon name="close" color="#fff" size="26"
+														style="position: absolute;z-index: 10;right: 0;background-color: black;border-radius:50%;"
+														@click="deletePic(pic)"></u-icon>
+ -->
+
+														<image :src="baseUrl+ pic.img1url" @click="imgPreview(pic)"
+															class="upLoadImg">
+														</image>
+													</view>
+												</view>
+
+											</view>
+										</view>
+
+
+										<u-gap height="5" v-show="!item.arrowType" bgColor="#eff0f1"
+											style='width: 106%;margin-left: -3%;'></u-gap>
+										<view class="head" v-show="!item.arrowType" style="padding-bottom: 10rpx;">
+											<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
+												<view class="head_left">
+													<view class="head_bar"></view>
+													<view class="head_title">
+														鍋滄満缁翠慨
+													</view>
+												</view>
+
+												<view class="" style="width: 120rpx;display: flex;">
+													<u-button type="primary" shape='circle' size="small"
+														:text="descMessage2.toString().length>0?'鍚�':'鏄�'">
+													</u-button>
+												</view>
+											</view>
+										</view>
+
+										<u-gap height="5" v-show="!item.arrowType&&descMessage2" bgColor="#eff0f1"
+											style='width: 106%;margin-left: -3%;'></u-gap>
+
+										<view class="head" v-show="!item.arrowType&&descMessage2"
+											style="padding-bottom: 10rpx;">
+											<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
+												<view class="head_left">
+													<view class="head_bar"></view>
+													<view class="head_title">
+														缁翠慨鍐呭
+													</view>
+												</view>
+											</view>
+											<view style="margin: 0 20rpx; width: 95%;" class="contentFont">
+												{{descMessage2}}
+											</view>
+										</view>
+
+										<u-gap height="5" v-show="!item.arrowType&&descMessage3" bgColor="#eff0f1"
+											style='width: 106%;margin-left: -3%;'></u-gap>
+
+										<view class="head" v-show="!item.arrowType&&descMessage3"
+											style="padding-bottom: 10rpx;">
+											<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
+												<view class="head_left">
+													<view class="head_bar"></view>
+													<view class="head_title">
+														鏇存崲澶囦欢
+													</view>
+												</view>
+											</view>
+
+
+											<view style="margin: 0 20rpx; width: 95%;" class="contentFont">
+												{{descMessage3}}
+											</view>
+											<view style="display: flex;" v-show="fileList2.length!==0">
+												<view v-for="(pic,index) in fileList2" :key="index">
+													<view style="margin: 20rpx 0rpx 20rpx 20rpx;position: relative;">
+														<!-- 								<u-icon name="close" color="#fff" size="26"
+														style="position: absolute;z-index: 10;right: 0;background-color: black;border-radius:50%;"
+														@click="deletePic(pic)"></u-icon>
+ -->
+														<image :src="baseUrl+ pic.img2url" @click="imgPreview2(pic)"
+															class="upLoadImg">
+														</image>
+													</view>
+												</view>
+
+											</view>
+										</view>
+
+
+										<u-gap height="5" v-show="!item.arrowType" bgColor="#eff0f1"
+											style='width: 106%;margin-left: -3%;'></u-gap>
+										<view class="head" v-show="!item.arrowType" style="padding-bottom: 10rpx;">
+											<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
+												<view class="head_left">
+													<view class="head_bar"></view>
+													<view class="head_title">
+														楠岃瘉缁撴灉
+													</view>
+												</view>
+
+
+												<view class=" " style="width:250rpx;display: flex;"
+													:key="Math.random()+item.repair_code">
+													<u-button :plain="item.resultValue!=='OK'" text="姝e父" shape='circle'
+														size="small" style="margin-right:5rpx;"
+														@click="resultValueClick(item.mouldcode,'OK')"
+														:key="Math.random()+item.repair_code+'OK'" type="primary">
+													</u-button>
+													<u-button type="warning" :plain="item.resultValue!=='NG'"
+														shape='circle' size="small"
+														:key="Math.random()+item.repair_code+'NG'" text="寮傚父"
+														@click="resultValueClick(item.mouldcode,'NG')">
+													</u-button>
+												</view>
+											</view>
+										</view>
+
+										<u-gap height="5" v-show="!item.arrowType" bgColor="#eff0f1"
+											style='width: 106%;margin-left: -3%;'></u-gap>
+										<view class="head" v-show="!item.arrowType" style="padding-bottom: 10rpx;">
+											<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
+												<view class="head_left">
+													<view class="head_bar"></view>
+													<view class="head_title">
+														鍓╀綑瀵垮懡(娆�)
+													</view>
+												</view>
+
+
+												<view class=" " style="width:250rpx;display: flex;">
+
+													<view class='inputClass marginTop10'>
+														<u--input placeholder="璇疯緭鍏ユ暟瀛�"
+															:disabled='item.resultValue!=="OK"' border="surround"
+															type='number' v-model="surp_life"></u--input>
+													</view>
+
+												</view>
+											</view>
+										</view>
+										<!-- <u-gap height="16" v-show="!item.arrowType" bgColor="#eff0f1"
+											style='width: 106%;margin-left: -3%;'></u-gap> -->
+
+										<view style="display: flex;justify-content: center;margin : 10rpx; 0">
+											<view class="arrowClass"
+												@click="item.arrowType?arrowDownClick(item):arrowUpClick(item)">
+												<u-icon :name="item.arrowType?'arrow-down':'arrow-up'" color="#c8c8c8"
+													size="24"></u-icon>
+											</view>
+										</view>
+
+
+										<u-gap height="16" bgColor="#eff0f1" style="width: 106%;margin-left: -3%;">
+										</u-gap>
+									</view>
+								</u-radio-group>
+							</view>
+						</view>
+					</view>
+
+				</view>
+			</view>
+
+			<view class="footer" style="min-height:62rpx;">
+				<u-button size="large" :loading="isDisabledSubmitButton" loadingText="姝e湪鎻愪氦,璇风◢绛�..." type="primary"
+					@click="submit" text="纭鎻愪氦">
+					<!-- :disabled="topContent.length>0? topContent.find(i=>i.repair_code===radioValue).resultValue==='':true" -->
+
+				</u-button>
+			</view>
+
+
+
+		</view>
+
+
+		<!-- <scan-code></scan-code> -->
+	</view>
 </template>
 
 <script>
+	import {
+		RepairVerificationScanMouldData,
+		RepairVerificationScanMouldDataSub,
+		RepairVerificationScanMouldSave
+	} from '../../config/api.js'
+
+	// import scanCode from '@/components/scan-code/scan-code.vue'
+	export default {
+		// components: {
+		// 	scanCode
+		// },
+		onLoad(option) {
+
+
+			// const _this = this
+			// uni.$off('scancodedate') // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒
+			// uni.$on('scancodedate', function(content) {
+			// 	console.log("鎵弿鍒扮殑鍐呭涓�:", content)
+
+
+			// 	let r = _this.topContent.find(i => i.repair_code === content)
+
+			// 	if (r === undefined) {
+			// 		uni.$u.toast('鎵�鎵殑浜岀淮鐮佷笉鍦ㄥ垪琛ㄤ腑锛�')
+			// 		// return
+			// 	} else {
+			// 		_this.topContent.forEach((item, index) => {
+			// 			if (item.repair_code === content) {
+			// 				_this.topContent.splice(index, 1)
+			// 			}
+			// 		})
+			// 		_this.topContent.unshift(r)
+			// 		_this.radioValue = content
+			// 	}
+			// })
+		},
+		onPullDownRefresh() {
+			setTimeout(() => {
+				this.init(() => {
+					uni.stopPullDownRefresh();
+				})
+			}, 1000);
+		},
+		data() {
+			return {
+				topRightMessageCount: 0,
+				isDisabledSubmitButton: false,
+				baseUrl: 'http://121.196.36.24:8021/',
+				topContent: [], //鎵弿淇濆吇宸ヤ綅鎵�甯﹀嚭鏉ョ殑鍐呭
+				radioValue: '', //鍗曢�夋鐨勫��
+				scanContent: '', //鎵弿鎵嚭鏉ョ殑鍊�
+
+				detailContent: [], //鏄剧ず璇︽儏鍐呭
+
+				descMessage: '', // 
+				descMessage2: '', // 
+				descMessage3: '', // 
+				imgPreviewSrcs: [], //鍥剧墖棰勮src   鏁呴殰鎻忚堪
+				fileList: [], //鍥剧墖鏁扮粍         鏁呴殰鎻忚堪
+				fileList2: [], //鏇存崲澶囦欢鍥剧墖
+				imgPreviewSrcs2: [],
+
+				surp_life: ''
+
+
+			}
+		},
+		created() {
+
+
+		},
+		mounted() {
+			this.init()
+			this.getRepairVerificationScanMouldData()
+
+		},
+		methods: {
+
+			// 棰勮鍥剧墖
+			imgPreview(img) {
+				console.log(img)
+				uni.previewImage({
+					current: this.fileList.findIndex(i => i.img1url === img.img1url),
+					indicator: "number",
+					loop: true,
+					urls: this.imgPreviewSrcs
+				})
+			},
+			imgPreview2(img) {
+				uni.previewImage({
+					current: this.fileList2.findIndex(i => i.img2url === img.img2url),
+					indicator: "number",
+					loop: true,
+					urls: this.imgPreviewSrcs2
+				})
+			},
+			init() {
+				uni.stopPullDownRefresh();
+			},
+			// 鍗曢�夋寜閽�変腑鍊兼敼鍙�
+			groupChange(mouldcode) {
+				this.radioValue = mouldcode
+
+				console.log(JSON.stringify(this.topContent))
+				this.topContent.forEach(item => {
+					if (item.mouldcode !== mouldcode) {
+						item.resultValue = ''
+					}
+				})
+				this.$forceUpdate()
+
+			},
+
+			// 鎵爜妗嗙偣鍑�
+			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.scanContent = res.result;
+
+
+
+						let r = that.topContent.find(i => i.repair_code === that.scanContent)
+
+						if (r === undefined) {
+							uni.$u.toast('鎵�鎵殑浜岀淮鐮佷笉鍦ㄥ垪琛ㄤ腑锛�')
+						} else {
+							that.topContent.forEach((item, index) => {
+								if (item.repair_code === that.scanContent) {
+									that.topContent.splice(index, 1)
+								}
+							})
+							that.topContent.unshift(r)
+							that.radioValue = that.scanContent
+						}
+
+					},
+					complete: function(res) {
+
+					},
+					fail: function(res) {
+						console.log('鏉$爜绫诲瀷锛�' + res.scanType);
+						console.log('鏉$爜鍐呭锛�' + res.result);
+					}
+
+				});
+			},
+
+			// 鑾峰彇缁翠慨鍒楄〃    
+			async getRepairVerificationScanMouldData(val) {
+				const res = await RepairVerificationScanMouldData({
+					mouldcode: ''
+				})
+				if (res.code === '200') {
+					this.topContent = res.data
+					this.topContent.forEach(i => {
+						i.arrowType = true
+						i.resultValue = ''
+					})
+					if (this.topContent.length > 0) {
+						this.getRepairVerificationScanMouldDataSub(this.topContent[0].repair_code, this.topContent[0]
+							.mouldcode)
+					}
+					this.radioValue = this.topContent.length > 0 ? this.topContent[0].mouldcode : ''
+					// console.log(this.topContent, 1)
+					this.$forceUpdate()
+
+				}
+			},
+			// 鑾峰彇缁翠慨鍒楄〃璇︽儏
+			async getRepairVerificationScanMouldDataSub(repair_code, mouldcode) {
+				const res = await RepairVerificationScanMouldDataSub({
+					repair_code,
+					mouldcode
+				})
+				this.detailContent = res.data
+
+				this.descMessage = this.detailContent.failure_descript
+				this.fileList = this.detailContent.failure_descriptimg ? this.detailContent.failure_descriptimg.filter(
+					i => i.img1url !== '') : []
+
+				this.imgPreviewSrcs = []
+				this.fileList.forEach(i => {
+					this.imgPreviewSrcs.push(this.baseUrl + i.img1url)
+				})
+
+				this.descMessage2 = this.detailContent.repair_content ? this.detailContent.repair_content : ''
+				this.descMessage3 = this.detailContent.repair_part ? this.detailContent.repair_part : ''
+				this.fileList2 = this.detailContent.repair_partimage ? this.detailContent.repair_partimage.filter(i =>
+					i.img2url !== '') : []
+				this.imgPreviewSrcs2 = []
+				this.fileList2.forEach(i => {
+					this.imgPreviewSrcs2.push(this.baseUrl + i.img2url)
+				})
+
+				this.surp_life = ''
+				this.$forceUpdate()
+			},
+			// 鍚戜笅鐨勭澶寸偣鍑�
+			arrowDownClick(val) {
+				this.topContent.forEach(item => {
+					item.arrowType = true
+					if (item.mouldcode === val.mouldcode) {
+						item.arrowType = false
+						item.resultValue = item.resultValue ? item.resultValue : ''
+						this.descMessage = ''
+						this.descMessage2 = ''
+						this.descMessage3 = ''
+						this.fileList = []
+						this.fileList2 = []
+						this.imgPreviewSrcs = []
+						this.imgPreviewSrcs2 = []
+						this.getRepairVerificationScanMouldDataSub(item.repair_code, item.mouldcode)
+					}
+				})
+				this.$forceUpdate()
+			},
+			//鍚戜笂浠庣澶寸偣鍑�
+			arrowUpClick(val) {
+				this.topContent.forEach(item => {
+					item.arrowType = true
+				})
+				this.$forceUpdate()
+			},
+			// 楠岃瘉缁撴灉鐐瑰嚮
+			resultValueClick(mouldcode, val) {
+
+				this.surp_life = ''
+
+				this.topContent.forEach(item => {
+					if (item.mouldcode === mouldcode) {
+						item.resultValue = val
+					}
+				})
+
+				this.$forceUpdate()
+			},
+			// 纭鎻愪氦鎸夐挳
+			async submit() {
+				const result = this.topContent.find(item => item.mouldcode === this.radioValue)
+				const data = {
+					repairwo: result.repair_code,
+					mouldcode: this.radioValue,
+					result: result.resultValue,
+					surp_life: this.surp_life
+				}
+
+				console.log(JSON.stringify(data));
+				this.isDisabledSubmitButton = true
+				const res = await RepairVerificationScanMouldSave(data)
+				if (res.code === '200') {
+					uni.$u.toast('鎻愪氦鎴愬姛锛�')
+					this.topContent = this.topContent.filter(i => i.mouldcode !== this
+						.radioValue)
+					this.radioValue = this.topContent.length === 0 ? '' : this.topContent[0]
+						.mouldcode
+
+				} else {
+					uni.$u.toast(res.message)
+				}
+				this.isDisabledSubmitButton = false
+				this.$forceUpdate()
+
+
+
+
+
+				// const header = {
+				// 	'Content-Type': 'application/x-www-form-urlencoded',
+				// 	'Token': uni.getStorageSync('Token'),
+				// }
+
+				// const result = this.topContent.find(item => item.mouldcode === this.radioValue)
+				// let formData = {
+				// 	username: uni.getStorageSync('username'),
+				// 	repairwo: result.repair_code,
+				// 	eqpcode: result.eqpcode,
+				// 	wkshpcode: result.wksp_code,
+				// 	result: result.resultValue,
+				// }
+
+				// this.isDisabledSubmitButton = true
+				// uni.uploadFile({
+				// 	url: this.$baseUrl + '/AppDeviceManage/RepairVerificationScanDeviceSave',
+				// 	files: [{
+				// 		"uri": "/"
+				// 	}],
+				// 	header: header,
+				// 	formData: formData,
+				// 	success: (res) => {
+				// 		let result = JSON.parse(res.data)
+				// 		if (res.statusCode == 200 && result.code == '200') {
+				// 			uni.$u.toast('鎻愪氦鎴愬姛锛�')
+				// 			this.topContent = this.topContent.filter(i => i.repair_code !== this
+				// 				.radioValue)
+				// 			this.radioValue = this.topContent.length === 0 ? '' : this.topContent[0]
+				// 				.repair_code
+				// 		} else {
+				// 			uni.$u.toast(result.Message)
+				// 		}
+				// 		this.isDisabledSubmitButton = false
+				// 		this.$forceUpdate()
+				// 	},
+				// 	fail(res) {
+				// 		uni.$u.toast('鎻愪氦澶辫触锛�')
+				// 		this.isDisabledSubmitButton = false
+				// 	},
+				// })
+
+
+
+
+
+			},
+		}
+	}
 </script>
 
-<style>
+<style lang="scss" scoped>
+	@import url('@/style/global.css');
+
+	::v-deep .uicon-arrow-left>span {
+		display: block;
+	}
+
+	::v-deep .uicon-camera-fill {
+		font-size: 60rpx !important;
+	}
+
+
+	::v-deep .uni-progress-bar {
+		background-color: transparent !important;
+	}
+
+	.upLoadImg {
+		width: 160rpx;
+		height: 160rpx;
+		border-radius: 20rpx;
+	}
+
+	.repairDetail {
+		margin-top: 20rpx;
+		background-color: #eff0f1;
+		height: 80rpx;
+		font-size: 36rpx;
+		width: 106%;
+		margin-left: -3%;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		border-radius: 10rpx;
+	}
+
+	.arrowClass {
+		display: flex;
+		justify-content: center;
+		// background-color: #efefef;
+		width: 100rpx;
+		// border-radius: 10rpx;
+		height: 56rpx;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3