<template>
	<view class="safe-mesure">
		<headers class="fixedheader" :themeType="true" :showBack="true">
			<view class="headerName">
				安全措施
			</view>
		</headers>
		<view class="safe-mesure-container">
			<view class="safe-mesure-header">
				<view class="header-left">安全措施</view>
				<view class="header-right">是否涉及</view>
			</view>
			<view class="safe-mesure-list" v-if="safeMeasure.length>0">
				<view class="safe-mesure-item" v-for="(item,i) in safeMeasure" :key="i">
					<view class="item-left">
						{{i + 1}}.{{item.name}}
					</view>
					<view class="item-right">
						
						<text v-if="item.flag === '是'" style="color: green;">{{item.flag}}</text>
						<text v-if="item.flag === '否'" style="color: red;">{{item.flag}}</text>
					</view>
				</view>
			</view>
			<view class="other-safe" style="margin-top: 100rpx;">
				<view class="other-head">
					<view class="other-icon"></view>
					<view class="other-text">其他安全措施</view>
				</view>
				<view class="other-content">
					<view class="content-1" style="line-height: 40rpx;">
						其他安全内容:
						<text v-if="otherSafeMeasure.length > 0">
							<text v-for="(item,i) in otherSafeMeasure" :key="i">
								<text style="margin: 0 5rpx;"> {{item.content}}</text>
							</text>
						</text>
						<text v-else>暂无数据</text>
						<!-- <text v-if="JSON.parse(detailData.otherSafeMeasure)">{{JSON.parse(detailData.otherSafeMeasure)[0].content}}</text>
						<text v-else>暂无数据</text> -->
					</view>
					<view class="content-3">
						<text style="float: right;">
							编制人:
							<text v-if="otherSafeMeasure.length > 0">
								<text v-for="(item,i) in otherSafeMeasure" :key="i">
									<text style="margin: 0 5rpx;"> {{item.person}}</text>
								</text>
							</text>
							<text v-else>暂无数据</text>
							<!-- <text v-if="JSON.parse(detailData.otherSafeMeasure)">{{JSON.parse(detailData.otherSafeMeasure)[0].person}}</text>
							<text v-else>暂无数据</text> -->
						</text>
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detailId: '',
				detailData: '',
				safeMeasure:[],
				otherSafeMeasure: []
			};
		},
		created() {
			this.getWork()
		},
		onLoad(options) {
			this.detailId = options.detailId
		},
		methods:{
			getWork(){
				let that = this;
				this.sendRequest({
					url:'xmgl/xzTemporaryElectricitySafe/queryById',
					method:'get',
					data:{id:this.detailId},
					success:res=>{
						uni.hideLoading()
						that.detailData =  res.result
						// that.detailData.safeMeasure = JSON.parse(that.detailData.safeMeasure)
						that.safeMeasure = JSON.parse(that.detailData.safeMeasure)
						//otherSafeMeasure
						that.otherSafeMeasure = JSON.parse(that.detailData.otherSafeMeasure)
						console.log("=detailData====================",that.detailData)
						console.log("=safeMeasure====================",that.safeMeasure)
					}
				})
			},
		}
	}
</script>

<style lang="scss">
.safe-mesure{
	min-height: 100%;
	background: #F6F6F6;
	// background: darkred;
	.fixedheader{
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		z-index: 2;
	}
	.safe-mesure-container{
		padding: 0 30rpx;
		padding-top: 138rpx;
		padding-bottom: 100rpx;
		// background-color: darkred;
		.safe-mesure-header{
			display: flex;
			// justify-content: space-between;
			margin-top: 10rpx;
			line-height: 80rpx;
			font-size: 32rpx;
			font-weight: bold;
			color: #81818c;
			.header-left{
				width: 75%;
				display: flex;
				justify-content: center;
			}
			.header-right{
				width: 25%;
				display: flex;
				justify-content: center;
			}
		}
		.safe-mesure-list{
			.safe-mesure-item{
				display: flex;
				// justify-content: space-between;
				margin-top: 15rpx;
				// line-height: 40rpx;
				.item-left{
					width: 75%;
				}
				.item-right{
					width: 25%;
					display: flex;
					justify-content: center;
					align-items: center;
				}
				
			}
		}
		.other-safe{
			margin-top: 50rpx;
			.other-head{
				display: flex;
				.other-icon{
					width: 10rpx;
					height: 40rpx;
					background-color: #2b8df3;
					border-radius: 100rpx;
				}
				.other-text{
					margin-left: 20rpx;
				}
			}
			.other-content{
				width: auto;
				height: 50rpx;
				// background-color: darkred;
				// border: 1rpx solid black;
				margin: 0 30rpx;
				margin-top: 25rpx;
			}
			
		}
	}
}
</style>
