check citizenId
This commit is contained in:
parent
a35309c68b
commit
b0e5bc6b46
4 changed files with 30 additions and 14 deletions
|
|
@ -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?.();
|
||||
|
|
|
|||
|
|
@ -457,6 +457,7 @@ watch(
|
|||
v-model:modal="modalDialogAdd"
|
||||
:fetchData="props.fetchData"
|
||||
:fetchType="props.fetchType"
|
||||
:empType="empType"
|
||||
/>
|
||||
|
||||
<DialogHistory v-model:modal="modalHistory" />
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue