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) => ({
...e,
posMasterNo:
e.orgShortname +
e.posMasterNoPrefix +
e.posMasterNo +
e.posMasterNoSuffix,
(e.orgShortname !== null ? e.orgShortname : "") +
(e.posMasterNoPrefix ? e.posMasterNoPrefix : "") +
(e.posMasterNo !== null ? e.posMasterNo : "") +
(e.posMasterNoSuffix !== null ? e.posMasterNoPrefix : ""),
}));
rows.value = list;
})
.catch((err) => {

View file

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

View file

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

View file

@ -23,6 +23,7 @@ const {
date2Thai,
messageError,
dialogConfirm,
dialogMessageNotify,
} = mixin;
const { calculateAge, fetchPerson, filterSelector } = store;
const profileId = ref<string>(
@ -334,7 +335,7 @@ function onSubmit() {
async function clickHistory() {
modalHistory.value = true;
await http
.get(config.API.profileNewProfileHisById(id.value,empType.value))
.get(config.API.profileNewProfileHisById(id.value, empType.value))
.then((res) => {
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(
() => formData.birthDate,
(v) => {
@ -498,6 +518,7 @@ onMounted(async () => {
val.length >= 13 ||
`${'กรุณากรอกเลขประจำตัวประชาชนให้ครบ'}`,
]"
@update:model-value="changeCardID"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">

View file

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

View file

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