<template>
	<view>
		<scroll-view :scroll-x="true" :scroll-y="true">
			<view style="padding: 10px 10px 10px 10px;">
				<uni-title title="基本信息" type="h1" color="blue"></uni-title>
				<yjly-row-cell :cellData="cellData" :rowDataCount="3"></yjly-row-cell>
				<uni-title title="工作简历" type="h1" color="blue"></uni-title>
				<uni-row>
					<uni-col :span="4">
						<view class="titleStyle">
							起始时间
						</view>
					</uni-col>
					<uni-col :span="4">
						<view class="titleStyle">
							终止时间
						</view>
					</uni-col>
					<uni-col :span="11">
						<view class="titleStyle">
							工作职务
						</view>
					</uni-col>
					<uni-col :span="5">
						<view class="titleStyle">
							岗位职务
						</view>
					</uni-col>
				</uni-row>
				<uni-row>
					<view v-for="(item,index) in gzjlList">
						<uni-col :span="4">
							<view class="dataStyle">
								{{item.kssj}}
							</view>
						</uni-col>
						<uni-col :span="4">
							<view class="dataStyle">
								{{item.jssj}}
							</view>
						</uni-col><uni-col :span="11">
							<view class="dataStyle">
								{{item.jlms}}
							</view>
						</uni-col><uni-col :span="5">
							<view class="dataStyle">
								{{item.jlms2}}
							</view>
						</uni-col>
					</view>
				</uni-row>
				<!-- <uni-segmented-control></uni-segmented-control> -->
				<uni-title title="学历信息" type="h1" color="blue"></uni-title>
				<uni-row>
					<uni-col :span="4">
						<view class="titleStyle">
							类别
						</view>
					</uni-col>
					<uni-col :span="4">
						<view class="titleStyle">
							毕业院校
						</view>
					</uni-col>
					<uni-col :span="4">
						<view class="titleStyle">
							所学专业
						</view>
					</uni-col>
					<uni-col :span="4">
						<view class="titleStyle">
							学历
						</view>
					</uni-col>
					<uni-col :span="4">
						<view class="titleStyle">
							学位
						</view>
					</uni-col>
					<uni-col :span="4">
						<view class="titleStyle">
							毕业时间
						</view>
					</uni-col>
				</uni-row>
				<uni-row>
					<view v-for="(item,index) in xlxxList">
						<uni-col :span="4">
							<view class="dataStyle">
								{{item.xllb}}
							</view>
						</uni-col>
						<uni-col :span="4">
							<view class="dataStyle">
								{{item.byyx}}
							</view>
						</uni-col><uni-col :span="4">
							<view class="dataStyle">
								{{item.sxzy}}
							</view>
						</uni-col><uni-col :span="4">
							<view class="dataStyle">
								{{item.qdxl}}
							</view>
						</uni-col>
						<uni-col :span="4">
							<view class="dataStyle">
								{{item.qdxw}}
							</view>
						</uni-col>
						<uni-col :span="4">
							<view class="dataStyle">
								{{item.bytime}}
							</view>
						</uni-col>
					</view>
				</uni-row>
				<uni-title title="取证信息" type="h1" color="blue"></uni-title>
				<uni-row>
					<uni-col :span="6">
						<view class="titleStyle">
							证书名称
						</view>
					</uni-col>
					<uni-col :span="5">
						<view class="titleStyle">
							证书等级
						</view>
					</uni-col>
					<uni-col :span="5">
						<view class="titleStyle">
							取证时间
						</view>
					</uni-col>
					<uni-col :span="5">
						<view class="titleStyle">
							复审时间
						</view>
					</uni-col>
					<uni-col :span="3">
						<view class="titleStyle">
							备注
						</view>
					</uni-col>
				</uni-row>
				<uni-row>
					<view v-for="(item,index) in zjtzList">
						<uni-col :span="6">
							<view class="dataStyle">
								{{item.zjmc}}
							</view>
						</uni-col>
						<uni-col :span="5">
							<view class="dataStyle">
								{{item.zsdj}}
							</view>
						</uni-col><uni-col :span="5">
							<view class="dataStyle">
								{{item.fzrq}}
							</view>
						</uni-col><uni-col :span="5">
							<view class="dataStyle">
								{{item.fssj}}
							</view>
						</uni-col>
						<uni-col :span="3">
							<view class="dataStyle">
								{{item.bz}}
							</view>
						</uni-col>
					</view>
				</uni-row>

				<uni-title title="家庭信息" type="h1" color="blue"></uni-title>
				<uni-row>
					<uni-col :span="4">
						<view class="titleStyle">
							称谓
						</view>
					</uni-col>
					<uni-col :span="3">
						<view class="titleStyle">
							姓名
						</view>
					</uni-col>
					<uni-col :span="6">
						<view class="titleStyle">
							出生年月
						</view>
					</uni-col>
					<uni-col :span="4">
						<view class="titleStyle">
							政治面貌
						</view>
					</uni-col>
					<uni-col :span="7">
						<view class="titleStyle">
							工作单位及职务
						</view>
					</uni-col>
				</uni-row>
				<uni-row>
					<view v-for="(item,index) in zyjtcyList">
						<uni-col :span="4">
							<view class="dataStyle">
								{{item.ybrgx}}
							</view>
						</uni-col>
						<uni-col :span="3">
							<view class="dataStyle">
								{{item.gxname}}
							</view>
						</uni-col><uni-col :span="6">
							<view class="dataStyle">
								{{item.cstime}}
							</view>
						</uni-col><uni-col :span="4">
							<view class="dataStyle">
								{{item.cyzzmm}}
							</view>
						</uni-col>
						<uni-col :span="7">
							<view class="dataStyle">
								{{item.cygzdw}}
							</view>
						</uni-col>
					</view>
				</uni-row>
			</view>
		</scroll-view>
	</view>

</template>

<script setup>
	import {
		onReady,
		onLoad
	} from '@dcloudio/uni-app';
	import {
		reactive,
		ref,
		onMounted
	} from 'vue';
	import {
		queryGzjlByRyLdhth,
		queryQzqkByRyLdhth,
		queryJtzycyByRyLdhth,
		queryXlxxByRyLdhth,
		queryGbxxByRyLdhth,
		queryZyzgdjByRyLdhth
	} from '@/api/renyuan.js'
	import {
		useStore
	} from '@/store';
	const tempCellData = ref({
		"title": "",
		"value": "",
		"titleSpan": 4,
		"valueSpan": 4
	})
	const ldhth = ref("")
	const renyuanData = ref({})
	const cellData = ref([])
	const gzjlList = ref([]) // 人员其他子表信息-工作经历
	const zjtzList = ref([]) // 人员其他子表信息-证件台账
	const zyjtcyList = ref([]) // 人员其他子表信息-主要家庭成员
	const xlxxList = ref([]) // 人员其他子表信息-学历证书
	const gbxxList = ref([]) // 人员其他子表信息-干部信息
	const zyzgdjList = ref([]) // 人员其他子表信息-职业资格等级


	function getChildTable() {
		console.log(ldhth.value)
		queryGbxxByRyLdhth({
			"ldhth": ldhth.value
		}).then((res) => {
			// console.log(res);
			gbxxList.value = res
			// console.log(gbxxList.value)
		}).catch((err) => {
			console.log(err);
		})
		queryZyzgdjByRyLdhth({
			"ldhth": ldhth.value
		}).then((res) => {
			// console.log(res);
			zyzgdjList.value = res
			// console.log(zyzgdjList.value)
		}).catch((err) => {
			console.log(err);
		})
		queryGzjlByRyLdhth({
			"ldhth": ldhth.value
		}).then((res) => {
			// console.log(res);
			if (res.length > 0) {
				gzjlList.value = res
			}
		}).catch((err) => {
			console.log(err);
		})
		queryQzqkByRyLdhth({
			"ldhth": ldhth.value
		}).then((res) => {
			// console.log(res);
			if (res.length > 0) {
				zjtzList.value = res
			}
		}).catch((err) => {
			console.log(err);
		})
		queryJtzycyByRyLdhth({
			"ldhth": ldhth.value
		}).then((res) => {
			// console.log(res);
			if (res.length > 0) {
				zyjtcyList.value = res
			}
		}).catch((err) => {
			console.log(err);
		})
		queryXlxxByRyLdhth({
			"ldhth": ldhth.value
		}).then((res) => {
			if (res.success) {
				xlxxList.value = []
				if (res.result.records.length > 0) {
					var rress = res.result.records
					for (let i = 0; i < rress.length; i++) {
						if (rress[i].onexl == 1) {
							rress[i].xllb = "第一学历"
							xlxxList.value.push(rress[i])
						}
						if (rress[i].zgxl == 1) {
							rress[i].xllb = "最高学历"
							xlxxList.value.push(rress[i])
						}

					}
				}

				console.log(xlxxList.value);
			}
		}).catch((err) => {
			console.log(err);
		})
	}

	function getJbxx() {
		cellData.value.push({
			"title": "姓名",
			"value": renyuanData.value.xm,
			"titleSpan": 3,
			"valueSpan": 3
		})
		cellData.value.push({
			"title": "性别",
			"value": renyuanData.value.xb_dictText,
			"titleSpan": 3,
			"valueSpan": 4
		})

		cellData.value.push({
			"title": "出生年月",
			"value": renyuanData.value.cssj,
			"titleSpan": 4,
			"valueSpan": 4
		})
		cellData.value.push({
			"title": "民族",
			"value": renyuanData.value.mz,
			"titleSpan": 3,
			"valueSpan": 3
		})
		cellData.value.push({
			"title": "籍贯",
			"value": renyuanData.value.jg,
			"titleSpan": 3,
			"valueSpan": 5
		})
		cellData.value.push({
			"title": "出生地",
			"value": renyuanData.value.csd,
			"titleSpan": 3,
			"valueSpan": 4
		})
		cellData.value.push({
			"title": "工作时间",
			"value": renyuanData.value.cjgzsj,
			"titleSpan": 4,
			"valueSpan": 5
		})

		cellData.value.push({
			"title": "政治面貌",
			"value": renyuanData.value.zzmm + renyuanData.value.jrsj,
			"titleSpan": 4,
			"valueSpan": 4
		})
		cellData.value.push({
			"title": "现专业",
			"value": "",
			"titleSpan": 3,
			"valueSpan": 8
		})
		cellData.value.push({
			"title": "用工形式",
			"value": renyuanData.value.rylb1_dictText,
			"titleSpan": 4,
			"valueSpan": 5
		})
		cellData.value.push({
			"title": "健康状况",
			"value": "",
			"titleSpan": 4,
			"valueSpan": 4
		})
		cellData.value.push({
			"title": "所在单位",
			"value": renyuanData.value.orgCode_dictText,
			"titleSpan": 4,
			"valueSpan": 6
		})
		cellData.value.push({
			"title": "专业技术资格",
			"value": gbxxList.value.zc + gbxxList.value.zcsj,
			"titleSpan": 5,
			"valueSpan": 7
		})
		cellData.value.push({
			"title": "职业资格等级",
			"value": zyzgdjList.value.ztgz + zyzgdjList.value.ztgzdj,
			"titleSpan": 5,
			"valueSpan": 7
		})
		cellData.value.push({
			"title": "",
			"value": "",
			"titleSpan": 0,
			"valueSpan": 0
		})

		cellData.value.push({
			"title": "职务(岗位)",
			"value": gbxxList.value.zw,
			"titleSpan": 5,
			"valueSpan": 7
		})

		cellData.value.push({
			"title": "职位级别",
			"value": gbxxList.value.zwcj,
			"titleSpan": 5,
			"valueSpan": 7
		})
		cellData.value.push({
			"title": "",
			"value": "",
			"titleSpan": 0,
			"valueSpan": 0
		})
	}

	onLoad((e) => {
		renyuanData.value = JSON.parse(decodeURIComponent(e.data));
		ldhth.value = renyuanData.value.ldhth
		getChildTable()
		setTimeout(function() {
			getJbxx()
		}, 500);

	})
</script>

<style scoped>
	.renyuanInfo {
		position: absolute;
		bottom: 0;
		left: 0;
		right: 0;
		top: 0;
		height: 98vh;
		width: 900px;
		background-color: rgba($color: #000000, $alpha: 0.4);
		display: flex;
		flex-direction: row;
		font-size: 18px;
		color: #fff;
	}

	.titleStyle {
		font-size: 12px;
		color: #747474;
		line-height: 50px;
		height: 50px;
		background: #F2F9FC;
		text-align: center;
		vertical-align: middle;
		border-left: 1px solid #919191;
		border-bottom: 1px solid #919191;
		;
	}

	/* 内容样式 */
	.dataStyle {
		max-font-size: 14px;
		/* 最大字体限制 */
		min-font-size: 10px;
		/* 最小字体限制 */
		font-size: 14px;
		color: #00007f;
		line-height: 25px;
		height: 50px;
		font-weight: 500;
		text-align: center;
		vertical-align: middle;
		border-bottom: 1px solid #919191;
		border-left: 1px solid #919191;
		text-overflow: ellipsis;

	}
</style>