<template>
    <div class="wrap">
        <van-sticky offset-top="0">
            <LHeader :text="text"></LHeader>
        </van-sticky>
        <div class="con-list">
            <van-pull-refresh @refresh="onRefresh" v-model="refreshing">
                <van-list finished-text="没有更多了" @load="onLoad()">
                    <van-cell v-for="(child) in group" :key="child.id" :title="child.applyTime" :value="child.reason"
                        label="" @click="() => $router.push({
                            name: 'patrolDetail',
                            query: {
                                id: child.id
                            }
                        })" />
                </van-list>
            </van-pull-refresh>
        </div>
        <div class="accident-icon" @click="handadd">
            <img src="@/assets/accidentIcon/add.svg" alt="" width="100%" />
        </div>
    </div>
</template>

<script type="text/ecmascript-6">
import LHeader from "@/components/header.vue";
import { getFun, postFun } from "@/service/table.js";
export default {
    name: 'patrolApprove', //巡查审批
    components: {
        LHeader,
    },
    props: {

    },
    data() {
        return {
            text: '申请记录',
            group: [],
            pages: {
                current: 1
            },
            refreshing: false
        }
    },
    computed: {

    },
    watch: {

    },
    created() {

    },
    mounted() {
        this.getData()
    },
    methods: {
        onLoad() {
            return false
        },
        handadd() {
            this.$router.push({
                name: 'patrolCreate'
            })
        },
        onRefresh() {
            this.pages.current = 1;
            this.group = []
            this.getData()
        },
        getData() {
            let userInfoData = JSON.parse(localStorage.getItem('LocalUserInfo'))
            getFun("risk/currentRiskHoliday/list", { ...this.pages, userId: userInfoData.userId }).then(res => {
                this.group = this.group.concat(res.rows);
                this.refreshing = false;
            })
        }
    },
}
</script>

<style scoped lang='less'>
.wrap {
    height: 100vh;
    width: 100vw;
}

.accident-icon {
    width: 60px;
    position: fixed;
    right: 5%;
    top: 80%;
}

.con-list {
    background-color: #f0f1f5;
    // padding: 0.2rem 0.4rem;
    height: calc(100vh - 1.5rem);

    .van-pull-refresh {
        height: 100%;
    }

    .van-cell-group--inset {
        margin: 0;
        margin-bottom: 0.26667rem;
        padding: 0.25rem;
        font-size: 0.4rem;
        position: relative;
        border-radius: 10px;
        box-shadow: 0px 0px 10px 2px #f3f3f3;
        margin: 0 auto 0.4rem;

        &>.van-row {
            font-size: 0.4rem;
            line-height: 0.8rem;
            margin-bottom: 0;
            padding: 0 0.2rem;

            .con_right {
                display: flex;
                justify-content: flex-end;
                color: #05a7f0;
            }
        }
    }
}
</style>
