<template>
	<dialog-base ref="baseDialog" title="结束报工">
		<view class="list-container">
			<view class="list-title"><text class="label">合格量</text></view>
			<view class="table-item">
				<input class="input" v-model="workInfo.qualified" placeholder="请输入合格量" />
			</view>
			<view class="list-title">
				<text class="label">废品量</text>
			</view>

			<view class="table-item"><input class="input" v-model="workInfo.amount"   placeholder="请输入废品量" /></view>
			<view class="list-title">
				<text class="label">废品原因</text>
			</view>

			<view class="table-item"><input class="input" v-model="workInfo.reason"  placeholder="请输入废品原因" /></view>
			<view class="list-title uni-row">
				<text class="label">当前序是否完成</text>
			
					<switch class="switch" @change="switchChange"   color="rgba(255,85,85,1)" style="transform:scale(0.7)" />
				
			
			</view>
			
		</view>
		<view class="add-btn-container uni-row">
			<button type="default" class="btn" @click="handleFinishReporting">结束报工</button>
		</view>
	</dialog-base>
</template>


<script setup>
	import {
		ref,
		getCurrentInstance
	} from 'vue'
	const baseDialog = ref(null)
	const workInfo = ref({})
	const open = (data) => {
		// console.log(dialog.value)
		baseDialog.value.open()
	}
	function switchChange(event) {
		if(event.detail.value) {
			workInfo.value.status = "2"
		}
		else {
			workInfo.value.status = "1"
		}
	}
	function handleFinishReporting(){
		console.log(workInfo.value,"123")
	}
	defineExpose({
		open
	})
</script>

<style lang="scss">
	.dialog-body {
		.list-container {
			width: 100%;
			display: flex;
			align-items: flex-start;
			padding: 0 4rpx;

			.list-title {
				margin-top: 24rpx;

				.label {
					font-size: 32rpx;
				}
			}
			.switch {
				margin-top: -8rpx;
				align-items: center;
			}

			.table-item {
				margin-top: 24rpx;

				.input {
					height: 60rpx;
					border: 1px solid #808080;
				}
			}

		}

		.add-btn-container {
			margin-top: 32rpx;

			.btn {
				flex: 1;
				background-color: rgba(255,85,85,1);
				color: #FFFFFF;

			}
		}
	}
</style>