no message

This commit is contained in:
Kittapath 2023-07-11 10:41:31 +07:00
parent dc05b4740c
commit cf343f7b8f
19 changed files with 2595 additions and 2416 deletions

View file

@ -5,11 +5,12 @@
header="ข้อมูลที่อยู่"
icon="mdi-map-marker"
:save="saveData"
:history="true"
:history="!statusAdd()"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
:historyClick="clickHistory"
:addEmployee="statusAdd()"
/>
<q-form ref="myform">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
@ -311,6 +312,10 @@ const props = defineProps({
type: Boolean,
required: true,
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -507,8 +512,28 @@ const visibleColumnsHistory = ref<String[]>([
onMounted(async () => {
await getNewData();
emit("update:statusEdit", false);
defaultAdd();
});
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
addressData.value = {
address: null,
provinceId: null,
districtId: null,
subdistrictId: null,
addressC: null,
provinceIdC: null,
districtIdC: null,
subdistrictIdC: null,
same: "0",
};
}
};
const filterSelector = (val: any, update: Function, refData: string) => {
switch (refData) {
case "provinceOps":
@ -675,10 +700,32 @@ const editData = async () => {
});
};
const addData = async () => {
// loaderPage(true);
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// edit.value = false;
// emit("update:statusEdit", false);
// await fetchData();
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
await editData();
if (props.statusAdd) {
await addData();
} else {
await editData();
}
} else {
}
});

View file

@ -486,31 +486,33 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
await http
.get(config.API.profileCertId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
certificateNo: e.certificateNo,
issuer: e.issuer,
issueDate: new Date(e.issueDate),
expireDate: new Date(e.expireDate),
certificateType: e.certificateType,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
if (profileId.value) {
loaderPage(true);
await http
.get(config.API.profileCertId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
certificateNo: e.certificateNo,
issuer: e.issuer,
issueDate: new Date(e.issueDate),
expireDate: new Date(e.expireDate),
certificateType: e.certificateType,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
/**

View file

@ -5,11 +5,12 @@
header="ข้อมูลครอบครัว"
icon="mdi-account-group"
:save="saveData"
:history="true"
:history="!statusAdd()"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
:historyClick="historyData"
:addEmployee="statusAdd()"
/>
<q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
@ -1114,6 +1115,10 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -1171,8 +1176,43 @@ onMounted(async () => {
await fetchPrefix();
await fetchData();
emit("update:statusEdit", false);
defaultAdd();
});
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
familyData.value = {
prefixC: null,
prefixIdC: null,
firstnameC: null,
lastnameC: null,
lastnameCOld: null,
occupationC: null,
citizenIdC: null,
liveC: null,
prefixM: null,
prefixIdM: null,
firstnameM: null,
lastnameM: null,
occupationM: null,
citizenIdM: null,
liveM: null,
prefixF: null,
prefixIdF: null,
firstnameF: null,
lastnameF: null,
occupationF: null,
citizenIdF: null,
liveF: null,
same: "0",
childrens: [],
};
}
};
const historyData = async () => {
await fetchHistory();
};
@ -1400,10 +1440,32 @@ const editData = async () => {
});
};
const addData = async () => {
// loaderPage(true);
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// edit.value = false;
// emit("update:statusEdit", false);
// await fetchData();
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => {
await myform.value?.validate().then(async (success: boolean) => {
if (success) {
await editData();
if (props.statusAdd) {
await addData();
} else {
await editData();
}
} else {
}
});

View file

@ -5,11 +5,12 @@
header="ข้อมูลส่วนตัว"
icon="mdi-account"
:save="saveData"
:history="true"
:history="!statusAdd()"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="onCancel"
:historyClick="clickHistory"
:addEmployee="statusAdd()"
/>
<q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-sm q-col-gutter-y-sm">
@ -439,6 +440,10 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -693,8 +698,36 @@ onMounted(async () => {
await fetchPerson();
await fetchData();
emit("update:statusEdit", false);
defaultAdd();
});
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
informaData.value = {
cardid: null,
age: null,
prefix: null,
prefixId: null,
firstname: null,
lastname: null,
birthDate: new Date(),
genderId: null,
bloodId: null,
nationality: null,
ethnicity: null,
statusId: null,
religionId: null,
tel: null,
employeeType: null,
employeeClass: null,
profileType: null,
};
}
};
const onCancel = async () => {
if (myform.value != null) {
myform.value.reset();
@ -1045,11 +1078,33 @@ const editData = async () => {
});
};
const addData = async () => {
// loaderPage(true);
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// edit.value = false;
// emit("update:statusEdit", false);
// await fetchData();
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => {
if (myform.value != null) {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
await editData();
if (props.statusAdd) {
await addData();
} else {
await editData();
}
} else {
}
});