<!--
 * @Title: 
 * @Description:  当前年度巡检填报标签页
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
    <basic-container>
        <avue-tabs :option="option" @change="tabHandleClick">
        </avue-tabs>
        <span v-if="type.prop === 'beforeRain'">
            <inspectionreportdetail v-if="inspectionReportStatus.beforeRainSeasonStatus == 1"
                :id="inspectionReportStatus.beforeRainSeasonReportId" ref="beforerainreportdetailVue">
            </inspectionreportdetail>
            <div v-else style="color: red;font-size: 0.9rem;margin-top: 10px;">
                汛前巡检暂未填报
            </div>
        </span>
        <span v-else-if="type.prop === 'rainFirst'">
            <inspectionreportdetail v-if="inspectionReportStatus.rainSeasonFirstStatus == 1"
                :id="inspectionReportStatus.rainSeasonFirstReportId" ref="rainFirstReportVue">
            </inspectionreportdetail>
            <div v-else style="color: red;font-size: 0.9rem;margin-top: 10px;">
                汛中第一次巡检暂未填报
            </div>
        </span>
        <span v-else-if="type.prop === 'rainSecond'">
            <inspectionreportdetail v-if="inspectionReportStatus.rainSeasonSecondStatus == 1"
                :id="inspectionReportStatus.rainSeasonSecondReportId" ref="rainSecondReportVue">
            </inspectionreportdetail>
            <div v-else style="color: red;font-size: 0.9rem;margin-top: 10px;">
                汛中第二次巡检暂未填报
            </div>
        </span>
    </basic-container>
</template>

<script>

import {
    getInspectionReportStatus
} from "@/api/business/inspection/inspection.js";
import inspectionreportdetail from "../inspection/inspectionreportdetail.vue"
export default {
    components: {
        inspectionreportdetail
    },
    props: {
        rtuCode: {
            type: [String],
            required: true
        },
    },
    data() {
        return {
            inspectionReportStatus: {
                beforeRainSeasonReportId: '',
                rainSeasonFirstReportId: '',
                rainSeasonSecondReportId: '',
                beforeRainSeasonStatus: 0,
                rainSeasonFirstStatus: 0,
                rainSeasonSecondStatus: 0,
            },
            type: {},
            option: {
                column: [{
                    icon: 'el-icon-info',
                    label: '汛前巡检暂未填报',
                    prop: 'beforeRain',
                }, {
                    icon: 'el-icon-info',
                    label: '汛中第一次巡检',
                    prop: 'rainFirst',
                }, {
                    icon: 'el-icon-info',
                    label: '汛中第二次巡检',
                    prop: 'rainSecond',
                }]
            }
        }
    },
    created() {
        this.type = this.option.column[0];
    },
    methods: {
        init() {
            getInspectionReportStatus(this.rtuCode).then(res => {
                const data = res.data;
                if (data != null && data.success) {
                    if (data.data != null) {
                        console.log(JSON.stringify(data.data))
                        this.inspectionReportStatus = data.data;
                        if (this.inspectionReportStatus.rainSeasonSecondStatus == 1) {
                            this.type = this.option.column[2];
                        } else if (this.inspectionReportStatus.rainSeasonFirstStatus == 1) {
                            this.type = this.option.column[1];
                        } else if (this.inspectionReportStatus.beforeRainSeasonStatus == 1) {
                            this.type = this.option.column[0];
                        }
                    }
                }
            })
        },
        tabHandleClick(column) {
            this.type = column
        }
    }
}
</script>