check.js 3.19 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
export default {

  data() {
    return {
      rules: {
        "fremsg.prttitle": [
          { type: "string", required: false, message: "必输项" },
          { max: 35, message: "长度不能超过35" }
        ],
        "fremsg.sndmt": [
          { type: "string", required: true, message: "必输项" },
          { max: 3, message: "长度不能超过3" }
        ],
        "fremsg.msgrol": [
          { type: "string", required: true, message: "必输项" },
          { max: 3, message: "长度不能超过3" }
        ],
        "fremsg.tag22d": [
          { type: "string", required: true, message: "必输项" },
          { max: 4, message: "长度不能超过4" }
        ],
        "fremsg.tag23h": [
          { type: "string", required: true, message: "必输项" },
          { max: 8, message: "长度不能超过8" }
        ],
        "fremsg.tag45d": [
          { type: "string", required: true, message: "必输项" },
        ],
        "swiadd.amestatxt": [
          { type: "string", required: true, message: "必输项" },
        ],
        "fremsg.issrol": [
          { type: "string", required: true, message: "必输项" },
          { max: 16, message: "长度不能超过16" }
				],
				"fremsg.det": [
					{required: true, message: "必输项"},
				],
				"fremsg.tag77a": [
					{max: 35, message: "长度不能超过35"},
				],
				"swiadd.amenbr": [
					{required: true, message: "必输项"},
					{pattern:/^[0-9]*$/,message:"请输入正整数"}
				],

        "fremsg.relmt": [
          {
            validator: (rule, value, callback) => {
              let list = ['92', '95', '96']
              if (list.includes(this.model.fremsg.sndmt) && !this.model.fremsg.relmt) {
                callback(new Error('必输项'))
              } else {
                callback()
              }
            },
            trigger: ['change', 'blur']
          }
        ],
        "fremsg.reldat": [
          {
            validator: (rule, value, callback) => {
              let list = ['92', '95', '96', '30']
              if (list.includes(this.model.fremsg.sndmt) && !this.model.fremsg.reldat) {
                callback(new Error('必输项'))
              } else {
                callback()
              }
            },
            trigger: ['change', 'blur']
          }
        ],
        "fremsg.fulmt": [
          {
            validator: (rule, value, callback) => {
              let list = ['59', '99']
              if (list.includes(this.model.fremsg.sndmt) && !this.model.fremsg.fulmt) {
                callback(new Error('必输项'))
              } else {
                callback()
              }
            },
            trigger: ['change', 'blur']
          }
        ],
        "fremsg.ccrol": [
          {
            validator: (rule, value, callback) => {
              if (this.model.fremsg.ccrol && this.model.fremsg.ccrol !="OTH") {
                if(this.model.fremsg.ccrol == this.model.fremsg.msgrol){
                  callback(new Error('You cannot send a CC copy to the same party as the message itself'))
                }
              } 
                callback()
            },
            trigger: ['change', 'blur']
          }
        ],
      }
    }
  }
}