api รายชื่อลูกจ้างชั่วคราว

This commit is contained in:
AnandaTon 2023-07-21 12:22:14 +07:00
parent 6b80d6804f
commit c44585a8b4
2 changed files with 411 additions and 243 deletions

View file

@ -1,13 +1,47 @@
interface FormRegistryEmployee {
no: string;
name: string;
positionNum: string;
id: string;
fullname: String;
fullnameOld: String;
oc: String;
position: string;
path: string;
type: string;
level: string;
affiliation: string;
yearly: number;
pay: string;
positionPathSide: String;
positionLine: String;
govAge: number;
refSalary: String;
positionEmployeePosition: String | null;
positionEmployeePositionSide: String | null;
positionEmployeeGroup: String | null;
age: String;
amount: String;
dateAppoint: String | null;
dateStart: String | null;
createdAt: String | null;
// salaryDate: String | null;
isLeave: String;
// leaveReason: string;
leaveDateOrder: String | null;
}
export type { FormRegistryEmployee };
interface ResponseEmployeeTemp {
id: string;
fullname: String;
fullnameOld: String;
oc: String;
position: string;
positionPathSide: String;
positionLine: String;
govAge: number;
refSalary: String;
positionEmployeePosition: String | null;
positionEmployeePositionSide: String | null;
positionEmployeeGroup: String | null;
age: String;
amount: String;
dateAppoint: Date | null;
dateStart: Date | null;
createdAt: Date | null;
salaryDate: Date | null;
isLeave: boolean;
leaveReason: string;
leaveDateOrder: Date | null;
}
export type { ResponseEmployeeTemp, FormRegistryEmployee };

View file

@ -33,7 +33,7 @@
</q-input>
<!-- แสดงคอลมนใน table -->
<q-select
v-model="visibleColumns"
v-model="visibleColumnsEmployeeTemp"
:display-value="$q.lang.table.columns"
multiple
outlined
@ -55,7 +55,7 @@
dense
:rows="rows"
:columns="columns"
:visible-columns="visibleColumns"
:visible-columns="visibleColumnsEmployeeTemp"
:filter="filter"
row-key="name"
class="custom-header-table"
@ -75,33 +75,58 @@
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="positionNum" :props="props">
{{ props.row.positionNum }}
<q-td key="fullname" :props="props">
{{ props.row.fullname }}
</q-td>
<q-td key="name" :props="props">
{{ props.row.name }}
<q-td key="positionEmployeePosition" :props="props">
{{ props.row.positionEmployeePosition }}
</q-td>
<q-td key="position" :props="props">
{{ props.row.position }}
<q-td key="positionEmployeePositionSide" :props="props">
{{ props.row.positionEmployeePositionSide }}
</q-td>
<q-td key="path" :props="props">
{{ props.row.path }}
<q-td key="positionLine" :props="props">
{{ props.row.positionLine }}
</q-td>
<q-td key="type" :props="props">
{{ props.row.type }}
<q-td key="positionEmployeeGroup" :props="props">
{{ props.row.positionEmployeeGroup }}
</q-td>
<q-td key="level" :props="props">
{{ props.row.level }}
<q-td key="oc" :props="props">
{{ props.row.oc }}
</q-td>
<q-td key="affiliation" :props="props">
{{ props.row.affiliation }}
<q-td key="amount" :props="props">
{{ props.row.amount }}
</q-td>
<q-td key="yearly" :props="props">
{{ props.row.yearly }}
<q-td key="govAge" :props="props">
{{ props.row.govAge }}
</q-td>
<q-td key="pay" :props="props">
{{ props.row.pay }}
<q-td key="dateAppoint" :props="props">
{{ props.row.dateAppoint }}
</q-td>
<q-td key="dateStart" :props="props">
{{ props.row.dateStart }}
</q-td>
<q-td key="salaryDate" :props="props">
{{ props.row.salaryDate }}
</q-td>
<q-td key="refSalary" :props="props">
{{ props.row.refSalary }}
</q-td>
<q-td key="age" :props="props">
{{ props.row.age }}
</q-td>
<q-td key="fullnameOld" :props="props">
{{ props.row.fullnameOld }}
</q-td>
<q-td key="createdAt" :props="props">
{{ props.row.createdAt }}
</q-td>
<q-td key="isLeave" :props="props">
{{ props.row.isLeave }}
</q-td>
<q-td key="leaveDateOrder" :props="props">
{{ props.row.leaveDateOrder }}
</q-td>
<q-td auto-width>
<q-btn
icon="mdi-dots-vertical"
@ -169,7 +194,11 @@
</q-table>
</div>
</q-card>
<q-dialog v-model="modal" persistent>
<q-card flat bordered class="col-12 q-mt-sm q-pt-sm q-pa-md"> </q-card>
</q-dialog>
</template>
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
@ -179,7 +208,11 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import type { treeTab } from "@/modules/05_placement/interface/index/Main";
import { FormRegistryEmployee } from "@/modules/08_registryEmployee/request/Main.ts";
import {
FormRegistryEmployee,
ResponseEmployeeTemp,
} from "@/modules/08_registryEmployee/request/Main.ts";
import { useDataStore } from "@/stores/data";
const props = defineProps({
next: {
@ -194,20 +227,16 @@ const props = defineProps({
const $q = useQuasar();
const mixin = useCounterMixin(); //
const { dialogMessage, messageError, showLoader, hideLoader } = mixin;
const { typeRetire, success, messageError, showLoader, hideLoader, date2Thai } =
mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const router = useRouter();
const myForm = ref<QForm>();
const filterRef = ref<QInput>();
const filter = ref<string>("");
const mutiselect = ref([]);
const selected = ref<string>("");
const modal = ref<boolean>(false);
const search = ref<string>("");
const expanded = ref<string[]>([]);
const nodesTree = ref<treeTab[]>([]);
const send = ref<String[]>([]);
const selectedModal = ref([]);
const filterModal = ref<string>("");
const visibleColumnsModal = ref<String[]>(["no", "positionNum", "name"]);
const columnsModal = [
{ name: "no", align: "left", label: "ลำดับ", field: "no", sortable: true },
@ -227,12 +256,6 @@ const columnsModal = [
},
];
const paginationModal = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
const pagination = ref({
sortBy: "desc",
descending: false,
@ -242,231 +265,270 @@ const pagination = ref({
const visibleColumns = ref<String[]>([
"no",
"positionNum",
"name",
"position",
"path",
"type",
"level",
"affiliation",
"yearly",
"pay",
"fullname",
"fullnameOld",
"oc",
"positionEmployeePosition",
"positionEmployeePositionSide",
"positionLine",
"govAge",
"positionEmployeeGroup",
"dateAppoint",
"refSalary",
"dateStart",
"createdAt",
"salaryDate",
"age",
"amount",
"isLeave",
"leaveDateOrder",
]);
const visibleColumnsEmployeeTemp = ref<String[]>([]);
visibleColumnsEmployeeTemp.value = [
"no",
"fullname",
"fullnameOld",
"oc",
"positionEmployeePosition",
"positionEmployeePositionSide",
"positionLine",
"govAge",
"positionEmployeeGroup",
"dateAppoint",
"refSalary",
"dateStart",
"createdAt",
"salaryDate",
"age",
"amount",
"isLeave",
"leaveDateOrder",
];
const columns = ref<QTableProps["columns"]>([
{ name: "no", align: "left", label: "ลำดับ", field: "no", sortable: true },
{
name: "name",
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, {
numeric: true,
sensitivity: "base",
}),
},
{
name: "fullname",
align: "left",
label: "ชื่อ-สกุล",
field: "name",
sortable: true,
},
{
name: "positionNum",
align: "left",
label: "ตำแหน่งเลขที่",
field: "positionNum",
sortable: true,
field: "fullname",
headerStyle: "font-size: 14px; min-width: 200px",
style: "font-size: 14px; ",
},
{
name: "position",
name: "positionEmployeePosition",
align: "left",
label: "ตำแหน่ง",
field: "position",
sortable: true,
field: "positionEmployeePosition",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, {
numeric: true,
sensitivity: "base",
}),
},
{
name: "path",
name: "positionEmployeePositionSide",
align: "left",
label: "ด้านของตำแหน่ง",
sortable: true,
field: "positionEmployeePositionSide",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, {
numeric: true,
sensitivity: "base",
}),
},
{
name: "positionLine",
align: "left",
label: "สายงาน",
field: "path",
sortable: true,
field: "positionLine",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, {
numeric: true,
sensitivity: "base",
}),
},
{
name: "type",
name: "positionEmployeeGroup",
align: "left",
label: "ประเภท",
field: "type",
label: "กลุ่มงาน",
sortable: true,
field: "positionEmployeeGroup",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, {
numeric: true,
sensitivity: "base",
}),
},
{
name: "level",
align: "left",
label: "ระดับชั้นงาน",
field: "level",
sortable: true,
},
{
name: "affiliation",
name: "oc",
align: "left",
label: "สังกัด",
field: "affiliation",
sortable: true,
field: "oc",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, {
numeric: true,
sensitivity: "base",
}),
},
{
name: "yearly",
align: "left",
label: "ปีงบประมาณ",
field: "yearly",
sortable: true,
},
{
name: "pay",
name: "amount",
align: "left",
label: "ค่าจ้าง",
field: "pay",
sortable: true,
field: "amount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, {
numeric: true,
sensitivity: "base",
}),
},
{
name: "govAge",
align: "left",
label: "อายุราชการ(ปี)",
sortable: true,
field: "govAge",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, {
numeric: true,
sensitivity: "base",
}),
},
{
name: "dateAppoint",
align: "left",
label: "วันที่จ้าง",
sortable: true,
field: "dateAppoint",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateStart",
align: "left",
label: "วันที่เริ่มปฎิบัติราชการ",
sortable: true,
field: "dateStart",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "salaryDate",
align: "left",
label: "วันที่แต่งตั้ง",
sortable: true,
field: "salaryDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refSalary",
align: "left",
label: "เอกสารอ้างอิง",
sortable: true,
field: "refSalary",
headerStyle: "font-size: 14px; min-width: 200px",
style: "font-size: 14px; ",
},
{
name: "age",
align: "left",
label: "อายุ",
sortable: true,
field: "age",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, {
numeric: true,
sensitivity: "base",
}),
},
{
name: "fullnameOld",
align: "left",
label: "ชื่อ-สกุล(เดิม)",
sortable: true,
field: "fullnameOld",
headerStyle: "font-size: 14px; min-width: 200px",
style: "font-size: 14px; ",
},
{
name: "createdAt",
align: "left",
label: "วันที่สร้าง",
sortable: true,
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "isLeave",
align: "left",
label: "สถานะ",
sortable: true,
field: "isLeave",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "leaveDateOrder",
align: "left",
label: "วันที่พ้นราชการ",
sortable: true,
field: "leaveDateOrder",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const rows = ref<FormRegistryEmployee[]>([
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นายภูวนัย ต้นทอง",
positionNum: "กทม.2",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "35,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางปริศนา ตรีวุฒิ",
positionNum: "กบห.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "38,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางเมษา เกียรติบวรสกุล ",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "25,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางพริมา พงศ์พินิจ",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "30,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางพรพักตร์ พาใจขวัญ",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางชลธิมา คมสกุล ",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "15,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "17,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "20,250",
},
]);
const rows = ref<FormRegistryEmployee[]>([]);
onMounted(async () => {
await nodeTree();
});
@ -522,7 +584,7 @@ const clickAdd = () => {
};
const editDetail = (id: string) => {
router.push({ name: "" });
modal.value = true;
};
const clickDelete = (id: string) => {
@ -536,7 +598,19 @@ const clickDelete = (id: string) => {
persistent: true,
})
.onOk(async () => {
await deleteData(id);
loaderPage(true);
await http
.delete(config.API.profileInforId(id))
.then((res) => {
success($q, "ลบข้อมูลการสอบสำเร็จ");
showEmployeeTemp();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.onCancel(() => {})
.onDismiss(() => {});
@ -548,16 +622,76 @@ const nodeTree = async () => {
.get(config.API.profileOrganizRoot)
.then((res: any) => {
const data = res.data.result;
nodesTree.value = data;
if (data.length > 0) {
expanded.value = [data[0].id];
selected.value = data[0].id;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
.finally(async () => {
hideLoader();
await showEmployeeTemp();
});
};
const showEmployeeTemp = async () => {
let cirteria = [];
cirteria.push({
criteriaType: "employee_class",
criteriaValue: "temp",
});
cirteria.push({
criteriaType: "is_retire",
criteriaValue: "false",
});
if (selected.value == null || selected.value == "") return;
loaderPage(true);
await http
.post(config.API.searchProfileByOcId(selected.value, "all"), {
criterias: cirteria,
})
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseEmployeeTemp) => {
rows.value.push({
id: e.id,
fullname: e.fullname,
fullnameOld: e.fullnameOld,
position: e.position,
positionPathSide: e.positionPathSide,
positionLine: e.positionLine,
govAge: e.govAge,
positionEmployeePosition: e.positionEmployeePosition,
positionEmployeePositionSide: e.positionEmployeePositionSide,
positionEmployeeGroup: e.positionEmployeeGroup,
oc: e.oc,
age: e.age,
amount: e.amount == null ? "" : e.amount.toLocaleString(),
refSalary: e.refSalary,
dateAppoint:
e.dateAppoint == null ? null : date2Thai(new Date(e.dateAppoint)),
dateStart:
e.dateStart == null ? null : date2Thai(new Date(e.dateStart)),
createdAt:
e.createdAt == null ? null : date2Thai(new Date(e.createdAt)),
isLeave: e.isLeave == false ? "ครอง" : `${typeRetire(e.leaveReason)}`,
leaveDateOrder:
e.leaveDateOrder == null
? null
: date2Thai(new Date(e.leaveDateOrder)),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};