You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.4 KiB

  1. <template>
  2. <div>
  3. <v-card
  4. v-if="currentDoc"
  5. class="title mb-5"
  6. >
  7. <v-card-text class="title">
  8. {{ currentDoc.text }}
  9. </v-card-text>
  10. </v-card>
  11. <seq2seq-box
  12. v-if="currentDoc"
  13. :text="currentDoc.text"
  14. :annotations="currentDoc.annotations"
  15. :delete-annotation="_deleteAnnotation"
  16. :update-annotation="_updateAnnotation"
  17. :create-annotation="_createAnnotation"
  18. />
  19. </div>
  20. </template>
  21. <script>
  22. import { mapActions, mapGetters } from 'vuex'
  23. import Seq2seqBox from '~/components/organisms/Seq2seqBox'
  24. export default {
  25. components: {
  26. Seq2seqBox
  27. },
  28. computed: {
  29. ...mapGetters('documents', ['currentDoc'])
  30. },
  31. created() {
  32. this.getDocumentList({
  33. projectId: this.$route.params.id
  34. })
  35. },
  36. methods: {
  37. ...mapActions('documents', ['getDocumentList', 'deleteAnnotation', 'updateAnnotation', 'addAnnotation']),
  38. _deleteAnnotation(annotationId) {
  39. const payload = {
  40. annotationId,
  41. projectId: this.$route.params.id
  42. }
  43. this.deleteAnnotation(payload)
  44. },
  45. _updateAnnotation(annotationId, text) {
  46. const payload = {
  47. annotationId,
  48. text: text,
  49. projectId: this.$route.params.id
  50. }
  51. this.updateAnnotation(payload)
  52. },
  53. _createAnnotation(text) {
  54. const payload = {
  55. text,
  56. projectId: this.$route.params.id
  57. }
  58. this.addAnnotation(payload)
  59. }
  60. }
  61. }
  62. </script>