Merge branch 'develop' into nice_dev

# Conflicts:
#	src/api/registry/api.profile.ts
This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-23 15:34:28 +07:00
commit 286c4bfd2f
2 changed files with 51 additions and 6 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}`,

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");
}
}