ค้นหาคนในทะเบียนประวัติ กรณีผู้ถูกร้องเรียนเป็นบุคคล #34
This commit is contained in:
parent
e9ac152cf7
commit
861cbf6eff
3 changed files with 127 additions and 74 deletions
|
|
@ -188,10 +188,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`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
16
src/interface/response/listPerson.ts
Normal file
16
src/interface/response/listPerson.ts
Normal 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 };
|
||||||
Loading…
Add table
Add a link
Reference in a new issue