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.

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