check.js 6.71 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
import moment from 'moment';
import RmbbopCheck from "../../../../components/business/rmb/rmbbop/model/check";

export default function () {
    return {
        ...new RmbbopCheck(this).check,
        "swiadd.amedat": [
            {type: "string", required: true, message: "输入正确的日期"},
            {
                validator: (rule, value, callback) => {
                    if (moment(value).diff(moment((new Date()).Format("yyyy-MM-dd")), 'days') != 0) {
                        callback(new Error('修改日期必须为当日'));
                    }
                    //校验通过
                    callback();

                }, trigger: ['blur', 'change']
            }
        ],


        "swiadd.newamt": [
            {
                validator: (rule, value, callback) => {
                    if (value < 0) {
                        callback(new Error('不能是负数'))
                    }
                    callback()
                },
                trigger: 'change'
            }
        ],
        // "nitamep.plateflg": [
        // 	{
        // 		validator: (rule, value, callback) => {
        // 			if ( value=="" && this.model.nitamep.prtflg=="") {
        // 				callback(new Error('至少选一项!'))
        // 			}
        // 			callback()
        // 		},
        // 		trigger: 'change'
        // 	}
        // ],
        // "nitamep.prtflg": [
        //   {
        //     validator: (rule, value, callback) => {
        //       if ( value=="" && this.model.nitamep.plateflg=="") {
        //         callback(new Error('至少选一项!'))
        //       }
        //       callback()
        //     },
        //     trigger: 'change'
        //   }
        // ],
        "nitamep.amenbr": [
            {required: true, message: "必输项"},
        ],

        "swiadd.newexpdat": [
            {required: false, message: "输入正确的日期"},
            {
                validator: (rule, value, callback) => {
                    if ((value != "" && value != null) && moment(value).diff(moment(this.model.swiadd.amedat), 'days') < 0) {
                        callback(new Error('新到期日期不得小于当天日期!'))
                    }
                    if ((value != "" && value != null) && (this.model.swiadd.newliadat == null || this.model.swiadd.newliadat == "") && this.model.swiadd.newliaflg == "" && (this.model.oldnidgrp.rec.liadat != "" && this.model.oldnidgrp.rec.liadat != null)) {
                        if (moment(value).diff(moment(this.model.oldnidgrp.rec.liadat), 'days') > 0) {
                            callback(new Error('保函有效期不允许大于反担保原有效期!'))
                        }
                    }
                    if ((value != "" && value != null) && (this.model.swiadd.newliadat != "" && this.model.swiadd.newliadat != null)) {
                        if (moment(value).diff(moment(this.model.swiadd.newliadat), 'days') > 0) {
                            callback(new Error('保函有效期不允许大于反担保有效期!'))
                        }
                    }
                    callback()
                },
                trigger: ['change', 'blur']
            }
        ],

        "swiadd.newliadat": [
            {required: false, message: "输入正确的日期"},
            {
                validator: (rule, value, callback) => {
                    if ((value != "" && value != null) && moment(value).diff(moment(this.model.swiadd.amedat), 'days') < 0) {
                        callback(new Error('新到期日期不得小于当天日期!'))
                    }
                    if ((value != "" && value != null) && (this.model.swiadd.newexpdat != "" && this.model.swiadd.newexpdat != null)) {
                        if (moment(value).diff(moment(this.model.swiadd.newexpdat), 'days') < 0) {
                            callback(new Error('反担保有效期不允许小于保函有效期!'))
                        }
                    }
                    callback()
                },
                trigger: ['change', 'blur']
            }
        ],


        "addbcb.gitamecho": [
            {required: true, message: "必输项"}
        ],
        "addbcb.bccls4": [
            {required: true, message: "必输项"}
        ],

        "nidgrp.rec.iscrotra": [
            {
                type: "string", validator: (rule, value, callback) => {
                    if (this.model.nidgrp.rec.hndtyp == 'OT' && !value) {
                        callback(new Error('必输项'))
                    } else {
                        callback()
                    }
                }, trigger: ['blur', 'change']
            },
        ],
        "nidgrp.rec.projnam": [
            {type: "string", required: true, message: "必输项"},
            {max: 100, message: "长度不能超过100"}
        ],
        "nidgrp.rec.guatyp": [
            {type: "string", required: true, message: "必输项"},
        ],
        "nidgrp.rec.countrycod": [
            {type: "string", required: true, message: "必输项", trigger: 'change'}
        ],

        "nitp.wzhflg":[
            { validator: (rule, value, callback) => {
            if (this.model.nitp.wzhflgVsb == 'Y' && !value) {
                callback(new Error('必输项'))
            } else {
                callback()
            }
            }, trigger: ['blur', 'change']}
        ],

                "nidgrp.blk.gidtxt":[
                    {
                        validator: (rule, value, callback)=> {
                            if(this.model.nitamep.prtflg=='X'){
                                if(this.model.nitp.wzhflg =='Y' && value && value.indexOf("银行签章")<0 ){
                                    callback(new Error("请添加'银行签章'关键字,以在凭证无纸化系统盖章使用"));
                                    return
                                }
                            }
                            callback()
                        },
                        trigger: ['change', 'blur']
                    },
                ],
                "swiadd.ameblk":[
                    {
                        validator: (rule, value, callback)=> {
                            if(this.model.nitamep.plateflg=='X'){
                                if(this.model.nitp.wzhflg =='Y' && value && value.indexOf("银行签章")<0 ){
                                    callback(new Error("请添加'银行签章'关键字,以在凭证无纸化系统盖章使用"));
                                    return
                                }
                            }
                            callback()
                        },
                        trigger: ['change', 'blur']
                    },
                ],

    }
}