refactor: refs #8664 enhance CmrList component with query initialization and user parameters
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
76fa04f9b2
commit
393aebb06f
|
@ -1,7 +1,8 @@
|
|||
<script setup>
|
||||
import { onMounted, computed, ref } from 'vue';
|
||||
import { onBeforeMount, onMounted, computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Notify } from 'quasar';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import { toDateHourMin } from 'filters/index';
|
||||
import { useStateStore } from 'src/stores/useStateStore';
|
||||
|
@ -13,12 +14,21 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
|||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const token = getTokenMultimedia();
|
||||
const state = useStateStore();
|
||||
const selectedRows = ref([]);
|
||||
const dataKey = 'CmrList';
|
||||
const shipped = Date.vnNew();
|
||||
shipped.setHours(0, 0, 0, 0);
|
||||
shipped.setDate(shipped.getDate() - 1);
|
||||
const userParams = {
|
||||
shipped: null,
|
||||
};
|
||||
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -75,9 +85,6 @@ const columns = computed(() => [
|
|||
name: 'shipped',
|
||||
cardVisible: true,
|
||||
component: 'date',
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
format: ({ shipped }) => toDateHourMin(shipped),
|
||||
},
|
||||
{
|
||||
|
@ -90,6 +97,7 @@ const columns = computed(() => [
|
|||
fields: ['id', 'name'],
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
name: 'warehouseFk',
|
||||
attrs: {
|
||||
url: 'warehouses',
|
||||
|
@ -112,8 +120,17 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
|
||||
onBeforeMount(() => {
|
||||
initializeFromQuery();
|
||||
});
|
||||
|
||||
onMounted(() => (state.rightDrawer = true));
|
||||
|
||||
const initializeFromQuery = () => {
|
||||
const query = route.query.table ? JSON.parse(route.query.table) : {};
|
||||
shipped.value = query.shipped || shipped.toISOString();
|
||||
Object.assign(userParams, { shipped });
|
||||
};
|
||||
function getApiUrl() {
|
||||
return new URL(window.location).origin;
|
||||
}
|
||||
|
@ -158,6 +175,7 @@ function downloadPdfs() {
|
|||
:data-key
|
||||
url="Cmrs/filter"
|
||||
:columns="columns"
|
||||
:user-params="userParams"
|
||||
default-mode="table"
|
||||
v-model:selected="selectedRows"
|
||||
table-height="85vh"
|
||||
|
|
Loading…
Reference in New Issue