This commit is contained in:
parent
f86525e31d
commit
2e8397a34b
|
@ -152,7 +152,11 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
|||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('worker.card.user')" :value="entity.user?.name" />
|
||||
<VnLv :label="t('worker.card.email')" :value="entity.user?.email" copy />
|
||||
<VnLv
|
||||
:label="t('worker.card.email')"
|
||||
:value="entity.user?.emailUser?.email"
|
||||
copy
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('worker.list.department')"
|
||||
:value="entity.department ? entity.department.department.name : null"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<script setup>
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { ref, onBeforeMount, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import { dashIfEmpty, toDate } from 'src/filters';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
|
@ -11,6 +11,7 @@ import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
|||
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||
import RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy.vue';
|
||||
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -23,64 +24,27 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const workerUrl = ref();
|
||||
const basicDataUrl = ref(null);
|
||||
const isHr = computed(() => useRole().hasAny(['hr']));
|
||||
const advancedSummary = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`;
|
||||
onBeforeMount(async () => {
|
||||
if (isHr.value) {
|
||||
advancedSummary.value = (
|
||||
await axios.get('Workers/advancedSummary', {
|
||||
params: { filter: { where: { id: entityId.value } } },
|
||||
})
|
||||
).data[0];
|
||||
basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
|
||||
}
|
||||
});
|
||||
|
||||
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',
|
||||
},
|
||||
],
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`Workers/${entityId}`"
|
||||
:filter="filter"
|
||||
:url="`Workers/summary`"
|
||||
:filter="{ where: { id: entityId } }"
|
||||
data-key="WorkerSummary"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
|
@ -88,10 +52,7 @@ const filter = {
|
|||
</template>
|
||||
<template #body="{ entity: worker }">
|
||||
<QCard class="vn-one">
|
||||
<VnTitle
|
||||
:url="`#/worker/${entityId}/basic-data`"
|
||||
:text="t('worker.summary.basicData')"
|
||||
/>
|
||||
<VnTitle :url="basicDataUrl" :text="t('worker.summary.basicData')" />
|
||||
<VnLv :label="t('worker.card.name')" :value="worker.user?.nickname" />
|
||||
<VnLv :label="t('worker.list.department')">
|
||||
<template #value>
|
||||
|
@ -128,13 +89,9 @@ const filter = {
|
|||
<VnLinkPhone :phone-number="worker.client?.phone" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('worker.summary.locker')" :value="worker.locker" />
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<VnTitle
|
||||
:url="`#/worker/${entityId}/basic-data`"
|
||||
:text="t('worker.summary.basicData')"
|
||||
/>
|
||||
<QCard class="vn-one" v-if="advancedSummary">
|
||||
<VnTitle :url="basicDataUrl" :text="t('worker.summary.basicData')" />
|
||||
<VnLv
|
||||
:label="t('worker.summary.fiDueDate')"
|
||||
:value="toDate(worker.fiDueDate)"
|
||||
|
@ -162,7 +119,6 @@ const filter = {
|
|||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<VnTitle :text="t('worker.summary.userData')" />
|
||||
<VnLv :label="t('worker.summary.userId')" :value="worker?.user?.id" />
|
||||
<VnLv :label="t('worker.card.name')" :value="worker?.user?.nickname" />
|
||||
<VnLv
|
||||
:label="t('worker.list.email')"
|
||||
|
|
Loading…
Reference in New Issue