feat: refs #8115 added support for printing parkings
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
f3576ded1d
commit
d66dda0b2e
|
@ -1,18 +1,25 @@
|
|||
<script setup>
|
||||
import { computed, onMounted, onUnmounted } from 'vue';
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { usePrintService } from 'src/composables/usePrintService';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import ParkingFilter from './ParkingFilter.vue';
|
||||
import exprBuilder from './ParkingExprBuilder.js';
|
||||
import ParkingSummary from './Card/ParkingSummary.vue';
|
||||
import { QBtn, QTooltip } from 'quasar';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const { openReport } = usePrintService();
|
||||
const dataKey = 'ParkingList';
|
||||
const tableRef = ref();
|
||||
const selectedRows = ref([]);
|
||||
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
||||
|
||||
onMounted(() => (stateStore.rightDrawer = true));
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
@ -57,9 +64,38 @@ const columns = computed(() => [
|
|||
action: (row) => viewSummary(row.id, ParkingSummary),
|
||||
isPrimary: true,
|
||||
},
|
||||
{
|
||||
title: t('globals.downloadPdf'),
|
||||
icon: 'cloud_download',
|
||||
isPrimary: true,
|
||||
action: (row) => openPdf(row.id),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function openPdf(id) {
|
||||
openReport(`Parkings/${id}/download`);
|
||||
}
|
||||
|
||||
function downloadPdf() {
|
||||
if (selectedRows.value.size === 0) return;
|
||||
const selectedCardsArray = Array.from(selectedRows.value.values());
|
||||
|
||||
if (selectedRows.value.size === 1) {
|
||||
const [parking] = selectedCardsArray;
|
||||
openPdf(parking.id);
|
||||
} else {
|
||||
const parkingIdsArray = selectedCardsArray.map((parking) => parking.id);
|
||||
const parkingIds = parkingIdsArray.join(',');
|
||||
|
||||
const params = {
|
||||
ids: parkingIds,
|
||||
};
|
||||
|
||||
openReport(`Parkings/downloadZip`, params);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -78,14 +114,19 @@ const columns = computed(() => [
|
|||
</template>
|
||||
<template #body>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
is-editable="false"
|
||||
:right-search="false"
|
||||
:use-model="true"
|
||||
:disable-option="{ table: true }"
|
||||
redirect="shelving/parking"
|
||||
default-mode="card"
|
||||
default-mode="table"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
>
|
||||
<template #actions="{ row }">
|
||||
<QBtn
|
||||
|
@ -93,6 +134,13 @@ const columns = computed(() => [
|
|||
@click.stop="viewSummary(row.id, ParkingSummary)"
|
||||
color="primary"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.downloadPdf')"
|
||||
@click.stop="openPdf(row.id)"
|
||||
color="primary"
|
||||
class="q-ml-sm"
|
||||
icon-right="cloud_download"
|
||||
/>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
@ -105,4 +153,4 @@ const columns = computed(() => [
|
|||
</QTooltip>
|
||||
</RouterLink>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
</template>
|
|
@ -145,5 +145,16 @@
|
|||
"allowedContentTypes": [
|
||||
"application/x-7z-compressed"
|
||||
]
|
||||
},
|
||||
"parkingStorage": {
|
||||
"name": "parkingStorage",
|
||||
"connector": "loopback-component-storage",
|
||||
"provider": "filesystem",
|
||||
"root": "./storage/pdfs/parking",
|
||||
"maxFileSize": "52428800",
|
||||
"allowedContentTypes": [
|
||||
"application/octet-stream",
|
||||
"application/pdf"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue