<template>
	<view class="deetailPage">
		<view class="fixedheader">
			<headers :showBack="true">
				<view class="headerName">
					查看详情
				</view>
			</headers>
		</view>
		<view class="content record" :style="{paddingTop: mobileTopHeight + 'px'}" >
			<view class="type flex2">
				<view class="textColor">路线名称</view>
				<view class="textRight">{{basicInfo.routeName}}</view>
			</view>
			<view class="type flex2">
				<view class="textColor">分包单位</view>
				<view class="textRight">{{detail.enterpriseName}}</view>

			</view>
			<view class="type flex2">
				<view class="textColor">巡检人员</view>
				<view class="textRight">{{detail.inspectUserNames}}</view>
			</view>
			<view class="type flex2">
				<view class="textColor">通知人员</view>
				<view class="textRight">{{detail.noticeUserNames}}</view>
			</view>

			<view class="type flex2">
				<view class="textColor">计划检查时间</view>
				<!-- <pre class="pre">{{basicInfo.dangerDesc}}</pre> -->
				<view class="textRight">{{basicInfo.startTime}} 至 {{basicInfo.endTime}}</view>
			</view>
			<view class="type flex2">
				<view class="textColor">检查频次</view>
				<view class="textRight">{{basicInfo.frequencyNum}}次/日</view>
			</view>
			<view class="type flex2">
				<view class="plan_path">
					<image src="@/static/plan_path.png"></image>
				</view>
				<view style="font-weight: bold;">巡检路线</view>
			</view>
			<view class="type-item" v-for="item in basicInfo.routeToPointList" :key="item.id">
				<view class="type flex2">
					<view class="textColor">
						巡检点：
					</view>
					<view class="textRight">
						<input class="uni-input" :value="xzCheckingRouteName(item.checkingPointId)" disabled="disabled" placeholder="" />
					</view>
				</view>
				<view class="type flex2">
					<view class="textColor">
						排序：
					</view>
					<view class="textRight">
						<input class="uni-input" v-model="item.sort" disabled="disabled" placeholder="" />
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mobileTopHeight: 0,
				checkedTab: 1,
				imgFileList: [],
				videoFileList: [],
				basicInfo: {},
				issueInfoList: [],
				userInfo: {},
				detail: {},
				recordType: 1, // 1为安全问题  2为排查记录
				id: '',
				btnEditAuth: true,
				btnDeleteAuth: true,
				inspectPointList:[],
			}
		},
		computed: {
			xzCheckingRouteName(){
				return (checkingPointId) => {
				  const find =	this.inspectPointList.find(item => item.id == checkingPointId)
				  console.log(find,checkingPointId, this.inspectPointList)
				  return find ? find.checkingPointName : ""
				}
			}
		},
		onLoad(option) {
			
			this.id = option.id;
			this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
			this.detail = JSON.parse(option.detail)
			console.log(this.detail)
		},
		onShow() {
			this.getBasicInfo();
			this.getPointList();
		},
		mounted() {
			var that = this
			uni.getSystemInfo({
				success(res) {
					that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
					uni.setStorageSync('systemInfo',res)
					console.log(res)
				}
			})
			console.log('this.mobileTopHeight',this.mobileTopHeight)
		},
		methods: {
			
			//获取基本信息
			getBasicInfo() {
				let that = this;
				this.sendRequest({
					url: 'xmgl/xzCheckingRoute/queryById',
					method: 'get',
					data: {
						id: that.id
					},
					success: res => {
						console.log(res.result, this.userInfo)
						that.basicInfo = res.result;
					}
				})
			},
			//查询巡检点
			getPointList() {
				let that = this;
				this.sendRequest({
					url: 'xmgl/checkingPoint/selectPage',
					method: 'post',
					data: {
						 pageNo: 10,
						 pageSize: -1,
						projectSn: JSON.parse(uni.getStorageSync('projectDetail')).projectSn,
					},
					success: res => {
						console.log(res.result)
						that.inspectPointList = res.result.records;
					}
				})
			},
			//播放视频
			playVideo(url, type) {
				uni.navigateTo({
					url: '../carWashManage/mediaPlay?url=' + url + '&type=' + type
				})
			},

			//预览图片
			previewImage(url) {
				uni.previewImage({
					urls: [url]
				})
			}

		}
	}
</script>

<style lang="scss">
	.fixedheader /deep/ .headerBox {
		background-color: #5181F6;
		color: white;
		.uni-icons{
			color: white !important;
		}
	}
	.plan_path{
		background-color: #5181F6;
		width: 50rpx;
		height: 50rpx;
		padding: 10rpx;
		display: flex;
		border-radius: 50rpx;
		margin-right: 20rpx;
		>image {
			width: 100%;
			height: 100%;
		}
	}
	.textColor::before{
		content: '*';
		color: #e54d42;
	}
	.uni-input{
		    height: 60rpx;
		    background: #F3F6F9;
		    border: 1px solid rgba(194, 194, 194, 0.2);
		    font-size: 28rpx;
	}
	.type-item {
		display: flex;
		.type:last-child{
			margin-left: 20rpx;
		}
	}
	.type-item > .type {
		width: 50%;
		padding: 20rpx 0;
		.textColor{
			width: initial;
		}
		.textRight{
			// width: initial;
			text-align: center;
		}
	}

	.fixedheader{
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		z-index: 2;
		.headerName{
			z-index: 1;
		}
	}
	.flex {
		display: flex;
		align-items: center;
	}

	.flex2 {
		display: flex;
		align-items: center;
		/* justify-content: space-between; */
	}

	.flex3 {
		display: flex;
	}

	.deetailPage {
		width: 100%;
		height: 100%;
	}

	.tab {
		width: 100%;
		height: 45px;
		text-align: center;
		box-shadow: 0 0 10px rgba(194, 194, 194, 0.5);
	}

	.tabType {
		width: 50%;
		line-height: 43px;
		border-bottom: 1px solid rgba(194, 194, 194, 0.2);

	}

	.checkedTab {
		color: #4181FE;
		border-bottom: 2px solid #4181FE;

	}

	.noCheckTab {
		padding-bottom: 2px;
	}

	.content {
		width: 100%;
		box-sizing: border-box;
		padding: 20rpx 16rpx
	}

	.type {
		font-size: 30rpx;
		line-height: 40px;
		border-bottom: 1px solid rgba(194, 194, 194, 0.2);
	}

	.pre {
		padding: 10px 30rpx;
		background-color: rgba(194, 194, 194, 0.2);
		min-height: 50px;
		width: 100%;
		white-space: pre-wrap;
		word-wrap: break-word;
		box-sizing: border-box;
		line-height: initial;
	}

	.accessory {
		width: 100%;
		height: 70px;
		padding: 0 10px;
		box-sizing: border-box;
	}

	.accessoryImg {
		width: 110rpx;
		height: 60px;
		margin-right: 8px;
	}

	.userImg {
		width: 25px;
		height: 25px;
		border-radius: 50%;
		box-shadow: 0px 0 15px rgba(194, 194, 194, 0.5);
		margin-top: 5px;
	}

	.bubble {
		margin-left: 18px;
		width: 90%;
		box-sizing: border-box;
	}

	.bubble .bubble_content {
		width: 90%;
		background-color: #fff;
		padding: 10px 15px;
		display: inline-block;
		border-radius: 6px;
		position: relative;
		box-shadow: -2px 0 15px rgba(194, 194, 194, 0.5);
		position: relative;

	}

	.bubble .bubble_content::after {
		content: '';
		border: 8px solid #ffffff00;
		border-right: 8px solid #fff;
		position: absolute;
		top: 10px;
		left: -16px;
	}

	.record {
		/* background-color: rgba(234, 234, 234, 0.4); */
		padding-bottom: 60px;
	}

	.bubble_content .name {
		font-size: 30rpx;
		margin: 10px 0;
	}

	.time {
		color: rgba(153, 153, 153, 1);
		font-size: 24rpx;
		font-family: PingFangSC-Regular;

	}

	.item_title {
		margin: 10px 0;
		font-family: PingFangSC-Regular;
		font-size: 28rpx;
		opacity: 0.8;
	}

	.approveBtn {
		position: fixed;
		bottom: 15px;
		width: calc(100% - 30px);
		box-sizing: border-box;
		z-index: 99;
	}

	.approveBtn .btn {
		width: 70%;
		line-height: 40px;
		background-color: #4181FE;
		color: #fff;
		text-align: center;
		border-radius: 30px;
		margin: 0 auto;
		box-shadow: 0 5px 5px rgba(65, 129, 254, 0.3);
	}

	.approveBtn .btn:active {
		background-color: rgba(65, 129, 254, 0.8);
	}

	.backBtn {
		position: fixed;
		bottom: 0px;
		left: 0px;
		width: 100%;
		box-sizing: border-box;
		z-index: 99;
	}

	.backBtn .btn-option {
		width: 100%;
		line-height: 40px;
		background-color: #4181FE;
		color: #fff;
		text-align: center;
	}

	.backBtn .btn-option:active {
		background-color: rgba(65, 129, 254, 0.8);
	}

	.editBtn {
		position: fixed;
		bottom: 0px;
		left: 0px;
		width: 100%;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		z-index: 99;
	}

	.editBtn .btn-delete {
		width: 50%;
		line-height: 40px;
		background-color: #D51C1C;
		color: #fff;
		text-align: center;
	}

	.editBtn .btn-resubmit {
		width: 50%;
		line-height: 40px;
		background-color: #5382F6;
		color: #fff;
		text-align: center;
	}

	.pass_wrap {
		position: absolute;
		top: 100px;
		right: 20px;
		z-index: 10;
	}

	.pass_icon {
		width: 80px;
		height: 80px;
	}

	.noData {
		text-align: center;
		font-size: 32rpx;
		margin-top: 120px;
		color: #bed0fb;
	}

	.noDataImg {
		width: 125px;
		height: 98px;
	}

	.table_title {
		list-style: none;
		justify-content: space-between;
		padding-left: 0;
		align-items: center;
		height: 56rpx;
		border-bottom: 1px solid #f1f1f1;
	}

	.table_title li {
		flex: 1;
		text-align: center;
		line-height: 56rpx;
	}

	.table_index {
		display: block;
		border-radius: 50%;
		color: #fff;
		background: #488DEC;
		width: 32rpx;
		height: 36rpx;
		text-align: center;
		line-height: 36rpx;
		margin-right: 10rpx;
	}

	.table_success {
		display: block;
		color: #13B98C;
		background: rgba(19, 185, 140, 0.2);
		line-height: 32rpx;
		padding: 6rpx;
	}

	.table_error {
		display: block;
		color: #EA3941;
		background: rgba(234, 57, 65, 0.2);
		line-height: 32rpx;
		padding: 6rpx;
	}

	.table_item {
		list-style: none;
		justify-content: space-between;
		padding-left: 0;
		align-items: center;
		height: 100rpx;
		border-bottom: 1px solid #f1f1f1;
	}

	.table_item li {
		flex: 1;
		text-align: center;
		font-size: 12px;
		line-height: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.table_item li:last-child {
		justify-content: flex-end;
	}

	.table_item li:nth-child(1) {
		flex: none;
		width: 136rpx;
	}

	.table_title li:nth-child(1) {
		flex: none;
		width: 136rpx;
	}

	.icon-down {
		height: 8px;
		width: 8px;
		background: url(../../../static/icon-down-black.png) center no-repeat;
		background-size: 100%;
		margin-left: 4rpx;
	}

	.icon-right {
		height: 8px;
		width: 8px;
		background: url(../../../static/icon-right.png) center no-repeat;
		background-size: 100%;
		margin-left: 8rpx;
	}

	.table_content {
		/* background: #f1f1f1; */
		padding: 28rpx;
	}

	.imgList {
		margin-bottom: 20rpx;
	}

	.imgList ul {
		list-style: none;
		padding: 0;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
	}

	.imgList ul li {
		width: 30%;
		height: 100px;
		margin: 0 10rpx;
		margin-bottom: 20rpx;
	}

	.imgList ul li image {
		width: 100%;
		height: 100%;
	}

	.textRight {
		/* margin-left: 20px; */
		width: 60%;
		color: gray;
		text-align: right;
	}

	.textColor {
		width: 40%;
		/* width: 130rpx; */
	}
</style>