From 17e1ae4795b1be3d4bfd7005fb1bb559d5e30115 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期四, 07 九月 2023 09:08:17 +0800
Subject: [PATCH] 小程序

---
 minipro_standard/pages_adjust/pages/reportingForWork/reportingForWork.vue |  201 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 174 insertions(+), 27 deletions(-)

diff --git a/minipro_standard/pages_adjust/pages/reportingForWork/reportingForWork.vue b/minipro_standard/pages_adjust/pages/reportingForWork/reportingForWork.vue
index b2445d8..04c7879 100644
--- a/minipro_standard/pages_adjust/pages/reportingForWork/reportingForWork.vue
+++ b/minipro_standard/pages_adjust/pages/reportingForWork/reportingForWork.vue
@@ -66,8 +66,8 @@
 											<text class="green" v-if="item.qualityType == 0">鍚堟牸&nbsp;/&nbsp;</text>
 											<text class="yellow" v-if="item.qualityType == 1">涓嶈壇&nbsp;/&nbsp;</text>
 											<text class="red" v-if="item.qualityType == 2">鎶ュ簾&nbsp;/&nbsp;</text>
-											<text>{{ item.locationName }}&nbsp;/&nbsp;</text>
-											<text>{{ item.batch }}</text>
+											<text>{{ item.locationName || '-' }}&nbsp;/&nbsp;</text>
+											<text>{{ item.batch || '-' }}</text>
 										</view>
 									</view>
 									<view class="bg_list_item_num_item_sr">
@@ -75,7 +75,7 @@
 										    placeholder="璇疯緭鍏�"
 										    border="surround"
 											type="number"
-											:customStyle="{width: '180rpx'}"
+											:customStyle="{width: '100%'}"
 										    v-model="item.num"
 											@input="inputwl(index)"
 										  ></u--input>
@@ -213,11 +213,11 @@
 		<!-- 鐢熶骇浜哄憳 -->
 		<user :show="userShow" @close="userShow = false" @value="onConfirm1" />
 		<!-- 鐢熶骇璁惧 -->
-		<u-picker :show="deviceShow" :columns="deviceList" keyName="name" @confirm="onConfirm" @cancel="onCancel"></u-picker>
+		<u-picker :show="deviceShow" :columns="deviceList" keyName="name" @confirm="onConfirm" @cancel="deviceShow = false"></u-picker>
 		<!-- 鏃堕棿 -->
 		<u-picker :show="TimeShow" :columns="columns" @confirm="onConfirm2" @cancel="TimeShow = false"></u-picker>
 		<!-- 鐗╂枡 -->
-		<selectMaterial ref="selectMaterial" @selectAction="getValue" />
+		<MaterialSelect ref="MaterialSelect" :plansId="String(plansId)" :selected="ids" :deviceId="String(deviceId)" @value="getValue" />
 		<!-- 涓嶈壇椤� -->
 		<u-popup :show="show" @close="show = false" :round="8" closeable zIndex="20000">
 			<view class="rp p40 contanir">
@@ -225,7 +225,7 @@
 				<view class="content bl_list">
 					<div class="bl_list_item" v-for="(item, i) in cateList" :key="i" @click="changeChecked(i)">
 						<div class="bl_list_item_left">
-							<u-checkbox-group>
+							<u-checkbox-group @change="poorSelection(item.active, i)">
 								<u-checkbox :checked="item.active" :label="item.name" :name="item.name"></u-checkbox>
 							</u-checkbox-group>
 						</div>
@@ -244,11 +244,13 @@
 
 <script>
 	import user from '../../components/user.vue'
-	import selectMaterial from '@/components/selectMaterial.vue'
+	import MaterialSelect from '../../components/MaterialSelect.vue'
+	import { mapState } from 'vuex'
+	import { getDeviceByCondition, getFindAll, queryOne, queryList, autoWorkReport, getIdPlansExt, categoryExtList } from '@/util/api/PlanningAPI'
 	export default {
 		components: {
 			user,
-			selectMaterial
+			MaterialSelect
 		},
 		data() {
 			return {
@@ -295,21 +297,22 @@
 			};
 		},
 		computed: {
+			...mapState(['userInfo']),
 			// 棰勮宸ヨ祫
 			expectedSalary() {
 				if (this.arrType.length === 0) return 0;
-				if (this.arrType[from.index].type == 0) {
+				if (this.arrType[this.from.index].type == 0) {
 					if (!this.from.qualified) return 0
-					if (this.arrType[from.index].unqualified == 1) {   // 鏄惁璁″叆涓嶈壇鍝�
+					if (this.arrType[this.from.index].unqualified == 1) {   // 鏄惁璁″叆涓嶈壇鍝�
 						let total = Number(this.from.qualified) + Number(this.from.undesirable)
 						return (total * (this.arrType[from.index].salary / 10 / 10)).toFixed(2)
 					} else {
-						return (Number(this.from.qualified) * (this.arrType[from.index].salary / 10 / 10)).toFixed(2)
+						return (Number(this.from.qualified) * (this.arrType[this.from.index].salary / 10 / 10)).toFixed(2)
 					}
 				} else {
 					if (!this.from.duration) return 0;
 					let h = (this.from.duration / 60 / 60).toFixed(2)
-					return (Number(h) * (this.arrType[from.index].salary / 10 / 10)).toFixed(2)
+					return (Number(h) * (this.arrType[this.from.index].salary / 10 / 10)).toFixed(2)
 				}
 			},
 			// 杈炬爣鐜�
@@ -317,32 +320,99 @@
 				if (this.arrType.length === 0) return 0;
 				if (!this.from.qualified && !this.from.undesirable) return 0;
 				if (!this.from.duration) return 0;
-				if (!this.arrType[from.index].num) return 0;
-				if (this.arrType[from.index].unqualified == 1) {   // 鏄惁璁″叆涓嶈壇鍝�
+				if (!this.arrType[this.from.index].num) return 0;
+				if (this.arrType[this.from.index].unqualified == 1) {   // 鏄惁璁″叆涓嶈壇鍝�
 					let a = ((Number(this.from.qualified) + Number(this.from.undesirable)) / (this.from.duration / 3600)).toFixed(2)
-					let b = (this.arrType[from.index].num / (this.arrType[from.index].times / 3600)).toFixed(2)
+					let b = (this.arrType[this.from.index].num / (this.arrType[this.from.index].times / 3600)).toFixed(2)
 					return ((Number(a) / Number(b)) * 100).toFixed(2)
 				} else {
 					let a = (this.from.qualified / (this.from.duration / 3600)).toFixed(2)
-					let b = (this.arrType[from.index].num / (this.arrType[from.index].times / 3600)).toFixed(2)
+					let b = (this.arrType[this.from.index].num / (this.arrType[this.from.index].times / 3600)).toFixed(2)
 					return ((Number(a) / Number(b)) * 100).toFixed(2)
 				}
 			}
+		},
+		onReady() {
+			this.from.userId = this.userInfo.id
+			this.form.userName = this.userInfo.realname
 		},
 		onLoad() {
 			let arr = []
 			for(let i = 0; i < 60; i++) {
 				arr.push(i)
 			}
+			this.getData()
 			this.columns = [arr, arr]
+			// 鎺ユ敹璁″垝
+			uni.$on('update', (data) => {
+				this.from.processPlan = data.obj
+				this.plansId = data.obj.id
+				this.from.deviceId = ''
+				this.from.deviceName = ''
+				this.deviceId = ''
+				this.total = data.obj.num - data.obj.workorderDistributNum
+				this.wuList = []
+				this.from.defective = []
+				this.from.defectiveName = ''
+				this.from.userName = ''
+				this.from.userId = ''
+				// 鑾峰彇璁惧
+				getDeviceByCondition({ procedureId: data.obj.procedureId })
+					.then(res1 => {
+						if (res1.code === 200) {
+							if (res1.data && res1.data.length > 0) {
+								this.deviceId = res1.data[0].id
+								this.from.deviceId = res1.data[0].id
+								this.from.deviceName = res1.data[0].name
+								this.deviceList = [res1.data]
+							}
+						}
+					})
+				// 鑾峰彇绫诲瀷
+				getIdPlansExt(data.obj.id)
+					.then(res2 => {
+						if (res2.code === 200) {
+							this.bomType = res2.data.bomType
+							this.hasBom = res2.data.hasBom
+						}
+					})
+				// 鑾峰彇宸ヨ祫缁╂晥鏁版嵁
+				queryList({
+					deleted: 0,
+					departId: data.obj.factoryId,
+					materialId: data.obj.materialId,
+					procedureId: data.obj.procedureId
+				}).then(result => {
+					if (result.code === 200) {
+						if (result.data && result.data.length > 0) {
+							result.data.forEach((item, index) => {
+								item.name = item.type == 0 ? '璁′欢' : '璁℃椂'
+								item.id = item.type
+								item.active = index == 0
+							})
+							this.arrType = result.data
+							console.log(this.arrType)
+						} else {
+							this.arrType = []
+						}
+					}
+				})
+			})
 		},
 		methods: {
+			poorSelection(val, i) {
+				this.cateList.forEach((item, index) => {
+					if (i === index) {
+						item.active = !item.active
+					}
+				})
+			},
 			// 鍒囨崲缁╂晥绫诲瀷
 			clickPerformanceType(i) {
 				this.from.index = i
 				this.arrType.forEach((item, index) => {
 					if (i === index) {
-						from.type = item.id
+						this.from.type = item.id
 					}
 					item.active = index === i
 				})
@@ -353,7 +423,7 @@
 				obj.total = val.num
 				this.wuList.unshift(obj)
 				let arr = this.wuList.map(item => item.id)
-				this.ids = arr.join(',')
+				this.ids = arr
 			},
 			// 鑾峰彇涓嶈壇椤圭洰
 			getData() {
@@ -371,9 +441,9 @@
 			},
 			// 閫夋嫨璁惧
 			onConfirm(e) {
-				this.from.deviceId = e.id
-				this.from.deviceName = e.name
-				this.deviceId = e.id
+				this.from.deviceId = e.value[0].id
+				this.from.deviceName = e.value[0].name
+				this.deviceId = e.value[0].id
 				this.from.userId = ''
 				this.from.userName = ''
 				// getFindAll({
@@ -403,15 +473,15 @@
 				let name = ''
 				for (let i = 0; i < this.cateList.length; i++) {
 					if (this.cateList[i].active) {
-						if (this.cateList[i].num <= 0) {
+						if (Number(this.cateList[i].num) <= 0) {
 							return uni.showToast({ title: '涓嶈壇鏁伴噺蹇呴』澶т簬0', icon: 'none', duration: 2000 });
 						}
-						total = total += this.cateList[i].num
+						total = total += Number(this.cateList[i].num)
 						arr.push(this.cateList[i])
 						name += this.cateList[i].name + this.cateList[i].num + '锛�'
 					}
 				}
-				if (total !== this.from.undesirable) return uni.showToast({ title: '涓嶈壇鏁板繀椤荤瓑浜庝骇鍑轰笉鑹暟', icon: 'none', duration: 2000 });
+				if (total !== Number(this.from.undesirable)) return uni.showToast({ title: '涓嶈壇鏁板繀椤荤瓑浜庝骇鍑轰笉鑹暟', icon: 'none', duration: 2000 });
 				this.from.defective = arr
 				this.from.defectiveName = name
 				this.show = false
@@ -450,7 +520,7 @@
 			openMaterial() {
 				if (!this.plansId) return uni.showToast({ title: '璇峰厛閫夋嫨宸ュ簭鐢熶骇璁″垝', icon: 'none', duration: 2000 });
 				if (!this.deviceId) return uni.showToast({ title: '璇峰厛閫夋嫨鐢熶骇璁惧', icon: 'none', duration: 2000 });
-				this.$refs.selectMaterial.open({})
+				this.$refs.MaterialSelect.open()
 			},
 			inputwl(i) {
 				if (this.wuList[i].num > this.wuList[i].total) {
@@ -543,6 +613,7 @@
 				}).then(res => {
 					if (res.code === 200) {
 						uni.showToast({ title: '鎶ュ伐鎴愬姛锛�', icon: 'success', duration: 2000 });
+						this.arrType = []
 						this.from.processPlan = null
 						this.from.deviceId = ''
 						this.from.deviceName = ''
@@ -830,7 +901,7 @@
 								}
 							}
 							.bg_list_item_num_item_wl {
-								flex-shrink: 0;
+								flex: 1;
 								display: flex;
 								flex-direction: column;
 								text {
@@ -888,6 +959,8 @@
 							}
 							.bg_list_item_num_item_sr {
 								// flex: 1;
+								flex-shrink: 0;
+								width: 230rpx;
 								display: flex;
 								align-items: center;
 								justify-content: flex-end;
@@ -911,6 +984,7 @@
 									font-weight: 400;
 									color: #333333;
 									padding: 0 30rpx;
+									margin-right: 20rpx;
 								}
 								.wulll {
 									width: 400rpx;
@@ -1042,7 +1116,8 @@
 						}
 					}
 					.bl_list_item_right {
-						flex: 1;
+						width: 200rpx;
+						flex-shrink: 0;
 						height: 50rpx;
 						text-align: right;
 						input {
@@ -1067,5 +1142,77 @@
 				}
 			}
 		}
+		.bl_list {
+			width: 100%;
+			height: calc(100% - 168rpx);
+			overflow-y: scroll;
+			margin-top: 30rpx;
+		
+			.bl_list_item {
+				width: 100%;
+				height: 96rpx;
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+				border-bottom: 1rPX solid #E5E5E5;
+		
+				&:last-child {
+					border: none !important;
+				}
+		
+				.bl_list_item_left {
+					flex: 1;
+					display: flex;
+					align-items: center;
+		
+					input {
+						width: 30rpx;
+						height: 30rpx;
+						border: 1rpX solid #CCCCCC;
+						margin: 0 !important;
+					}
+		
+					span {
+						font-size: 30rpx;
+						color: #222222;
+						margin-left: 10rpx;
+					}
+				}
+		
+				.bl_list_item_right {
+					width: 200rpx;
+					flex-shrink: 0;
+					height: 50rpx;
+					text-align: right;
+		
+					input {
+						padding-left: 5rpx;
+						width: 180rpx;
+						height: 60rpx;
+						border-radius: 8rpx;
+						border: 1rpx solid #CCCCCC;
+						padding: 0 30rpx;
+						box-sizing: border-box;
+						text-align: right;
+						font-size: 28rpx;
+						color: #333333;
+						border-radius: 10rpx;
+						border: 1rPX solid #CCCCCC;
+		
+						&::-webkit-input-placeholder {
+							font-size: 28rpx;
+							font-family: PingFangSC-Regular, PingFang SC;
+							font-weight: 400;
+							color: #999999;
+						}
+					}
+				}
+			}
+		}
+		.bottom-view {
+			left: 40rpx;
+			right: 40rpx;
+			bottom: 0
+		}
 	}
 </style>

--
Gitblit v1.9.3