check.js 2.9 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
import Rmb2101Check from "../../rmb2101/model/check";
import Rmb2103Check from "../../rmb2103/model/check";
import Rmb2106Check from "../../rmb2106/model/check";
import Rmb2107Check from "../../rmb2107/model/check";
import Rmb2108Check from "../../rmb2108/model/check";
import Rmb2111Check from "../../rmb2111/model/check";
import Rmb2112Check from "../../rmb2112/model/check";
import Rmb2122Check from "../../rmb2122/model/check";
import Rmb2123Check from "../../rmb2123/model/check";

export default class RmbbopCheck {
    constructor(_this) {
        this.check = {
            ...(_this.model.rmbbop.aloneflg === "2" ? {} : new Rmb2101Check(_this).check),
            ...(_this.model.rmbbop.aloneflg === "2" ? {} : new Rmb2103Check(_this).check),
            ...(_this.model.rmbbop.aloneflg === "2" ? {} : new Rmb2106Check(_this).check),
            ...(_this.model.rmbbop.aloneflg === "2" ? {} : new Rmb2107Check(_this).check),
            ...(_this.model.rmbbop.aloneflg === "2" ? {} : new Rmb2108Check(_this).check),
            ...(_this.model.rmbbop.aloneflg === "2" ? {} : new Rmb2111Check(_this).check),
            ...(_this.model.rmbbop.aloneflg === "2" ? {} : new Rmb2112Check(_this).check),
            ...(_this.model.rmbbop.aloneflg === "2" ? {} : new Rmb2122Check(_this).check),
            ...(_this.model.rmbbop.aloneflg === "2" ? {} : new Rmb2123Check(_this).check),
            "rmbbop.rmb2101.rmbflg": [
                {required: true, message: "必输项", trigger: 'blur'}
            ],
            "rmbbop.rmb2112.rmbflg": [
                {required: true, message: "必输项"}
            ],
            "rmbbop.rmb2111.rmbflg": [
                {required: true, message: "必输项", trigger: 'blur'}
            ],
            "rmbbop.rmb2107.rmbflg": [
                {required: true, message: "必输项", trigger: 'blur'}
            ],
            "rmbbop.rmb2103.rmbflg": [
                {required: true, message: "必输项", trigger: 'blur'}
            ],
            "rmbbop.rmb2106.rmbflg": [
                {required: true, message: "必输项", trigger: 'blur'}
            ],
            "rmbbop.rmb2108.rmbflg": [
                {required: true, message: "必输项"}
            ],
            "rmbbop.rmb2122.rmbflg": [
                {required: true, message: "必输项"}
            ],
            "rmbbop.rmb2123.rmbflg": [
                {required: true, message: "必输项"}
            ],
            "rmbbop.aloneflg": [
                {
                    validator: (rule, value, callback) => {
                        const rmbbop = _this.model.rmbbop;
                        const hasRmbbop = Object.values(rmbbop).find(value => value.rmbflg === '1');
                        if (hasRmbbop && !value) {
                            callback(new Error('必输项'));
                        }
                        callback();
                    }
                }
            ],
        }
    }
}