<template>
   <div class="flex">
     <validator name='v'>
       <ul class="nav nav-tabs">
         <p class="bg-info text-center" style="padding: 8px;">公司抬头</p>
       </ul>
       <div class="form-horizontal select-overspread container-fluid auto" style="margin-top:20px;flex: 1;">
         <div class="row">
           <div class="col-sm-6 form-group" :class="[$v.f_saler_name.required ? 'has-error' : '']">
             <label for:f_saler_name class="font_normal_body">销货方名称</label>
             <input type="text" v-model="model.f_saler_name" v-validate:f_saler_name='{required: true }'
                    class="input_search" style="width:60%" placeholder="销货方名称" >
           </div>
           <div class="col-sm-6 form-group" :class="[$v.f_taxpayer_number.required ? 'has-error' : '']">
             <label class="font_normal_body">纳税人识别号</label>
             <input type="text" v-model="model.f_taxpayer_number" v-validate:f_taxpayer_number='{required: true }'
                    class="input_search" style="width:60%" placeholder="纳税人识别号">
           </div>
           <div class="col-sm-6 form-group" :class="[$v.f_saler_address_phone.required ? 'has-error' : '']">
             <label class="font_normal_body">地 址 电 话</label>
             <input type="text" v-model="model.f_saler_address_phone" v-validate:f_saler_address_phone='{required: true }'
                    class="input_search" style="width:60%" placeholder="地址电话">
           </div>
           <div class="col-sm-6 form-group" :class="[$v.f_bank_account.required ? 'has-error' : '']">
             <label class="font_normal_body">&ensp;&ensp;银 行 账 号</label>
             <input type="text" v-model="model.f_bank_account" v-validate:f_bank_account='{required: true }'
                    class="input_search" style="width:60%" placeholder="银行账号">
           </div>
           <div class="col-sm-6 form-group" :class="[$v.f_kpr.required ? 'has-error' : '']">
             <label class="font_normal_body">开 &ensp;票 &ensp; 人</label>
             <input type="text" v-model="model.f_kpr" v-validate:f_kpr='{required: true }'
                    class="input_search" style="width:60%" placeholder="开票人">
           </div>
           <div class="col-sm-6 form-group" :class="[$v.f_fhr.required ? 'has-error' : '']">
             <label class="font_normal_body">&ensp;&ensp;复 &ensp;核 &ensp; 人</label>
             <input type="text" v-model="model.f_fhr" v-validate:f_fhr='{required: true }'
                    class="input_search" style="width:60%" placeholder="复核人">
           </div>
           <div class="col-sm-6 form-group" :class="[$v.f_skr.required ? 'has-error' : '']">
             <label class="font_normal_body">收 &ensp;款 &ensp; 人</label>
             <input type="text" v-model="model.f_skr" v-validate:f_skr='{required: true }'
                    class="input_search" style="width:60%" placeholder="收款人">
           </div>
         </div>
       </div>
       <div class="row">
         <div style="float:right;">
           <button @click="confirm()" class="btn button_search" style="width: 70px" :disabled='!$v.valid'>
             <span class="glyphicon glyphicon-floppy-disk"></span>保存
           </button>
           <button @click='close()' class="btn button_clear" style="width: 70px">
             <span class="glyphicon glyphicon-log-out"></span>清空
           </button>
         </div>
       </div>
     </validator>
   </div>
</template>

<script>

  export default {
    props: ['row'],
    name: 'CompanyTitleInput',
    data () {
      return {
        model: {}
      }
    },
    created () {
    },
    ready () {
      this.model = Object.assign({}, this.row)
    },
    methods: {
      close () {
        this.model = {}
        this.model.id = this.row.id
      },
      confirm () {
        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,
        this.$resetpost('rs/logic/saveCompanyTitle', this.model, {
          resolveMsg: '保存成功',
          rejectMsg: '保存失败'
        }).then((res) => {
          this.$dispatch('company-title-input-close')
        })
      },
    }
  }
</script>

<style lang="less">

</style>
