From 044b6f50a7cc57565409f67b62d4766f2e7cbf52 Mon Sep 17 00:00:00 2001
From: Mr.Zhang <710666463@qq.com>
Date: 星期四, 07 九月 2023 16:15:11 +0800
Subject: [PATCH] 小程序

---
 minipro_standard/pages/linePatrol/linePatrol.vue           |  121 +++++++++++++----
 minipro_standard/pages/inspectComplete/inspectComplete.vue |  129 +++++++++++++-----
 minipro_standard/pages/inspectPatrol/inspectPatrol.vue     |  122 +++++++++++++----
 3 files changed, 276 insertions(+), 96 deletions(-)

diff --git a/minipro_standard/pages/inspectComplete/inspectComplete.vue b/minipro_standard/pages/inspectComplete/inspectComplete.vue
index d55a676..f38b8c4 100644
--- a/minipro_standard/pages/inspectComplete/inspectComplete.vue
+++ b/minipro_standard/pages/inspectComplete/inspectComplete.vue
@@ -22,8 +22,7 @@
 			<div class="inspection_list_item" v-if="form.gdmc">
 				<span>璁″垝鏁伴噺</span>
 				<div class="right1">
-					<span
-						style="color: black;">{{info.planNum}}{{info.umodel ? info.umodel.name : ''}}</span>
+					<span style="color: black;">{{info.planNum}}{{info.umodel ? info.umodel.name : ''}}</span>
 				</div>
 			</div>
 		</div>
@@ -53,59 +52,119 @@
 		</div>
 		<div class="inspection_footer">
 			<button class="inspection_footer_sub" @click="submit" v-preventReClick>鎻愪氦</button>
-		</div>
-		<u-picker :show="show1" title="璇烽�夋嫨涓嶈壇璇存槑" :columns="columns" @cancel="show1=false" @confirm="badConfirm"></u-picker>
+		</div>
+		<u-picker :show="show1" title="璇烽�夋嫨涓嶈壇璇存槑" :columns="columns" keyName="name" @cancel="show1=false"
+			@confirm="badConfirm">
+		</u-picker>
 	</view>
 </template>
 
-<script>
-	import { createStandard } from '@/util/api/QualityAPI'
-	import { checkAllList, getListByCondition, toolingQueryById } from "@/util/api/WorkOrderAPI"
-	export default {
+<script>
+	import {
+		createStandard
+	} from '@/util/api/QualityAPI'
+	import {
+		checkAllList
+	} from "@/util/api/WorkOrderAPI"
+	import { REGULAR } from '@/util/utils'
+	export default {
 		data() {
 			return {
 				info: {},
 				show1: false,
-				columns: [['涓浗', '缇庡浗', '鏃ユ湰']],
-				columns1: [],
+				columns: [],
 				form: {
-					status: '0',
+					status: '2',
 					gdid: '',
 					gdmc: '',
 					jygz: '',
 					jygzmc: '',
 					hgsl: 0,
-					blsl: 1,
+					blsl: 0,
 					blgz: '',
 					blgzmc: '',
 					blsm: '',
 					dw: ''
 				}
 			};
-		},
-		onLoad() {
-			uni.$on('workOrder', (data) => {
-				this.form.gdmc = data.mmodel.name + '-' + data.pgmodel.name
-				this.form.gdid = data.id
-				this.info = data
-				
-			})
-		},
+		},
+		onLoad() {
+			checkAllList({
+					bmodelCateType: '3'
+				})
+				.then(res => {
+					let bad = res.data.map(item => {
+						return {
+							name: item.combinationName,
+							id: item.id
+						}
+					})
+					this.columns = [bad]
+				})
+			uni.$on('workOrder', (data) => {
+				this.form.gdmc = data.mmodel.name + '-' + data.pgmodel.name
+				this.form.gdid = data.id
+				this.info = data
+
+			})
+		},
 		methods: {
-			jumpGD() {
-				uni.navigateTo({
-					url: '/pages/selectWorkOrder/selectWorkOrder'
-				})
-			},
-			openBL() {},
-			getValue1() {},
-			selectBad() {
-				console.log('------0-----');
-				this.show1 = true
-			},
-			badConfirm(value) {
-				console.log(value);
-				this.show1 = false
+			jumpGD() {
+				uni.navigateTo({
+					url: '/pages/selectWorkOrder/selectWorkOrder?type=2'
+				})
+			},
+			selectBad() {
+				this.show1 = true
+			},
+			badConfirm({
+				value
+			}) {
+				this.form.blsm = value[0].name
+				this.show1 = false
+			},
+			submit() {
+				if (!this.form.gdid) return uni.$u.toast('宸ュ崟涓嶈兘涓虹┖')
+				
+				if (this.form.hgsl || this.form.blsl) {
+					if (this.form.hgsl) {
+						if (this.form.dw == '0') { // 鏁存暟
+							if (!REGULAR.positiveInteger.test(this.form.hgsl)) return uni.$u.toast('鑹搧鏁伴噺鍙兘涓烘鏁存暟') 
+						} else if (this.form.dw == '1') { // 灏忔暟
+							if (!REGULAR.number.test(this.form.hgsl)) uni.$u.toast('鑹搧鏁伴噺鍙兘涓烘鏁存暟鎴栧洓浣嶅皬鏁�')
+						}
+					}
+					if (this.form.blsl) {
+						if (this.form.dw == '0') { // 鏁存暟
+							if (!REGULAR.positiveInteger.test(this.form.blsl)) return uni.$u.toast('涓嶈壇鏁伴噺鍙兘涓烘鏁存暟')
+						} else if (this.form.dw == '1') { // 灏忔暟
+							if (!REGULAR.number.test(this.form.blsl)) {
+								return uni.$u.toast('涓嶈壇鏁伴噺鍙兘涓烘鏁存暟鎴栧洓浣嶅皬鏁�')
+							}
+						}
+					}
+				} else {
+					return uni.$u.toast('鑹搧鍜屼笉鑹笉鑳藉悓鏃朵负绌�')
+				}
+				let total = (this.form.hgsl ? Number(this.form.hgsl) : 0) + (this.form.blsl ? Number(this.form.blsl) : 0)
+				if (total > this.info.planNum) {
+					return  uni.$u.toast('鍚堟牸涓嶈壇鐩稿姞涓嶈兘瓒呰繃璁″垝鏁伴噺')
+				}
+				if (Number(this.form.blsl) > 0) {
+					if (!this.form.blsm) return uni.$u.toast('涓嶈壇璇存槑涓嶈兘涓虹┖')
+				}
+				createStandard({
+					workorderId: this.form.gdid,
+					qualifiedNum: this.form.hgsl ? this.form.hgsl : 0,
+					unqualifiedNum: this.form.blsl ? this.form.blsl : 0,
+					checkInfo: this.form.blsm,
+					checkType: this.form.status
+				}).then(res => {
+					if (res.code === 200) {
+						uni.$u.toast('妫�楠屾垚鍔�')
+						uni.navigateBack()
+					}
+				})
 			}
 		}
 	}
diff --git a/minipro_standard/pages/inspectPatrol/inspectPatrol.vue b/minipro_standard/pages/inspectPatrol/inspectPatrol.vue
index 6d08d9c..b80a33f 100644
--- a/minipro_standard/pages/inspectPatrol/inspectPatrol.vue
+++ b/minipro_standard/pages/inspectPatrol/inspectPatrol.vue
@@ -59,53 +59,113 @@
 </template>
 
 <script>
+	import {
+		createStandard
+	} from '@/util/api/QualityAPI'
+	import {
+		checkAllList
+	} from "@/util/api/WorkOrderAPI"
+	import { REGULAR } from '@/util/utils'
 	export default {
-		data() {
-			return {
-				info: {},
-				show1: false,
-				columns: [['涓浗', '缇庡浗', '鏃ユ湰']],
-				columns1: [],
-				form: {
-					status: '0',
-					gdid: '',
-					gdmc: '',
-					jygz: '',
-					jygzmc: '',
-					hgsl: 0,
-					blsl: 1,
-					blgz: '',
-					blgzmc: '',
-					blsm: '',
-					dw: ''
-				}
-			};
+		data() {
+			return {
+				info: {},
+				show1: false,
+				columns: [],
+				form: {
+					status: '1',
+					gdid: '',
+					gdmc: '',
+					jygz: '',
+					jygzmc: '',
+					hgsl: 0,
+					blsl: 0,
+					blgz: '',
+					blgzmc: '',
+					blsm: '',
+					dw: ''
+				}
+			};
 		},
 		onLoad() {
+			checkAllList({
+					bmodelCateType: '3'
+				})
+				.then(res => {
+					let bad = res.data.map(item => {
+						return {
+							name: item.combinationName,
+							id: item.id
+						}
+					})
+					this.columns = [bad]
+				})
 			uni.$on('workOrder', (data) => {
-				console.log(data);
 				this.form.gdmc = data.mmodel.name + '-' + data.pgmodel.name
 				this.form.gdid = data.id
 				this.info = data
-				
+	
 			})
 		},
-		methods: {
+		methods: {
 			jumpGD() {
 				uni.navigateTo({
-					url: '/pages/selectWorkOrder/selectWorkOrder'
+					url: '/pages/selectWorkOrder/selectWorkOrder?type=1'
 				})
 			},
-			openBL() {},
-			getValue1() {},
 			selectBad() {
-				console.log('------0-----');
 				this.show1 = true
 			},
-			badConfirm(value) {
-				this.show1 = false;
-			}
-		}
+			badConfirm({
+				value
+			}) {
+				this.form.blsm = value[0].name
+				this.show1 = false
+			},
+			submit() {
+				if (!this.form.gdid) return uni.$u.toast('宸ュ崟涓嶈兘涓虹┖')
+				
+				if (this.form.hgsl || this.form.blsl) {
+					if (this.form.hgsl) {
+						if (this.form.dw == '0') { // 鏁存暟
+							if (!REGULAR.positiveInteger.test(this.form.hgsl)) return uni.$u.toast('鑹搧鏁伴噺鍙兘涓烘鏁存暟') 
+						} else if (this.form.dw == '1') { // 灏忔暟
+							if (!REGULAR.number.test(this.form.hgsl)) uni.$u.toast('鑹搧鏁伴噺鍙兘涓烘鏁存暟鎴栧洓浣嶅皬鏁�')
+						}
+					}
+					if (this.form.blsl) {
+						if (this.form.dw == '0') { // 鏁存暟
+							if (!REGULAR.positiveInteger.test(this.form.blsl)) return uni.$u.toast('涓嶈壇鏁伴噺鍙兘涓烘鏁存暟')
+						} else if (this.form.dw == '1') { // 灏忔暟
+							if (!REGULAR.number.test(this.form.blsl)) {
+								return uni.$u.toast('涓嶈壇鏁伴噺鍙兘涓烘鏁存暟鎴栧洓浣嶅皬鏁�')
+							}
+						}
+					}
+				} else {
+					return uni.$u.toast('鑹搧鍜屼笉鑹笉鑳藉悓鏃朵负绌�')
+				}
+				let total = (this.form.hgsl ? Number(this.form.hgsl) : 0) + (this.form.blsl ? Number(this.form.blsl) : 0)
+				if (total > this.info.planNum) {
+					return  uni.$u.toast('鍚堟牸涓嶈壇鐩稿姞涓嶈兘瓒呰繃璁″垝鏁伴噺')
+				}
+				if (Number(this.form.blsl) > 0) {
+					if (!this.form.blsm) return uni.$u.toast('涓嶈壇璇存槑涓嶈兘涓虹┖')
+				}
+				createStandard({
+					workorderId: this.form.gdid,
+					qualifiedNum: this.form.hgsl ? this.form.hgsl : 0,
+					unqualifiedNum: this.form.blsl ? this.form.blsl : 0,
+					checkInfo: this.form.blsm,
+					checkType: this.form.status
+				}).then(res => {
+					if (res.code === 200) {
+						uni.$u.toast('妫�楠屾垚鍔�')
+						uni.navigateBack()
+					}
+				})
+			}
+		}
 	}
 </script>
 
diff --git a/minipro_standard/pages/linePatrol/linePatrol.vue b/minipro_standard/pages/linePatrol/linePatrol.vue
index 094111a..b422379 100644
--- a/minipro_standard/pages/linePatrol/linePatrol.vue
+++ b/minipro_standard/pages/linePatrol/linePatrol.vue
@@ -57,52 +57,113 @@
 </template>
 
 <script>
+	import {
+		createStandard
+	} from '@/util/api/QualityAPI'
+	import {
+		checkAllList
+	} from "@/util/api/WorkOrderAPI"
+	import { REGULAR } from '@/util/utils'
 	export default {
-		data() {
-			return {
-				info: {},
-				show1: false,
-				columns: [['涓浗', '缇庡浗', '鏃ユ湰']],
-				columns1: [],
-				form: {
-					status: '0',
-					gdid: '',
-					gdmc: '',
-					jygz: '',
-					jygzmc: '',
-					hgsl: 0,
-					blsl: 1,
-					blgz: '',
-					blgzmc: '',
-					blsm: '',
-					dw: ''
-				}
-			};
+		data() {
+			return {
+				info: {},
+				show1: false,
+				columns: [],
+				form: {
+					status: '0',
+					gdid: '',
+					gdmc: '',
+					jygz: '',
+					jygzmc: '',
+					hgsl: 0,
+					blsl: 0,
+					blgz: '',
+					blgzmc: '',
+					blsm: '',
+					dw: ''
+				}
+			};
 		},
 		onLoad() {
+			checkAllList({
+					bmodelCateType: '3'
+				})
+				.then(res => {
+					let bad = res.data.map(item => {
+						return {
+							name: item.combinationName,
+							id: item.id
+						}
+					})
+					this.columns = [bad]
+				})
 			uni.$on('workOrder', (data) => {
 				this.form.gdmc = data.mmodel.name + '-' + data.pgmodel.name
 				this.form.gdid = data.id
 				this.info = data
-				
+	
 			})
 		},
-		methods: {
+		methods: {
 			jumpGD() {
 				uni.navigateTo({
-					url: '/pages/selectWorkOrder/selectWorkOrder'
+					url: '/pages/selectWorkOrder/selectWorkOrder?type=1'
 				})
 			},
-			openBL() {},
-			getValue1() {},
 			selectBad() {
-				console.log('------0-----');
 				this.show1 = true
 			},
-			badConfirm() {
-				this.show1 = false;
-			}
-		}
+			badConfirm({
+				value
+			}) {
+				this.form.blsm = value[0].name
+				this.show1 = false
+			},
+			submit() {
+				if (!this.form.gdid) return uni.$u.toast('宸ュ崟涓嶈兘涓虹┖')
+				
+				if (this.form.hgsl || this.form.blsl) {
+					if (this.form.hgsl) {
+						if (this.form.dw == '0') { // 鏁存暟
+							if (!REGULAR.positiveInteger.test(this.form.hgsl)) return uni.$u.toast('鑹搧鏁伴噺鍙兘涓烘鏁存暟') 
+						} else if (this.form.dw == '1') { // 灏忔暟
+							if (!REGULAR.number.test(this.form.hgsl)) uni.$u.toast('鑹搧鏁伴噺鍙兘涓烘鏁存暟鎴栧洓浣嶅皬鏁�')
+						}
+					}
+					if (this.form.blsl) {
+						if (this.form.dw == '0') { // 鏁存暟
+							if (!REGULAR.positiveInteger.test(this.form.blsl)) return uni.$u.toast('涓嶈壇鏁伴噺鍙兘涓烘鏁存暟')
+						} else if (this.form.dw == '1') { // 灏忔暟
+							if (!REGULAR.number.test(this.form.blsl)) {
+								return uni.$u.toast('涓嶈壇鏁伴噺鍙兘涓烘鏁存暟鎴栧洓浣嶅皬鏁�')
+							}
+						}
+					}
+				} else {
+					return uni.$u.toast('鑹搧鍜屼笉鑹笉鑳藉悓鏃朵负绌�')
+				}
+				let total = (this.form.hgsl ? Number(this.form.hgsl) : 0) + (this.form.blsl ? Number(this.form.blsl) : 0)
+				if (total > this.info.planNum) {
+					return  uni.$u.toast('鍚堟牸涓嶈壇鐩稿姞涓嶈兘瓒呰繃璁″垝鏁伴噺')
+				}
+				if (Number(this.form.blsl) > 0) {
+					if (!this.form.blsm) return uni.$u.toast('涓嶈壇璇存槑涓嶈兘涓虹┖')
+				}
+				createStandard({
+					workorderId: this.form.gdid,
+					qualifiedNum: this.form.hgsl ? this.form.hgsl : 0,
+					unqualifiedNum: this.form.blsl ? this.form.blsl : 0,
+					checkInfo: this.form.blsm,
+					checkType: this.form.status
+				}).then(res => {
+					if (res.code === 200) {
+						uni.$u.toast('妫�楠屾垚鍔�')
+						uni.navigateBack()
+					}
+				})
+			}
+		}
 	}
 </script>
 

--
Gitblit v1.9.3