<!---->
<template>
  <div>
    <xy-dialog :form="form" :rules="rules" ref="dialog" type="form" :is-show.sync="isShow" title="修改备注" @submit="submit">
      <template v-slot:comment>
        <div class="xy-table-item">
          <div class="xy-table-item-label">
            备注：
          </div>
          <div class="xy-table-item-content">
            <el-input type="textarea" :autosize="{minRows:2}" placeholder="请输入备注" clearable v-model="form.comment" style="width: 300px;"></el-input>
          </div>
        </div>
      </template>
    </xy-dialog>
  </div>
</template>

<script>
import {changeremark} from "@/api/finance"
import { Message } from 'element-ui'
export default {
  data() {
    return {
      isShow:false,
      id:'',
      form:{
        comment:''
      },
      comment:'',
      rules:{
      }
    }
  },
  methods: {
    submit(){
        changeremark({
          id:this.id,
          comment:this.form.comment
        }).then(res => {
          Message({
            type:'success',
            message:'修改成功'
          })
          this.isShow = false
          this.$emit('refresh')
        })
        return

    }
  },
  watch:{
    isShow(val){
      if(val){
        this.form.comment = this.comment
      }else{
        this.$refs['dialog'].reset()
        this.id=''
        this.comment = ''
      }
    }
  }

}
</script>

<style scoped lang="scss">
</style>
