Communication.vue 1.94 KB
//沟通

<template>
  <div>
    <allSimilarDialog
      :title="'沟通'"
      ref="allSimilarDialog"
      :nodeId="nodeId"
      :userSelectorIsSingle="userSelectorIsSingle"
      :taskId="taskId"
      :instId="instId"
      :noticeId="noticeId"
      @onClickRight="onClickRight"
    ></allSimilarDialog>
  </div>
</template>

<script>
  import matterButton from '@/mixins/matterButton.js'
  import { communicate } from '@/api/process'
  import allSimilarDialog from '@/views/matter/components/allSimilarDialog.vue'
  export default {
    name: 'Communication',
    mixins: [matterButton],
    components: { allSimilarDialog },
    props: {
      userSelectorIsSingle: {
        type: Boolean,
        default: false,
      },
      taskId: {
        type: String,
        default: '',
      },
      instId: {
        type: String,
        default: '',
      },
      nodeId: {
        type: String,
        default: '',
      },
      defId: {
        type: String,
        default: '',
      },
      noticeId: {
        type: String,
        default: '',
      },
    },
    data() {
      return {}
    },
    methods: {
      showDialog() {
        this.$refs.allSimilarDialog.showDialog()
      },

      onClickRight(val, cb) {
        let { userId, files, opinion } = val
        if (opinion.length > 500) {
          opinion = opinion.substring(0, 500)
        }
        const data = {
          files,
          userId,
          opinion,
          defId: this.defId,
          instId: this.instId,
          nodeId: this.nodeId,
          parentId: this.noticeId,
        }
        communicate(data, (res) => {
          if (res.state) {
            cb?.()
            this.$emit('closePop')
            this.$emit('submit-after')
            this.$toast.success(res.message)
          } else {
            this.$toast.fail(res.message)
          }
        })
      },
    },
  }
</script>

<style lang="scss" scoped>
  @import '@/styles/matterButton.scss';
</style>