fix: refs #8638 restore invoiceInBasicData
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
a39f648da0
commit
eb6046f338
|
@ -2,18 +2,24 @@
|
|||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnDms from 'src/components/common/VnDms.vue';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
import axios from 'axios';
|
||||
import VnSelectSupplier from 'src/components/common/VnSelectSupplier.vue';
|
||||
import VnDmsInput from 'src/components/common/VnDmsInput.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const route = useRoute();
|
||||
const quasar = useQuasar();
|
||||
const editDownloadDisabled = ref(false);
|
||||
const userConfig = ref(null);
|
||||
const invoiceId = computed(() => +route.params.id);
|
||||
|
||||
|
@ -31,6 +37,24 @@ const allowedContentTypes = ref([]);
|
|||
const sageWithholdings = ref([]);
|
||||
const documentDialogRef = ref({});
|
||||
const invoiceInRef = ref({});
|
||||
|
||||
function deleteFile(dmsFk) {
|
||||
quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('globals.confirmDeletion'),
|
||||
message: t('globals.confirmDeletionMessage'),
|
||||
},
|
||||
})
|
||||
.onOk(async () => {
|
||||
await axios.post(`dms/${dmsFk}/removeFile`);
|
||||
invoiceInRef.value.formData.dmsFk = null;
|
||||
invoiceInRef.value.formData.dms = undefined;
|
||||
invoiceInRef.value.hasChanges = true;
|
||||
invoiceInRef.value.save();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -133,7 +157,78 @@ const invoiceInRef = ref({});
|
|||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnDmsInput :data="data" :formRef="invoiceInRef" />
|
||||
|
||||
<div class="row no-wrap">
|
||||
<VnInput
|
||||
:label="t('Document')"
|
||||
v-model="data.dmsFk"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
class="full-width"
|
||||
:disable="true"
|
||||
/>
|
||||
<div
|
||||
v-if="data.dmsFk"
|
||||
class="row no-wrap q-pa-xs q-gutter-x-xs"
|
||||
data-cy="dms-buttons"
|
||||
>
|
||||
<QBtn
|
||||
:class="{
|
||||
'no-pointer-events': editDownloadDisabled,
|
||||
}"
|
||||
:disable="editDownloadDisabled"
|
||||
icon="cloud_download"
|
||||
:title="t('Download file')"
|
||||
padding="xs"
|
||||
round
|
||||
@click="downloadFile(data.dmsFk)"
|
||||
/>
|
||||
<QBtn
|
||||
:class="{
|
||||
'no-pointer-events': editDownloadDisabled,
|
||||
}"
|
||||
:disable="editDownloadDisabled"
|
||||
icon="edit"
|
||||
round
|
||||
padding="xs"
|
||||
@click="
|
||||
() => {
|
||||
documentDialogRef.show = true;
|
||||
documentDialogRef.dms = data.dms;
|
||||
}
|
||||
"
|
||||
>
|
||||
<QTooltip>{{ t('Edit document') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:class="{
|
||||
'no-pointer-events': editDownloadDisabled,
|
||||
}"
|
||||
:disable="editDownloadDisabled"
|
||||
icon="delete"
|
||||
:title="t('Delete file')"
|
||||
padding="xs"
|
||||
round
|
||||
@click="deleteFile(data.dmsFk)"
|
||||
/>
|
||||
</div>
|
||||
<QBtn
|
||||
v-else
|
||||
icon="add_circle"
|
||||
round
|
||||
v-shortcut="'+'"
|
||||
padding="xs"
|
||||
@click="
|
||||
() => {
|
||||
documentDialogRef.show = true;
|
||||
delete documentDialogRef.dms;
|
||||
}
|
||||
"
|
||||
data-cy="dms-create"
|
||||
>
|
||||
<QTooltip>{{ t('Create document') }}</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
|
@ -169,6 +264,29 @@ const invoiceInRef = ref({});
|
|||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
<QDialog v-model="documentDialogRef.show">
|
||||
<VnDms
|
||||
model="dms"
|
||||
default-dms-code="invoiceIn"
|
||||
:form-initial-data="documentDialogRef.dms"
|
||||
:url="
|
||||
documentDialogRef.dms
|
||||
? `Dms/${documentDialogRef.dms.id}/updateFile`
|
||||
: 'Dms/uploadFile'
|
||||
"
|
||||
:description="documentDialogRef.supplierName"
|
||||
@on-data-saved="
|
||||
(_, { data }) => {
|
||||
let dmsData = data;
|
||||
if (Array.isArray(data)) dmsData = data[0];
|
||||
invoiceInRef.formData.dmsFk = dmsData.id;
|
||||
invoiceInRef.formData.dms = dmsData;
|
||||
invoiceInRef.hasChanges = true;
|
||||
invoiceInRef.save();
|
||||
}
|
||||
"
|
||||
/>
|
||||
</QDialog>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
|
|
Loading…
Reference in New Issue