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.

186 lines
4.3 KiB

  1. <template>
  2. <v-toolbar
  3. class="toolbar-control"
  4. dense
  5. flat
  6. >
  7. <v-row no-gutters>
  8. <v-btn-toggle>
  9. <button-review
  10. :is-reviewd="isReviewd"
  11. @click:review="$emit('click:review')"
  12. />
  13. <button-filter
  14. :value="filterOption"
  15. @click:filter="changeFilter"
  16. />
  17. <button-guideline
  18. @click:guideline="dialogGuideline=true"
  19. />
  20. <v-dialog v-model="dialogGuideline">
  21. <form-guideline
  22. :guideline-text="guidelineText"
  23. @click:close="dialogGuideline=false"
  24. />
  25. </v-dialog>
  26. <button-comment
  27. @click:comment="dialogComment=true"
  28. />
  29. <v-dialog v-model="dialogComment">
  30. <form-comment
  31. :example-id="docId"
  32. @click:cancel="dialogComment=false"
  33. />
  34. </v-dialog>
  35. <button-auto-labeling
  36. @click:auto="dialogAutoLabeling=true"
  37. />
  38. <v-dialog v-model="dialogAutoLabeling">
  39. <form-auto-labeling
  40. :is-enabled="enableAutoLabeling"
  41. :error-message="errorMessage"
  42. @click:cancel="dialogAutoLabeling=false"
  43. @input="updateAutoLabeling"
  44. />
  45. </v-dialog>
  46. <button-clear
  47. @click:clear="dialogClear=true"
  48. />
  49. <v-dialog v-model="dialogClear">
  50. <form-clear-label
  51. @click:ok="$emit('click:clear-label');dialogClear=false"
  52. @click:cancel="dialogClear=false"
  53. />
  54. </v-dialog>
  55. </v-btn-toggle>
  56. <slot />
  57. <v-spacer />
  58. <button-pagination
  59. :value="page"
  60. :total="total"
  61. @click:prev="updatePage(page - 1)"
  62. @click:next="updatePage(page + 1)"
  63. @click:first="updatePage(1)"
  64. @click:last="updatePage(total)"
  65. @click:jump="updatePage($event)"
  66. />
  67. </v-row>
  68. </v-toolbar>
  69. </template>
  70. <script lang="ts">
  71. import Vue from 'vue'
  72. import ButtonAutoLabeling from './buttons/ButtonAutoLabeling.vue'
  73. import ButtonClear from './buttons/ButtonClear.vue'
  74. import ButtonComment from './buttons/ButtonComment.vue'
  75. import ButtonFilter from './buttons/ButtonFilter.vue'
  76. import ButtonGuideline from './buttons/ButtonGuideline.vue'
  77. import ButtonPagination from './buttons/ButtonPagination.vue'
  78. import ButtonReview from './buttons/ButtonReview.vue'
  79. import FormAutoLabeling from './forms/FormAutoLabeling.vue'
  80. import FormClearLabel from './forms/FormClearLabel.vue'
  81. import FormComment from './forms/FormComment.vue'
  82. import FormGuideline from './forms/FormGuideline.vue'
  83. export default Vue.extend({
  84. components: {
  85. ButtonAutoLabeling,
  86. ButtonClear,
  87. ButtonComment,
  88. ButtonFilter,
  89. ButtonGuideline,
  90. ButtonPagination,
  91. ButtonReview,
  92. FormAutoLabeling,
  93. FormClearLabel,
  94. FormComment,
  95. FormGuideline
  96. },
  97. props: {
  98. docId: {
  99. type: Number,
  100. required: true
  101. },
  102. enableAutoLabeling: {
  103. type: Boolean,
  104. default: false,
  105. required: true
  106. },
  107. guidelineText: {
  108. type: String,
  109. default: '',
  110. required: true
  111. },
  112. isReviewd: {
  113. type: Boolean,
  114. default: false
  115. },
  116. total: {
  117. type: Number,
  118. default: 1
  119. }
  120. },
  121. data() {
  122. return {
  123. dialogAutoLabeling: false,
  124. dialogClear: false,
  125. dialogComment: false,
  126. dialogGuideline: false,
  127. errorMessage: ''
  128. }
  129. },
  130. computed: {
  131. page(): number {
  132. // @ts-ignore
  133. return parseInt(this.$route.query.page, 10)
  134. },
  135. filterOption(): string {
  136. // @ts-ignore
  137. return this.$route.query.isChecked
  138. }
  139. },
  140. methods: {
  141. updatePage(page: number) {
  142. this.$router.push({ query: {
  143. page: page.toString(),
  144. isChecked: this.filterOption,
  145. q: this.$route.query.q
  146. }})
  147. },
  148. changeFilter(isChecked: string) {
  149. this.$router.push({ query: {
  150. page: '1',
  151. isChecked,
  152. q: this.$route.query.q
  153. }})
  154. },
  155. updateAutoLabeling(isEnable: boolean) {
  156. if (isEnable) {
  157. this.$emit('update:enable-auto-labeling', true)
  158. } else {
  159. this.$emit('update:enable-auto-labeling', false)
  160. }
  161. }
  162. }
  163. })
  164. </script>
  165. <style scoped>
  166. .toolbar-control >>> .v-toolbar__content {
  167. padding: 0px !important;
  168. }
  169. ::v-deep .v-dialog {
  170. width: 800px;
  171. }
  172. </style>