import CfaecaCheck from '~/components/business/cfa/cfaeca/model/check.js';
import CfaeadCheck from '~/components/business/cfa/cfaead/model/check.js';
import CfaeafCheck from '~/components/business/cfa/cfaeaf/model/check.js';

export default class CfabopCheck {
    constructor(_this) {
        // 可以再当前方法中取_this,此_this即为根组件的this
        this.check = {
            ...new CfaecaCheck(_this).check,
            ...new CfaeadCheck(_this).check,
            ...new CfaeafCheck(_this).check,

            "cfabop.cfaeca.ownextkey": [
                {
                    validator: (rule, value, callback) => {
                        if (_this.model.cfabop.cfaeca.cfaflg === '1' || _this.model.cfabop.cfaeca.cfaflg === '2') {
                            if (value == null || value === '') {
                                callback(new Error('必输项'));
                            }
                        }
                        callback()
                    },
                    trigger: ['blur', 'change']
                }
            ],

            "cfabop.cfaead.ownextkey": [
                {
                    validator: (rule, value, callback) => {
                        if (_this.model.cfabop.cfaead.cfaflg === '1' || _this.model.cfabop.cfaead.cfaflg === '2') {
                            if (value == null || value === '') {
                                callback(new Error('必输项'));
                            }
                        }
                        callback()
                    },
                    trigger: ['blur', 'change']
                }
            ],

            "cfabop.cfaeaf.ownextkey": [
                {
                    validator: (rule, value, callback) => {
                        if (_this.model.cfabop.cfaeaf.cfaflg === '1' || _this.model.cfaeaf.cfaead.cfaflg === '2') {
                            if (value == null || value === '') {
                                callback(new Error('必输项'));
                            }
                        }
                        callback()
                    },
                    trigger: ['blur', 'change']
                }
            ],

        }
    }
}