<template>
  <div class="auto">
    <modal :show.sync="show"  v-ref:modal big backdrop="false">
      <header slot="modal-header" class="modal-header">
        <h3 style="color:black" class="modal-title">变更录入</h3>
      </header>
      <article slot="modal-body" style = "padding-bottom:0px;">
        <validator name='v'>
          <div class="" >
            <div class="col-sm-12" style= "margin-top: 10px " :class="[$v.f_change_name.required ? 'has-error' : 'has-success']">
              <label for="f_change_name" class=" col-sm-2 control-label">变更人:</label>
              <div class="col-sm-4">
                <input type="text" class="form-control" v-model="model.f_change_name"  v-validate:f_change_name='{required: true }' placeholder="变更人"/>
              </div>
            </div>
            <div class="col-sm-12" style="margin-top:10px;" :class="[$v.f_change_message.required ? 'has-error' : 'has-success']">
              <label for="f_change_message" class=" col-sm-2 control-label">变更内容:</label>
              <div class="col-sm-8" style = "margin-bottom:10px">
                <textarea class="form-control" v-model="model.f_change_message"  v-validate:f_change_message='{required: true }' placeholder="请填写内容"></textarea>
              </div>
            </div>
          </div>
        </validator>
      </article>
      <footer slot="modal-footer" class="modal-footer" style = "">
        <button type="button" class="btn btn-primary"  @click='confirm()' :disabled='!$v.valid'>提交</button>
        <button type="button" class="btn btn-default" @click='cancel()'>取消</button>
      </footer>
    </modal>
  </div>
</template>
<script>
export default {
  title: '',
  props: ['show'],
  data () {
    return {
      model: {
        f_change_name: '',
        f_change_message: ''
      }
    }
  },
  methods: {
    cancel  () {
      this.model = {}
      this.$emit('toggle')
    },
    confirm () {
      let param = {
        tablename: 't_changedeclare',
        parameters: this.model
      }
      this.$post('rs/logic/save', {data: param})
      .then(() => {
        this.model = {}
        this.$emit('toggle')
      })
    }
  }
}

</script>
<style >

</style>
