<template>
  <div class="auto">
      <validator name='m'>
        <form novalidate class="form-horizontal select-overspread">
          <div class="row" style="margin-top:10px;">
            <div class="col-sm-8">
              <label for="f_address" class="font_normal_body ">新卡号</label>
              <input class="input_search " style="width:80%"  v-model="model.f_card_id_new" placeholder='新卡号' :value="row.f_card_id_new" >
            </div>
            <div class="col-sm-4">
              <label for="f_idnumber" class="font_normal_body ">旧卡号</label>
              <input class="input_search " style="width:60%"  v-model="model.f_card_id" placeholder='旧卡号' :value="row.f_card_id" readonly>
            </div>

          </div>
          <div class="row" style="margin-top:10px;">
            <div class="col-sm-8">
              <label for="f_user_phone" class="font_normal_body ">备&emsp;&emsp;注</label>
              <input class="input_search " style="width:80%"  v-model="model.f_nfc_comments" placeholder='备注' :value="row.f_nfc_comments">
            </div>
          </div>
        </form>
        <div style="text-align:right;">
          <button class="button_search btn-gn" @click="confirm()">确认</button>
          <button class="button_clear btn-gn" @click="clean()">取消</button>
        </div>
      </validator>
  </div>
</template>
<script>
  export default {
    title: 'NFC卡置换',
    data () {
      return {
        model: {
          f_card_id_new: '',
          f_card_id: '',
          f_user_id: '',
          f_userfiles_id: '',
          f_nfc_comments: '',
          f_user_name: '',
          f_filialeid: '',
          f_userinfo_id: ''
        }
      }
    },
    props: ['row'],
    ready () {
      this.model.f_user_name = this.row.f_user_name
      this.model.f_card_id = this.row.f_card_id
      this.model.f_userfiles_id = this.row.f_userfiles_id
      this.model.f_filialeid = this.$login.f.orgid
      this.model.f_userinfo_id = this.row.f_userinfo_id
      this.model.f_user_id = this.row.f_user_id
    },
    methods: {
      async confirm () {
        if (this.model.f_card_id_new === '' || this.model.f_card_id_new === null) {
          this.$showAlert('请填写新卡号！！', 'warning', 2000)
          return
        }
        this.model.f_operator = this.$login.f.name
        this.model.f_operatorid = this.$login.f.id
        this.model.f_orgid = this.$login.f.orgid
        this.model.f_orgname = this.$login.f.orgs
        this.model.f_depid = this.$login.f.depids
        this.model.f_depname = this.$login.f.deps

        await this.$resetpost('rs/logic/fileNfcCardUpdate', this.model, {resolveMsg: '档案信息已完善成功', rejectMsg: '档案信息完善失败'})
        this.clean()
      },
      clean () {
        this.$info('取消操作')
        this.$dispatch('refresh', this.row)
      },

      printok () {
        this.$dispatch('success')
      }

    },
    computed: {
    }
  }
</script>

<style>
</style>
