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.

62 lines
1.1 KiB

  1. <template>
  2. <label-list
  3. :headers="headers"
  4. :labels="items"
  5. :selected="selected"
  6. :loading="loading"
  7. @update-selected="updateSelected"
  8. @update-label="handleUpdateLabel"
  9. />
  10. </template>
  11. <script>
  12. import { mapState, mapActions, mapMutations } from 'vuex'
  13. import LabelList from '@/components/organisms/LabelList'
  14. export default {
  15. components: {
  16. LabelList
  17. },
  18. data() {
  19. return {
  20. headers: [
  21. {
  22. text: 'Name',
  23. align: 'left',
  24. value: 'text'
  25. },
  26. {
  27. text: 'Shortkey',
  28. value: 'suffix_key'
  29. },
  30. {
  31. text: 'Color',
  32. sortable: false,
  33. value: 'background_color'
  34. }
  35. ]
  36. }
  37. },
  38. computed: {
  39. ...mapState('labels', ['items', 'selected', 'loading'])
  40. },
  41. created() {
  42. this.getLabelList()
  43. },
  44. methods: {
  45. ...mapActions('labels', ['getLabelList', 'updateLabel']),
  46. ...mapMutations('labels', ['updateSelected']),
  47. handleUpdateLabel(payload) {
  48. const data = {
  49. projectId: this.$route.params.id,
  50. ...payload
  51. }
  52. this.updateLabel(data)
  53. }
  54. }
  55. }
  56. </script>