index.js 1.24 KB
import {getDectyp, init, resolveResponse, save} from "../../../../../../service/business/rmb";
import Utils from "../../../../../../utils";
import operationFunc from "../../../../../../mixin/operationFunc";

export default {
    methods: {
        saveTcp() {
            this.$refs['modelForm'].validate(async (validStatic) => {
                if (validStatic) {
                    save('rmb2135', this.model).then(response => {
                        resolveResponse.bind(this)(response);
                    });
                } else {
                    // 前端校验失败
                    this.$notify({
                        title: '失败',
                        message: '校验失败',
                        type: 'error',
                    });
                    operationFunc.methods.showFrontendErrors.call(this);
                }
            })
        },

        init(transName, pblInr) {
            this.model.pblmod.dectyp = getDectyp(transName);
            this.model.pblmod.wrkpbl.inr = pblInr;
            init('rmb2135', this.model).then(response => {
                if (response.respCode === SUCCESS) {
                    Utils.copyValueFromVoData(this.model, response.data);
                }
            })
        },
    }
}