/**
* inflsb Check规则
*/
export default {
  data(){
    return {
      rules:{
        "limpan.gjownref": [
          { required: true, message: this.$t('bus.必输项') }
        ],
        "limpan.ptytyp": [
          { required: true, message: this.$t('bus.必输项') }
        ],
        "limpan.nonrevflg": [
          { required: true, message: this.$t('bus.必输项') }
        ],
        "limpan.branch": [
          {
            validator: (rule, value, callback) => {
              if (this.model.limpan.ptytyp=='1') {
                if (!this.model.limpan.branch) {
                  callback(new Error('必输项'))
                } else {
                  callback()
                }
              } else {
                callback()
              }
            },
            trigger: ['change', 'blur']
          }
        ],
        "limpan.extkey": [
          {
            validator: (rule, value, callback) => {
              if ((this.model.limpan.ptytyp == '1' && !this.model.limpan.extkey && !this.model.limpan.ownref) || (this.model.limpan.ptytyp == '2' && !this.model.limpan.extkey && !this.model.limpan.ownref && !this.model.limpan.swiftno)) {
                  callback(new Error('必输项'))
              } else {
                callback()
              }
            },
            trigger: ['change', 'blur']
          }
        ],
        "limpan.swiftno": [
          {
            validator: (rule, value, callback) => {
              if (this.model.limpan.ptytyp == '2' && !this.model.limpan.extkey && !this.model.limpan.ownref && !this.model.limpan.swiftno) {
                  callback(new Error('必输项'))
              } else {
                callback()
              }
            },
            trigger: ['change', 'blur']
          }
        ],
        "limpan.ownref": [
          {
            validator: (rule, value, callback) => {
              if (!!this.model.limpan.ptytyp  && !this.model.limpan.extkey && !this.model.limpan.ownref && !this.model.limpan.swiftno) {
                  callback(new Error('必输项'))
              } else {
                callback()
              }
            },
            trigger: ['change', 'blur']
          }
        ],
      }
    }
  }
}