<template>
	<view class="detail" v-if="detail!=null">
		<Nav :navs="navs" @change="navChange" />
		<view class="card" v-if="navIndex==0">
			<view class="title">基础信息</view>
			<view class="row">
				<label>学号：</label>
				<label>{{detail.stuNo}}</label>
			</view>
			<view class="row">
				<label>姓名：</label>
				<label>{{detail.stuName}}</label>
			</view>
			<view class="row">
				<label>性别：</label>
				<label>{{detail.gender}}</label>
			</view>
			<view class="row">
				<label>学院：</label>
				<label>{{detail.departmentName}}</label>
			</view>
			<view class="row">
				<label>年级：</label>
				<label>{{detail.gradeName}}</label>
			</view>
			<view class="row">
				<label>班级：</label>
				<label>{{detail.className}}</label>
			</view>
			<view class="row">
				<label>民族：</label>
				<label>{{detail.mz}}</label>
			</view>
			<view class="row">
				<label>出生日期：</label>
				<label>{{detail.birthday}}</label>
			</view>
			<view class="row">
				<label>籍贯：</label>
				<label>{{detail.jg}}</label>
			</view>
		</view>
		<view class="card" v-if="navIndex==1">
			<view class="title">处分信息</view>
			<view class="row">
				<label>处分文号：</label>
				<label>{{detail.penaltyNumber}}</label>
			</view>
			<view class="row">
				<label>违纪时间：</label>
				<label>{{detail.violationDate}}</label>
			</view>
			<view class="row" style="display: flex;">
				<label>处分等级：</label>
				<DictStatus :status="rt_penalty_type" :value="detail.penaltyType" />
			</view>
			<view class="row disciplinary-materials">
				<label>违纪材料：</label>
				<view>
					<image src="../../../static/word_file.png" mode="widthFix"></image>
					<text>QQ截图2024fsf.pdf</text>
				</view>
			</view>
			<view class="row">
				<label>处分建议：</label>
				<label>{{detail.penaltyRecommendation}}</label>
			</view>
			<view class="row">
				<label>违纪条例：</label>
				<label>{{detail.violationRegulations}}</label>
			</view>
			<!-- <view class="row">
				<label>解除违纪申请：</label>
				<label>{{detail.gender}}</label>
			</view> -->
		</view>
		<view class="card" v-if="navIndex==2">
			<view class="title">处分进度</view>
			<view class="steps">
				<view class="step" v-for="step in stepList" :key="step.taskId">
					<image v-if="step.finishTime" class="icon" src="../../../static/success.png" mode="widthFix"></image>
					<image style="width:34rpx;" v-else class="icon" src="../../../static/wating.png" mode="widthFix">
					</image>
					<image class="line" src="../../../static/step-line.png" mode="widthFix"></image>
					<view class="right">
						<text>{{step.taskName}}:</text>
						<text>{{step.assigneeName}}</text>
					</view>
				</view>
				<view class="loading-more-top" v-if="stepList.length==0">
					<uni-load-more status="loading" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import Nav from "@/components/navs/navs.vue"
	import DictStatus from "@/components/dict-status/dict-status.vue"
	import {
		getDicts,
	} from '@/api/system/dict/data.js';
	import {
		relieveDetail
	} from '@/api/applyrelieve/applyrelieve.js';
	import {
		flowRecord
	} from '@/api/flowRecord/flowRecord.js';
	export default {
		components: {
			Nav,
			DictStatus
		},
		data() {
			return {
				navs: [{
						text: "基础信息",
						val: 0
					},
					{
						text: "处分信息",
						val: 1
					},
					{
						text: "处分进度",
						val: 2
					}
				],
				basicInfo: null,
				detail: null,
				navIndex: 0,
				rt_penalty_type: [],
				stepList: []
			}
		},
		onLoad(option) {
			this.stuNo = option.stuNo;
			this.procInsId = option.procInsId;
			this.deployId = option.deployId;
			this.getRelieveDetail();
			this.get_penalty_type();
			this.getFlowRecord();
		},
		methods: {
			async get_penalty_type() {
				let res = await getDicts('rt_penalty_type');
				console.log(res);
				this.rt_penalty_type = res.data;
			},
			navChange(index) {
				this.navIndex = index;
			},
			async getRelieveDetail() {
				let res = await relieveDetail(this.procInsId);
				this.detail = res.data;
				console.log(res);
			},
			async getFlowRecord() {
				let res = await flowRecord({
					procInsId: this.procInsId,
					deployId: this.deployId
				});
				this.stepList = res.data.flowList.reverse();
			}
		}
	}
</script>

<style scoped lang="scss">
	.detail {
		height: calc(100vh - 44px);
		background-color: #F5F5F7;
		padding: 80rpx 30rpx 0;

		.card {
			margin: 30rpx 0rpx 0;
			padding: 30rpx;
			background-color: white;
			border-radius: 20rpx;

			.title {
				font-weight: bold;
				color: #202020;
				display: inline-block;
				font-size: 30rpx;
				margin-bottom: 30rpx;
			}
			.row {
				margin-bottom: 30rpx;

				&>label:first-child {
					color: #9C9C9C;
					margin-right: 40rpx;
				}

				&.disciplinary-materials {

					// display: flex;
					// flex-direction: column;
					view {
						margin-top: 15px;
						background-color: #F5F5F5;
						padding: 18rpx;
						display: flex;
						align-items: center;

						image {
							width: 70rpx;
							margin-right: 15rpx;
						}
					}
				}
			}

			.steps {
				margin-top: 20px;

				.step {
					display: flex;
					align-items: center;
					margin-bottom: 50rpx;

					.icon {
						width: 35rpx;
					}

					.line {
						flex: 0.7;
						margin: 0 10px;
					}

					.right {
						flex: 1.4;

						text:first-child {
							color: #9E9E9E;
							margin-right: 10rpx;
						}
					}
				}
			}
		}
	}
</style>