Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-03-05 15:01:01 +07:00
commit c867e8c569
4 changed files with 22 additions and 17 deletions

View file

@ -29,6 +29,7 @@ const props = defineProps({
fetchActive: { fetchActive: {
type: Function, type: Function,
require: true, require: true,
default: () => "fetchActive function",
}, },
}); });
@ -84,7 +85,6 @@ function validateForm() {
} }
if (hasError.every((result) => result === true)) { if (hasError.every((result) => result === true)) {
onSubmit(); onSubmit();
} else {
} }
} }
@ -102,7 +102,7 @@ function onSubmit() {
store.draftId = res.data.result.id; store.draftId = res.data.result.id;
store.statusView = "list"; store.statusView = "list";
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
props.fetchActive?.(); props.fetchActive();
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);

View file

@ -29,8 +29,8 @@ const modalDateTime = ref<boolean>(false); // ตั้งเวลาเผย
/** สถานะ*/ /** สถานะ*/
const isStatusData = ref<boolean>(false); // const isStatusData = ref<boolean>(false); //
const ishasActive = ref<boolean>(false); // // const ishasActive = ref<boolean>(false); //
const ishasDraft = ref<boolean>(false); // // const ishasDraft = ref<boolean>(false); //
/** List เพิ่มโครงสร้าง*/ /** List เพิ่มโครงสร้าง*/
const itemStructure = ref<DataOption[]>([ const itemStructure = ref<DataOption[]>([
{ {
@ -73,10 +73,10 @@ async function fetchOrganizationActive() {
isStatusData.value = true; isStatusData.value = true;
if (isStatusData.value) { if (isStatusData.value) {
if (data.activeName === null) { if (data.activeName === null) {
ishasActive.value = true; // ishasActive.value = true;
store.typeOrganizational = "draft"; store.typeOrganizational = "draft";
} else if (data.draftName === null) { } else if (data.draftName === null) {
ishasDraft.value = true; // ishasDraft.value = true;
store.typeOrganizational = "current"; store.typeOrganizational = "current";
} }
} }
@ -143,6 +143,7 @@ function onClickHistory(id: string, name: string) {
/** lifecycleHook */ /** lifecycleHook */
onMounted(async () => { onMounted(async () => {
store.typeOrganizational = "current";
await fetchOrganizationActive(); await fetchOrganizationActive();
await fetchHistory(); await fetchHistory();
}); });
@ -225,6 +226,7 @@ onMounted(async () => {
:outline="store.typeOrganizational === 'current' ? false : true" :outline="store.typeOrganizational === 'current' ? false : true"
color="blue" color="blue"
label="ปัจจุบัน" label="ปัจจุบัน"
:disable="store.activeId == '' || store.activeId == null"
@click=" @click="
(store.typeOrganizational = 'current'), (store.typeOrganizational = 'current'),
(labelHistory = 'ประวัติโครงสร้าง') (labelHistory = 'ประวัติโครงสร้าง')
@ -237,11 +239,11 @@ onMounted(async () => {
:outline="store.typeOrganizational === 'draft' ? false : true" :outline="store.typeOrganizational === 'draft' ? false : true"
color="blue" color="blue"
label="แบบร่าง" label="แบบร่าง"
:disable="store.draftId == '' || store.draftId == null"
@click=" @click="
(store.typeOrganizational = 'draft'), (store.typeOrganizational = 'draft'),
(labelHistory = 'ประวัติโครงสร้าง') (labelHistory = 'ประวัติโครงสร้าง')
" "
:disable="ishasDraft"
/> />
<q-btn-dropdown <q-btn-dropdown
v-if="itemHistory.length !== 0" v-if="itemHistory.length !== 0"

View file

@ -185,7 +185,7 @@ const maxPage = ref<number>(1);
* @param id กล * @param id กล
*/ */
function fetchDataQuota(id: string) { function fetchDataQuota(id: string) {
showLoader(); // showLoader();
http http
.get(config.API.salaryListPeriodQuota(id)) .get(config.API.salaryListPeriodQuota(id))
.then((res) => { .then((res) => {
@ -205,10 +205,10 @@ function fetchDataQuota(id: string) {
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
})
.finally(() => {
hideLoader();
}); });
// .finally(() => {
// hideLoader();
// });
} }
/** /**

View file

@ -77,9 +77,9 @@ function getRound() {
store.roundMainCode = roundFilter.value.shortCode; store.roundMainCode = roundFilter.value.shortCode;
getSnap(roundFilter.value.shortCode); await getSnap(roundFilter.value.shortCode);
getAgency(roundFilter.value.revisionId); await getAgency(roundFilter.value.revisionId);
getAgencyPosition(roundFilter.value.revisionId); await getAgencyPosition(roundFilter.value.revisionId);
// if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { // if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
// await fetchSalalyPeriod( // await fetchSalalyPeriod(
@ -149,7 +149,7 @@ async function getAgency(id: string) {
id: x.id, id: x.id,
name: x.orgRootName, name: x.orgRootName,
})); }));
agencyFilter.value = store.rootId; // agencyFilter.value = store.rootId;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -165,11 +165,12 @@ async function getAgencyPosition(id: string) {
await http await http
.get(config.API.keycloakPositionByid(id)) .get(config.API.keycloakPositionByid(id))
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = await res.data.result;
const position = agencyOptions.value?.find( const position = agencyOptions.value?.find(
(e: DataOption) => e.id === data.rootId (e: DataOption) => e.id === data.rootId
); );
agencyFilter.value = position ? position.id : ""; agencyFilter.value = position ? position.id : "";
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
@ -217,7 +218,9 @@ function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
messageError($q, err); messageError($q, err);
}) })
.finally(() => { .finally(() => {
hideLoader(); setTimeout(() => {
hideLoader();
}, 800);
}); });
} }