diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index f9de8e0c1..c815b8e16 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -15,6 +15,10 @@ const props = defineProps({ type: Object, default: null, }, + userFilter: { + type: Object, + default: null, + }, entityId: { type: [Number, String], default: null, @@ -34,6 +38,7 @@ const isSummary = ref(); const arrayData = useArrayData(props.dataKey, { url: props.url, filter: props.filter, + userFilter: props.userFilter, skip: 0, }); const { store } = arrayData; diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 3268939de..bd3cecf08 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -93,6 +93,9 @@ export function useArrayData(key, userOptions) { if (params.filter.where || exprFilter) params.filter.where = { ...params.filter.where, ...exprFilter }; + + if (!params?.filter?.order?.length) delete params?.filter?.order; + params.filter = JSON.stringify(params.filter); store.isLoading = true; diff --git a/src/pages/Worker/Card/WorkerSummary.vue b/src/pages/Worker/Card/WorkerSummary.vue index 98bdffe25..992f6ec71 100644 --- a/src/pages/Worker/Card/WorkerSummary.vue +++ b/src/pages/Worker/Card/WorkerSummary.vue @@ -12,7 +12,6 @@ import RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue'; import { useAdvancedSummary } from 'src/composables/useAdvancedSummary'; import WorkerDescriptorMenu from './WorkerDescriptorMenu.vue'; -import axios from 'axios'; const route = useRoute(); const { t } = useI18n(); @@ -28,76 +27,6 @@ const entityId = computed(() => $props.id || route.params.id); const basicDataUrl = ref(null); const advancedSummary = ref(); -const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['name', 'nickname', 'roleFk'], - - include: [ - { - relation: 'role', - scope: { - fields: ['name'], - }, - }, - { - relation: 'emailUser', - scope: { - fields: ['email'], - }, - }, - ], - }, - }, - { - relation: 'department', - scope: { - include: { - relation: 'department', - scope: { - fields: ['name'], - }, - }, - }, - }, - { - relation: 'boss', - }, - { - relation: 'client', - }, - { - relation: 'sip', - }, - { - relation: 'business', - scope: { - include: [ - { - relation: 'department', - scope: { - fields: ['id', 'name'], - }, - }, - { - relation: 'reasonEnd', - scope: { - fields: ['id', 'reason'], - }, - }, - { - relation: 'workerBusinessProfessionalCategory', - scope: { - fields: ['id', 'description'], - }, - }, - ], - }, - }, - ], -}; onBeforeMount(async () => { advancedSummary.value = await useAdvancedSummary('Workers', entityId.value); basicDataUrl.value = `#/worker/${entityId.value}/basic-data`; @@ -107,8 +36,8 @@ onBeforeMount(async () => {