diff --git a/src/pages/08_request-list/FormExpansion.vue b/src/pages/08_request-list/FormExpansion.vue index cce0db43..5aa75f31 100644 --- a/src/pages/08_request-list/FormExpansion.vue +++ b/src/pages/08_request-list/FormExpansion.vue @@ -11,6 +11,7 @@ import { useRequestList } from 'src/stores/request-list'; const props = defineProps<{ readonly?: boolean; step: Step; + requestWorkId: string; }>(); const requestListStore = useRequestList(); @@ -116,7 +117,7 @@ function assignToForm() { {{ $t('quotation.templateForm') }} - + diff --git a/src/pages/08_request-list/FormIssue.vue b/src/pages/08_request-list/FormIssue.vue index f13ee3ac..e455b481 100644 --- a/src/pages/08_request-list/FormIssue.vue +++ b/src/pages/08_request-list/FormIssue.vue @@ -2,14 +2,49 @@ import { ref } from 'vue'; import { MainButton } from 'components/button'; import SelectInput from 'src/components/shared/SelectInput.vue'; +import { onMounted } from 'vue'; +import { api } from 'src/boot/axios'; +import { baseUrl } from 'src/stores/utils'; -defineProps<{ +const prop = defineProps<{ readonly?: boolean; + requestWorkId: string; }>(); const templateForm = defineModel(); const templateFormOption = ref< { label: string; labelEN: string; value: string }[] >([]); + +onMounted(async () => { + const { data: docTemplate, status } = await api.get( + '/doc-template', + { params: { templateGroup: 'Request' } }, + ); + + if (status < 400) { + templateFormOption.value = docTemplate.map((v) => ({ + label: v, + labelEN: v, + value: v, + })); + } +}); + +async function formDownload() { + const res = await fetch( + baseUrl + + '/doc-template/' + + templateForm.value + + `?templateGroup=Request&data=request-work&dataId=${prop.requestWorkId}`, + ); + const blob = await res.blob(); + + const a = document.createElement('a'); + a.download = templateForm.value; + a.href = window.URL.createObjectURL(blob); + a.click(); + a.remove(); +}