guoyujia 1 рік тому
батько
коміт
d1a55c2d76
1 змінених файлів з 30 додано та 17 видалено
  1. 30 17
      components/dialog-end-work/dialog-end-work.vue

+ 30 - 17
components/dialog-end-work/dialog-end-work.vue

@@ -3,19 +3,21 @@
 		<view class="list-container">
 			<view class="list-title uni-row">
 				<text class="label">合格量</text>
-				<input class="input" type="number" maxlength="5" v-model="workInfo.qualifiedNum" @input="handleInputQualifiedNum" placeholder="请输入合格量" />
+				<input class="input" style="width: 70%;" v-model="workInfo.qualifiedNum" placeholder="请输入合格量" />
 			</view>
 			<view class="list-title uni-row">
-				<text class="label">废品</text>
-				<input class="input" type="number" maxlength="5" v-model="workInfo.rejectNum" @input="handleInputRejectNum" placeholder="请输入废品量" />
+				<text class="label">废品信息</text>
+		        <view class="uni-row" style="justify-content: flex-end;"><text class="label" style="color: blue;" @click="handleAddWasteInfo">+添加</text></view>
 			</view>
-			<view class="list-title uni-row">
-				<text class="label">废品原因</text>
-				<input class="input" v-model="workInfo.reason" placeholder="请输入废品原因" />
+			<view class="list-title uni-row" v-for="(item, index) in wasteInfo">
+				<input class="input" style="width: 20%;" v-model="item.rejectNum" placeholder="废品量" />
+				<input class="input" style="margin-left: 24rpx;width: 70%;" v-model="item.reason" placeholder="请输入废品原因" />
+				<uni-icons class="icon-gear" type="close" size="60" color="red"  @click="handleDeleteWasteInfo(index)"></uni-icons>
 			</view>
+			
 			<view class="list-title uni-row" style="margin-top: 48rpx;">
 				<text class="label">当前序是否完成</text><text>否</text>
-				<switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" /> 
+				<switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" />
 				<text>是</text>
 			</view>
 			<!-- <view class="list-title"><text class="label">请选择设备:</text></view> -->
@@ -35,7 +37,7 @@
 </template>
 
 
-<script setup>
+<script setup> 
 	import {
 		ref,
 		getCurrentInstance
@@ -49,9 +51,11 @@
 	} from '@/utils/common.js'
 	const baseDialog = ref(null)
 	const workInfo = ref({})
+	const wasteInfo = ref([])
 	const open = (data) => {
 		workInfo.value = data;
 		console.log(data)
+		wasteInfo.value =[]
 		baseDialog.value.open()
 	}
 	const emit = defineEmits(['reset'])
@@ -62,13 +66,10 @@
 		}
 	}
 
-	function handleInputQualifiedNum() {
-		workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^0+|^-|[^\d]/g, '');
-	}
-	
-	function handleInputRejectNum() {
-		workInfo.value.rejectNum = workInfo.value.rejectNum.replace(/^0+|^-|[^\d]/g, '');
-	}
+	// function checkboxChange(event) {
+	// 	console.log(event.detail.value)
+	// 	workInfo.value.equiments = event.detail.value
+	// }
 
 	function handleFinishReporting() {
 		console.log(workInfo.value)
@@ -96,6 +97,13 @@
 			}
 		})
 	}
+	 function handleAddWasteInfo() {
+		 wasteInfo.value.push({ rejectNum: '', reason: '' })
+	 }
+	  
+	 function handleDeleteWasteInfo(index) {
+		 wasteInfo.value.splice(index,1)
+	 }
 
 	defineExpose({
 		open
@@ -122,14 +130,19 @@
 				}
 
 				.input {
-					width: 60%;
+					width: 40%;
 
 					height: 60rpx;
 					padding-left: 10rpx;
-					border-radius: 18rpx;
+
 					font-size: 22rpx;
 					border: 1px solid #808080;
 				}
+				.icon-gear {
+					
+					font-size: 56rpx;
+
+				}
 			}
 
 			.switch {