<template>
  <div class="auto">
    <validator name='v'>
      <form novalidate class="form-horizontal select-overspread">
        <ul class="nav nav-tabs">
          <li class="active"><a href="#">{{title}}</a></li>
        </ul>
        <div class="form-group" style="margin-top: 20px">
            <label for="f_user_type" class="col-sm-2 control-label">内容</label>
            <div class="col-sm-8" id="f_change_message">
              <textarea class="col-sm-3 form-control" type="text" v-model="listinfo.f_change_message"  :disabled="title=='修改状态'"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label for="f_user_type" class="col-sm-2 control-label">模块名</label>
            <div class="col-sm-2" id="f_model_name">
              <input class="col-sm-3 form-control"  type="text" v-model="listinfo.f_model_name"
                     :disabled="title=='修改状态'" placeholder="模块名">
            </div>
            <label for="f_user_type" class="col-sm-2 control-label">登记人</label>
            <div class="col-sm-2" id="f_change_name">
              <input class="form-control"  type="text" v-model="listinfo.f_change_name"
                     :disabled="title=='修改状态'" placeholder="登记人">
            </div>
        </div>
        <div class="form-group">
            <label for="f_user_type" class="col-sm-2 control-label">开发人</label>
            <div class="col-sm-2" id="f_exploit_name">
              <input class="col-sm-3 form-control"  type="text" v-model="listinfo.f_exploit_name"
                     :disabled="title=='修改状态'" placeholder="开发人">
            </div>
            <label for="f_user_type" class="col-sm-2 control-label">测试人</label>
            <div class="col-sm-2" id="f_test_name">
              <input class="form-control"  type="text" v-model="listinfo.f_test_name"
                     :disabled="title=='修改状态'" placeholder="测试人">
            </div>
        </div>
        <div class="form-group" v-show="title=='修改状态'">
            <label for="f_user_type" class="col-sm-2 control-label">状态</label>
            <div class="col-sm-2" id="f_state">
              <v-select id="f_gasproperties"
                        v-model="listinfo.f_state"
                        placeholder='请选择'
                        :value.sync="listinfo.f_state"
                        :options='listState'
                        close-on-select>
              </v-select>
            </div>
        </div>
        <div class="form-group" v-show="title=='修改状态'">
          <label for="f_user_type" class="col-sm-2 control-label">备注</label>
          <div class="col-sm-8" id="f_comments">
            <textarea class="col-sm-3 form-control" type="text" v-model="listinfo.f_comments"></textarea>
          </div>
        </div>

        <div style="text-align:right;height:auto;margin-top:30px;margin-right:50px;">
          <button class="btn btn-success width-60" @click="confirm()" style="width:80px;margin-left:20px;" >保存</button>
        </div>
      </form>
    </validator>
  </div>
</template>
<script>
  export default {
    data () {
      return {
      }
    },
    props:{
      listinfo:{
        type: Object
      },
      title:{
        type:String
      }
    },
    methods:{
      confirm(){
        let data = Object.assign(this.listinfo,{f_edit_date: this.$login.toStandardTimeString(),f_state: this.listinfo.f_state[0]})
        this.$resetpost('rs/entity/t_changedeclare', data, {resolveMsg: '保存成功。', rejectMsg: '保存失败!!!'}).then((res) => {
            this.$dispatch('refresh')
          }
        )
      },
    },
    computed:{
      listState(){
        return [{label: '未测', value: '未测'},{label: '已测', value: '已测'},{label: '作废', value: '作废'}]
      }
    }
  }
</script>
