<template>
	<view class="shipPlan">
		<head-view :title="title" url="/pages/shipWork/documentList"></head-view>
		<view class="container contentFixed">
			<p class="title">基本信息</p>
			<view class="ul">
				<view class="li wLi">船名：{{shipInfo.spmName}}</view>
				<view v-for="(item,index) in vvyList" :key="index">
					<view class="li">{{item.importExportFlagName}}航次：{{item.vvyName}}</view>
					<view class="li">贸易类型：{{item.tradeTypeName}}</view>
					<view class="li">航线：{{item.lcoName}}</view>
					<view class="li">船公司：{{item.shipComName}}</view>
					<view class="li wLi">船代：{{item.shipAgentName}}</view>
				</view>

			</view>
			<p class="title">船期信息</p>
			<view class="ul">
				<view class="li">计划到港时间：{{shipInfo.planArrivePortTime}}</view>
				<view class="li">计划离港时间：{{shipInfo.planDeparturePortTime}}</view>
				<view class="li">计划靠泊时间：{{shipInfo.planBerthingTime}}</view>
				<view class="li">计划离泊时间：{{shipInfo.planAnchoringTime}}</view>
				<view class="li">确报时间：{{shipInfo.confirmTime}}</view>
				<view class="li">船期状态：{{shipInfo.shipmentStatus}}</view>
				<view class="li">靠泊状态：{{shipInfo.berthStatus}}</view>
				<view class="li">计划泊位：{{shipInfo.planBerthageName}}</view>
			</view>
			<p class="title">计划信息</p>
			<view class="ul" v-for="(item,index) in vvyList" :key="index">
				<view class="li">{{item.importExportFlagName}}航次：{{item.vvyName}}</view>
				<view class="li">计划开工时间：{{item.planStartTime}}</view>
				<view class="li">计划完工时间：{{item.planFinishTime}}</view>
				<view class="li">品牌：{{item.vgdGoodName}}</view>
				<view class="li">计划数量：{{item.planAmount}}</view>
				<view class="li">工班人数：{{item.planNum}}</view>
				<view class="li">计划组数：{{item.teamNum}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import sqlite from "../../common/sqlite.js"
	export default {
		data() {
			return {
				title: "船名 - 船舶计划",
				shipInfo: {},
				vvyList: [],
				vtpId: "",
			}
		},
		mounted() {
			let title = uni.getStorageSync('shipWorkTitle')
			this.title = `${title} / 船舶计划 `
			this.vtpId = uni.getStorageSync('vtpId')
			this.executeSql1('voyageScheduleDataPadRespDTO')
			this.executeSql1('voyageScheduleDataDetailRespDTOList')
		},
		methods: {
			// 查
			executeSql1(tableName) {
				let sql = `select * from ${tableName}  WHERE vtpId = '${this.vtpId}'`
				sqlite.executeSqlCeshi(sql).then((value) => {
					// 在resolve时执行的回调函数
					if (tableName == 'voyageScheduleDataPadRespDTO') {
						this.shipInfo = value[0]
					} else {
						this.vvyList = value
					}
				}).catch((error) => {
					// 在reject时执行的回调函数
					console.error(error);
				});
			},
		}
	}
</script>

<style lang="less" scoped>
	.shipPlan {
		.container {
			padding: 30px 20px;

			.title {
				padding-left: 10px;
				border-left: 5px solid #2979ff;
				font-size: 20px;
				font-weight: bold;
			}

			.ul {
				display: flex;
				flex-wrap: wrap;
				padding: 0 20px;
				margin-bottom: 20px;

				.li {
					min-width: 45%;
					margin: 10px 20px 0;
				}

				.wLi {
					width: 100%;
				}
			}
		}
	}
</style>