<template>
  <div>
    <el-dialog custom-class="shakeDialog" :title="this.form.patentNo+'标注'" v-draggable :visible.sync="visible" width="400px" 
    :before-close="handleClose" :modal="false" :close-on-click-modal="false" :modal-append-to-body="false">
        <myRichText type="textarea" v-model="form.markNoteText" placeholder="请输入标注内容"></myRichText>
        <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" :loading="loading" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    projectId:{

    },
    retrieveRecordId:{}
  },
  data() {
    return {
        visible:false,
        loading:false,
        form:{}
    };
  },
  watch: {},
  computed: {},
  created() {},
  mounted() {},
  methods: {
    open(form){
        this.form = {
          ...form
        }
        this.visible = true
    },
    handleClose(){
        this.visible = false
    },
    submit(){
      if(this.form.markNoteText.trim() == ''){
        this.$message.error('请输入标注内容')
        return
      }
      var params = {
        projectId:this.projectId,
        retrieveRecordId:this.retrieveRecordId,
        ...this.form
      }
      this.loading = true
      this.$api.editNoveltyMark(params).then(response=>{
        if(response.code == 200){
          var data = {
            ...params,
            id:response.data
          }
          this.loading = false
          this.$emit('saveRemark',data)
          this.handleClose()
        }
      }).catch(error=>{
        this.loading = false
      })
      
    },
  },
};
</script>
<style lang="scss" scoped>
</style>