fix bug
This commit is contained in:
parent
ab19e5937f
commit
21cb24bbaf
5 changed files with 162 additions and 73 deletions
|
|
@ -366,8 +366,42 @@ watch(
|
|||
|
||||
<q-card-section class="q-pa-sm">
|
||||
<q-card bordered class="bg-grey-13">
|
||||
<q-list dense class="q-py-sm">
|
||||
<q-item dense>
|
||||
<q-card-section>
|
||||
<div class="text-grey">ตำแหน่งเลขที่</div>
|
||||
<div class="text-subtitle2 text-black q-ml-sm">
|
||||
{{ props.row.posNo ? props.row.posNo : "-" }}
|
||||
</div>
|
||||
|
||||
<div class="text-grey">
|
||||
{{ empType === "officer" ? `ตำแหน่งในสายงาน` : `ตำแหน่ง` }}
|
||||
</div>
|
||||
<div class="text-subtitle2 text-black q-ml-sm">
|
||||
{{ props.row.position ? props.row.position : "-" }}
|
||||
</div>
|
||||
|
||||
<div class="text-grey">
|
||||
{{ empType === "officer" ? "ตำแหน่งประเภท" : "กลุ่มงาน" }}
|
||||
</div>
|
||||
<div class="text-subtitle2 text-black q-ml-sm">
|
||||
{{ props.row.posType ? props.row.posType : "-" }}
|
||||
</div>
|
||||
|
||||
<div class="text-grey">
|
||||
{{ empType === "officer" ? "ระดับ" : "ระดับชั้นงาน" }}
|
||||
</div>
|
||||
<div class="text-subtitle2 text-black q-ml-sm">
|
||||
{{
|
||||
props.row.posLevel
|
||||
? props.row.posTypeShortName
|
||||
? `${props.row.posTypeShortName} ${props.row.posLevel}`
|
||||
: props.row.posLevel
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
<!-- <q-list dense class="q-py-sm"> -->
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>ตำแหน่งเลขที่</q-item-label>
|
||||
</q-item-section>
|
||||
|
|
@ -376,9 +410,9 @@ watch(
|
|||
props.row.posNo ? props.row.posNo : "-"
|
||||
}}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-item> -->
|
||||
|
||||
<q-item dense>
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>{{
|
||||
empType === "officer" ? `ตำแหน่งในสายงาน` : `ตำแหน่ง`
|
||||
|
|
@ -391,9 +425,9 @@ watch(
|
|||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-item> -->
|
||||
|
||||
<q-item dense>
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>
|
||||
{{
|
||||
|
|
@ -408,9 +442,9 @@ watch(
|
|||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-item> -->
|
||||
|
||||
<q-item dense>
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>
|
||||
{{
|
||||
|
|
@ -429,8 +463,8 @@ watch(
|
|||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-item> -->
|
||||
<!-- </q-list> -->
|
||||
</q-card>
|
||||
</q-card-section>
|
||||
<q-separator inset />
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
|
|||
const posTypeMain = ref<DataType[]>([]);
|
||||
const posLevelOps = ref<DataOption[]>([]);
|
||||
const yearOps = ref<DataOption[]>([]);
|
||||
const mode = ref<string>("card");
|
||||
const mode = ref<string>("table");
|
||||
|
||||
function fetchType(data: DataType[]) {
|
||||
posTypeMain.value = data;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,14 @@ import { useRoute } from "vue-router";
|
|||
/** Use */
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError, success, showLoader, hideLoader, dialogConfirm } = mixin;
|
||||
const {
|
||||
messageError,
|
||||
success,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
dialogConfirm,
|
||||
findOrgName,
|
||||
} = mixin;
|
||||
const route = useRoute();
|
||||
const retireld_params = route.params.id;
|
||||
|
||||
|
|
@ -82,7 +89,7 @@ watch(modal, () => {
|
|||
}
|
||||
});
|
||||
|
||||
function findOrgName(obj: any) {
|
||||
function findOrgChildName(obj: any) {
|
||||
if (obj) {
|
||||
let name =
|
||||
obj.orgChild4Name != null && obj.orgChild3Name != null
|
||||
|
|
@ -120,36 +127,77 @@ function findOrgName(obj: any) {
|
|||
|
||||
const formPagePersonList = reactive({ keyword: "", pageSize: 10, page: 1 });
|
||||
const maxPage = ref<number>(1);
|
||||
const totalList = ref<number>(0);
|
||||
|
||||
// fecth profile
|
||||
const fecthProfile = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.orgProfileProbation, formPagePersonList)
|
||||
.then((res) => {
|
||||
maxPage.value = Math.ceil(
|
||||
res.data.result.total / formPagePersonList.pageSize
|
||||
);
|
||||
rows.value = res.data.result.data.map((e: any) => ({
|
||||
id: e.id,
|
||||
prefix:e.prefix,
|
||||
firstName:e.firstName,
|
||||
lastName:e.lastName,
|
||||
fullname: e.prefix + e.firstName + " " + e.lastName,
|
||||
position: e.position,
|
||||
level:
|
||||
e.posTypeName && e.posLevelName
|
||||
? e.posTypeName + " (" + e.posLevelName + ")"
|
||||
: "-",
|
||||
organizationOrganization: findOrgName(e),
|
||||
}));
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
if (props?.dataProfile?.type === "OFFICER") {
|
||||
showLoader();
|
||||
formPagePersonList.keyword =
|
||||
formPagePersonList.keyword === null ? "" : formPagePersonList.keyword;
|
||||
await http
|
||||
.post(config.API.orgProfileProbation, formPagePersonList)
|
||||
.then((res) => {
|
||||
maxPage.value = Math.ceil(
|
||||
res.data.result.total / formPagePersonList.pageSize
|
||||
);
|
||||
totalList.value = res.data.result.total;
|
||||
rows.value = res.data.result.data.map((e: any) => ({
|
||||
id: e.id,
|
||||
prefix: e.prefix,
|
||||
firstName: e.firstName,
|
||||
lastName: e.lastName,
|
||||
fullname: e.prefix + e.firstName + " " + e.lastName,
|
||||
position: e.position,
|
||||
level:
|
||||
e.posTypeName && e.posLevelName
|
||||
? e.posTypeName + " (" + e.posLevelName + ")"
|
||||
: "-",
|
||||
organizationOrganization: findOrgChildName(e),
|
||||
}));
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
let queryParams: any = {
|
||||
page: formPagePersonList.page,
|
||||
pageSize: formPagePersonList.pageSize,
|
||||
searchKeyword: formPagePersonList.keyword,
|
||||
searchField: "fullName",
|
||||
type: "perm",
|
||||
};
|
||||
http
|
||||
.get(config.API.registryNew("-employee"), { params: queryParams })
|
||||
.then((res) => {
|
||||
maxPage.value = Math.ceil(
|
||||
res.data.result.total / formPagePersonList.pageSize
|
||||
);
|
||||
totalList.value = res.data.result.total;
|
||||
rows.value = res.data.result.data.map((e: any) => ({
|
||||
id: e.id,
|
||||
prefix: e.prefix,
|
||||
firstName: e.firstName,
|
||||
lastName: e.lastName,
|
||||
fullname: e.prefix + e.firstName + " " + e.lastName,
|
||||
position: e.position,
|
||||
level:
|
||||
e.posTypeName && e.posLevelName
|
||||
? e.posTypeName + " (" + e.posLevelName + ")"
|
||||
: "-",
|
||||
organizationOrganization: findOrgName(e),
|
||||
}));
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// ยืนยันการเพิ่มราชชื่อ
|
||||
|
|
@ -183,20 +231,17 @@ const updateListData = (retireld: string, pId: string) => {
|
|||
props.UpdateListId(retireld, pId);
|
||||
};
|
||||
|
||||
/**
|
||||
* Setiting Pagination
|
||||
*/
|
||||
const paging = ref<boolean>(true);
|
||||
const pagination = ref({
|
||||
sortBy: "fullname",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const paginationLabel = (start: number, end: number, total: number) => {
|
||||
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
function updatePageSize(newPagination: any) {
|
||||
formPagePersonList.page = 1;
|
||||
formPagePersonList.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formPagePersonList.pageSize,
|
||||
() => {
|
||||
fecthProfile();
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -232,17 +277,18 @@ const paginationLabel = (start: number, end: number, total: number) => {
|
|||
borderless
|
||||
outlined
|
||||
dense
|
||||
debounce="300"
|
||||
v-model="filter"
|
||||
clearable
|
||||
v-model="formPagePersonList.keyword"
|
||||
placeholder="ค้นหา"
|
||||
style="width: 850px; max-width: auto"
|
||||
@keyup.enter="(formPagePersonList.page = 1), fecthProfile()"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
</template>
|
||||
</q-input>
|
||||
</q-toolbar>
|
||||
<q-table
|
||||
<d-table
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
|
|
@ -250,9 +296,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
|
|||
:columns="columns"
|
||||
row-key="name"
|
||||
class="custom-header-table"
|
||||
:filter="filter"
|
||||
:pagination-label="paginationLabel"
|
||||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[10, 20, 50, 100]"
|
||||
@update:pagination="updatePageSize"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
|
|
@ -266,12 +311,19 @@ const paginationLabel = (start: number, end: number, total: number) => {
|
|||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td>{{ props.rowIndex + 1 }}</q-td>
|
||||
<q-td>{{
|
||||
(formPagePersonList.page - 1) *
|
||||
Number(formPagePersonList.pageSize) +
|
||||
props.rowIndex +
|
||||
1
|
||||
}}</q-td>
|
||||
<q-td key="fullname" :props="props">
|
||||
{{ props.row.prefix ? props.row.prefix:'' }}{{ props.row.firstName ? props.row.firstName:'' }} {{ props.row.lastName ? props.row.lastName:'' }}
|
||||
{{ props.row.prefix ? props.row.prefix : ""
|
||||
}}{{ props.row.firstName ? props.row.firstName : "" }}
|
||||
{{ props.row.lastName ? props.row.lastName : "" }}
|
||||
</q-td>
|
||||
<q-td key="position" :props="props">
|
||||
{{ props.row.position ? props.row.position:'-' }}
|
||||
{{ props.row.position ? props.row.position : "-" }}
|
||||
</q-td>
|
||||
<q-td key="level" :props="props">{{ props.row.level }}</q-td>
|
||||
<q-td
|
||||
|
|
@ -293,17 +345,19 @@ const paginationLabel = (start: number, end: number, total: number) => {
|
|||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
ทั้งหมด {{ totalList }} รายการ
|
||||
<q-pagination
|
||||
v-model="pagination.page"
|
||||
v-model="formPagePersonList.page"
|
||||
color="primary"
|
||||
:max="scope.pagesNumber"
|
||||
:max="maxPage"
|
||||
:max-pages="5"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
@update:model-value="fecthProfile"
|
||||
></q-pagination>
|
||||
</template>
|
||||
</q-table>
|
||||
</d-table>
|
||||
</div>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ onMounted(() => {
|
|||
}}
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<div v-else class="table_ellipsis">
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
|
|
|
|||
|
|
@ -86,14 +86,14 @@ async function fetchLeaveday(
|
|||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
data && genReport(data);
|
||||
!data && hideLoader();
|
||||
detailReport.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -114,18 +114,19 @@ async function genReport(data: any) {
|
|||
const objectUrl = URL.createObjectURL(blob);
|
||||
fileBlob.value = blob;
|
||||
const pdfData = await usePDF(`${objectUrl}`);
|
||||
showLoader();
|
||||
|
||||
setTimeout(() => {
|
||||
pdfSrc.value = pdfData.pdf.value;
|
||||
numOfPages.value = pdfData.pages.value;
|
||||
hideLoader();
|
||||
}, 1500);
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue