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}`,
profileSearchNewEmOcLeaveId: (id: string) =>
`${profile}search/new-employee/oc/leave/${id}`,
profileSearchPersonal: () => `${profile}search-personal`,
profileEmployeeTempId: (id: string) => `${profile}employee/temp/${id}`,
profileCoupleId: (profileId: string) => `${profile}couple/${profileId}`,
@ -188,10 +189,8 @@ export default {
//ระบบ ลูกจ้างชั่คราว
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">
import { ref, onMounted,watch } from "vue";
import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { ResponsePreson } from "@/interface/response/listPerson";
const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogConfirm, dialogMessageNotify } = mixin;
const { dialogConfirm, dialogMessageNotify, showLoader, hideLoader } = mixin;
const data = [
{
id: "001",
idcard: "0000000000001",
prefix: "นาง",
firstName: "ศิรินภา",
lastName: "คงน้อย",
posNo: "สกก.1",
position: "ตำเเหน่ง1",
positionLevel: "level1",
salary: "100",
organization: "สำนักงาน 1",
name: "นางศิรินภา คงน้อย",
},
{
id: "002",
idcard: "0000000000002",
prefix: "นาย",
firstName: "แก้ว",
lastName: "คำ",
posNo: "สกก.1",
position: "ตำแหน่ง2",
positionLevel: "level2",
salary: "100",
organization: "สำนักงาน 2",
name: "นางแก้ว คำ",
},
{
id: "003",
idcard: "0000000000003",
prefix: "นาย",
firstName: "ภัทรานุย",
lastName: "คงนอย",
posNo: "สกก.1",
position: "ตำแหน่ง2",
positionLevel: "level3",
salary: "100",
organization: "สำนักงาน 3",
name: "นางภัทรานุย คงนอย",
},
];
{
id: "001",
idcard: "0000000000001",
prefix: "นาง",
firstName: "ศิรินภา",
lastName: "คงน้อย",
posNo: "สกก.1",
position: "ตำเเหน่ง1",
positionLevel: "level1",
salary: "100",
organization: "สำนักงาน 1",
name: "นางศิรินภา คงน้อย",
},
{
id: "002",
idcard: "0000000000002",
prefix: "นาย",
firstName: "แก้ว",
lastName: "คำ",
posNo: "สกก.1",
position: "ตำแหน่ง2",
positionLevel: "level2",
salary: "100",
organization: "สำนักงาน 2",
name: "นางแก้ว คำ",
},
{
id: "003",
idcard: "0000000000003",
prefix: "นาย",
firstName: "ภัทรานุย",
lastName: "คงนอย",
posNo: "สกก.1",
position: "ตำแหน่ง2",
positionLevel: "level3",
salary: "100",
organization: "สำนักงาน 3",
name: "นางภัทรานุย คงนอย",
},
];
interface typeOp {
id: string;
@ -170,9 +174,9 @@ const columns = ref<QTableProps["columns"]>([
/** รับค่ามาจาก หน้าหลัก */
const props = defineProps({
checkId:{
type:Array,
default:[]
checkId: {
type: Array,
default: [],
},
modal: {
type: Boolean,
@ -215,7 +219,7 @@ async function close() {
/** เปิด dialog ยืนยัน */
function savePost() {
if (selected.value.length != 0) {
dialogConfirm($q, () => saveData());
dialogConfirm($q, () => console.log(selected.value));
} else {
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 รายการ");
}
@ -227,15 +231,45 @@ function saveData() {
emit("returnData", selected.value);
}
const searchRef = ref<any>(null);
/** input ค้นหา */
function searchInput() {
const data = dataObject.value;
if (type.value === "idcard") {
rows.value = data.filter((item: any) => item.idcard === search.value);
} else if (type.value === "firstname") {
rows.value = data.filter((item: any) => item.firstName === search.value);
} else if (type.value === "lastname") {
rows.value = data.filter((item: any) => item.lastName === search.value);
async function searchInput() {
searchRef.value.validate();
if (!searchRef.value.hasError) {
showLoader();
const body = {
fieldName: type.value,
keyword: 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 */
function updateSelect() {
rows.value = dataObject.value;
search.value = "";
}
watch(() => props.modal, () => {
if (props.modal === true) {
console.log(props.checkId);
const dataProps = props.checkId.map((item: any) => item.idcard);
const dataMapId = data.filter((item: any) => !dataProps.includes(item.idcard));
rows.value = dataMapId
}
});
// watch(
// () => props.modal,
// () => {
// if (props.modal === true) {
// console.log(props.checkId);
// const dataProps = props.checkId.map((item: any) => item.idcard);
// const dataMapId = data.filter(
// (item: any) => !dataProps.includes(item.idcard)
// );
// rows.value = dataMapId;
// }
// }
// );
/** เรียกข้อมูลเมื่อเริ่มโหลด หน้า dialog mock */
onMounted(() => {
dataObject.value = data;
rows.value = data;
// dataObject.value = data;
// rows.value = data;
});
</script>
@ -304,12 +342,13 @@ onMounted(() => {
<div class="col-12 col-sm-6 col-md-6">
<q-input
ref="searchRef"
v-model="search"
outlined
clearable
@update:model-value="updateInput"
dense
label="คำค้น"
:rules="[(val) => !!val || `กรุณากรอกคำค้น`]"
/>
</div>
@ -330,7 +369,7 @@ onMounted(() => {
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
row-key="personId"
flat
bordered
:paging="true"
@ -383,8 +422,8 @@ onMounted(() => {
{{ props.rowIndex + 1 }}
</div>
<div v-if="col.name === 'fullName'">
{{ props.prefix }}
</div>
{{ props.prefix }}
</div>
<div>
{{ col.value }}
</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>({
year: 0, //*( .)
year: new Date().getFullYear(), //*( .)
type: "00000000-0000-0000-0000-000000000000", //*Id
status: "ALL", //*
page: 1, //*
pageSize: 5, //*
pageSize: 10, //*
keyword: "", //keyword
});
const maxPage = ref<number>(1);
@ -54,7 +54,6 @@ function updatePaging(
querySting.page = newPage;
querySting.pageSize = pageSize;
querySting.keyword = dateFilter ? dateFilter.keyword : querySting.keyword;
console.log(querySting);
}
@ -102,7 +101,10 @@ onMounted(async () => {
</q-tabs>
</q-toolbar>
<div v-if="leaveStore.tabView === 'list'">
<ToolBar @update:querySting="updatePaging" />
<ToolBar
:rowsPerPage="querySting.pageSize"
@update:querySting="updatePaging"
/>
<TableList
:page="querySting.page"
:rowsPerPage="querySting.pageSize"

View file

@ -11,11 +11,18 @@ import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
const leaveStore = useLeavelistDataStore();
const props = defineProps({
rowsPerPage: {
type: Number,
require: true,
},
});
const emit = defineEmits(["update:querySting"]);
/** formFilter*/
const filter = reactive<DateFilter>({
year: 0, //*( .)
year: new Date().getFullYear(), //*( .)
type: "00000000-0000-0000-0000-000000000000", //*Id
status: "ALL", //*
keyword: "", //keyword
@ -38,20 +45,14 @@ function updateQuerySting(
/** function ค้นหาข้อมูลใน Table*/
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*/
const optionYear = ref<DataOption2[]>([
{
id: 0,
name: "ทั้งหมด",
},
{
id: 2023,
name: "2566",
},
]);
const optionType = ref<DataOption[]>([
{
id: "00000000-0000-0000-0000-000000000000",
@ -138,19 +139,52 @@ onMounted(async () => {
<template>
<div class="row col-12 q-col-gutter-sm q-mb-sm">
<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"
emit-value
map-options
outlined
dense
v-model="filter.year"
:options="optionYear"
:options="optionStatus"
option-value="id"
option-label="name"
label="ปีงบประมาณ"
@update:model-value="filterListLeave"
/>
/> -->
</div>
<div class="col-xs-12 col-sm-3 col-md-2">
<q-select

View file

@ -1,10 +1,24 @@
<script setup lang="ts">
import { ref, reactive, watch } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import type {
FormData,
FormRef,
} 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 หล
*/
@ -19,9 +33,7 @@ const props = defineProps({
},
});
const emit = defineEmits([
"formDataReturn"
])
const emit = defineEmits(["formDataReturn"]);
/**
* อมลรหสบตรประชาชน
*/
@ -33,13 +45,13 @@ const idCardRef = ref<any>(null);
* อมลทงกอน form
*/
const formData = reactive<FormData>({
personalId:"",
personalId: "",
prefix: "",
firstname: "",
lastname: "",
position: "",
phone: "",
email: ""
email: "",
});
/**
@ -61,8 +73,40 @@ watch(props.data, async () => {
* เพมบคลากร
*/
function addEmployee() {
if (idCardRef.value.validate()) {
if (idCard.value.length === 13) {
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");
}
}