feat: add support for request work form
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 9s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 9s
This commit is contained in:
parent
0e685a99f7
commit
9312701096
3 changed files with 40 additions and 12 deletions
|
|
@ -11,6 +11,7 @@ import { useRequestList } from 'src/stores/request-list';
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
step: Step;
|
step: Step;
|
||||||
|
requestWorkId: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const requestListStore = useRequestList();
|
const requestListStore = useRequestList();
|
||||||
|
|
@ -116,7 +117,7 @@ function assignToForm() {
|
||||||
<FormGroupHead>
|
<FormGroupHead>
|
||||||
{{ $t('quotation.templateForm') }}
|
{{ $t('quotation.templateForm') }}
|
||||||
</FormGroupHead>
|
</FormGroupHead>
|
||||||
<FormIssue :readonly="!state.isEdit" />
|
<FormIssue :request-work-id="requestWorkId" :readonly="!state.isEdit" />
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</q-expansion-item>
|
</q-expansion-item>
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,49 @@
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { MainButton } from 'components/button';
|
import { MainButton } from 'components/button';
|
||||||
import SelectInput from 'src/components/shared/SelectInput.vue';
|
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;
|
readonly?: boolean;
|
||||||
|
requestWorkId: string;
|
||||||
}>();
|
}>();
|
||||||
const templateForm = defineModel<string>();
|
const templateForm = defineModel<string>();
|
||||||
const templateFormOption = ref<
|
const templateFormOption = ref<
|
||||||
{ label: string; labelEN: string; value: string }[]
|
{ label: string; labelEN: string; value: string }[]
|
||||||
>([]);
|
>([]);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const { data: docTemplate, status } = await api.get<string[]>(
|
||||||
|
'/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();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -24,7 +59,6 @@ const templateFormOption = ref<
|
||||||
<SelectInput
|
<SelectInput
|
||||||
id="quotation-branch"
|
id="quotation-branch"
|
||||||
style="grid-column: span 2"
|
style="grid-column: span 2"
|
||||||
incremental
|
|
||||||
v-model="templateForm"
|
v-model="templateForm"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
:readonly
|
:readonly
|
||||||
|
|
@ -32,21 +66,13 @@ const templateFormOption = ref<
|
||||||
:label="$t('quotation.templateForm')"
|
:label="$t('quotation.templateForm')"
|
||||||
:option-label="$i18n.locale === 'eng' ? 'labelEN' : 'label'"
|
:option-label="$i18n.locale === 'eng' ? 'labelEN' : 'label'"
|
||||||
/>
|
/>
|
||||||
<MainButton
|
|
||||||
outlined
|
|
||||||
icon="mdi-play-box-outline"
|
|
||||||
color="207 96% 32%"
|
|
||||||
class="full-width"
|
|
||||||
style="grid-column: span 1"
|
|
||||||
>
|
|
||||||
{{ $t('general.view', { msg: $t('general.example') }) }}
|
|
||||||
</MainButton>
|
|
||||||
<MainButton
|
<MainButton
|
||||||
solid
|
solid
|
||||||
icon="mdi-pencil-outline"
|
icon="mdi-pencil-outline"
|
||||||
color="207 96% 32%"
|
color="207 96% 32%"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
style="grid-column: span 1"
|
style="grid-column: span 1"
|
||||||
|
@click="formDownload"
|
||||||
>
|
>
|
||||||
{{ $t('general.designForm') }}
|
{{ $t('general.designForm') }}
|
||||||
</MainButton>
|
</MainButton>
|
||||||
|
|
|
||||||
|
|
@ -906,6 +906,7 @@ async function submitRejectCancel() {
|
||||||
/>
|
/>
|
||||||
<FormExpansion
|
<FormExpansion
|
||||||
v-if="value._formExpansion"
|
v-if="value._formExpansion"
|
||||||
|
:request-work-id="value.id"
|
||||||
:readonly="
|
:readonly="
|
||||||
data.requestDataStatus === RequestDataStatus.Canceled
|
data.requestDataStatus === RequestDataStatus.Canceled
|
||||||
"
|
"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue