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.

61 lines
1.4 KiB

  1. <template>
  2. <form-create
  3. v-bind.sync="editedItem"
  4. @save="create"
  5. />
  6. </template>
  7. <script lang="ts">
  8. import Vue from 'vue'
  9. import FormCreate from '~/components/project/FormCreate.vue'
  10. import { ProjectWriteDTO } from '~/services/application/project/projectData'
  11. export default Vue.extend({
  12. components: {
  13. FormCreate,
  14. },
  15. layout: 'projects',
  16. middleware: ['check-auth', 'auth'],
  17. data() {
  18. return {
  19. editedItem: {
  20. name: '',
  21. description: '',
  22. projectType: 'DocumentClassification',
  23. enableRandomOrder: false,
  24. enableShareAnnotation: false,
  25. singleClassClassification: false,
  26. allowOverlapping: false,
  27. graphemeMode: false,
  28. useRelation: false,
  29. tags: [] as string[],
  30. } as ProjectWriteDTO,
  31. defaultItem: {
  32. name: '',
  33. description: '',
  34. projectType: 'DocumentClassification',
  35. enableRandomOrder: false,
  36. enableShareAnnotation: false,
  37. singleClassClassification: false,
  38. allowOverlapping: false,
  39. graphemeMode: false,
  40. useRelation: false,
  41. tags: [] as string[],
  42. } as ProjectWriteDTO,
  43. }
  44. },
  45. methods: {
  46. async create() {
  47. const project = await this.$services.project.create(this.editedItem)
  48. this.$router.push(`/projects/${project.id}`)
  49. this.$nextTick(() => {
  50. this.editedItem = Object.assign({}, this.defaultItem)
  51. })
  52. },
  53. }
  54. })
  55. </script>