feat: employee stats
This commit is contained in:
parent
0728f0a3ff
commit
be92fd509a
2 changed files with 40 additions and 15 deletions
|
|
@ -119,6 +119,7 @@ const formDataEmployeeTab = ref('personalInfo');
|
||||||
const infoDrawerEmployee = ref(false);
|
const infoDrawerEmployee = ref(false);
|
||||||
const infoDrawerEmployeeEdit = ref(false);
|
const infoDrawerEmployeeEdit = ref(false);
|
||||||
const infoEmployeePersonCard = ref();
|
const infoEmployeePersonCard = ref();
|
||||||
|
const statsEmployee = ref(0);
|
||||||
const formDataEmployee = ref<EmployeeCreate>({
|
const formDataEmployee = ref<EmployeeCreate>({
|
||||||
image: null,
|
image: null,
|
||||||
customerBranchId: '',
|
customerBranchId: '',
|
||||||
|
|
@ -319,7 +320,7 @@ const selectorList = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'EMPLOYEE',
|
label: 'EMPLOYEE',
|
||||||
count: listEmployee.value ? listEmployee.value.length : 0,
|
count: statsEmployee.value ?? 0,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -593,6 +594,9 @@ async function onSubmit() {
|
||||||
const resultList = await employeeStore.fetchList();
|
const resultList = await employeeStore.fetchList();
|
||||||
if (resultList) listEmployee.value = resultList.result;
|
if (resultList) listEmployee.value = resultList.result;
|
||||||
|
|
||||||
|
const resultStatsEmployee = await employeeStore.getStatsEmployee();
|
||||||
|
if (resultStatsEmployee) statsEmployee.value = resultStatsEmployee;
|
||||||
|
|
||||||
clearFormEmployee();
|
clearFormEmployee();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -897,7 +901,6 @@ onMounted(async () => {
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: pageSizeCustomer.value,
|
pageSize: pageSizeCustomer.value,
|
||||||
});
|
});
|
||||||
const resultListEmployee = await employeeStore.fetchList();
|
|
||||||
|
|
||||||
if (resultStats) statsCustomerType.value = resultStats;
|
if (resultStats) statsCustomerType.value = resultStats;
|
||||||
|
|
||||||
|
|
@ -919,6 +922,10 @@ onMounted(async () => {
|
||||||
listCustomer.value = resultList.result;
|
listCustomer.value = resultList.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resultStatsEmployee = await employeeStore.getStatsEmployee();
|
||||||
|
if (resultStatsEmployee) statsEmployee.value = resultStatsEmployee;
|
||||||
|
|
||||||
|
const resultListEmployee = await employeeStore.fetchList();
|
||||||
if (resultListEmployee) listEmployee.value = resultListEmployee.result;
|
if (resultListEmployee) listEmployee.value = resultListEmployee.result;
|
||||||
|
|
||||||
const resultOption = await fetch('/option/option.json');
|
const resultOption = await fetch('/option/option.json');
|
||||||
|
|
@ -1030,19 +1037,13 @@ watch(fieldSelectedCustomer, async () => {
|
||||||
<StatCardComponent
|
<StatCardComponent
|
||||||
v-if="customerStats && selectorLabel === 'EMPLOYEE'"
|
v-if="customerStats && selectorLabel === 'EMPLOYEE'"
|
||||||
labelI18n
|
labelI18n
|
||||||
:branch="
|
:branch="[
|
||||||
customerStats.map((v) => ({
|
{
|
||||||
count:
|
label: 'EMPLOYEE',
|
||||||
v.name === 'CORP'
|
count: statsEmployee,
|
||||||
? statsCustomerType?.CORP ?? 0
|
color: 'pink',
|
||||||
: statsCustomerType?.PERS ?? 0,
|
},
|
||||||
label:
|
]"
|
||||||
v.name === 'CORP'
|
|
||||||
? 'customerLegalEntity'
|
|
||||||
: 'customerNaturalPerson',
|
|
||||||
color: v.name === 'CORP' ? 'pink' : 'green',
|
|
||||||
}))
|
|
||||||
"
|
|
||||||
:dark="$q.dark.isActive"
|
:dark="$q.dark.isActive"
|
||||||
class="no-wrap"
|
class="no-wrap"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,29 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getStatsEmployee(
|
||||||
|
customerBranchId?: string,
|
||||||
|
flow?: {
|
||||||
|
sessionId: string;
|
||||||
|
refTransactionId: string;
|
||||||
|
transactionId: string;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const res = await api.get(
|
||||||
|
`/employee/stats${customerBranchId ? '?customerBranchId=' + customerBranchId : ''}/`,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
'X-Session-Id': flow?.sessionId,
|
||||||
|
'X-Rtid': flow?.refTransactionId,
|
||||||
|
'X-Tid': flow?.transactionId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res && res.status === 200) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
globalOption,
|
globalOption,
|
||||||
|
|
@ -216,6 +239,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
||||||
fetchCheckup,
|
fetchCheckup,
|
||||||
fetchWork,
|
fetchWork,
|
||||||
fetchOther,
|
fetchOther,
|
||||||
|
getStatsEmployee,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue