API รายการอื่นๆ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-16 11:18:04 +07:00
parent ce4712a199
commit 928c487126
2 changed files with 494 additions and 244 deletions

View file

@ -50,19 +50,22 @@ const personal = ref<any[]>([]);
const personalId = ref<string>("");
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"fullname",
"organizationName",
"birthday",
"status",
"position",
"positionLevel",
"organizationPositionOld",
"organization",
"statustext",
]);
const visibleColumns2 = ref<string[]>([
"no",
"citizenId",
"fullname",
"organizationName",
"birthday",
"position",
"positionLevel",
"organizationPositionOld",
"organization",
"statustext",
]); //
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
@ -78,7 +81,7 @@ const type = ref<string>("");
onMounted(() => {
fecthlistOthet();
});
const listRecevice = ref<any>([]);
// const listRecevice = ref<any>([]);
const fecthlistOthet = async () => {
showLoader();
await http
@ -86,32 +89,36 @@ const fecthlistOthet = async () => {
.then((res) => {
console.log(res);
let response = res.data.result;
listRecevice.value = response;
// listRecevice.value = response;
console.log(response);
rows.value = response.map((e: any) => ({
personalId: e.id,
citizenId: e.citizenId,
fullname: e.firstName + " " + e.lastName,
organizationName:
e.organizationName +
" " +
e.organizationShortName +
" " +
e.positionNumber +
" " +
e.positionPath,
orgName: e.organizationName,
organizationShortName: e.organizationShortName,
positionNumber: e.positionNumberOld,
positionPath: e.positionPath,
birthday: date2Thai(e.dateOfBirth),
status: status(e.status),
rows.value = response.map((r: any) => ({
createdAt: new Date(),
date: new Date(),
firstName: r.firstName ?? "",
personalId: r.id ?? "",
isActive: r.isActive ? r.isActive : false,
lastName: r.lastName ?? "",
organization: r.organization ?? "",
organizationPositionOld: r.organizationPositionOld ?? "",
posNo: r.posNo ?? "",
position: r.position ?? "",
positionLevel: r.positionLevel ?? "",
positionLevelOld: r.positionLevelOld ?? "",
positionNumberOld: r.positionNumberOld ?? "",
positionTypeOld: r.positionTypeOld ?? "",
prefix: r.prefix ?? "",
reason: r.reason ?? "",
salary: r.salary ? r.salary : 0,
status: r.status ?? "",
statustext: status(r.status ?? ""),
fullname: `${r.prefix ?? ""} ${r.firstName ?? ""} ${r.lastName ?? ""}`,
}));
console.log(rows.value);
rows2.value = rows.value.filter((e: any) => e.orgName !== null);
})
.catch((e) => {
console.log(typeof e);
messageError($q);
console.log(e);
})
.finally(() => {
hideLoader();
@ -149,17 +156,17 @@ const rows = ref<any>([
// },
]);
const rows2 = ref<any>([
{
personalId: "08db721d-add6-47b0-8a13-5f45d106e8d1",
citizenId: "1234444332222",
fullname: "นางสาวอย พชช",
organizationName: "นักจัดการงานทั่วไป",
orgName: "กลุ่มงานช่วยนักบริหาร",
organizationShortName: "สกจ.",
positionNumber: "กก. 1",
positionPath: "นักจัดการงานทั่วไป",
birthday: dateText(new Date("1989-09-03")),
},
// {
// personalId: "08db721d-add6-47b0-8a13-5f45d106e8d1",
// citizenId: "1234444332222",
// fullname: " ",
// organizationName: "",
// orgName: "",
// organizationShortName: ".",
// positionNumber: ". 1",
// positionPath: "",
// birthday: dateText(new Date("1989-09-03")),
// },
]);
const columns = ref<QTableProps["columns"]>([
{
@ -171,15 +178,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "citizenId",
align: "left",
label: "เลขประจำตัวประชาชน",
sortable: true,
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullname",
align: "left",
@ -190,31 +188,47 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
{
name: "organizationName",
name: "position",
align: "left",
label: "หน่วยงานที่รับโอน",
label: "ตำแหน่งในสายงาน",
sortable: true,
field: "organizationName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "birthday",
align: "left",
label: "วัน/เดือน/ปี เกิด",
sortable: true,
field: "birthday",
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
name: "positionLevel",
align: "left",
label: "ระดับ",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organizationPositionOld",
align: "left",
label: "สังกัด",
sortable: true,
field: "organizationPositionOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organization",
align: "left",
label: "หน่วยงานที่ขอโอนไป",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "statustext",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
field: "statustext",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -229,15 +243,6 @@ const columns2 = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "citizenId",
align: "left",
label: "เลขประจำตัวประชาชน",
sortable: true,
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullname",
align: "left",
@ -248,34 +253,59 @@ const columns2 = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
{
name: "organizationName",
name: "position",
align: "left",
label: "หน่วยงานที่รับโอน",
label: "ตำแหน่งในสายงาน",
sortable: true,
field: "organizationName",
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "birthday",
name: "positionLevel",
align: "left",
label: "วัน/เดือน/ปี เกิด",
label: "ระดับ",
sortable: true,
field: "birthday",
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organizationPositionOld",
align: "left",
label: "สังกัด",
sortable: true,
field: "organizationPositionOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organization",
align: "left",
label: "หน่วยงานที่ขอโอนไป",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "statustext",
align: "left",
label: "สถานะ",
sortable: true,
field: "statustext",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const openModalTree = (id: string) => {
personalId.value = id;
console.log(personalId.value);
// const openModalTree = (id: string) => {
// personalId.value = id;
// console.log(personalId.value);
personal.value = listRecevice.value.filter((e: any) => e.id === id);
modalTree.value = true;
};
// personal.value = listRecevice.value.filter((e: any) => e.id === id);
// modalTree.value = true;
// };
const clickDelete = (id: string) => {
dialogRemove($q, () => deleteOther(id));
@ -427,128 +457,52 @@ const status = (val: string) => {
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="no" :props="props" @click="nextPage(props.row)">
<q-tr
:props="props"
class="cursor-pointer"
@click="nextPage(props.row)"
>
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td
key="citizenId"
:props="props"
@click="nextPage(props.row)"
>
{{ props.row.citizenId }}
</q-td>
<q-td
key="fullname"
:props="props"
@click="nextPage(props.row)"
>
<q-td key="fullname" :props="props">
{{ props.row.fullname }}
</q-td>
<q-td
key="organizationName"
:props="props"
@click="nextPage(props.row)"
>
<div
v-if="
props.row.orgName !== null ||
props.row.positionPath !== null
"
>
<div class="col-4">
<div class="text-weight-medium">
{{
props.row.orgName !== null ? props.row.orgName : "-"
}}
{{
props.row.organizationShortName !== null
? `(${props.row.organizationShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{
props.row.positionPath !== null
? props.row.positionPath
: "-"
}}
{{
props.row.positionNumber !== null
? `(${props.row.positionNumber})`
: ""
}}
</div>
</div>
</div>
<div v-else>
<div class="col-4">
<div class="text-weight-medium">-</div>
</div>
<q-td key="position" :props="props">
{{ props.row.position }}
</q-td>
<q-td key="positionLevel" :props="props">
{{ props.row.positionLevel }}
</q-td>
<q-td key="organizationPositionOld" :props="props">
<div class="table_ellipsis">
{{ props.row.organizationPositionOld }}
<!-- <q-tooltip>
{{ props.row.organizationPositionOld }}
</q-tooltip> -->
</div>
</q-td>
<q-td
key="birthday"
:props="props"
@click="nextPage(props.row)"
>
{{ props.row.birthday }}
<q-td key="organization" :props="props">
<div class="table_ellipsis">
{{ props.row.organization }}
<!-- <q-tooltip>
{{ props.row.organization }}
</q-tooltip> -->
</div>
</q-td>
<q-td key="status" :props="props" @click="nextPage(props.row)">
{{ props.row.status }}
<q-td key="statustext" :props="props">
{{ props.row.statustext }}
</q-td>
<q-td auto-width>
<q-td key="statustext" :props="props">
<q-btn
icon="mdi-dots-vertical"
size="12px"
color="grey-7"
flat
round
class="text-red-14"
icon="mdi-delete"
dense
@click.stop="clickDelete(props.row.personalId)"
><q-tooltip>ลบขอม</q-tooltip></q-btn
>
<q-menu
transition-show="jump-down"
transition-hide="jump-up"
>
<q-list dense style="min-width: 100px">
<q-item
clickable
v-close-popup
@click="openModalTree(props.row.personalId)"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
<q-icon
color="primary"
size="xs"
name="mdi-bookmark-outline"
/>
</q-item-section>
<q-item-section
>เลอกหนวยงานทบโอน</q-item-section
>
</q-item>
<q-item
clickable
v-close-popup
@click="clickDelete(props.row.personalId)"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
<q-tooltip>ลบขอม</q-tooltip>
<q-icon color="red" size="xs" name="mdi-delete" />
</q-item-section>
<q-item-section>ลบ</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-td>
</q-tr>
</template>
@ -659,54 +613,27 @@ const status = (val: string) => {
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="citizenId" :props="props" @click="nextPage(props.row)">
{{ props.row.citizenId }}
</q-td>
<q-td key="fullname" :props="props" @click="nextPage(props.row)">
<q-td key="fullname" :props="props">
{{ props.row.fullname }}
</q-td>
<q-td
key="organizationName"
:props="props"
@click="nextPage(props.row)"
>
<div
v-if="
props.row.orgName !== null ||
props.row.positionPath !== null
"
>
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.orgName !== null ? props.row.orgName : "-" }}
{{
props.row.organizationShortName !== null
? `(${props.row.organizationShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{
props.row.positionPath !== null
? props.row.positionPath
: "-"
}}
{{
props.row.positionNumber !== null
? `(${props.row.positionNumber})`
: ""
}}
</div>
</div>
</div>
<div v-else>
<div class="col-4">
<div class="text-weight-medium">-</div>
</div>
<q-td key="position" :props="props">
{{ props.row.position }}
</q-td>
<q-td key="positionLevel" :props="props">
{{ props.row.positionLevel }}
</q-td>
<q-td key="organizationPositionOld" :props="props">
<div class="table_ellipsis">
{{ props.row.organizationPositionOld }}
</div>
</q-td>
<q-td key="birthday" :props="props" @click="nextPage(props.row)">
{{ props.row.birthday }}
<q-td key="organization" :props="props">
<div class="table_ellipsis">
{{ props.row.organization }}
</div>
</q-td>
<q-td key="statustext" :props="props">
{{ props.row.statustext }}
</q-td>
</q-tr>
</template>
@ -724,12 +651,12 @@ const status = (val: string) => {
</q-card>
</q-dialog>
<DialogOrgTree
<!-- <DialogOrgTree
v-model:modal="modalTree"
:close="closeModalTree"
:personal="personal"
:personalId="personalId"
/>
/> -->
<!-- :personalId="personalId" -->
</template>
<style scoped lang="scss"></style>