Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop

* 'develop' of github.com:Frappet/bma-ehr-frontend:
  โครงสร้าง
  check citizenId
  แก้คำผืด
This commit is contained in:
Warunee Tamkoo 2024-05-15 12:18:32 +07:00
commit 1f87c51fb0
6 changed files with 40 additions and 23 deletions

View file

@ -128,11 +128,12 @@ async function fetchTable() {
const list = data.map((e: PosMaster) => ({ const list = data.map((e: PosMaster) => ({
...e, ...e,
posMasterNo: posMasterNo:
e.orgShortname + (e.orgShortname !== null ? e.orgShortname : "") +
e.posMasterNoPrefix + (e.posMasterNoPrefix ? e.posMasterNoPrefix : "") +
e.posMasterNo + (e.posMasterNo !== null ? e.posMasterNo : "") +
e.posMasterNoSuffix, (e.posMasterNoSuffix !== null ? e.posMasterNoPrefix : ""),
})); }));
rows.value = list; rows.value = list;
}) })
.catch((err) => { .catch((err) => {

View file

@ -30,6 +30,7 @@ const {
} = useCounterMixin(); } = useCounterMixin();
const { calculateAge } = profileStore; const { calculateAge } = profileStore;
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const empType = defineModel<string>("empType", { required: true });
const props = defineProps({ const props = defineProps({
fetchData: { type: Function }, fetchData: { type: Function },
@ -140,8 +141,9 @@ function clearFormData() {
async function onSubmit() { async function onSubmit() {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
const type = empType.value !== "officer" ? "-employee" : "";
await http await http
.post(config.API.registryNew, formData) .post(config.API.registryNew(type), formData)
.then(() => { .then(() => {
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
props.fetchData?.(); props.fetchData?.();

View file

@ -457,6 +457,7 @@ watch(
v-model:modal="modalDialogAdd" v-model:modal="modalDialogAdd"
:fetchData="props.fetchData" :fetchData="props.fetchData"
:fetchType="props.fetchType" :fetchType="props.fetchType"
:empType="empType"
/> />
<DialogHistory v-model:modal="modalHistory" /> <DialogHistory v-model:modal="modalHistory" />

View file

@ -23,6 +23,7 @@ const {
date2Thai, date2Thai,
messageError, messageError,
dialogConfirm, dialogConfirm,
dialogMessageNotify,
} = mixin; } = mixin;
const { calculateAge, fetchPerson, filterSelector } = store; const { calculateAge, fetchPerson, filterSelector } = store;
const profileId = ref<string>( const profileId = ref<string>(
@ -334,7 +335,7 @@ function onSubmit() {
async function clickHistory() { async function clickHistory() {
modalHistory.value = true; modalHistory.value = true;
await http await http
.get(config.API.profileNewProfileHisById(id.value,empType.value)) .get(config.API.profileNewProfileHisById(id.value, empType.value))
.then((res) => { .then((res) => {
rowsHistory.value = res.data.result; rowsHistory.value = res.data.result;
}) })
@ -346,6 +347,25 @@ async function clickHistory() {
}); });
} }
function changeCardID(citizenId: string | number | null) {
if (citizenId != null && typeof citizenId == "string") {
if (citizenId.length == 13 && citizenId) {
http
.put(config.API.profileNewCitizenId(citizenId), {
citizenId: citizenId,
})
.then(() => {})
.catch((err) => {
if (err.response.data.status === 500) {
dialogMessageNotify($q, err.response.data.message);
} else {
messageError($q, err);
}
});
}
}
}
watch( watch(
() => formData.birthDate, () => formData.birthDate,
(v) => { (v) => {
@ -498,6 +518,7 @@ onMounted(async () => {
val.length >= 13 || val.length >= 13 ||
`${'กรุณากรอกเลขประจำตัวประชาชนให้ครบ'}`, `${'กรุณากรอกเลขประจำตัวประชาชนให้ครบ'}`,
]" ]"
@update:model-value="changeCardID"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">

View file

@ -133,7 +133,9 @@ const fromData = reactive({
statusMarital: "", statusMarital: "",
}); });
function onSubmit() { function onSubmit(type: string) {
console.log(type);
dialogConfirm($q, () => { dialogConfirm($q, () => {
closeDialog(); closeDialog();
}); });
@ -224,14 +226,6 @@ function fetchData() {
}, },
]; ];
const data3 = {
isLive: 1,
citizenId: "1231231231231",
prefix: "นาย",
firstName: "ตรีชาไทย",
lastName: "หวังดี",
job: "จอมพล",
};
spouseData.value = data; spouseData.value = data;
childData.value = data2; childData.value = data2;
} }
@ -605,7 +599,7 @@ onMounted(() => {
<q-dialog v-model="modal" class="dialog" persistent> <q-dialog v-model="modal" class="dialog" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<q-form @submit.prevent greedy @validation-success="onSubmit()"> <q-form @submit.prevent greedy @validation-success="onSubmit(typeForm)">
<DialogHeader <DialogHeader
:tittle="isEdit ? 'แก้ไขข้อมูลครอบครัว' : 'เพิ้มข้อมูลครอบครัว'" :tittle="isEdit ? 'แก้ไขข้อมูลครอบครัว' : 'เพิ้มข้อมูลครอบครัว'"
:close="closeDialog" :close="closeDialog"
@ -776,13 +770,11 @@ onMounted(() => {
<q-separator /> <q-separator />
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn <q-btn
dense
unelevated unelevated
label="บันทึก" label="บันทึก"
id="onSubmit" id="onSubmit"
type="submit" type="submit"
color="public" color="public"
class="q-px-md"
> >
<q-tooltip>นทกขอม</q-tooltip> <q-tooltip>นทกขอม</q-tooltip>
</q-btn> </q-btn>
@ -793,7 +785,7 @@ onMounted(() => {
<q-dialog v-model="modalHistory" class="dialog" persistent> <q-dialog v-model="modalHistory" class="dialog" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<DialogHeader tittle="ประวัติแก้ไขข้อมูลที่อยู่" :close="closeDialog" /> <DialogHeader tittle="ประวัติแก้ไขข้อมูลครอบครัว" :close="closeDialog" />
<q-separator color="grey-4" /> <q-separator color="grey-4" />
<q-card-section> <q-card-section>
<div class="row q-gutter-sm q-mb-sm"> <div class="row q-gutter-sm q-mb-sm">

View file

@ -127,10 +127,10 @@ async function fetchTable() {
const list = data.map((e: PosMaster) => ({ const list = data.map((e: PosMaster) => ({
...e, ...e,
posMasterNo: posMasterNo:
e.orgShortname + (e.orgShortname !== null ? e.orgShortname : "") +
e.posMasterNoPrefix + (e.posMasterNoPrefix ? e.posMasterNoPrefix : "") +
e.posMasterNo + (e.posMasterNo !== null ? e.posMasterNo : "") +
e.posMasterNoSuffix, (e.posMasterNoSuffix !== null ? e.posMasterNoPrefix : ""),
})); }));
rows.value = list; rows.value = list;
}) })