<!--
 * @Title: 
 * @Description: 巡检参数配置
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
    <div>
        <el-row>
            <el-col :span="24">
                <basic-container>
                    <label style="color: gray;font-size: 0.8rem;">备注：汛期设备巡检填报年份默认为本年度，填报有效时间段包括开始日期，不包括结束日期</label>
                </basic-container>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="24">
                <basic-container>
                    <avue-form :option="inspectionPlanOption" v-model="inspectionPlanForm" @submit="submitInspectionPlan" />
                </basic-container>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import { getDetail, submit } from "@/api/business/inspection/plan.js";

export default {
    components: {

    },
    props: {

    },
    name: 'projectPlan',
    data() {
        return {
            inspectionPlanForm: {

            },
            inspectionPlanOption: {
                labelWidth: 180,
                emptyBtn: false,
                column: [
                    {
                        label: "汛前巡检开始日期",
                        prop: "beforeRainSeasonStartTime",
                        span: 24,
                        type: "date",
                        rules: [{
                            required: true,
                        }],
                        format: 'yyyy年MM月dd日',
                        valueFormat: 'yyyy-MM-dd',
                    },
                    {
                        label: "汛前巡检结束日期",
                        prop: "beforeRainSeasonEndTime",
                        span: 24,
                        type: "date",
                        rules: [{
                            required: true,
                        }],
                        format: 'yyyy年MM月dd日',
                        valueFormat: 'yyyy-MM-dd',
                    },
                    {
                        label: "第1次汛中巡检开始日期",
                        prop: "rainSeasonFirstStartTime",
                        span: 24,
                        type: "date",
                        rules: [{
                            required: true,
                        }],
                        format: 'yyyy年MM月dd日',
                        valueFormat: 'yyyy-MM-dd',
                    },
                    {
                        label: "第1次汛中巡检结束日期",
                        prop: "rainSeasonFirstEndTime",
                        span: 24,
                        type: "date",
                        rules: [{
                            required: true,
                        }],
                        format: 'yyyy年MM月dd日',
                        valueFormat: 'yyyy-MM-dd',
                    },
                    {
                        label: "第2次汛中巡检开始日期",
                        prop: "rainSeasonSecondStartTime",
                        span: 24,
                        type: "date",
                        rules: [{
                            required: true,
                        }],
                        format: 'yyyy年MM月dd日',
                        valueFormat: 'yyyy-MM-dd',
                    },
                    {
                        label: "第2次汛中巡检结束日期",
                        prop: "rainSeasonSecondEndTime",
                        span: 24,
                        type: "date",
                        rules: [{
                            required: true,
                        }],
                        format: 'yyyy年MM月dd日',
                        valueFormat: 'yyyy-MM-dd',
                    },
                ]
            },
            loading: true,
        };
    },
    computed: {
        // ...mapGetters(["userInfo", "permission"]),
        permissionList() {
            return {
                // addBtn: this.vaildData(this.permission.docCategory_add, false),
                // viewBtn: this.vaildData(this.permission.docCategory_view, false),
                // delBtn: this.vaildData(this.permission.docCategory_delete, false),
                // editBtn: this.vaildData(this.permission.docCategory_edit, false),
            };
        },
        ids() {
            let ids = [];
            return ids.join(",");
        },
    },
    mounted() {
    },
    created() {
        this.initData();
    },
    methods: {
        initData() {
            getDetail().then((res) => {
                this.inspectionPlanForm = res.data.data;
                console.log(JSON.stringify(this.inspectionPlanForm))
            });
        },
        submitInspectionPlan(from, done) {
            console.log(JSON.stringify(from))
            console.log(JSON.stringify(this.inspectionPlanForm))
            this.loading = true;
            submit(from).then((res) => {
                console.log(JSON.stringify(res))
                this.loading = false;
                this.$message({
                    type: "success",
                    message: "配置提交成功！",
                });
                done();
            }, (error) => {
                console.log(error)
                this.loading = false;
                done();
            });
        }
    },
};
</script>
