<template>
    <div>
        <LHeader :text="text"></LHeader>
        <van-form @submit="onSubmit" :scroll-to-error="true" :show-error="false" validate-trigger="onSubmit">
            <div class="title">
                <img src="@/assets/accidentIcon/bookmark.svg" alt="" class="title-img" />
                基本信息
            </div>
            <div>
                <van-field label="项目名称">
                    <template #input>
                        <van-field readonly v-model="form.projectName" label="" autosize placeholder="请输入"
                            style="padding: 0" />
                    </template>
                </van-field>
                <van-field label="风险因素">
                    <template #input>
                        <van-field readonly v-model="form.factor" label="" autosize placeholder="请输入" style="padding: 0" />
                    </template>
                </van-field>
                <van-field label="风险类型">
                    <template #input>
                        <van-field readonly v-model="form.type" label="" autosize placeholder="请输入" style="padding: 0" />
                    </template>
                </van-field>
                <van-field label="风险等级">
                    <template #input>
                        <van-field readonly v-model="form.level" label="" autosize placeholder="请输入" style="padding: 0" />
                    </template>
                </van-field>
                <van-field label="管控措施">
                    <template #input>
                        <van-field readonly v-model="form.measuresProject" label="" autosize placeholder="请输入"
                            style="padding: 0" />
                    </template>
                </van-field>
                <van-field label="岗位">
                    <template #input>
                        <van-field readonly v-model="form.riskPostName" label="" autosize placeholder="请输入"
                            style="padding: 0" />
                    </template>
                </van-field>
                <van-field label="巡查类型">
                    <template #input>
                        <van-field readonly :value="patrolTypeList[form.patrolType]" label="" autosize placeholder="请输入"
                            style="padding: 0" />
                    </template>
                </van-field>
            </div>
            <div class="title" v-if="form.exceptStatus == 1">
                <img src="@/assets/accidentIcon/bookmark.svg" alt="" class="title-img" />
                巡查地点
            </div>
            <van-field label="巡查地点">
                <template #input>
                    <van-field v-model="form.currentailAbnormal.riskLocation" name="abnormalDesc" label="" autosize
                        placeholder="请输入" style="padding: 0" />
                </template>
            </van-field>

            <div class="list" v-if="form.exceptStatus == 1">
                <div class="title">
                    <img src="@/assets/accidentIcon/bookmark.svg" alt="" class="title-img" />
                    异常上报
                </div>
                <van-field name="hdPicture1" label="异常照片">
                    <template #input>
                        <div>
                            <img v-for="item in form.currentailAbnormal.abnormalPics" :src="item.filePath"
                                :key="item.fileId" alt="">
                        </div>
                    </template>
                </van-field>
                <van-field label="异常说明">
                    <template #input>
                        <van-field readonly v-model="form.currentailAbnormal.abnormalDesc" name="abnormalDesc" label=""
                            type="textarea" rows="3" autosize placeholder="请输入" style="padding-left: 0; padding-top: 0" />
                    </template>
                </van-field>
                <van-field readonly v-model="form.currentailAbnormal.assessmentLevel" name="assessmentLevel" label="风险等级"
                    placeholder="请选择" @click="seletGrade" />
            </div>
        </van-form>
    </div>
</template>

<script>
import LHeader from "@/components/header.vue";
import { getFun, postFun } from "@/service/table.js";
export default {
    name: "logDetail",
    components: {
        LHeader,
    },
    data() {
        return {
            form: {
            },
            text: "巡查详情",
            id: '',
            patrolTypeList: ['日查', '周查', '月查', '年查'],
        };
    },
    mounted() {
        if (!this.$route.query.id) {
            this.$router.go(-1)
        }
        this.id = this.$route.query.id;
        this.getData()
    },
    methods: {
        getData() {
            getFun('/risk/riskUserPatrol/patrolInfoDetail/' + this.id).then(res => {
                this.form = res.data
            })
        }
    },
};
</script>
<style lang="less" scoped>
.title {
    height: 1rem;
    font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
    font-weight: 700;
    line-height: 1rem;

    .title-img {
        position: relative;
        top: 32%;
        transform: translateY(-50%)
    }
}

.content {
    background: #fff;
    padding: 14px 20px;
    line-height: 21px;
    font-size: 14px;
}

.content-upload {

    width: 2.13333rem;
    height: 2.13333rem;
    background: #f7f8fa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

}

/* @import url(); 引入css类 */
.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;
        }

        .van-overlay {
            position: absolute;

            .wrapper {
                display: flex;
                align-items: center;
                justify-content: space-evenly;
                height: 100%;
            }
        }
    }
}

.dialogContain {
    width: 100%;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
}
</style>
