feat: Personnel => enter card
This commit is contained in:
parent
ff00043b17
commit
6bc8bc7d7e
2 changed files with 20 additions and 5 deletions
|
|
@ -25,6 +25,7 @@ defineProps<{
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
(e: 'deleteCard', id: string): void;
|
(e: 'deleteCard', id: string): void;
|
||||||
(e: 'updateCard', id: string): void;
|
(e: 'updateCard', id: string): void;
|
||||||
|
(e: 'enterCard', id: string): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const status = ref(false);
|
const status = ref(false);
|
||||||
|
|
@ -53,6 +54,7 @@ const status = ref(false);
|
||||||
style="padding: 0"
|
style="padding: 0"
|
||||||
v-for="(v, i) in list"
|
v-for="(v, i) in list"
|
||||||
:key="i"
|
:key="i"
|
||||||
|
@click="$emit('enterCard', v.id)"
|
||||||
>
|
>
|
||||||
<div class="q-pa-sm column items-center">
|
<div class="q-pa-sm column items-center">
|
||||||
<!-- kebab menu -->
|
<!-- kebab menu -->
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, watch } from 'vue';
|
import { ref, onMounted, watch } from 'vue';
|
||||||
import { api } from 'src/boot/axios';
|
import { api } from 'src/boot/axios';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import useUserStore from 'stores/user';
|
import useUserStore from 'stores/user';
|
||||||
import useBranchStore from 'src/stores/branch';
|
import useBranchStore from 'src/stores/branch';
|
||||||
|
|
@ -23,6 +24,7 @@ import TooltipComponent from 'components/TooltipComponent.vue';
|
||||||
import FormDialog from 'src/components/FormDialog.vue';
|
import FormDialog from 'src/components/FormDialog.vue';
|
||||||
import { dateFormat } from 'src/utils/datetime';
|
import { dateFormat } from 'src/utils/datetime';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const branchStore = useBranchStore();
|
const branchStore = useBranchStore();
|
||||||
const { data: userData } = storeToRefs(userStore);
|
const { data: userData } = storeToRefs(userStore);
|
||||||
|
|
@ -319,6 +321,10 @@ async function onDelete(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cardClick(id: string) {
|
||||||
|
router.push({ name: 'PersonnelInfo', params: { id } });
|
||||||
|
}
|
||||||
|
|
||||||
function mapUserType(label: string) {
|
function mapUserType(label: string) {
|
||||||
if (label === 'personnelSelector1') {
|
if (label === 'personnelSelector1') {
|
||||||
formData.value.userType = 'USER';
|
formData.value.userType = 'USER';
|
||||||
|
|
@ -339,8 +345,8 @@ function calculateAge(birthDate: Date | null): string {
|
||||||
|
|
||||||
const ageDate = new Date(diff);
|
const ageDate = new Date(diff);
|
||||||
const years = ageDate.getUTCFullYear() - 1970;
|
const years = ageDate.getUTCFullYear() - 1970;
|
||||||
const months = ageDate.getUTCMonth();
|
// const months = ageDate.getUTCMonth();
|
||||||
const days = ageDate.getUTCDate() - 1;
|
// const days = ageDate.getUTCDate() - 1;
|
||||||
|
|
||||||
age.value = `${years} ปี`;
|
age.value = `${years} ปี`;
|
||||||
return `${years} ปี`;
|
return `${years} ปี`;
|
||||||
|
|
@ -452,6 +458,7 @@ watch(
|
||||||
"
|
"
|
||||||
@updateCard="openDialog"
|
@updateCard="openDialog"
|
||||||
@deleteCard="onDelete"
|
@deleteCard="onDelete"
|
||||||
|
@enterCard="cardClick"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="column"
|
class="column"
|
||||||
|
|
@ -721,7 +728,9 @@ watch(
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
label="วันที่เริ่มงาน"
|
label="วันที่เริ่มงาน"
|
||||||
:model-value="dateFormat(formData.startDate)"
|
:model-value="
|
||||||
|
formData.startDate ? dateFormat(formData.startDate) : ''
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -760,7 +769,9 @@ watch(
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
label="วันที่พ้นสภาพพนักงาน"
|
label="วันที่พ้นสภาพพนักงาน"
|
||||||
:model-value="dateFormat(formData.retireDate)"
|
:model-value="
|
||||||
|
formData.retireDate ? dateFormat(formData.retireDate) : ''
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -799,7 +810,9 @@ watch(
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
label="วันเดือนปีเกิด"
|
label="วันเดือนปีเกิด"
|
||||||
:model-value="dateFormat(formData.birthDate)"
|
:model-value="
|
||||||
|
formData.birthDate ? dateFormat(formData.birthDate) : ''
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue