index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <RightFillPano>
  3. <ui-group borderBottom>
  4. <template #header>
  5. <ui-button @click="currentTagging = createTagging()">
  6. <ui-icon type="add" />
  7. 新增
  8. </ui-button>
  9. </template>
  10. </ui-group>
  11. <ui-group title="标注">
  12. <template #icon>
  13. <ui-icon type="eye-s" />
  14. </template>
  15. <ui-group-option>
  16. <ui-input type="text" width="100%" placeholder="搜索">
  17. <template #preIcon>
  18. <ui-icon type="search" />
  19. </template>
  20. </ui-input>
  21. </ui-group-option>
  22. <TagingSign
  23. v-for="tagging in taggings"
  24. :key="tagging.id"
  25. :tagging="tagging"
  26. @edit="currentTagging = tagging"
  27. @delete="deleteTagging(tagging)"
  28. />
  29. </ui-group>
  30. </RightFillPano>
  31. <Edit
  32. v-if="currentTagging"
  33. :data="currentTagging"
  34. @quit="currentTagging = null"
  35. @save="saveHandler"
  36. />
  37. </template>
  38. <script lang="ts" setup>
  39. import Edit from './edit.vue'
  40. import { RightFillPano } from '@/layout'
  41. import { Tagging, taggings, TemploraryID } from '@/store'
  42. import TagingSign from './sign.vue'
  43. import { ref } from 'vue';
  44. import type { LocalTagging } from './edit.vue'
  45. const createTagging = (): Tagging => ({
  46. id: TemploraryID,
  47. title: '',
  48. styleId: '',
  49. desc: '',
  50. part: '',
  51. method: '',
  52. principal: '',
  53. images: [],
  54. positions: []
  55. })
  56. const currentTagging = ref<Tagging | null>(null)
  57. const saveHandler = (tagging: LocalTagging) => {
  58. currentTagging.value = null
  59. }
  60. const deleteTagging = (tagging: Tagging) => {
  61. const index = taggings.value.indexOf(tagging)
  62. taggings.value.splice(index, 1)
  63. }
  64. </script>