<template>
  <div class="auto">
    <validator name='v'>
      <form class="form-horizontal">
        <div class="row">
          <div class="col-sm-4 form-group">
            <label for="f_reason" class="font_normal_body">停用原因</label>
            <v-select v-model="model.f_reason" multiple
                      placeholder='停用原因'
                      :value.sync="model.f_reason"
                      :options='reason'
                      v-ref:reason
                      close-on-select ></v-select>
          </div>
        </div>
        <div class="row" style="margin-top:1px;" >
          <div class="col-sm-8 form-group">
            <label for="f_reason" class="font_normal_body">其他原因</label>
            <input class="input_search" style="width:80%" v-model="model.f_othereason"  placeholder="请填写原因"/>
          </div>
        </div>
      </form>
      <div style="text-align:right;">
        <button class="button_search button_spacing" @click="confirm()"  :disabled='!$v.valid'>确认</button>
        <button class="button_clear" @click="clean()" >取消</button>
      </div>
    </validator>
  </div>
  <upload :blodid="blodid" v-if="false" isremark="true" fusetype="表具停用"></upload>
</template>
<script>
  import LogicService from '../../plugins/LogicService'
  /**
   *综合业务
   表具停用组件
   */
  export default {
    title: '表具停用',
    props: ['row'],
    data () {
      return {
        blodid: '',
        showupload: true,
        model: {},
        reason: this.$appdata.getParam('停用原因'),
        select: {}
      }
    },
    ready () {
      this.blodid = this.row.f_userinfo_id
    },
    methods: {
      async confirm () {
        console.log('reasons', this.model.f_reason.length)
        this.model.c = ''
        for (var i = 0; i < this.model.f_reason.length; i++) {
          this.model.c += this.model.f_reason[i] + ','
          console.log(this.model.c)
        }
        console.log('看看原因有哪些', this.model, 'this.row', this.row)
        await LogicService.meterDisable(this.model, this.row)
        this.$dispatch('success')
      },
      clean () {
        this.$dispatch('refresh')
      }
    }
  }
</script>

<style>
</style>
