check.js 8.01 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 172 173 174 175 176 177 178 179 180 181 182
import moment from 'moment';

export default function () {
  return {
    "dialogData.pratyp": [
      { type: "string", required: true, message: "必输项" },
    ],
    "dialogData.rattyp": [],
    "dialogData.sigflg": [
      { type: "string", required: true, message: "必输项" },
    ],
    "dialogData.allowlistflg": [],
    "dialogData.mintim": [],
    "dialogData.maxtim": [],
    "dialogData.minappday": [],
    "dialogData.maxappday": [],
    "dialogData.maxlmtamt": [],
    "dialogData.sefhepappday": [
      // { type: "number", required: true, message: "必输项" },
      // { pattern: /(^0?[6-9]$)|(^1[0-9]$)|(^2[0-2]$)/, message: "请输入6到22的数字" },
      {
        validator: (rule, value, callback) => {
          if(!value){
            return callback(new Error('必输项'))
          }
          //pratyp = 0总行全局参数
          if (this.model.dialogData.pratyp == "0" && this.model.dialogData.sefhepcur == 'USD') {
            if (Number(value) > Number(this.model.dialogData.maxappday) || Number(value) < Number(this.model.dialogData.minappday)) {
              return callback(new Error('提前申请时限范围为' + this.model.dialogData.minappday + '到' + this.model.dialogData.maxappday))
            }
          }
          //采用当前币种总行范围
          else {
            if (Number(value) > Number(this.model.dialogData.maxappday) || Number(value) < Number(this.model.CURLimitData.curappday)) {
              return callback(new Error('提前申请时限范围为' + this.model.CURLimitData.curappday + '到' + this.model.dialogData.maxappday))
            }
          }
          callback();
        },
        trigger: ['blur', 'change']
      },
    ],
    "dialogData.sefheptimfrm": [
      { type: "string", required: true, message: "必输项" },
      {
        validator: (rule, value, callback) => {
          if (moment.duration(value).as('seconds') > moment.duration(this.model.dialogData.sefheptimend).as('seconds')) {
            return callback(new Error('开始时间不得晚于截止时间!'))
          }
          var mintim;
          //总行各币种参数范围以美元最大最小范围为准
          if (this.model.dialogData.pratyp == "0") {
            mintim = this.model.dialogData.mintim;
          } else {
            //分行参数
            //未勾选白名单,以总行当前币种范围为限
            if (this.model.dialogData.allowlistflg != 'X') {
              mintim = this.model.CURLimitData.curtimfrm;
            } else {
              mintim = this.model.dialogData.mintim;
              if (moment.duration(value).as('seconds') < moment.duration(this.model.CURLimitData.curtimfrm).as('seconds')
                && Number(this.model.dialogData.sefheplmtamt) > Number(this.model.CURLimitData.curlmtamt)) {
                return callback(new Error('白名单客户,单笔限额已超出总行设置的单笔限额,交易开始时间不得小于于总行设置的时间范围'))
              }
            }
          }
          if (moment.duration(value).as('seconds') < moment.duration(mintim).as('seconds')) {
            return callback(new Error('最早开始时间为' + mintim))
          }
          callback();
        },
        trigger: ['blur', 'change']
      },
    ],
    "dialogData.sefheptimend": [
      { type: "string", required: true, message: "必输项" },
      {
        validator: (rule, value, callback) => {
          if (moment.duration(value).as('seconds') < moment.duration(this.model.dialogData.sefheptimfrm).as('seconds')) {
            return callback(new Error('截止时间不得早于开始时间!'))
          }
          var maxtim;
          //总行各币种参数范围以美元最大最小范围为准
          if (this.model.dialogData.pratyp == "0") {
            maxtim = this.model.dialogData.maxtim;
          } else {
            //分行参数
            //未勾选白名单,以总行当前币种范围为限
            if (this.model.dialogData.allowlistflg != 'X') {
              maxtim = this.model.CURLimitData.curtimend;
            } else {
              maxtim = this.model.dialogData.maxtim;
              if (moment.duration(value).as('seconds') > moment.duration(this.model.CURLimitData.curtimend).as('seconds')
                && Number(this.model.dialogData.sefheplmtamt) > Number(this.model.CURLimitData.curlmtamt)) {
                return callback(new Error('白名单客户,单笔限额已超出总行设置的单笔限额,交易截止时间不得大于总行设置的时间范围'))
              }
            }
          }
          if (moment.duration(value).as('seconds') > moment.duration(maxtim).as('seconds')) {
            return callback(new Error('最晚截止时间为' + maxtim))
          }
          callback();
        },
        trigger: ['blur', 'change']
      },
    ],
    "dialogData.sefheplmtamt": [
      //{ type: "number", required: true, message: "必输项" },
      {
        validator: (rule, value, callback) => {
          if(!value){
            return callback(new Error('必输项'))
          }
          //pratyp = 0总行全局参数
          if (this.model.dialogData.pratyp == "0") {
            if (Number(value) > Number(this.model.dialogData.maxlmtamt)) {
              return callback(new Error('单笔限额必须小于等于总行设置的最大值' + this.model.dialogData.maxlmtamt))
            }
          } else {
            //未勾选白名单
            if (this.model.dialogData.allowlistflg != 'X') {
              if (Number(value) > Number(this.model.CURLimitData.curlmtamt)) {
                return callback(new Error('非白名单客户,单笔限额必须小于等于总行设置的单笔限额' + this.model.CURLimitData.curlmtamt))
              }
            } else {
              //勾选白名单单笔限额和时间范围只能一个超出本币种范围
              if (Number(value) > Number(this.model.CURLimitData.curlmtamt)
                && (moment.duration(this.model.dialogData.sefheptimfrm).as('seconds') > moment.duration(this.model.CURLimitData.curtimfrm).as('seconds')
                  || moment.duration(this.model.dialogData.sefheptimend).as('seconds') > moment.duration(this.model.CURLimitData.curtimend).as('seconds'))) {
                return callback(new Error('白名单客户,交易起、止时间已超出总行设置的时间范围,单笔限额必须小于等于总行设置的单笔限额'))
              }
              if (Number(value) > Number(this.model.dialogData.maxlmtamt)) {
                return callback(new Error('白名单客户,单笔限额必须小于等于总行设置的最大值' + this.model.dialogData.maxlmtamt))
              }
            }
          }
          callback();
        },
        trigger: ['blur', 'change']
      },
    ],
    "dialogData.sefhepdatfrm": [
      //{ type: "string", required: true, message: "必输项" },
      {
        validator: (rule, value, callback) => {
          if(this.model.dialogData.sefheptyp!=""&&!value){
            return callback(new Error('必输项'))
          }
          callback();
        },
        trigger: ['blur', 'change']
      },
    ],
    "dialogData.sefhepdatend": [
      //{ type: "string", required: true, message: "必输项" },
      {
        validator: (rule, value, callback) => {
          if(this.model.dialogData.sefheptyp!=""&&!value){
            return callback(new Error('必输项'))
          }
          callback();
        },
        trigger: ['blur', 'change']
      },
    ],
    "dialogData.sefhepcur": [{ type: "string", required: true, message: "必输项" },],
    "dialogData.sefheptyp": [{ type: "string", required: false, message: "必输项" },],
    "dialogData.sefheprat": [
      //{ type: "string", required: true, message: "必输项" },
      {
        validator: (rule, value, callback) => {
          if (this.model.dialogData.sefheptyp!=''&&!this.model.dialogData.sefheprat) {
            return callback(new Error('必输项'))
          }
          callback();
        },
        trigger: ['blur', 'change']
      }
    ],
    "sefgrp.apl.pts.cnnam": []
  }
}