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>
|
<script setup>
|
||||||
import { computed, onMounted, onUnmounted } from 'vue';
|
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
import { usePrintService } from 'src/composables/usePrintService';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnSection from 'src/components/common/VnSection.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import ParkingFilter from './ParkingFilter.vue';
|
import ParkingFilter from './ParkingFilter.vue';
|
||||||
import exprBuilder from './ParkingExprBuilder.js';
|
import exprBuilder from './ParkingExprBuilder.js';
|
||||||
import ParkingSummary from './Card/ParkingSummary.vue';
|
import ParkingSummary from './Card/ParkingSummary.vue';
|
||||||
|
import { QBtn, QTooltip } from 'quasar';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
const { openReport } = usePrintService();
|
||||||
const dataKey = 'ParkingList';
|
const dataKey = 'ParkingList';
|
||||||
|
const tableRef = ref();
|
||||||
|
const selectedRows = ref([]);
|
||||||
|
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
||||||
|
|
||||||
onMounted(() => (stateStore.rightDrawer = true));
|
onMounted(() => (stateStore.rightDrawer = true));
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
@ -57,9 +64,38 @@ const columns = computed(() => [
|
||||||
action: (row) => viewSummary(row.id, ParkingSummary),
|
action: (row) => viewSummary(row.id, ParkingSummary),
|
||||||
isPrimary: true,
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -78,14 +114,19 @@ const columns = computed(() => [
|
||||||
</template>
|
</template>
|
||||||
<template #body>
|
<template #body>
|
||||||
<VnTable
|
<VnTable
|
||||||
|
ref="tableRef"
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
is-editable="false"
|
is-editable="false"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
:disable-option="{ table: true }"
|
|
||||||
redirect="shelving/parking"
|
redirect="shelving/parking"
|
||||||
default-mode="card"
|
default-mode="table"
|
||||||
|
v-model:selected="selectedRows"
|
||||||
|
:table="{
|
||||||
|
'row-key': 'id',
|
||||||
|
selection: 'multiple',
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -93,6 +134,13 @@ const columns = computed(() => [
|
||||||
@click.stop="viewSummary(row.id, ParkingSummary)"
|
@click.stop="viewSummary(row.id, ParkingSummary)"
|
||||||
color="primary"
|
color="primary"
|
||||||
/>
|
/>
|
||||||
|
<QBtn
|
||||||
|
:label="t('globals.downloadPdf')"
|
||||||
|
@click.stop="openPdf(row.id)"
|
||||||
|
color="primary"
|
||||||
|
class="q-ml-sm"
|
||||||
|
icon-right="cloud_download"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
@ -105,4 +153,4 @@ const columns = computed(() => [
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</template>
|
</template>
|
|
@ -145,5 +145,16 @@
|
||||||
"allowedContentTypes": [
|
"allowedContentTypes": [
|
||||||
"application/x-7z-compressed"
|
"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