<!--
 * @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;">备注：维修任务未确认超时默认为120分钟</label>
                </basic-container>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="24">
                <basic-container>
                    <avue-form :option="orderSettingOption" v-model="orderSettingForm" @submit="submitOrderSetting" />
                </basic-container>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import { getSettingDetail, submitSetting } from "@/api/business/order/order.js";

export default {
    components: {

    },
    props: {

    },
    name: 'checkordersetting',
    data() {
        return {
            orderSettingForm: {

            },
            orderSettingOption: {
                labelWidth: 180,
                emptyBtn: false,
                column: [
                    {
                        label: "维修任务确认超时设置",
                        prop: "orderComfireDelayTime",
                        span: 24,
                        rules: [{
                            required: true,
                        }],
                    },
                ]
            },
            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() {
            getSettingDetail().then((res) => {
                this.orderSettingForm = res.data.data;
                console.log(JSON.stringify(this.orderSettingForm))
            });
        },
        submitOrderSetting(from, done) {
            console.log(JSON.stringify(from))
            console.log(JSON.stringify(this.orderSettingForm))
            this.loading = true;
            submitSetting(from).then((res) => {
                console.log(JSON.stringify(res))
                this.loading = false;
                this.$message({
                    type: "success",
                    message: "配置提交成功！",
                });
                done();
                getSettingDetail().then((res) => {
                    this.orderSettingForm = res.data.data;
                });
            }, (error) => {
                console.log(error)
                this.loading = false;
                done();
            });
        }
    },
};
</script>
