Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2023-11-23 15:41:40 +07:00
commit 422ea07f4d
6 changed files with 233 additions and 99 deletions

View file

@ -45,6 +45,7 @@ export default {
`${profile}search/new-employee/oc/${id}`, `${profile}search/new-employee/oc/${id}`,
profileSearchNewEmOcLeaveId: (id: string) => profileSearchNewEmOcLeaveId: (id: string) =>
`${profile}search/new-employee/oc/leave/${id}`, `${profile}search/new-employee/oc/leave/${id}`,
profileSearchPersonal: () => `${profile}search-personal`,
profileEmployeeTempId: (id: string) => `${profile}employee/temp/${id}`, profileEmployeeTempId: (id: string) => `${profile}employee/temp/${id}`,
profileCoupleId: (profileId: string) => `${profile}couple/${profileId}`, profileCoupleId: (profileId: string) => `${profile}couple/${profileId}`,
@ -188,10 +189,8 @@ export default {
//ระบบ ลูกจ้างชั่คราว //ระบบ ลูกจ้างชั่คราว
employmentId: (profileId: string) => `${profile}employment/${profileId}`, employmentId: (profileId: string) => `${profile}employment/${profileId}`,
employmentHistoryId: (employmentId: string) => `${profile}employment/history/${employmentId}` employmentHistoryId: (employmentId: string) =>
`${profile}employment/history/${employmentId}`,
searchPersonal: () => `${profile}search-personal`,
}; };

View file

@ -1,54 +1,58 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted,watch } from "vue"; import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { ResponsePreson } from "@/interface/response/listPerson";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dialogConfirm, dialogMessageNotify } = mixin; const { dialogConfirm, dialogMessageNotify, showLoader, hideLoader } = mixin;
const data = [ const data = [
{ {
id: "001", id: "001",
idcard: "0000000000001", idcard: "0000000000001",
prefix: "นาง", prefix: "นาง",
firstName: "ศิรินภา", firstName: "ศิรินภา",
lastName: "คงน้อย", lastName: "คงน้อย",
posNo: "สกก.1", posNo: "สกก.1",
position: "ตำเเหน่ง1", position: "ตำเเหน่ง1",
positionLevel: "level1", positionLevel: "level1",
salary: "100", salary: "100",
organization: "สำนักงาน 1", organization: "สำนักงาน 1",
name: "นางศิรินภา คงน้อย", name: "นางศิรินภา คงน้อย",
}, },
{ {
id: "002", id: "002",
idcard: "0000000000002", idcard: "0000000000002",
prefix: "นาย", prefix: "นาย",
firstName: "แก้ว", firstName: "แก้ว",
lastName: "คำ", lastName: "คำ",
posNo: "สกก.1", posNo: "สกก.1",
position: "ตำแหน่ง2", position: "ตำแหน่ง2",
positionLevel: "level2", positionLevel: "level2",
salary: "100", salary: "100",
organization: "สำนักงาน 2", organization: "สำนักงาน 2",
name: "นางแก้ว คำ", name: "นางแก้ว คำ",
}, },
{ {
id: "003", id: "003",
idcard: "0000000000003", idcard: "0000000000003",
prefix: "นาย", prefix: "นาย",
firstName: "ภัทรานุย", firstName: "ภัทรานุย",
lastName: "คงนอย", lastName: "คงนอย",
posNo: "สกก.1", posNo: "สกก.1",
position: "ตำแหน่ง2", position: "ตำแหน่ง2",
positionLevel: "level3", positionLevel: "level3",
salary: "100", salary: "100",
organization: "สำนักงาน 3", organization: "สำนักงาน 3",
name: "นางภัทรานุย คงนอย", name: "นางภัทรานุย คงนอย",
}, },
]; ];
interface typeOp { interface typeOp {
id: string; id: string;
@ -170,9 +174,9 @@ const columns = ref<QTableProps["columns"]>([
/** รับค่ามาจาก หน้าหลัก */ /** รับค่ามาจาก หน้าหลัก */
const props = defineProps({ const props = defineProps({
checkId:{ checkId: {
type:Array, type: Array,
default:[] default: [],
}, },
modal: { modal: {
type: Boolean, type: Boolean,
@ -215,7 +219,7 @@ async function close() {
/** เปิด dialog ยืนยัน */ /** เปิด dialog ยืนยัน */
function savePost() { function savePost() {
if (selected.value.length != 0) { if (selected.value.length != 0) {
dialogConfirm($q, () => saveData()); dialogConfirm($q, () => console.log(selected.value));
} else { } else {
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 รายการ"); dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 รายการ");
} }
@ -227,15 +231,45 @@ function saveData() {
emit("returnData", selected.value); emit("returnData", selected.value);
} }
const searchRef = ref<any>(null);
/** input ค้นหา */ /** input ค้นหา */
function searchInput() { async function searchInput() {
const data = dataObject.value; searchRef.value.validate();
if (type.value === "idcard") { if (!searchRef.value.hasError) {
rows.value = data.filter((item: any) => item.idcard === search.value); showLoader();
} else if (type.value === "firstname") { const body = {
rows.value = data.filter((item: any) => item.firstName === search.value); fieldName: type.value,
} else if (type.value === "lastname") { keyword: search.value,
rows.value = data.filter((item: any) => item.lastName === search.value); };
await http
.post(config.API.searchPersonal(), body)
.then((res) => {
const data = res.data.result;
const list = data.map((e: ResponsePreson) => ({
personId: e.personId,
idcard: e.idcard,
prefix: e.prefix,
firstName: e.firstName,
lastName: e.lastName,
fullName: `${e.prefix}${e.firstName} ${e.lastName}`,
posNo: e.posNo ?? "-",
position: e.position ?? "-",
positionLevel: e.positionLevel ?? "-",
salary: e.salaries ?? "-",
organization: e.organization ?? "-",
phone: e.phone ?? "-",
email: e.email ?? "-",
}));
rows.value = list;
console.log(list);
})
.catch((err) => {
console.log(err);
})
.finally(() => {
hideLoader();
});
} }
} }
@ -248,23 +282,27 @@ function updateInput() {
/** update เมื่อเปลี่ยน option */ /** update เมื่อเปลี่ยน option */
function updateSelect() { function updateSelect() {
rows.value = dataObject.value;
search.value = ""; search.value = "";
} }
watch(() => props.modal, () => { // watch(
if (props.modal === true) { // () => props.modal,
console.log(props.checkId); // () => {
const dataProps = props.checkId.map((item: any) => item.idcard); // if (props.modal === true) {
const dataMapId = data.filter((item: any) => !dataProps.includes(item.idcard)); // console.log(props.checkId);
rows.value = dataMapId // const dataProps = props.checkId.map((item: any) => item.idcard);
} // const dataMapId = data.filter(
}); // (item: any) => !dataProps.includes(item.idcard)
// );
// rows.value = dataMapId;
// }
// }
// );
/** เรียกข้อมูลเมื่อเริ่มโหลด หน้า dialog mock */ /** เรียกข้อมูลเมื่อเริ่มโหลด หน้า dialog mock */
onMounted(() => { onMounted(() => {
dataObject.value = data; // dataObject.value = data;
rows.value = data; // rows.value = data;
}); });
</script> </script>
@ -304,12 +342,13 @@ onMounted(() => {
<div class="col-12 col-sm-6 col-md-6"> <div class="col-12 col-sm-6 col-md-6">
<q-input <q-input
ref="searchRef"
v-model="search" v-model="search"
outlined outlined
clearable clearable
@update:model-value="updateInput"
dense dense
label="คำค้น" label="คำค้น"
:rules="[(val) => !!val || `กรุณากรอกคำค้น`]"
/> />
</div> </div>
@ -330,7 +369,7 @@ onMounted(() => {
ref="table" ref="table"
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
row-key="id" row-key="personId"
flat flat
bordered bordered
:paging="true" :paging="true"
@ -383,8 +422,8 @@ onMounted(() => {
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
</div> </div>
<div v-if="col.name === 'fullName'"> <div v-if="col.name === 'fullName'">
{{ props.prefix }} {{ props.prefix }}
</div> </div>
<div> <div>
{{ col.value }} {{ col.value }}
</div> </div>

View file

@ -0,0 +1,16 @@
interface ResponsePreson {
personId: string; //id อ้างอิง profile
idcard: string; //รหัสบัตรประชาชน
prefix: string; //คำนำหน้า
firstName: string; //ชื่อ
lastName: string; //นามสกุล
posNo: string; //เลขที่ตำแหน่ง
position: string; //ตำแหน่ง
positionLevel: string; //ระดับ
salaries: number; //เงินเดือน
organization: string; //สังกัด
email: string; //อีเมล
phone: string; //เบอร์โทรศัพท์
}
export type { ResponsePreson };

View file

@ -28,11 +28,11 @@ function fecthLeaveList() {
// //
const querySting = reactive<QuerySting>({ const querySting = reactive<QuerySting>({
year: 0, //*( .) year: new Date().getFullYear(), //*( .)
type: "00000000-0000-0000-0000-000000000000", //*Id type: "00000000-0000-0000-0000-000000000000", //*Id
status: "ALL", //* status: "ALL", //*
page: 1, //* page: 1, //*
pageSize: 5, //* pageSize: 10, //*
keyword: "", //keyword keyword: "", //keyword
}); });
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
@ -54,7 +54,6 @@ function updatePaging(
querySting.page = newPage; querySting.page = newPage;
querySting.pageSize = pageSize; querySting.pageSize = pageSize;
querySting.keyword = dateFilter ? dateFilter.keyword : querySting.keyword; querySting.keyword = dateFilter ? dateFilter.keyword : querySting.keyword;
console.log(querySting); console.log(querySting);
} }
@ -102,7 +101,10 @@ onMounted(async () => {
</q-tabs> </q-tabs>
</q-toolbar> </q-toolbar>
<div v-if="leaveStore.tabView === 'list'"> <div v-if="leaveStore.tabView === 'list'">
<ToolBar @update:querySting="updatePaging" /> <ToolBar
:rowsPerPage="querySting.pageSize"
@update:querySting="updatePaging"
/>
<TableList <TableList
:page="querySting.page" :page="querySting.page"
:rowsPerPage="querySting.pageSize" :rowsPerPage="querySting.pageSize"

View file

@ -11,11 +11,18 @@ import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
const leaveStore = useLeavelistDataStore(); const leaveStore = useLeavelistDataStore();
const props = defineProps({
rowsPerPage: {
type: Number,
require: true,
},
});
const emit = defineEmits(["update:querySting"]); const emit = defineEmits(["update:querySting"]);
/** formFilter*/ /** formFilter*/
const filter = reactive<DateFilter>({ const filter = reactive<DateFilter>({
year: 0, //*( .) year: new Date().getFullYear(), //*( .)
type: "00000000-0000-0000-0000-000000000000", //*Id type: "00000000-0000-0000-0000-000000000000", //*Id
status: "ALL", //* status: "ALL", //*
keyword: "", //keyword keyword: "", //keyword
@ -38,20 +45,14 @@ function updateQuerySting(
/** function ค้นหาข้อมูลใน Table*/ /** function ค้นหาข้อมูลใน Table*/
async function filterListLeave() { async function filterListLeave() {
filter.status && filter.type && (await updateQuerySting(1, 10, filter)); console.log("test");
// filter.status &&
// filter.type &&
// (await updateQuerySting(1, Number(props.rowsPerPage), filter));
} }
/** Option*/ /** Option*/
const optionYear = ref<DataOption2[]>([
{
id: 0,
name: "ทั้งหมด",
},
{
id: 2023,
name: "2566",
},
]);
const optionType = ref<DataOption[]>([ const optionType = ref<DataOption[]>([
{ {
id: "00000000-0000-0000-0000-000000000000", id: "00000000-0000-0000-0000-000000000000",
@ -138,19 +139,52 @@ onMounted(async () => {
<template> <template>
<div class="row col-12 q-col-gutter-sm q-mb-sm"> <div class="row col-12 q-col-gutter-sm q-mb-sm">
<div class="col-xs-12 col-sm-3 col-md-2"> <div class="col-xs-12 col-sm-3 col-md-2">
<q-select <datepicker
menu-class-name="modalfix"
v-model="filter.year"
class="col-2"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
@update:model-value="filterListLeave"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
lazy-rules
outlined
:model-value="Number(filter.year) + 543"
:label="`${'ปีงบประมาณ'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<!-- <q-select
for="selectYear" for="selectYear"
emit-value emit-value
map-options map-options
outlined outlined
dense dense
v-model="filter.year" v-model="filter.year"
:options="optionYear" :options="optionStatus"
option-value="id" option-value="id"
option-label="name" option-label="name"
label="ปีงบประมาณ" label="ปีงบประมาณ"
@update:model-value="filterListLeave" @update:model-value="filterListLeave"
/> /> -->
</div> </div>
<div class="col-xs-12 col-sm-3 col-md-2"> <div class="col-xs-12 col-sm-3 col-md-2">
<q-select <q-select

View file

@ -1,10 +1,24 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, watch } from "vue"; import { ref, reactive, watch } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import type { import type {
FormData, FormData,
FormRef, FormRef,
} from "@/modules/11_discipline/interface/request/director"; } from "@/modules/11_discipline/interface/request/director";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar();
const mixin = useCounterMixin();
const {
messageError,
showLoader,
dialogMessageNotify,
dialogConfirm,
success,
hideLoader,
} = mixin;
/** /**
* props มาจาก page หล * props มาจาก page หล
*/ */
@ -19,9 +33,7 @@ const props = defineProps({
}, },
}); });
const emit = defineEmits([ const emit = defineEmits(["formDataReturn"]);
"formDataReturn"
])
/** /**
* อมลรหสบตรประชาชน * อมลรหสบตรประชาชน
*/ */
@ -33,13 +45,13 @@ const idCardRef = ref<any>(null);
* อมลทงกอน form * อมลทงกอน form
*/ */
const formData = reactive<FormData>({ const formData = reactive<FormData>({
personalId:"", personalId: "",
prefix: "", prefix: "",
firstname: "", firstname: "",
lastname: "", lastname: "",
position: "", position: "",
phone: "", phone: "",
email: "" email: "",
}); });
/** /**
@ -61,8 +73,40 @@ watch(props.data, async () => {
* เพมบคลากร * เพมบคลากร
*/ */
function addEmployee() { function addEmployee() {
if (idCardRef.value.validate()) { if (idCard.value.length === 13) {
console.log("idCard===>", idCard.value); console.log("idCard===>", idCard.value);
showLoader();
http
.post(config.API.profileSearchPersonal(), {
fieldName: "idcard",
keyword: idCard.value,
})
.then((res) => {
const dataApi = res.data.result;
if (dataApi.length > 0) {
const dataList = dataApi[0];
formData.prefix = dataList.prefix;
formData.firstname = dataList.firstName;
formData.lastname = dataList.lastName;
formData.position = dataList.position;
formData.phone = dataList.phone;
formData.email = dataList.email;
} else {
dialogMessageNotify($q, "ไม่มีข้อมูลบุคคลากรที่ต้องการค้นหา");
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
if (idCard.value.length !== 13) {
hideLoader();
dialogMessageNotify($q, "กรุณากรอกเลขบัตรประชาชนให้ครบ 13 หลัก");
} else {
console.log("nodata");
} }
} }