<template>
	<view class="content">
		<!-- 申请类型 -->
		<view class="request_type">
			<view class="type_title">临时人员</view>
			<view class="type_time">{{list.submissionTime}}</view>
			<view class="type_zhuang2" v-if="list.status==0">已拒绝</view>
			<view class="type_zhuang3" v-if="list.status==1">待审批</view>
			<view class="type_zhuang3" v-if="list.status==2">处理中</view>
			<view class="type_zhuang" v-if="list.status==3">审批通过</view>
		</view>
		<!-- 申请内容 -->
		<view class="request_detail">
			<uni-forms ref="valiForm">
				<uni-forms-item label="类型" name="companyName" required>
						<view class="uni-input">
							临时人员
						</view>
				</uni-forms-item>
				<view class="form-line"></view>
				<uni-forms-item label="开始时间" name="companyName" required>
					<view class="uni-input">
						{{list.startTime}}
					</view>
				</uni-forms-item>
				<view class="form-line"></view>
				<uni-forms-item label="结束时间" name="companyName" required>
					<view class="uni-input">
						{{list.endTime}}
					</view>
				</uni-forms-item>
				<view class="form-line"></view>
				<uni-forms-item label="申请部门" name="companyName" required>
					<view class="uni-input">
						<template v-if="list.department=='0'">其他</template>
						<template v-if="list.department=='1'">学生</template>
						<template v-if="list.department=='4'">教职工</template>
						<template v-if="list.department=='5'">校友</template>
						<template v-if="list.department=='6'">访客</template>
						<template v-if="list.department=='7'">临时人员</template>
					</view>
				</uni-forms-item>
				<view class="form-line"></view>
				<uni-forms-item label="房间数量" name="companyName" required>
					<view class="uni-input">
						{{list.houseCount}}
					</view>
				</uni-forms-item>
			</uni-forms>
		</view>
		<!-- 申请备注 -->
		<view class="request_remark">
			<uni-forms-item label="申请原因" name="companyName" required>
			</uni-forms-item>
			<view class="liyou">{{list.reasonApplication}}</view>
			<text class="textsrea-txt">{{zishunum}}</text>
		</view>
		<view class="request_remark" style="height: 100%;">
			<view class="submit-start" style="color: rgba(0, 0, 0, 1);">附件：</view>
			<view class="submit-start" style="color: rgba(0, 0, 0, 1);">
				<!-- {{item.imageUrl!=null&&item.imageUrl!=''}}3{{(item.imageUrl).split(',')}} -->
				<text v-if="list.imageUrl!=null&&list.imageUrl!=''">
					<image @click.stop="clickImg2(item2)" style="color: rgba(0, 97, 255, 1);width: 200rpx;height: 200rpx;margin-left: 20rpx;" :src="item2" v-for="(item2,index2) in (list.imageUrl).split(',')" :key="index2">
					</image>
				</text>
			</view>
		</view>
		
		<!-- 审批记录 -->
		<view class="request_list">
			<view class="list_title">审批记录</view>
			<!-- 几级审批 -->
			<view style="position: absolute;margin-top: 110rpx;">
			<view>
				<image class="item_image"></image>
				<view class="item_title">提交申请</view>
				<view class="item_name">{{list.usersName}}</view>
				<view class="item_time">{{list.submissionTime}}</view>
				<view class="item_line" v-if="list.approverUserName || list.secondaryApproverName"></view>
			</view>
			<view v-if="list.secondaryApproverName">
				<image class="item_image"></image>
				<view class="item_title">{{list.secondaryExamineAndApproveRemark}}</view>
				<view class="item_name">{{list.secondaryApproverName}}</view>
				<view class="item_time">{{list.secondaryExamineAndApproveTime}}</view>
				<view class="item_line" v-if="list.approverName"></view>
			</view>
			<view v-if="list.approverName">
				<image class="item_image"></image>
				<view class="item_title">{{list.examineAndApproveRemark}}</view>
				<view class="item_name">{{list.approverName}}</view>
				<view class="item_time">{{list.examineAndApproveTime}}</view>
			</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getlistXiang
	} from '../../../utils/api_hotel.js'
	export default {
		data() {
			return {
				list:{},
				id:'',
				department:'',//身份
				zishunum:0,
			}
		},
		onLoad(option) {
			this.id=option.id
			this.department=option.department
			this.getXiang()
		},
		mounted() {
		},
		methods: {
			//点击放大图片
			clickImg2(item2) {
				// console.log(item.srcUrl)
				uni.previewImage({
					urls: [item2], //需要预览的图片http链接列表，多张的时候，url直接写在后面就行了
					current: '', // 当前显示图片的http链接，默认是第一个
					success: function(res) {},
					fail: function(res) {},
					complete: function(res) {},
				})
			},
			// 临时人员提交记录
			getXiang(){
				let _self = this
				// adminMenuId身份类型，4为教职工，7为临时人员localStorage.getItem('department')
				// 状态，0:已拒绝，1:待审批，2:处理中，3:已同意
				var data="?department="+_self.department+"&id="+_self.id
				getlistXiang(data).then((res) => {
					if (res.success) {
						this.list=res.data
						this.zishunum=res.data.reasonApplication.length
						return;
					} else {
						uni.showToast({
							title: '获取记录详情失败'
						})
					}
				}).catch((err) => {
					uni.showToast({
						title: err.message
					})
				});
			},
		}
	}
</script>

<style>
	@import url("./teach_detail.css");
</style>