<template>
	<view>		
		<view style="margin:10px 100px;position: fixed;z-index: 50;opacity:0.7;" v-show="isShow">
			<button type="primary" style="border-radius: 5px;" class="mini-btn" size="mini" @click="modify">修改</button>
		</view>
		<uni-list>
			<uni-list-item v-if="listData.entity">
				<view slot="body" class="slot-box">
					<view class="row">
						<view class="column-left">工程名称：</view>
						<view class="column-right">{{listData.entity.projectName}}</view>
					</view>
					<view class="row">
						<view class="column-left">编号：</view>
						<view class="column-right">{{listData.entity.checkCode}}</view>
					</view>
					<view class="row">
						<view class="column-left">检查日期：</view>
						<view class="column-right">{{listData.entity.checkDateStr}}</view>
					</view>
					<view class="row">
						<view class="column-left">审核状态：</view>
						<view class="column-right">{{listData.entity.statusName}}</view>
					</view>
					
					<view class="row">
						<view class="column-left">附件：</view>
						<view class="column-right">
							<view v-for="(item,index) in listData.attachments" :key="index">								
								<a :href="'/api/common/ShowImg?code='+item.attachMentCode">{{item.fileName}}</a>
							</view>
						</view>
					</view>
				</view>
			</uni-list-item>
		</uni-list>
		 
		
		<uni-section title="检查项目明细"  type="line"></uni-section>
		<uni-list>
			<uni-list-item v-if="listData.list"  v-for="(item, index) in listData.list"  :key="index">
				<view slot="body" class="slot-box">
					<view class="row">
						<view class="column-left">检查项目：</view>
						<view class="column-right">{{item.checkContent}}</view>
					</view>
					<view class="row">
						<view class="column-left">检查结果：</view>
						<view class="column-right">{{item.checkResult}}</view>
					</view>
					</view> 
			</uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import {
		 GetSafeQualityCheckDTO
	} from "@/common/api/SafeQualityCheckApi.js";
	import {
		Decimal
	} from 'decimal.js';
	export default {
		data() {
			return {
				listData: {},
				isShow:false
			}
		},
		onLoad() {
			//console.info("当前登录状态:" + this.$store.state.isLogin);
			//console.info(this);
			this.$util.persistLogin(this);
			let type=this.$util.getQuery("type")-0;
			if(type==1){
				uni.setNavigationBarTitle({
					title:'安全检查明细'
				});
			}
			else{
				uni.setNavigationBarTitle({
					title:'质量检查明细'
				});
			}
		},
		created: function() {
			this.getDetail(this.$util.getQuery("id"));
		},
		mounted:function(){
			
		},
		methods: {
			getDetail(id) {
				let that = this;
				GetSafeQualityCheckDTO(id).then((res) => {
					console.info('GetSafeQualityCheckDTO',res);
					
					if(res.entity.status==0){
						that.isShow=true;
					}
					else{
						that.isShow=true;
					}
					that.listData=res;
					 
					//console.info(that.listData);
				});
			},
			 
			 modify: function() { //跳转到修改页面
			 	let id = this.$util.getQuery("id");
			 	uni.navigateTo({
			 		url: '/pages/template/SafeQualityCheckEdit/SafeQualityCheckEdit?id=' + id
			 	});
			 }
		}
	}
</script>

<style>
  /deep/ .uni-section__content-title{
	  font-size:15px;
	  font-weight: 600;
  }
  
 /deep/ .uni-list-item{
	  background-color: #f8f8f8;
  }
  .slot-box{
	  background-color: #fff;
	  padding: 5px 8px;
  }
</style>
