<template>
	<view class="wrap">
		<uni-list>
			<uni-list-item title="隐患编码" :rightText="baseInfo.dangerCode" ></uni-list-item>
			<uni-list-item title="隐患状态" :rightText="dangerStatus(baseInfo.status)" ></uni-list-item>
			<uni-list-item title="隐患类别" :rightText="baseInfo.dangerCatTitle" ></uni-list-item>
			<uni-list-item title="隐患等级" :rightText="baseInfo.dangerLevel===1?'一般':'重大'" ></uni-list-item>
			<uni-list-item title="所在位置" :rightText="baseInfo.dangerLocation" v-if="baseInfo.dangerLocation"></uni-list-item>
			<uni-list-item title="描述" :rightText="baseInfo.dangerDesc" ></uni-list-item>
			<uni-list-item title="所在部门" :rightText="baseInfo.curGroupName" v-if="baseInfo.curGroupName"></uni-list-item>
			<uni-list-item title="整改人员" :rightText="baseInfo.curAccountName"  v-if="baseInfo.curAccountName"></uni-list-item>
			<uni-list-item title="所在部门" :rightText="baseInfo.submitGroupName" v-if="baseInfo.submitGroupName"></uni-list-item>
			<uni-list-item title="整改人员" :rightText="baseInfo.submitAccountName"  v-if="baseInfo.submitAccountName"></uni-list-item>
			<uni-list-item title="所在部门" :rightText="baseInfo.rectifyGroupName" v-if="baseInfo.rectifyGroupName"></uni-list-item>
			<uni-list-item title="整改人员" :rightText="baseInfo.rectifyAccountName"  v-if="baseInfo.rectifyAccountName"></uni-list-item>
			<uni-list-item title="整改措施" :rightText="baseInfo.rectifyMeasure" v-if="baseInfo.rectifyMeasure"></uni-list-item>
			<uni-list-item title="整改说明" :rightText="baseInfo.rectifyRemark" v-if="baseInfo.rectifyRemark"></uni-list-item>	
		</uni-list>
		<button class="submit_bt" @click="handle" v-if="visable">处理</button>	
	</view>
</template>

<script>
	export default{
		data(){
			return{
				baseInfo:{},
				user:{},
				visable:false
			}
		},
		onLoad() {
			let info=uni.getStorageSync('detail-info')
			let accountInfo=uni.getStorageSync('accountInfo')
			this.baseInfo=info
			this.user=accountInfo
			console.log(accountInfo.userId===info.curAccountId)
			console.log(info.status===1||info.status===2||info.status===3)
			this.visable=(accountInfo.userId===info.curAccountId)&&(info.status===1||info.status===2||info.status===3);
		},
		methods:{
			dangerStatus(i) {
			  if (i >= 0) {
			    const strs = ['待提交','待评审','待整改','待验收','已完成']
			    return strs[i]
			  } else {
			    return '已撤销'
			  }
			},
			handle(){
				uni.navigateTo({
					url:'/pages/app_views/danger/handle/handle'
				})
			},
			isEmpty(val){
				if(val!=="undefined"&&val!==undefined&&val!==""&&val!==null){
					return false
				}
				return true
			}			
		}
	}
</script>

<style  lang="scss" scoped>
.wrap{	
	padding:20rpx;
	.submit_bt{
		width: 600rpx;
		height: 72rpx;
		line-height: 72rpx;
		box-sizing: border-box;
		border-radius: 16upx;
		margin-top: 50upx;
		background-color:#3384FF;
		font-size: 32rpx;
		color: #fff;
	}
}
</style>