<template>
	<view class="deetailPage">
		<headers :showBack="true">
			<view class="headerName">
				进度管理系统
			</view>
		</headers>
		<view class="content" :style="{paddingTop: mobileTopHeight + 'px'}">
			<view class="title">
				进度详情
			</view>
			<view class="type">
				<view class="textColor">
					<text>所属承包商：</text>
					<text class="textStyle">{{itemFrom.enterpriseName || ""}}</text>
				</view>
			</view>
			<view class="type">
				<view class="textColor">
					<text>所属厂区：</text>
					<text class="textStyle">{{itemFrom.regionName || ""}}</text>
				</view>
			</view>
			<view class="type">
				<view class="textColor">
					<text>分部分项工程：</text>
					<text class="textStyle">{{itemFrom.taskName || ""}}</text>
				</view>
			</view>
			<view class="type">
				<view class="textColor">
					<text>上报时间：</text>
					<text class="textStyle">{{itemFrom.uploadDate || ""}}</text>
				</view>
			</view>
			<view class="type">
				<view class="textColor">
					<text>上报进度：</text>
					<text class="textStyle">{{itemFrom.progressRatio || 0}}%</text>
				</view>
			</view>
			<view class="type">
				<view class="textColor">反馈内容：</view>
				<view class="type-area">
					<view>{{itemFrom.feedbackContent || ""}}</view>
				</view>
			</view>
			<view class="type">
				<view class="textColor">图片：</view>
				<view class="type-img">
					<image @click="previewImage(item)" :src="item" mode="" v-for="(item,index) in itemFrom.imgList" :key="index"></image>
				</view>
			</view>
			<view class="type">
				<view class="textColor">是否有延期误工事件：<text
						class="textStyle">{{itemFrom.hasDelayEvent == 1 ? "是" : "否"}}</text></view>
			</view>
			<view class="type">
				<view class="textColor">延期误工原因：</view>
				<view class="type-area">
					<view>{{itemFrom.delayEventReason || ""}}</view>
				</view>
			</view>
			<view class="type">
				<view class="textColor">延期原因类型：</view>
				<view class="type-area">
					<view>{{ itemFrom.delayEventType | filterType }}</view>
				</view>
			</view>
			<view class="type">
				<view class="textColor">驳回原因：</view>
				<view class="type-area">
					<view>{{itemFrom.rejectReason || ""}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mobileTopHeight: 0,
				itemFrom: {},
				userInfo: {},
				tableData: [],
				projectSn: '',
			}
		},
		onLoad(option) {
			uni.getSystemInfo({
				success(res) {
					that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
					console.log(res)
				}
			})
			this.itemFrom = JSON.parse(option.obj);
			console.log(this.itemFrom, 666777)
			if (this.itemFrom) {
				this.filterItemForm();
			}
			this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
			this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
		},
		filters: {
			filterType(val) {
				let typeList = val.split(",");
				let typeTextArr = ["人为因素", "环境因素", "不可抵抗因素"];
				let dealDataArr = [];
				typeList.map((item) => {
					dealDataArr.push(typeTextArr[item - 1]);
				});
				return dealDataArr.join(",");
			},
		},
		methods: {
			previewImage(url) {
				uni.previewImage({
					urls: [url]
				})
			},
			filterItemForm() {
				console.log(this.itemFrom)
				if (this.itemFrom.image) {
					let imgArr = JSON.parse(this.itemFrom.image);
					let dealArr = [];
					imgArr.map(item => {
						if (item.url.indexOf("http") == -1) {
							dealArr.push(this.url_config + 'image/' + item.url)
						} else {
							dealArr.push(item.url)
						}
					})
					this.itemFrom.imgList = dealArr
				}
			}
		}
	}
</script>

<style lang="less">
	.content {
		width: 100%;
		box-sizing: border-box;
		padding: 20rpx 16rpx;
		// height: calc(100vh - 88rpx - 32rpx);

		.title {
			margin: 20rpx;
			font-weight: bold;
			font-size: 28rpx;
		}

		.type {
			color: #9f9f9f;
			margin: 40rpx 20rpx 0 20rpx;
			font-size: 28rpx;

			.textColor {
				display: flex;
				// align-items: center;
				justify-content: space-between;
				text:nth-child(1){
					white-space: nowrap;
				}
				.textStyle {
					color: #000;
					overflow-wrap: anywhere;
				}
			}

			.type-img {
				display: flex;
				flex-wrap: wrap;

				image {
					margin-top: 20rpx;
					width: 280rpx;
					height: 200rpx;
					margin-right: 20rpx;
				}
			}

			.type-area {
				background-color: #F6F6F6;
				border-radius: 6rpx;
				padding: 15rpx;
				color: #626677;
				margin-top: 20rpx;
			}

		}

		.record-content {
			.record-item {
				display: flex;
				background-color: #F6F6F6;
				border-radius: 6rpx;
				padding: 15rpx;

				image {
					width: 30rpx;
					height: 30rpx;
					margin-top: 5rpx;
					margin-left: 20rpx;
					margin-right: 70rpx;
				}

				.item-text {
					display: flex;
					flex-direction: column;
					margin-right: auto;

					text:nth-child(1) {
						margin-bottom: 20rpx;
					}
				}

				.record-status {
					width: 100rpx;
					height: 40rpx;
					line-height: 40rpx;
					text-align: center;
					font-size: 24rpx;
					color: white;
					border-radius: 30rpx;
				}

				.pass-status {
					background-color: #5382F6;
				}

				.noPass-status {
					background-color: #EB3B43;
				}
			}

			.record-item:not(:last-child) {
				margin-bottom: 40rpx;
			}
		}

		.line {
			border-bottom: 1px solid #e6e6e6;
			margin-top: 60rpx;
		}

		.container {
			width: 100%;
			height: 100%;
			display: flex;
			flex-direction: column;
			font-size: 28rpx;
			margin-top: 40rpx;
		}

		.table-header {
			display: flex;
			background-color: #f7f8fa;

			text-align: center;
			height: 70rpx;
			line-height: 70rpx;

		}

		.header-cell {
			flex: 1;
			border: 1px solid #f0f0f0;
		}

		.table-body {
			display: flex;
			flex-direction: column;
			text-align: center;

		}

		.table-row {
			display: flex;

			height: 70rpx;
			line-height: 70rpx;
		}

		.table-cell {
			flex: 1;
			border: 1px solid #f0f0f0;
			width: 50rpx;
			white-space: nowrap;
			/* 防止换行 */
			overflow: hidden;
			/* 超出部分隐藏 */
			text-overflow: ellipsis;
			/* 超出部分显示省略号 */
		}

		.addProgess {
			width: 50%;
			background: #5181f6;
			text-align: center;
			margin: auto;
			height: 60rpx;
			color: #fff;
			border-radius: 40rpx;
			line-height: 60rpx;
			margin-top: 110rpx;
			font-size: 28rpx;
		}

		.closeProgess {
			width: 50%;
			text-align: center;
			margin: auto;
			height: 60rpx;
			border-radius: 40rpx;
			line-height: 60rpx;
			margin-top: 110rpx;
			font-size: 28rpx;
			background: #f7f8fa;
			color: #8c8c8c;
		}

		.greenText {
			color: green !important;
		}

		.blueText {
			color: #5181f6 !important;
		}

		.redText {
			color: red !important;
		}
	}
</style>