import event from "../../tcp/event";
import operationFunc from "../../../../../../mixin/operationFunc";

export default {
    mixins: [event],
    methods: {
        save() {
            this.$refs['modelForm'].validate(async (validStatic) => {
                if (validStatic) {
                    if (this.model.pblmod.dectyp === "D") {
                        this.$confirm('系统将删除主信息,是否确认?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(() => {
                            this.saveTcp();
                        })
                    }
                } else {
                    // 前端校验失败
                    this.$notify({
                        title: '失败',
                        message: '校验失败',
                        type: 'error',
                    });
                    operationFunc.methods.showFrontendErrors.call(this);
                }
            })
        },
        // commitDel() {
        //     this.$refs['modelForm'].validate(async (validStatic) => {
        //         if (validStatic) {
        //             let data = {
        //                 inr: this.model.pblmod.pbl.inr,
        //                 tcpVo: this.model.recgrp.ads
        //             };
        //             Api.post('/report/rmbsel/del2135', data).then(res => {
        //                 if (res.respCode === SUCCESS) {
        //                     this.$notify({
        //                         title: "成功",
        //                         message: "成功",
        //                         type: "success",
        //                     });
        //                     this.$store.commit('delTagsArry', this.$route.path);
        //                     this.$router.back()
        //                 } else {
        //                     this.$notify({
        //                         title: "失败",
        //                         message: "失败",
        //                         type: "error",
        //                     });
        //                 }
        //             })
        //         } else {
        //             // 前端校验失败
        //             this.$notify({
        //                 title: '失败',
        //                 message: '校验失败',
        //                 type: 'error',
        //             });
        //         }
        //     })
        // }
    },
}