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.

99 lines
2.2 KiB

3 years ago
2 years ago
  1. <template>
  2. <v-main>
  3. <v-container fluid>
  4. <v-row justify="center">
  5. <v-col cols="12" md="9">
  6. <v-card>
  7. <v-card-title>
  8. <label-group
  9. :labels="items"
  10. :annotations="currentDoc.annotations"
  11. :single-label="singleLabel"
  12. @add="addLabel"
  13. @remove="removeLabel"
  14. />
  15. </v-card-title>
  16. <v-divider />
  17. <v-img
  18. contain
  19. :src="currentDoc.filename"
  20. max-height="300"
  21. class="grey lighten-2"
  22. />
  23. </v-card>
  24. </v-col>
  25. <v-col cols="12" md="3">
  26. <list-metadata :metadata="currentDoc.meta" />
  27. </v-col>
  28. </v-row>
  29. </v-container>
  30. </v-main>
  31. </template>
  32. <script>
  33. import ListMetadata from '@/components/tasks/metadata/ListMetadata'
  34. import LabelGroup from '@/components/tasks/textClassification/LabelGroup'
  35. export default {
  36. components: {
  37. LabelGroup,
  38. ListMetadata
  39. },
  40. layout: 'demo',
  41. data() {
  42. return {
  43. items: [
  44. {
  45. id: 4,
  46. text: 'Cat',
  47. prefixKey: null,
  48. suffixKey: 'c',
  49. backgroundColor: '#7c20e0',
  50. textColor: '#ffffff'
  51. },
  52. {
  53. id: 5,
  54. text: 'Dog',
  55. prefixKey: null,
  56. suffixKey: 'd',
  57. backgroundColor: '#fbb028',
  58. textColor: '#000000'
  59. }
  60. ],
  61. singleLabel: true,
  62. currentDoc: {
  63. id: 8,
  64. filename: require('~/assets/6737785.png'),
  65. annotations: [
  66. {
  67. id: 17,
  68. prob: 0.0,
  69. label: 4,
  70. user: 1,
  71. document: 8
  72. }
  73. ],
  74. meta: {
  75. url: 'https://github.com/Hironsan'
  76. },
  77. annotation_approver: null,
  78. }
  79. }
  80. },
  81. methods: {
  82. removeLabel(annotationId) {
  83. this.currentDoc.annotations = this.currentDoc.annotations.filter(item => item.id !== annotationId)
  84. },
  85. addLabel(labelId) {
  86. const payload = {
  87. id: Math.floor(Math.random() * Math.floor(Number.MAX_SAFE_INTEGER)),
  88. label: labelId
  89. }
  90. this.currentDoc.annotations.push(payload)
  91. }
  92. }
  93. }
  94. </script>