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.

65 lines
1.5 KiB

4 years ago
  1. <template>
  2. <div>
  3. <v-card
  4. v-if="isReady"
  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="isReady"
  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, mapState, mapGetters } from 'vuex'
  23. import Seq2seqBox from '~/components/organisms/annotation/Seq2seqBox'
  24. export default {
  25. components: {
  26. Seq2seqBox
  27. },
  28. computed: {
  29. ...mapState('documents', ['loading']),
  30. ...mapGetters('documents', ['currentDoc']),
  31. isReady() {
  32. return this.currentDoc && !this.loading
  33. }
  34. },
  35. methods: {
  36. ...mapActions('documents', ['getDocumentList', 'deleteAnnotation', 'updateAnnotation', 'addAnnotation']),
  37. _deleteAnnotation(annotationId) {
  38. const payload = {
  39. annotationId,
  40. projectId: this.$route.params.id
  41. }
  42. this.deleteAnnotation(payload)
  43. },
  44. _updateAnnotation(annotationId, text) {
  45. const payload = {
  46. annotationId,
  47. text,
  48. projectId: this.$route.params.id
  49. }
  50. this.updateAnnotation(payload)
  51. },
  52. _createAnnotation(text) {
  53. const payload = {
  54. text,
  55. projectId: this.$route.params.id
  56. }
  57. this.addAnnotation(payload)
  58. }
  59. }
  60. }
  61. </script>