<template>
<div>
  <el-form-item v-if="mty == 'mt752'" v-bind:error="tagValue[2].s1">
    <c-select size="small" v-model="tagValue[0].s1" placeholder="Further Identification" @change="handleChange" :disabled="pattern.tagFlag && pattern.tagFlag.indexOf('s1') !== -1">
      <el-option label="ACCEPT" value="ACCEPT"></el-option>
      <el-option label="DEBIT" value="DEBIT"></el-option>
      <el-option label="NEGOTIATE" value="NEGOTIATE"></el-option>
      <el-option label="REIMBURSE" value="REIMBURSE"></el-option>
      <el-option label="REMITTED" value="REMITTED"></el-option>
      <el-option label="SEE79Z" value="SEE79Z"></el-option>
    </c-select>
  </el-form-item>
  <el-form-item v-else-if="mty == 'mt760' || mty == 'mt767'" v-bind:error="tagValue[2].s1">
    <c-select size="small" v-model="tagValue[0].s1" placeholder="Further Identification" @change="handleChange" :disabled="pattern.tagFlag && pattern.tagFlag.indexOf('s1') !== -1">
      <el-option label="ISSUE" value="ISSUE"></el-option>
      <el-option label="REQUEST" value="REQUEST"></el-option>
    </c-select>
  </el-form-item>
  <el-form-item v-else-if="mty == 'mt605'" v-bind:error="tagValue[2].s1">
    <c-select size="small" v-model="tagValue[0].s1" placeholder="Further Identification" @change="handleChange" :disabled="pattern.tagFlag && pattern.tagFlag.indexOf('s1') !== -1">
      <el-option label="DELIVERY" value="DELIVERY"></el-option>
      <el-option label="TRANSFER" value="TRANSFER"></el-option>
    </c-select>
  </el-form-item>
  <el-form-item v-else v-bind:error="tagValue[2].s1">
    <c-input size="small" v-model="tagValue[0].s1" placeholder="Further Identification"  @blur="handleChange" :disabled="pattern.tagFlag && pattern.tagFlag.indexOf('s1') !== -1"></c-input>
  </el-form-item>
</div>
</template>
<script>
export default {
  props: {
    tag: {
      type: String,
      default: ''
    },
    pattern: {
      type: Object,
      default: () => {}
    },
    mty: {
      type: String,
      default: ''
    }
  },
  data: function () {
    return {
      tagValue: [{
        s1: ''
      },
      '',
      {
        s1: ''
      }],
    }
  },
  created: function () {
    if (this.pattern.tagValue == undefined || JSON.stringify(this.pattern.tagValue) == '[{},null]') {
      this.pattern.tagValue = this.tagValue
    } else {
      this.tagValue = this.pattern.tagValue
    }
  },
  methods: {
    handleChange: function () {
      // 触发校验
       let obj = this.pattern.tagValue[0]
      let mval = ''
      mval = obj.s1
      this.pattern.tagValue[1] = mval   
      this.$emit('validate')
    }
  }
}
</script>