<template>
    <div class="responseDialog">
      <el-dialog title="重命名会话" :visible.sync="showDialog" width="500px" :close-on-click-modal="false"  :before-close="handleClose" append-to-body>
        
        <div>
            <p>会话名称</p>
            <el-input v-model="form.conversationName" placeholder="请输入会话名称"></el-input>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="handleClose">取 消</el-button>
          <el-button type="primary" @click="updateConfessionSession" >确 定</el-button>
        </span>
      </el-dialog>
    </div>
</template>
  
<script>
  export default {
    props:{},
    data() {
      return {
        showDialog:false,
        form:{}
      }
    },
    watch: {
    },
    mounted() {
  
    },
    methods: {
        open(row){
            this.form = JSON.parse(JSON.stringify(row))
            this.showDialog = true
        },
        handleClose(){
            this.showDialog = false
        },
        //更新技术交底书会话记录
        updateConfessionSession(){
            var params = {
                confessionSessionId:this.form.id,
                inventionPoint:this.form.inventionPoint,
                conversationName:this.form.conversationName
            }
            this.$api.updateConfessionSession(params).then(response=>{
                if(response.code == 200){
                    this.$emit('rename',this.form)
                    this.handleClose()
                }
            }).catch(error=>{
                this.$message.error('更新失败')
            })
        },
    },
  }
</script>
  
<style lang="scss">
  .responseDialog{
    .el-dialog__body{
      padding-bottom: 0px;
    }
  }
</style>