<template>
	<dialog-base ref="baseDialog" title="周转申请">
		<view class="list-container">
			<view class="list-title"><text class="label">请选择周转类型</text></view>
			<view class="btn uni-row">
				<view :class="{ 'middle-btn': true, 'active': isLeftTurnoverType }"
					@click="selectTurnoverType('leftType')"><text class="label">车间内周转</text></view>
				<view :class="{ 'middle-btn': true, 'active': isRightTurnoverType }"
					@click="selectTurnoverType('rightType')"><text class="label">车间外周转</text></view>
			</view>
			<view class="list-title">
				<text class="label">请选择周转位置</text>
			</view>
			<view class="list-container">
				<view class="btn uni-row">
					<view :class="{ 'middle-btn': true, 'active': isLeftTurnoverDoor }"
						@click="selectTurnoverDoor('leftDoor')"><text class="label">A门</text></view>
					<view :class="{ 'middle-btn': true, 'active': isRightTurnoverDoor }"
						@click="selectTurnoverDoor('rightDoor')"><text class="label">B门</text></view>
				</view>
			</view>
		</view>
		<view class="add-btn-container uni-row">
			<button type="default" class="btn" >确认</button>
		</view>
	</dialog-base>
</template>

<script setup>
	import {
		ref,
		getCurrentInstance
	} from 'vue'
    const baseDialog = ref(null)
	const isLeftTurnoverType = ref(false)
	const isRightTurnoverType = ref(false)
	const isLeftTurnoverDoor = ref(false)
	const isRightTurnoverDoor = ref(false)

	const selectTurnoverType = (data) => {
			if (data === 'leftType') {
				isLeftTurnoverType.value = !isLeftTurnoverType.value;
				isRightTurnoverType.value = false; // 右边按钮恢复为非活动状态
			} else if (data === 'rightType') {
				isRightTurnoverType.value = !isRightTurnoverType.value;
				isLeftTurnoverType.value = false; // 左边按钮恢复为非活动状态
			}
		}
		const selectTurnoverDoor = (data) => {
			if (data === 'leftDoor') {
				isLeftTurnoverDoor.value = !isLeftTurnoverDoor.value;
				isRightTurnoverDoor.value = false; // 右边按钮恢复为非活动状态
			} else if (data === 'rightDoor') {
				isRightTurnoverDoor.value = !isRightTurnoverDoor.value;
				isLeftTurnoverDoor.value = false; // 左边按钮恢复为非活动状态
			}
		}
		const open = (data) => {
			// console.log(dialog.value)
			baseDialog.value.open()
		}
		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;
				}
			}

			.btn {
				justify-content: space-between;

				margin-top: 24rpx;

				.middle-btn {
					margin-right: 32rpx;
					align-items: center;
					justify-content: center;
					padding-left: 0;
					height: 80rpx;
					width: 240rpx;
					border-radius: 8rpx;
					background-color: #FFFFFF;
					border: 1px solid #999999;
					background-color: #FFFFFF;

				}

				.label {
					font-size: 24rpx;
					color: #000000;
				}

				.active {
					border-color: #1684fc;
					background-color: rgb(236, 245, 255);

					.label {
						color: #1684fc;
					}
				}


			}

		}

		.add-btn-container {
			margin-top: 32rpx;
			.btn {
				flex: 1; 
				background-color: rgb(255, 121, 1);
				color: #FFFFFF;
				
			}
		}
	}
</style>