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

* 'develop' of github.com:Frappet/bma-ehr-frontend:
  ปรับหน้ารายละเอียดของผู้สอบผ่าน เเก้เป็นส่ง name แทน id
  แก้list รูปไม่ตรง
  ทะเบียนประวัติ เปลี่ยนรูป
This commit is contained in:
Warunee Tamkoo 2024-05-16 17:08:02 +07:00
commit 5ac08fd6ea
8 changed files with 99 additions and 51 deletions

View file

@ -90,6 +90,7 @@ const profileFile = ref();
const input = document.createElement("input"); const input = document.createElement("input");
const activeImage = ref<any | null>(null); const activeImage = ref<any | null>(null);
const images = ref<any[]>([]); const images = ref<any[]>([]);
const imagesAlldata = ref<any[]>([]);
input.type = "file"; input.type = "file";
input.accept = ".jpg,.png,.tif,.pic"; input.accept = ".jpg,.png,.tif,.pic";
@ -137,7 +138,7 @@ async function uploadProfile(path: string) {
.then(async (res) => { .then(async (res) => {
uploadUrl.value = res.data[fileName.value].uploadUrl; uploadUrl.value = res.data[fileName.value].uploadUrl;
uploadFileURL(uploadUrl.value, profileFile.value); uploadFileURL(uploadUrl.value, profileFile.value);
dialogImage.value = false; closeImage();
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -368,15 +369,19 @@ async function clickSaveDeceased() {
function openDialogImg() { function openDialogImg() {
dialogImage.value = true; dialogImage.value = true;
getImage();
}
function getImage() {
showLoader(); showLoader();
http http
.get(config.API.orgProfileAvatar + `/${profileId.value}`) .get(config.API.orgProfileAvatar + `/${profileId.value}`)
.then((res) => { .then(async (res) => {
let data = res.data.result; let data = res.data.result;
imagesAlldata.value = data;
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
getImg(data[i]); await getImg(data[i]);
} }
// images.value = data
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -390,7 +395,14 @@ function getImg(dataList: any) {
http http
.get(config.API.fileByPath(`${dataList.avatar}/${dataList.avatarName}`)) .get(config.API.fileByPath(`${dataList.avatar}/${dataList.avatarName}`))
.then((res) => { .then((res) => {
console.log(res); const data = res.data;
const newData = {
id: dataList.id,
isActive: dataList.isActive,
...data,
};
images.value = [...images.value, newData];
console.log(images.value);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -400,10 +412,31 @@ function getImg(dataList: any) {
function closeImage() { function closeImage() {
dialogImage.value = false; dialogImage.value = false;
images.value = [];
imagesAlldata.value = [];
} }
async function deletePhoto(id: string) { async function deletePhoto(id: string) {
dialogRemove($q, () => {}, "ต้องการทำการลบข้อมูลนี้ใช่หรือไม่"); dialogRemove(
$q,
() => {
showLoader();
http
.delete(config.API.orgProfileAvatar + `/${id}`)
.then((res) => {
images.value = [];
imagesAlldata.value = [];
getImage();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
},
"ต้องการทำการลบข้อมูลนี้ใช่หรือไม่"
);
} }
function imageClass(n: any) { function imageClass(n: any) {
@ -413,7 +446,6 @@ function imageClass(n: any) {
"rounded-borders bg-grey-2 image-size-full": !val, "rounded-borders bg-grey-2 image-size-full": !val,
}; };
} }
function getClass(n: any) { function getClass(n: any) {
const val = n == activeImage.value; const val = n == activeImage.value;
return { return {
@ -423,20 +455,21 @@ function getClass(n: any) {
} }
async function selectAvatarHistory() { async function selectAvatarHistory() {
console.log(activeImage.value);
if (activeImage.value == null) { if (activeImage.value == null) {
dialogMessageNotify($q, "กรุณาเลือกรูปที่ต้องการเปลี่ยน"); dialogMessageNotify($q, "กรุณาเลือกรูปที่ต้องการเปลี่ยน");
return; return;
} }
const data = activeImage.value;
showLoader(); showLoader();
await http await http
.put(config.API.profileAvatarId(profileId.value), { .get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`)
avatar: activeImage.value.avatarId, .then(async(res) => {
}) closeImage();
.then((res) => {
dialogImage.value = false; await fetchDataPersonal();
// fileName.value = `profile-${profileId.value}`; await fetchProfile(profileId.value);
fetchProfile(profileId.value);
fetchDataPersonal();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -770,8 +803,8 @@ onMounted(async () => {
> >
<div :class="getClass(n)"> <div :class="getClass(n)">
<q-img <q-img
v-if="n.avatar != null" v-if="n.downloadUrl != null"
:src="n.avatar" :src="n.downloadUrl"
:class="imageClass(n)" :class="imageClass(n)"
> >
<!-- <div <!-- <div
@ -791,7 +824,7 @@ onMounted(async () => {
class="absolute-bottom col-12 cursor-pointer flex justify-between items-center" class="absolute-bottom col-12 cursor-pointer flex justify-between items-center"
style="padding: 5px" style="padding: 5px"
> >
{{ date2Thai(n.createdDate) }} {{ date2Thai(n.createdAt) }}
<q-btn <q-btn
v-if="!n.isActive" v-if="!n.isActive"
@ -871,4 +904,18 @@ h2.title {
.bg-active-image { .bg-active-image {
background-color: #52c688; background-color: #52c688;
} }
.image-size-default {
height: 150px;
max-width: 15vw;
}
.image-size-full {
height: 160px;
max-width: 15vw;
}
.border-green {
border: 5px solid #52c688;
border-radius: 8px;
}
</style> </style>

View file

@ -172,12 +172,7 @@ function insertAvatar(items: DataPerson[]) {
items.map((x: any, index: number) => { items.map((x: any, index: number) => {
http http
.get( .get(
config.API.fileByFile( config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", x.id, x.avatarName)
"ทะเบียนประวัติ",
"โปรไฟล์",
x.id,
"profile-" + x.id
)
) )
.then((img) => { .then((img) => {
dataPersonMain.value[index] = { dataPersonMain.value[index] = {

View file

@ -129,12 +129,11 @@ const fetchData = async () => {
InformationData.value.lastname = data.lastname; InformationData.value.lastname = data.lastname;
InformationData.value.nationality = data.nationality; InformationData.value.nationality = data.nationality;
InformationData.value.race = data.race; InformationData.value.race = data.race;
InformationData.value.genderId = guidCheck(data.genderId) ?? ""; InformationData.value.genderId = guidCheck(data.gender) ?? "";
InformationData.value.prefixId = guidCheck(data.prefixId) ?? ""; InformationData.value.prefixId = guidCheck(data.prefix) ?? "";
InformationData.value.relationshipId = InformationData.value.relationshipId = guidCheck(data.relationship) ?? "";
guidCheck(data.relationshipId) ?? ""; InformationData.value.religionId = guidCheck(data.religion) ?? "";
InformationData.value.religionId = guidCheck(data.religionId) ?? ""; InformationData.value.bloodGroupId = guidCheck(data.bloodGroup) ?? "";
InformationData.value.bloodGroupId = guidCheck(data.bloodGroupId) ?? "";
InformationData.value.dateOfBirth = new Date(data.dateOfBirth); InformationData.value.dateOfBirth = new Date(data.dateOfBirth);
InformationData.value.age = data.age; InformationData.value.age = data.age;
InformationData.value.telephone = data.telephone; InformationData.value.telephone = data.telephone;
@ -165,17 +164,17 @@ const fetchData = async () => {
FamilyData.value.couple = data.couple ? "1" : "0"; FamilyData.value.couple = data.couple ? "1" : "0";
FamilyData.value.marryPrefix = data.marryPrefix ?? ""; FamilyData.value.marryPrefix = data.marryPrefix ?? "";
FamilyData.value.marryPrefixId = guidCheck(data.marryPrefixId) ?? ""; FamilyData.value.marryPrefixId = guidCheck(data.marryPrefix) ?? "";
FamilyData.value.marryFirstName = data.marryFirstName ?? ""; FamilyData.value.marryFirstName = data.marryFirstName ?? "";
FamilyData.value.marryLastName = data.marryLastName ?? ""; FamilyData.value.marryLastName = data.marryLastName ?? "";
FamilyData.value.marryOccupation = data.marryOccupation ?? ""; FamilyData.value.marryOccupation = data.marryOccupation ?? "";
FamilyData.value.fatherPrefix = data.fatherPrefix ?? ""; FamilyData.value.fatherPrefix = data.fatherPrefix ?? "";
FamilyData.value.fatherPrefixId = guidCheck(data.fatherPrefixId) ?? ""; FamilyData.value.fatherPrefixId = guidCheck(data.fatherPrefix) ?? "";
FamilyData.value.fatherFirstName = data.fatherFirstName ?? ""; FamilyData.value.fatherFirstName = data.fatherFirstName ?? "";
FamilyData.value.fatherLastName = data.fatherLastName ?? ""; FamilyData.value.fatherLastName = data.fatherLastName ?? "";
FamilyData.value.fatherOccupation = data.fatherOccupation ?? ""; FamilyData.value.fatherOccupation = data.fatherOccupation ?? "";
FamilyData.value.motherPrefix = data.motherPrefix ?? ""; FamilyData.value.motherPrefix = data.motherPrefix ?? "";
FamilyData.value.motherPrefixId = guidCheck(data.motherPrefixId) ?? ""; FamilyData.value.motherPrefixId = guidCheck(data.motherPrefix) ?? "";
FamilyData.value.motherFirstName = data.motherFirstName ?? ""; FamilyData.value.motherFirstName = data.motherFirstName ?? "";
FamilyData.value.motherLastName = data.motherLastName ?? ""; FamilyData.value.motherLastName = data.motherLastName ?? "";
FamilyData.value.motherOccupation = data.motherOccupation ?? ""; FamilyData.value.motherOccupation = data.motherOccupation ?? "";

View file

@ -291,7 +291,7 @@ onMounted(async () => {
const fetchLevel = async () => { const fetchLevel = async () => {
showLoader(); showLoader();
await http await http
.get(config.API.educationLevel) .get(config.API.orgEducationLevel)
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
let option: optionData[] = []; let option: optionData[] = [];
@ -774,6 +774,7 @@ const getClass = (val: boolean) => {
</ProfileTable> </ProfileTable>
</q-form> </q-form>
</q-card> </q-card>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card style="width: 600px"> <q-card style="width: 600px">
<q-form ref="myForm" greedy @submit.prevent @validation-success="clickSave"> <q-form ref="myForm" greedy @submit.prevent @validation-success="clickSave">

View file

@ -247,7 +247,7 @@ const selectSubDistrict = (e: string | null, name: string) => {
const fetchProvince = async () => { const fetchProvince = async () => {
showLoader(); showLoader();
await http await http
.get(config.API.province) .get(config.API.orgProvince)
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result;
let option: optionData[] = []; let option: optionData[] = [];
@ -326,9 +326,9 @@ const fetchDistrict = async (id: string | null, position: string) => {
if (id != null && id != "") { if (id != null && id != "") {
showLoader(); showLoader();
await http await http
.get(config.API.listDistrict(id)) .get(config.API.orgProvince+`/${id}`)
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result.districts;
let option: optionData[] = []; let option: optionData[] = [];
data.map((r: any) => { data.map((r: any) => {
option.push({ id: r.id.toString(), name: r.name.toString() }); option.push({ id: r.id.toString(), name: r.name.toString() });
@ -372,9 +372,9 @@ const fetchSubDistrict = async (id: string | null, position: string) => {
if (id != null && id != "") { if (id != null && id != "") {
showLoader(); showLoader();
await http await http
.get(config.API.listSubDistrict(id)) .get(config.API.orgDistrict+`/${id}`)
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result.subDistricts;
let option: zipCodeOption[] = []; let option: zipCodeOption[] = [];
data.map((r: any) => { data.map((r: any) => {
option.push({ option.push({

View file

@ -81,12 +81,12 @@ const refreshData = async () => {
const fetchPrefix = async () => { const fetchPrefix = async () => {
showLoader(); showLoader();
await http await http
.get(config.API.prefix) .get(config.API.profileNewMetaMain)
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
let option: DataOption[] = []; let option: DataOption[] = [];
data.map((r: any) => { data.prefixs.map((r: any) => {
option.push({ id: r.id.toString(), name: r.name.toString() }); option.push({ id: r.name.toString(), name: r.name.toString() });
}); });
Ops.value.prefixOps = option; Ops.value.prefixOps = option;
OpsFilter.value.prefixOps = option; OpsFilter.value.prefixOps = option;

View file

@ -112,53 +112,59 @@ const onCancel = async () => {
const fetchPerson = async () => { const fetchPerson = async () => {
showLoader(); showLoader();
await http await http
.get(config.API.person) .get(config.API.profileNewMetaMain)
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
//
let optionbloodGroups: optionData[] = []; let optionbloodGroups: optionData[] = [];
data.bloodGroups.map((r: any) => { data.bloodGroups.map((r: any) => {
optionbloodGroups.push({ optionbloodGroups.push({
id: r.id ?? "", id: r.name ?? "",
name: r.name ?? "", name: r.name ?? "",
}); });
}); });
Ops.value.bloodOps = optionbloodGroups; Ops.value.bloodOps = optionbloodGroups;
OpsFilter.value.bloodOps = optionbloodGroups; OpsFilter.value.bloodOps = optionbloodGroups;
//
let optiongenders: optionData[] = []; let optiongenders: optionData[] = [];
data.genders.map((r: any) => { data.genders.map((r: any) => {
optiongenders.push({ optiongenders.push({
id: r.id ?? "", id: r.name ?? "",
name: r.name ?? "", name: r.name ?? "",
}); });
}); });
Ops.value.genderOps = optiongenders; Ops.value.genderOps = optiongenders;
OpsFilter.value.genderOps = optiongenders; OpsFilter.value.genderOps = optiongenders;
//
let optionprefixs: optionData[] = []; let optionprefixs: optionData[] = [];
data.prefixs.map((r: any) => { data.prefixs.map((r: any) => {
optionprefixs.push({ optionprefixs.push({
id: r.id ?? "", id: r.name ?? "",
name: r.name ?? "", name: r.name ?? "",
}); });
}); });
Ops.value.prefixOps = optionprefixs; Ops.value.prefixOps = optionprefixs;
OpsFilter.value.prefixOps = optionprefixs; OpsFilter.value.prefixOps = optionprefixs;
//
let optionrelationships: optionData[] = []; let optionrelationships: optionData[] = [];
data.relationships.map((r: any) => { data.relationships.map((r: any) => {
optionrelationships.push({ optionrelationships.push({
id: r.id ?? "", id: r.name ?? "",
name: r.name ?? "", name: r.name ?? "",
}); });
}); });
Ops.value.statusOps = optionrelationships; Ops.value.statusOps = optionrelationships;
OpsFilter.value.statusOps = optionrelationships; OpsFilter.value.statusOps = optionrelationships;
//
let optionreligions: optionData[] = []; let optionreligions: optionData[] = [];
data.religions.map((r: any) => { data.religions.map((r: any) => {
optionreligions.push({ optionreligions.push({
id: r.id ?? "", id: r.name ?? "",
name: r.name ?? "", name: r.name ?? "",
}); });
}); });

View file

@ -142,10 +142,10 @@ interface Address {
} }
interface AddressData { interface AddressData {
subDistrictId: string; subDistrictId: any;
zipCode: string; zipCode: string;
districtId: string; districtId: any;
provinceId: string; provinceId: any;
} }
interface Certificate { interface Certificate {