ปรับ fe sprint2

This commit is contained in:
Kittapath 2023-06-19 15:50:50 +07:00
parent 8576f3c387
commit 0d6ff7be0a
83 changed files with 6932 additions and 2571 deletions

View file

@ -2,11 +2,24 @@
<div class="col-12 row">
<div class="row col-12" style="padding-top: 80px">
<div id="information" name="1" class="row col-12 information">
<Informationvue
<!-- <Informationvue
v-model:statusEdit="statusEdit"
:profileType="profileType"
/> -->
<Information
v-model:statusEdit="statusEdit"
:fetchDataProfile="fetchData"
/>
</div>
<div id="government" name="16" class="row col-12 q-mt-md">
<Government v-model:statusEdit="statusEdit" />
</div>
<div id="address" name="17" class="row col-12 q-mt-md">
<Address v-model:statusEdit="statusEdit" />
</div>
<div id="family" name="18" class="row col-12 q-mt-md">
<Family v-model:statusEdit="statusEdit" />
</div>
<div id="certicate" name="15" class="row col-12 q-mt-md">
<Certicate v-model:statusEdit="statusEdit" :profileType="profileType" />
</div>
@ -29,7 +42,12 @@
/>
</div>
<div id="position" name="7" class="row col-12 q-mt-md">
<SalaryVue v-model:statusEdit="statusEdit" />
<SalaryVue
v-model:statusEdit="statusEdit"
v-if="profileType === 'officer'"
/>
<SalaryEmployeeVue v-model:statusEdit="statusEdit" v-else />
</div>
<div id="rule" name="8" class="row col-12 q-mt-md">
<DisciplineVue v-model:statusEdit="statusEdit" />
@ -284,7 +302,9 @@
style="padding: 5px"
>
{{ date2Thai(n.createdDate) }}
<q-btn
v-if="!n.isActive"
icon="delete"
unelevated
dense
@ -486,13 +506,13 @@ import { useDataStore } from "@/stores/data";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import Informationvue from "@/modules/04_registry/components/Information/layout.vue";
import EducationVue from "@/modules/04_registry/components/Education.vue";
import TrainVue from "@/modules/04_registry/components/Train.vue";
import InsigniaVue from "@/modules/04_registry/components/Insignia.vue";
import CoinedVue from "@/modules/04_registry/components/Coin.vue";
import AssessmentVue from "@/modules/04_registry/components/Assessment.vue";
import SalaryVue from "@/modules/04_registry/components/Salary.vue";
import SalaryEmployeeVue from "@/modules/04_registry/components/SalaryEmployee.vue";
import DisciplineVue from "@/modules/04_registry/components/Discipline.vue";
import LeaveVue from "@/modules/04_registry/components/Leave.vue";
import TalentVue from "@/modules/04_registry/components/Talent.vue";
@ -501,6 +521,11 @@ import RecordVue from "@/modules/04_registry/components/Record.vue";
import OtherVue from "@/modules/04_registry/components/Other.vue";
import DocumentVue from "@/modules/04_registry/components/Document.vue";
import Certicate from "@/modules/04_registry/components/Information/Certicate.vue";
import Information from "@/modules/04_registry/components/Information/Information.vue";
import Government from "@/modules/04_registry/components/Information/Government.vue";
import Address from "@/modules/04_registry/components/Information/Address.vue";
import Family from "@/modules/04_registry/components/Information/Family.vue";
import OldName from "@/modules/04_registry/components/Information/OldName.vue";
import type { DataOption } from "@/modules/04_registry/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
@ -509,15 +534,7 @@ const $q = useQuasar();
const store = useDataStore();
const { changeTab, loaderPage } = store;
const mixin = useCounterMixin();
const {
date2Thai,
dateToISO,
modalConfirm,
messageError,
dialogMessage,
showLoader,
hideLoader,
} = mixin;
const { date2Thai, dateToISO, messageError, dialogMessage, success } = mixin;
const route = useRoute();
const router = useRouter();
const imageUrl = ref<any>(null);
@ -593,7 +610,7 @@ onMounted(async () => {
});
const fetchData = async () => {
showLoader();
loaderPage(true);
await http
.get(config.API.profileAvatarId(profileId.value))
.then((res) => {
@ -617,12 +634,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
hideLoader();
loaderPage(false);
});
};
const checkProfileData = async () => {
showLoader();
loaderPage(true);
await http
.get(config.API.profileCheckId(profileId.value))
.then((res) => {
@ -633,12 +650,12 @@ const checkProfileData = async () => {
router.push("/registry");
})
.finally(() => {
hideLoader();
loaderPage(false);
});
};
const fetchAvatarHistory = async () => {
showLoader();
loaderPage(true);
await http
.get(config.API.profileAvatarHistoryId(profileId.value))
.then((res) => {
@ -650,6 +667,7 @@ const fetchAvatarHistory = async () => {
avatar: e.avatar,
avatarId: e.avatarId,
createdDate: new Date(e.createdDate),
isActive: e.isActive,
});
});
})
@ -657,7 +675,7 @@ const fetchAvatarHistory = async () => {
messageError($q, e);
})
.finally(() => {
hideLoader();
loaderPage(false);
});
};
@ -666,7 +684,7 @@ const uploadImage = async (e: any) => {
if (input.length > 0) {
const formData = new FormData();
formData.append("FileData", input[0]);
showLoader();
loaderPage(true);
await http
.post(config.API.profileAvatarId(profileId.value), formData)
.then((res) => {})
@ -681,31 +699,37 @@ const uploadImage = async (e: any) => {
}
};
const deletePhoto = async (id: string) => {
// dialogMessage(
// $q,
// "",
// "",
// "delete",
// undefined,
// "red",
// undefined,
// undefined,
// false
// );
showLoader();
const fetchDataDelete = async (id: string) => {
loaderPage(true);
await http
.delete(config.API.profileAvatarHistoryId(id))
.then((res) => {})
.then((res) => {
success($q, "ลบรูปภาพสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
dialogImage.value = false;
await clickImage();
// dialogImage.value = false;
});
};
const deletePhoto = async (id: string) => {
dialogMessage(
$q,
"ลบข้อมูล",
"ต้องการทำการลบข้อมูลนี้ใช่หรือไม่",
"delete",
undefined,
"red",
() => fetchDataDelete(id),
undefined,
false
);
};
const selectAvatarHistory = async () => {
if (activeImage.value == null) {
dialogMessage(
@ -721,7 +745,7 @@ const selectAvatarHistory = async () => {
);
return;
}
showLoader();
loaderPage(true);
await http
.put(config.API.profileAvatarId(profileId.value), {
avatar: activeImage.value.avatarId,
@ -789,7 +813,7 @@ const downloadKP7Short = () => {};
const clickKp7 = async () => {
window.open(config.API.profileReportId(profileId.value));
// showLoader();
// loaderPage(true);
// await http
// .get(config.API.profileReportId(profileId.value))
// .then((res) => {
@ -802,7 +826,7 @@ const clickKp7 = async () => {
// })
// .catch((e) => {messageError($q, e);})
// .finally(() => {
// hideLoader();
// loaderPage(false);
// });
};
@ -821,7 +845,7 @@ const downloadFilePDF = async (res: string, fileName: string) => {
const clickKp7Short = async () => {
window.open(config.API.profileKp7ShortId(profileId.value));
// showLoader();
// loaderPage(true);
// await http
// .get(config.API.profileKp7ShortId(profileId.value))
// .then((res) => {
@ -834,17 +858,22 @@ const clickKp7Short = async () => {
// })
// .catch((e) => {messageError($q, e);})
// .finally(() => {
// hideLoader();
// loaderPage(false);
// });
};
const clickRetire = async () => {
if (reasonStatus.value == true) {
modalConfirm(
dialogMessage(
$q,
"โปรดยืนยัน",
"ต้องการย้ายข้อมูลจากพ้นราชการไปถือครองใช่หรือไม่?",
Retire
"ต้องการย้ายข้อมูลจากพ้นราชการไปถือครองใช่หรือไม่",
"info",
undefined,
"primary",
Retire,
undefined,
false
);
} else {
leaveDate.value = new Date();
@ -858,7 +887,7 @@ const clickRetire = async () => {
const Retire = async () => {
if (reasonStatus.value == true) {
showLoader();
loaderPage(true);
await http
.put(config.API.profileReactive(profileId.value))
.then((res) => {
@ -873,7 +902,7 @@ const Retire = async () => {
router.push("/registry");
});
} else {
showLoader();
loaderPage(true);
await http
.put(config.API.profileDeactive(profileId.value), {
leaveDate: dateToISO(leaveDate.value),