<template>
	<view class="operaSafetyCheck">
		<uni-nav-bar dark :fixed="true" :border="false" background-color="#002648" status-bar left-icon="left"
			title="屈光手术安全核查表" @clickLeft="back">
		</uni-nav-bar>
		<view class="BT-text">麻醉实施前</view>
		<operaBefore title="屈光手术安全核查表" ref="operaBeforeRef"></operaBefore>
		<view class="BT-text">手术开始前</view>
		<operaCheck title="屈光手术安全核查表" ref="operaCheckRef"></operaCheck>
		<view class="buttons" @click="sureHandle">保存</view>
	</view>
</template>

<script>
	import operaBefore from '@/pages/operaBefore/index.vue'
	import operaCheck from '@/pages/operaCheck/index.vue'
	export default {
		data() {
			return {
				optionsList:{}
			}
		},
		components: {
			operaBefore,
			operaCheck
		},
		onLoad(options) {
			console.log(options);
			this.optionsList = options
		},
		mounted() {
			this.$refs.operaBeforeRef.init(this.optionsList)
			this.$refs.operaCheckRef.init(this.optionsList)
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			async sureHandle() {
				const res = await this.$baseAPI.request(this.$portAdress.allPda, [{
					checkContent: JSON.stringify(this.$refs.operaBeforeRef.formListValue),
					checkName: '屈光手术安全核查表',
					checkType: '麻醉实施前',
					operaId: this.optionsList.operaId,
					source:'all' // 标记是单表保存到数据还是整表保存的数据
				},{
					checkContent: JSON.stringify(this.$refs.operaCheckRef.formListValue),
					checkName: '屈光手术安全核查表',
					checkType: '手术开始前',
					operaId: this.optionsList.operaId,
					source:'all' // 标记是单表保存到数据还是整表保存的数据
				}],'post')
				if(res.code===0) {
					uni.navigateTo({
						url: '/pages/patientList/index'
					})
				} else {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
				}
			},
		}
	}
</script>

<style lang="less" scoped>
	.operaSafetyCheck {
		background-color: #fff;
		.BT-text {
			font-weight: 700;
			font-size: 40rpx;
			margin: 40rpx 0 20rpx 20rpx;
		}
		.buttons {
			width: 90%;
			height: 88rpx;
			line-height: 88rpx;
			background-color: #1e79ff;
			color: #fff;
			text-align: center;
			border-radius: 20rpx;
			margin: auto;
			margin-top: 50rpx;
			margin-bottom: 40rpx;
		}
	}
</style>
<style lang="less">
	.content-sign {
		background-color: #fff;
		.operaSign {
			padding: 20rpx 0;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 1rpx solid #F2F2F2;
		}
	
		.sign {
			color: #aeb8bf;
			font-size: 48rpx;
			width: 240rpx;
			height: 96rpx;
			line-height: 96rpx;
			text-align: center;
			border: 1px dashed #6EB1FF;
			border-radius: 12px;
			position: relative;
		}
	
		.sign-text,
		.signature {
			position: absolute;
			left: 0;
			bottom: 0;
			width: 240rpx;
			height: 96rpx;
			line-height: 96rpx;
			text-align: center;
		}
	}
	.operaBefore,.operaCheck,.operaBackCheck {
		.signature-wrap .img-wrap {
			width: 240rpx !important;
			height: 96rpx !important;
			line-height: 96rpx !important;
		}
		.signature-wrap .img-wrap,
		.signature-wrap .img-wrap image {
			width: 240rpx;
			height: 96rpx;
			line-height: 96rpx;
		}
	}
</style>