<template>
    <div>
        <LHeader :text="text"></LHeader>
        <!-- 内容列表 -->
        <!-- 接口对接4 START -->
        <div class="con-list">
            <van-cell-group inset>
                <van-row gutte>
                    <van-col span="24">项目名称: {{this.detailObj.projectName}}</van-col>
                </van-row>
                   <van-row gutte>
                    <van-col span="24">岗位: {{this.detailObj.postName}}</van-col>
                </van-row>
                <!-- <van-row gutte>
                    <van-col span="12">开始巡查时间: 09:30</van-col>
                    <van-col span="12" class="cont-end">结束巡查时间: 11:25</van-col>
                </van-row> -->
                <!-- <van-row gutter>
                    <van-col span="24">巡查时长: 2小时13分</van-col>
                </van-row> -->
                <van-row gutter>
                    <van-col span="24">巡查类型: {{this.detailObj.postType}}</van-col>
                </van-row>
                <van-row gutter>
                    <van-col span="24">巡查批次: {{this.detailObj.cycle|cycle}}</van-col>
                </van-row>
                <van-row gutter>
                    <van-col span="24">上报隐患: {{this.detailObj.hdReportCount}}</van-col>
                </van-row>
                <van-row gutter>
                    <van-col span="24">确认隐患: {{this.detailObj.hdConfirmCount}}</van-col>
                </van-row>
            </van-cell-group>

            <van-cell-group inset v-for="(item, index) in detailObj.list" :key="index">
                <van-row gutte>
                    <van-col span="12">危险级别：{{item.hdLev}}</van-col>
                    <van-col span="12" class="cont-end affirm-status">{{item.status|status}}</van-col>
                </van-row>
                <van-row gutter>
                    <van-col span="24">{{item.regulatoryBasis}}</van-col>
                </van-row>
             </van-cell-group>
        </div>
        <tab-bar :index="1"></tab-bar>
    </div>
</template>

<script>
let that;
import tabBar from "@/components/TabBar";
import LHeader from "@/components/header.vue";
import { getFun, postFun } from "@/service/table.js";

export default {
    name: "record-detail",
    components: {
        LHeader,
        tabBar
    },
    data() {
        return {
            text: "记录详情",
            messageList: [],
            isHaveNews: false,
            cycle:'',
            startTime:'',
            detailObj:{

            },
            contentList:[
                {
                    id: "1",
                    content: "日查"
                },
                {
                    id: "2",
                    content: "周查"
                },
                {
                    id: "3",
                    content: "半月查"
                },
                {
                    id: "4",
                    content: "月查"
                },
                {
                    id: "5",
                    content: "季查"
                },
                {
                    id: "6",
                    content: "半年查"
                },
                {
                    id: "7",
                    content: "年查"
                }
            ]
        };
    },
    beforeCreate () {
	    that = this
    },
    filters:{
        cycle(val){
            var value;
            that.contentList.forEach((i)=>{
                if(i.id==val){
                    value=i.content
                }
            })
            return value
        },
        status(val){
            if(val=='0'){
                return '已认定'
            }else if(val=='1'){
                return '已撤回'
            }else{
                return '未知'
            }
        }
    },
    mounted(){
        if(this.$route.query.cycle){
            this.cycle=this.$route.query.cycle
        }
        if(this.$route.query.startTime){
            this.startTime=this.$route.query.startTime
        }
        this.loading()
    },
    methods: {
        loading(){
            this.detailObj={}
            var obj={
                cycle:this.cycle,
                startTime:this.util.timestampToTime(this.startTime,'DT5',true)
            }
            getFun("patrol/details/list",obj).then((res) => {
                this.detailObj=res.data
            })
        }
    }
};
</script>
<style lang="less" scoped>
/* @import url(); 引入css类 */
#app {
    font-family: "";
    color: #2c3e50;
}
.con-list {
    padding: 0;
    background-color: #f0f1f5;
    .van-cell-group--inset {
        margin: 0;
        margin-bottom: 0.26667rem;
        padding: 0.25rem;
        font-size: 0.4rem;
        position: relative;
        border-radius: 4%;
        box-shadow: 0px 0px 10px 2px #f3f3f3;
        width: 90%;
        margin: 0.4rem auto;
        .van-row {
            font-size: 0.4rem;
            line-height: 0.8rem;
            margin-bottom: 0;
            .cont-end{
                display: flex;
                justify-content: flex-end;
            }
            .affirm-status{
                color: #008080;
            }
            .back-status{
                color: #f59a83;
            }
        }
    }
}
</style>
