แก้ไข loader
This commit is contained in:
parent
f072224851
commit
b663eedb09
147 changed files with 3095 additions and 3256 deletions
|
|
@ -432,15 +432,19 @@ import type { DataOption } from "@/modules/02_organizational/interface/index/Mai
|
|||
import HistoryTable from "@/components/TableHistory.vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
import type { QTableProps } from "quasar";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
import type { QTableProps } from "quasar";
|
||||
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
const { success, modalConfirm, modalError, modalDelete } = mixin;
|
||||
const {
|
||||
success,
|
||||
modalConfirm,
|
||||
modalError,
|
||||
modalDelete,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
} = mixin;
|
||||
const { date2Thai } = mixin;
|
||||
const store = useOrganizationalDataStore();
|
||||
const { organizationalData, changeOrganizationalColumns } = store;
|
||||
|
|
@ -843,7 +847,7 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
|
|||
});
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await fetchPosition();
|
||||
await fetchData();
|
||||
await fetchHistory();
|
||||
|
|
@ -853,7 +857,7 @@ onMounted(async () => {
|
|||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getPostionMasterDraft(true))
|
||||
.then((res) => {
|
||||
|
|
@ -897,7 +901,7 @@ const fetchData = async () => {
|
|||
})
|
||||
.finally(() => {
|
||||
// updateData.value = false;
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -905,7 +909,7 @@ const fetchData = async () => {
|
|||
* ฟังชั้นดูข้อมูลประวัติแก้ไขข้อมูลทั้งหมด
|
||||
*/
|
||||
const fetchHistory = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listxxxxxxxxPublishedHistory)
|
||||
// .then((res) => {
|
||||
|
|
@ -937,7 +941,7 @@ const fetchHistory = async () => {
|
|||
// statusCode.value = e.response.data.status;
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
|
|
@ -945,7 +949,7 @@ const fetchHistory = async () => {
|
|||
* get รายการ ตำแหน่ง
|
||||
*/
|
||||
const fetchPosition = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.position)
|
||||
.then((res) => {
|
||||
|
|
@ -1036,7 +1040,7 @@ const fetchPosition = async () => {
|
|||
})
|
||||
.catch((e: any) => {})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1185,7 +1189,7 @@ const clickSave = async () => {
|
|||
*/
|
||||
const saveData = async () => {
|
||||
modal.value = false;
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.getPositionMaster, {
|
||||
positionTypeId: positionTypeId.value,
|
||||
|
|
@ -1218,7 +1222,7 @@ const saveData = async () => {
|
|||
*/
|
||||
const editData = async () => {
|
||||
modal.value = false;
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.getPositionMasterId(positionMasterId.value), {
|
||||
positionMasterId: positionMasterId.value,
|
||||
|
|
@ -1252,7 +1256,7 @@ const editData = async () => {
|
|||
* เมื่อเรียก api เสร็จแล้วจะ get data มาใหม่
|
||||
*/
|
||||
const clearPublishedData = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.getPositionMasterSync)
|
||||
.then((res) => {
|
||||
|
|
@ -1265,7 +1269,7 @@ const clearPublishedData = async () => {
|
|||
statusCode.value = e.response.data.status;
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await fetchHistory();
|
||||
await fetchData();
|
||||
});
|
||||
|
|
@ -1277,7 +1281,7 @@ const clearPublishedData = async () => {
|
|||
*/
|
||||
const publishedData = async () => {
|
||||
// editvisible.value = false;
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.getPositionMasterPublish)
|
||||
.then((res) => {
|
||||
|
|
@ -1287,7 +1291,7 @@ const publishedData = async () => {
|
|||
statusCode.value = e.response.data.status;
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await fetchData();
|
||||
});
|
||||
};
|
||||
|
|
@ -1383,7 +1387,7 @@ const clickAdd = () => {
|
|||
* @param row ข้อมูล row ที่ดูประวัติการแก้ไข
|
||||
*/
|
||||
const clickHistory = async (row: RequestItemsObject) => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getPositionMasterHistoryId(row.id))
|
||||
.then((res) => {
|
||||
|
|
@ -1427,7 +1431,7 @@ const clickHistory = async (row: RequestItemsObject) => {
|
|||
})
|
||||
.finally(async () => {
|
||||
modalHistory.value = true;
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1470,7 +1474,7 @@ const clickIsActive = async (val: string, status: boolean) => {
|
|||
})
|
||||
.onOk(async () => {
|
||||
// edit.value = false;
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.getPositionMasterId(val) + `?Id=${val}`)
|
||||
.then((res) => {
|
||||
|
|
|
|||
|
|
@ -374,7 +374,8 @@
|
|||
import { ref, defineAsyncComponent, watch, onMounted } from "vue";
|
||||
import { useQuasar, QForm } from "quasar";
|
||||
import type { PropType } from "vue";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import type { DataOption } from "../../interface/index/Main";
|
||||
|
|
@ -382,8 +383,9 @@ import type { DataOption } from "../../interface/index/Main";
|
|||
const ddNoResultMsg = defineAsyncComponent(
|
||||
() => import("@/components/DropDownNoResultMsg.vue")
|
||||
); //แสดงข้อความเมื่อ Dropdown Filter ไม่เจอข้อมูล
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader } = mixin;
|
||||
const $q = useQuasar(); // show dialog
|
||||
const emit = defineEmits(["update:positions", "update:formprops"]);
|
||||
const props = defineProps({
|
||||
|
|
@ -430,12 +432,12 @@ const positionFilter = ref<Array<any>>([]); //for DropDown
|
|||
const position = ref<Array<any>>([]); //for DropDown
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await fetchPositionMaster();
|
||||
});
|
||||
|
||||
const fetchPositionMaster = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
// .get(config.API.getPostionMasterDraft(false))
|
||||
.get(config.API.getPostionMaster(false))
|
||||
|
|
@ -476,7 +478,7 @@ const fetchPositionMaster = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -333,8 +333,9 @@ import type {
|
|||
GovermentOption,
|
||||
} from "../../interface/index/Main";
|
||||
import { log } from "console";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
// import { organizationSet } from "../interface/index/Main";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const props = defineProps({
|
||||
organizprops: Array as PropType<OrganizaOption[]>,
|
||||
|
|
@ -343,8 +344,9 @@ const props = defineProps({
|
|||
|
||||
const emit = defineEmits(["update:organizprops", "update:formprops"]);
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader } = mixin;
|
||||
|
||||
const $q = useQuasar(); // show dialog
|
||||
const myForm = ref<QForm | null>(null);
|
||||
|
||||
|
|
@ -381,7 +383,7 @@ const organizationAgencyCode = ref<GovermentOption[]>([]);
|
|||
const organizationAgencyCodeFilter = ref<GovermentOption[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await fetchOrganizationOri();
|
||||
await fetchOrganizationAgencyCode();
|
||||
await fetchOrganizationGovernmentCode();
|
||||
|
|
@ -400,7 +402,7 @@ onMounted(async () => {
|
|||
* หน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationOri = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organization)
|
||||
.then((res) => {
|
||||
|
|
@ -416,14 +418,14 @@ const fetchOrganizationOri = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* รหัสหน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationAgencyCode = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationCode)
|
||||
.then((res) => {
|
||||
|
|
@ -445,14 +447,14 @@ const fetchOrganizationAgencyCode = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* รหัสส่วนราชการ
|
||||
*/
|
||||
const fetchOrganizationGovernmentCode = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationShortName)
|
||||
.then((res) => {
|
||||
|
|
@ -474,14 +476,14 @@ const fetchOrganizationGovernmentCode = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// /**
|
||||
// * ชื่อย่อหน่วยงาน
|
||||
// */
|
||||
// const fetchOrganizationShortName = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.organizationShortName)
|
||||
// .then((res) => {
|
||||
|
|
@ -503,14 +505,14 @@ const fetchOrganizationGovernmentCode = async () => {
|
|||
// console.log(e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
// });
|
||||
// };
|
||||
/**
|
||||
* หน่วยงานต้นสังกัด
|
||||
*/
|
||||
const fetchOrganizationAgency = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listOrganizationHistoryAgency("หน่วยงาน"))
|
||||
.then((res) => {
|
||||
|
|
@ -529,14 +531,14 @@ const fetchOrganizationAgency = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* ส่วนราชการต้นสังกัด
|
||||
*/
|
||||
const fetchOrganizationGovernmentAgency = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listOrganizationHistoryAgency("ส่วนราชการ"))
|
||||
.then((res) => {
|
||||
|
|
@ -555,14 +557,14 @@ const fetchOrganizationGovernmentAgency = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* ประเภทหน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationType = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationType)
|
||||
.then((res) => {
|
||||
|
|
@ -578,14 +580,14 @@ const fetchOrganizationType = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* ระดับหน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationLevel = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationLevel)
|
||||
.then((res) => {
|
||||
|
|
@ -601,14 +603,14 @@ const fetchOrganizationLevel = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* เบอร์ติดต่อภายใน
|
||||
*/
|
||||
const fetchOrganizationTelInternal = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationTelInternal)
|
||||
.then((res) => {
|
||||
|
|
@ -624,14 +626,14 @@ const fetchOrganizationTelInternal = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* เบอร์ติดต่อภายนอก
|
||||
*/
|
||||
const fetchOrganizationTelExternal = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationTelExternal)
|
||||
.then((res) => {
|
||||
|
|
@ -647,14 +649,14 @@ const fetchOrganizationTelExternal = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* เบอร์โทรสาร
|
||||
*/
|
||||
const fetchOrganizationFax = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationFax)
|
||||
.then((res) => {
|
||||
|
|
@ -670,7 +672,7 @@ const fetchOrganizationFax = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -772,7 +774,7 @@ const addOrganizationItem = async () => {
|
|||
|
||||
const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
|
||||
let option: GovermentOption[] = [];
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationGovernmentCode(val))
|
||||
.then((res) => {
|
||||
|
|
@ -792,14 +794,14 @@ const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
return option;
|
||||
};
|
||||
|
||||
const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
|
||||
let option: GovermentOption[] = [];
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationAgencyCode(val))
|
||||
.then((res) => {
|
||||
|
|
@ -819,7 +821,7 @@ const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
return option;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -310,9 +310,13 @@ import type {
|
|||
GovermentOption,
|
||||
} from "../../interface/index/Main";
|
||||
import { log } from "console";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
import type { EnumStringMember } from "@babel/types";
|
||||
// import { organizationSet } from "../interface/index/Main";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader } = mixin;
|
||||
|
||||
const props = defineProps({
|
||||
organizprops: Object as PropType<OrganizaOption>,
|
||||
|
|
@ -323,8 +327,6 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
const emit = defineEmits(["update:organizprops", "update:formprops"]);
|
||||
|
||||
const $q = useQuasar(); // show dialog
|
||||
|
|
@ -393,7 +395,7 @@ const organization = ref<OrganizaOption>({
|
|||
emit("update:organizprops", organization.value);
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
// await fillOrgEdit(); //มาแค่ตรง selector(q-select)
|
||||
await fetchOrganizationOri();
|
||||
// await fetchOrganizationShortName();
|
||||
|
|
@ -427,7 +429,7 @@ const getClass = (val: boolean) => {
|
|||
* @param node node that you want to edit data
|
||||
*/
|
||||
const fillOrgEdit = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getOrgDraft(props.org.organizationId))
|
||||
.then((res) => {
|
||||
|
|
@ -499,7 +501,7 @@ const fillOrgEdit = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
console.log("success");
|
||||
};
|
||||
|
|
@ -508,7 +510,7 @@ const fillOrgEdit = async () => {
|
|||
* หน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationOri = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organization)
|
||||
.then((res) => {
|
||||
|
|
@ -524,14 +526,14 @@ const fetchOrganizationOri = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* รหัสหน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationAgencyCode = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationCode)
|
||||
.then((res) => {
|
||||
|
|
@ -553,14 +555,14 @@ const fetchOrganizationAgencyCode = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* รหัสส่วนราชการ
|
||||
*/
|
||||
const fetchOrganizationGovernmentCode = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationShortName)
|
||||
.then((res) => {
|
||||
|
|
@ -585,14 +587,14 @@ const fetchOrganizationGovernmentCode = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// /**
|
||||
// * ชื่อย่อหน่วยงาน
|
||||
// */
|
||||
// const fetchOrganizationShortName = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.organizationShortName)
|
||||
// .then((res) => {
|
||||
|
|
@ -614,14 +616,14 @@ const fetchOrganizationGovernmentCode = async () => {
|
|||
// console.log(e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
// });
|
||||
// };
|
||||
/**
|
||||
* หน่วยงานต้นสังกัด
|
||||
*/
|
||||
const fetchOrganizationAgency = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
// .get(config.API.organizationAgency)
|
||||
.get(config.API.listOrganizationHistoryAgency("หน่วยงาน"))
|
||||
|
|
@ -641,14 +643,14 @@ const fetchOrganizationAgency = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* ส่วนราชการต้นสังกัด
|
||||
*/
|
||||
const fetchOrganizationGovernmentAgency = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
// .get(config.API.organizationGovernmentAgency)
|
||||
.get(config.API.listOrganizationHistoryAgency("ส่วนราชการ"))
|
||||
|
|
@ -669,14 +671,14 @@ const fetchOrganizationGovernmentAgency = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* ประเภทหน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationType = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationType)
|
||||
.then((res) => {
|
||||
|
|
@ -692,7 +694,7 @@ const fetchOrganizationType = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -700,7 +702,7 @@ const fetchOrganizationType = async () => {
|
|||
* สถานะหน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationStatus = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationStatus)
|
||||
.then((res) => {
|
||||
|
|
@ -716,7 +718,7 @@ const fetchOrganizationStatus = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -724,7 +726,7 @@ const fetchOrganizationStatus = async () => {
|
|||
* ระดับหน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationLevel = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationLevel)
|
||||
.then((res) => {
|
||||
|
|
@ -740,14 +742,14 @@ const fetchOrganizationLevel = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* เบอร์ติดต่อภายใน
|
||||
*/
|
||||
const fetchOrganizationTelInternal = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationTelInternal)
|
||||
.then((res) => {
|
||||
|
|
@ -763,14 +765,14 @@ const fetchOrganizationTelInternal = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* เบอร์ติดต่อภายนอก
|
||||
*/
|
||||
const fetchOrganizationTelExternal = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationTelExternal)
|
||||
.then((res) => {
|
||||
|
|
@ -786,14 +788,14 @@ const fetchOrganizationTelExternal = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* เบอร์โทรสาร
|
||||
*/
|
||||
const fetchOrganizationFax = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationFax)
|
||||
.then((res) => {
|
||||
|
|
@ -809,13 +811,13 @@ const fetchOrganizationFax = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
|
||||
let option: GovermentOption[] = [];
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationGovernmentCode(val))
|
||||
.then((res) => {
|
||||
|
|
@ -835,14 +837,14 @@ const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
return option;
|
||||
};
|
||||
|
||||
const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
|
||||
let option: GovermentOption[] = [];
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationAgencyCode(val))
|
||||
.then((res) => {
|
||||
|
|
@ -862,7 +864,7 @@ const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
return option;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,8 +6,13 @@ import config from "@/app.config";
|
|||
|
||||
import { OrgChart } from "bma-org-chart";
|
||||
import "bma-org-chart/org-chart.css";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import chartData from "@/assets/orgChartData";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader } = mixin;
|
||||
|
||||
const dataSource = ref(chartData);
|
||||
// const dataSource = ref() // ข้อมูล Chart
|
||||
|
||||
|
|
@ -21,8 +26,6 @@ const savePDF = () => {
|
|||
chartRef.value.savePDF();
|
||||
};
|
||||
|
||||
const loader = ref<boolean>(false); //รอโหลด
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchTreeRoot();
|
||||
await fetchOrgChart();
|
||||
|
|
@ -32,7 +35,7 @@ onMounted(async () => {
|
|||
* อ่าน Root ของข้อมูลทั้งหมดก่อน
|
||||
*/
|
||||
const fetchTreeRoot = async () => {
|
||||
loader.value = true;
|
||||
showLoader();
|
||||
let urlRequest = config.API.chartGetTreeRoot;
|
||||
await http
|
||||
.get(urlRequest)
|
||||
|
|
@ -45,12 +48,12 @@ const fetchTreeRoot = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loader.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const fetchOrgChart = async () => {
|
||||
loader.value = true;
|
||||
showLoader();
|
||||
let urlRequest = config.API.chartGetOrg(rootOrgID.value);
|
||||
await http
|
||||
.get(urlRequest)
|
||||
|
|
@ -65,7 +68,7 @@ const fetchOrgChart = async () => {
|
|||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loader.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -111,7 +114,6 @@ const refreshChart = async (data: any) => {
|
|||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<full-loader :visibility="loader"></full-loader>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -1,123 +1,123 @@
|
|||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">รายงานบัญชี</div>
|
||||
<q-card flat bordered class="col-12">
|
||||
<div class="row col-12">
|
||||
<q-tabs
|
||||
v-model="tab"
|
||||
no-caps
|
||||
inline-label
|
||||
align="left"
|
||||
class="text-primary"
|
||||
>
|
||||
<q-tab name="audit1" label="บัญชี 1" />
|
||||
<q-tab name="audit2" label="บัญชี 2" />
|
||||
<q-tab name="audit3" label="บัญชี 3" />
|
||||
</q-tabs>
|
||||
</div>
|
||||
<q-separator />
|
||||
<q-tab-panels
|
||||
v-model="tab"
|
||||
transition-prev="jump-up"
|
||||
transition-next="jump-up"
|
||||
animated
|
||||
swipeable
|
||||
class="row col-12 text-dark"
|
||||
>
|
||||
<q-tab-panel name="audit1">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<q-select
|
||||
class="col-xs-12 col-sm-6"
|
||||
v-model="goverment"
|
||||
label="ระบุหน่วยงานที่ต้องการออกรายงาน"
|
||||
dense
|
||||
:options="govermentOP"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
/>
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-download"
|
||||
round
|
||||
flat
|
||||
color="primary"
|
||||
@click="clickAccount1"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="audit2">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<q-select
|
||||
class="col-xs-12 col-sm-6"
|
||||
v-model="goverment"
|
||||
label="ระบุรหัสส่วนราชการ"
|
||||
dense
|
||||
:options="govermentOP"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
/>
|
||||
<div class="toptitle text-dark col-12 row items-center">รายงานบัญชี</div>
|
||||
<q-card flat bordered class="col-12">
|
||||
<div class="row col-12">
|
||||
<q-tabs
|
||||
v-model="tab"
|
||||
no-caps
|
||||
inline-label
|
||||
align="left"
|
||||
class="text-primary"
|
||||
>
|
||||
<q-tab name="audit1" label="บัญชี 1" />
|
||||
<q-tab name="audit2" label="บัญชี 2" />
|
||||
<q-tab name="audit3" label="บัญชี 3" />
|
||||
</q-tabs>
|
||||
</div>
|
||||
<q-separator />
|
||||
<q-tab-panels
|
||||
v-model="tab"
|
||||
transition-prev="jump-up"
|
||||
transition-next="jump-up"
|
||||
animated
|
||||
swipeable
|
||||
class="row col-12 text-dark"
|
||||
>
|
||||
<q-tab-panel name="audit1">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<q-select
|
||||
class="col-xs-12 col-sm-6"
|
||||
v-model="goverment"
|
||||
label="ระบุหน่วยงานที่ต้องการออกรายงาน"
|
||||
dense
|
||||
:options="govermentOP"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
/>
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-download"
|
||||
round
|
||||
flat
|
||||
color="primary"
|
||||
@click="clickAccount1"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="audit2">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<q-select
|
||||
class="col-xs-12 col-sm-6"
|
||||
v-model="goverment"
|
||||
label="ระบุรหัสส่วนราชการ"
|
||||
dense
|
||||
:options="govermentOP"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-download"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
@click="clickAccount2"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="audit3">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<q-select
|
||||
class="col-xs-12 col-sm-6"
|
||||
v-model="goverment"
|
||||
label="ระบุรหัสส่วนราชการ"
|
||||
dense
|
||||
:options="govermentOP"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
/>
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-download"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
@click="clickAccount3"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
<!-- <viewpdf
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-download"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
@click="clickAccount2"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="audit3">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<q-select
|
||||
class="col-xs-12 col-sm-6"
|
||||
v-model="goverment"
|
||||
label="ระบุรหัสส่วนราชการ"
|
||||
dense
|
||||
:options="govermentOP"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
/>
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-download"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
@click="clickAccount3"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
<!-- <viewpdf
|
||||
:src="pdfSrc"
|
||||
:currentpage="pdfCurrentPage"
|
||||
:totalpage="pdfTotalPage" /> -->
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
</q-card>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, computed, ref, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
import TableReport from "@/modules/02_organizational/components/TableReport.vue";
|
||||
import DialogHeader from "@/modules/02_organizational/components/DialogHeader.vue";
|
||||
import DialogFooter from "@/modules/02_organizational/components/DialogFooter.vue";
|
||||
|
|
@ -128,11 +128,10 @@ import type { RequestReport2 } from "@/modules/02_organizational/interface/reque
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError, modalError, modalWarning } = mixin;
|
||||
const { messageError, modalError, modalWarning, showLoader, hideLoader } =
|
||||
mixin;
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { date2Thai, success, dateToISO } = mixin;
|
||||
|
|
@ -143,112 +142,112 @@ const goverment = ref<any>();
|
|||
const tab = ref<string>("audit1");
|
||||
|
||||
const clickAccount1 = async () => {
|
||||
if (goverment.value === null || goverment.value === undefined) {
|
||||
modalWarning($q, "คำเตือน", "กรุณาเลือกหน่วยงานที่ต้องการออกรายงาน!");
|
||||
return;
|
||||
}
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.getReportAccount1(goverment.value?.value as string), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `รายงานบัญชี1_${goverment.value?.label}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
if (goverment.value === null || goverment.value === undefined) {
|
||||
modalWarning($q, "คำเตือน", "กรุณาเลือกหน่วยงานที่ต้องการออกรายงาน!");
|
||||
return;
|
||||
}
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getReportAccount1(goverment.value?.value as string), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `รายงานบัญชี1_${goverment.value?.label}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
|
||||
// window.open(config.API.getReportAccount1(goverment.value));
|
||||
// window.open(config.API.getReportAccount1(goverment.value));
|
||||
};
|
||||
|
||||
const clickAccount2 = async () => {
|
||||
if (goverment.value === null || goverment.value === undefined) {
|
||||
modalWarning($q, "คำเตือน", "กรุณาเลือกหน่วยงานที่ต้องการออกรายงาน!");
|
||||
return;
|
||||
}
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.getReportAccount2(goverment.value?.value as string), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `รายงานบัญชี2_${goverment.value?.label}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
//window.open(config.API.getReportAccount2(goverment.value));
|
||||
if (goverment.value === null || goverment.value === undefined) {
|
||||
modalWarning($q, "คำเตือน", "กรุณาเลือกหน่วยงานที่ต้องการออกรายงาน!");
|
||||
return;
|
||||
}
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getReportAccount2(goverment.value?.value as string), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `รายงานบัญชี2_${goverment.value?.label}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
//window.open(config.API.getReportAccount2(goverment.value));
|
||||
};
|
||||
|
||||
const clickAccount3 = async () => {
|
||||
if (goverment.value === null || goverment.value === undefined) {
|
||||
modalWarning($q, "คำเตือน", "กรุณาเลือกหน่วยงานที่ต้องการออกรายงาน!");
|
||||
return;
|
||||
}
|
||||
loaderPage(true);
|
||||
await http
|
||||
.get(config.API.getReportAccount3(goverment.value?.value as string), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `รายงานบัญชี3_${goverment.value?.label}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
// window.open(config.API.getReportAccount3(goverment.value));
|
||||
if (goverment.value === null || goverment.value === undefined) {
|
||||
modalWarning($q, "คำเตือน", "กรุณาเลือกหน่วยงานที่ต้องการออกรายงาน!");
|
||||
return;
|
||||
}
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getReportAccount3(goverment.value?.value as string), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `รายงานบัญชี3_${goverment.value?.label}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
// window.open(config.API.getReportAccount3(goverment.value));
|
||||
};
|
||||
|
||||
const fetchOrganizationAgency = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
// .get(config.API.organizationAgency)
|
||||
.get(config.API.getOCType)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let option: any[] = [];
|
||||
data.map((r: any) => {
|
||||
option.push({
|
||||
value: r.organizationId.toString(),
|
||||
label: r.organizationName.toString(),
|
||||
});
|
||||
});
|
||||
govermentOP.value = option;
|
||||
govermentOPfilter.value = option;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
showLoader();
|
||||
await http
|
||||
// .get(config.API.organizationAgency)
|
||||
.get(config.API.getOCType)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let option: any[] = [];
|
||||
data.map((r: any) => {
|
||||
option.push({
|
||||
value: r.organizationId.toString(),
|
||||
label: r.organizationName.toString(),
|
||||
});
|
||||
});
|
||||
govermentOP.value = option;
|
||||
govermentOPfilter.value = option;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
await fetchOrganizationAgency();
|
||||
console.log(govermentOP.value);
|
||||
hideLoader();
|
||||
await fetchOrganizationAgency();
|
||||
console.log(govermentOP.value);
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -5,84 +5,88 @@ import { ref, onMounted } from "vue";
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import { StructChart } from "structure-chart";
|
||||
import "structure-chart/structure-chart.css";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import { StructChart } from 'structure-chart'
|
||||
import 'structure-chart/structure-chart.css'
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader } = mixin;
|
||||
|
||||
// import chartData from '@/assets/structChartData'
|
||||
// const dataSource = ref(chartData)
|
||||
const dataSource = ref() // ข้อมูล Chart
|
||||
const rootOrgID = ref() // org id ของ root ตัวปัจจุบันที่เลือกอยู่
|
||||
const dataSourceLock = ref() // ข้อมูลตั้งต้นของ Chart ใช้ให้กดกลับไปที่ home
|
||||
const chartRef = ref() // อ้างอิงไปที่ตัว chart
|
||||
const dataSource = ref(); // ข้อมูล Chart
|
||||
const rootOrgID = ref(); // org id ของ root ตัวปัจจุบันที่เลือกอยู่
|
||||
const dataSourceLock = ref(); // ข้อมูลตั้งต้นของ Chart ใช้ให้กดกลับไปที่ home
|
||||
const chartRef = ref(); // อ้างอิงไปที่ตัว chart
|
||||
const savePNG = () => {
|
||||
chartRef.value.savePNG()
|
||||
}
|
||||
chartRef.value.savePNG();
|
||||
};
|
||||
const savePDF = () => {
|
||||
chartRef.value.savePDF()
|
||||
}
|
||||
chartRef.value.savePDF();
|
||||
};
|
||||
|
||||
const loader = ref<boolean>(false) // Loader
|
||||
const loader = ref<boolean>(false); // Loader
|
||||
|
||||
onMounted(async() => {
|
||||
await fetchTreeRoot()
|
||||
await fetchStructChart()
|
||||
})
|
||||
onMounted(async () => {
|
||||
await fetchTreeRoot();
|
||||
await fetchStructChart();
|
||||
});
|
||||
|
||||
/**
|
||||
* อ่าน Root ของข้อมูลทั้งหมดจาก API ต้องทำเป็นอันดับแรก เพื่อจะได้รู้รากของข้อมูล
|
||||
*/
|
||||
const fetchTreeRoot = async () => {
|
||||
loader.value = true
|
||||
let urlRequest = config.API.chartGetTreeRoot
|
||||
await http.get(urlRequest)
|
||||
.then((response) => {
|
||||
if (response.data.result.length > 0) {
|
||||
rootOrgID.value = response.data.result[0].organizationId
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e)
|
||||
})
|
||||
.finally(() => {
|
||||
loader.value = false
|
||||
})
|
||||
showLoader();
|
||||
let urlRequest = config.API.chartGetTreeRoot;
|
||||
await http
|
||||
.get(urlRequest)
|
||||
.then((response) => {
|
||||
if (response.data.result.length > 0) {
|
||||
rootOrgID.value = response.data.result[0].organizationId;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* อ่านข้อมูล organization id ปัจจุบันจาก API ข้อมูลที่ได้เอามาสร้าง Structure Chart
|
||||
*/
|
||||
const fetchStructChart = async () => {
|
||||
loader.value = true
|
||||
let urlRequest = config.API.chartGetStructure(rootOrgID.value)
|
||||
await http.get(urlRequest)
|
||||
.then((response) => {
|
||||
if (response.data.result.length > 0) {
|
||||
dataSource.value = response.data.result[0]
|
||||
if (dataSourceLock.value === undefined)
|
||||
dataSourceLock.value = dataSource.value
|
||||
breadcrumbsGen()
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e)
|
||||
})
|
||||
.finally(() => {
|
||||
loader.value = false
|
||||
})
|
||||
}
|
||||
showLoader();
|
||||
let urlRequest = config.API.chartGetStructure(rootOrgID.value);
|
||||
await http
|
||||
.get(urlRequest)
|
||||
.then((response) => {
|
||||
if (response.data.result.length > 0) {
|
||||
dataSource.value = response.data.result[0];
|
||||
if (dataSourceLock.value === undefined)
|
||||
dataSourceLock.value = dataSource.value;
|
||||
breadcrumbsGen();
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* เมื่อมีการคลิกที่ Chart ให้อ่าน ID ของหน่วยงานที่ถูกคลิก แล้วดึงข้อมูล Chart ของหน่วยงานนั้น ๆ จาก API
|
||||
* @param data
|
||||
*/
|
||||
const refreshChart = async (data: any) => {
|
||||
if (data.value !== undefined)
|
||||
rootOrgID.value = data.value
|
||||
else rootOrgID.value = data
|
||||
if (rootOrgID.value !== 0) await fetchStructChart()
|
||||
if (data.value !== undefined) data.value = 0
|
||||
}
|
||||
if (data.value !== undefined) rootOrgID.value = data.value;
|
||||
else rootOrgID.value = data;
|
||||
if (rootOrgID.value !== 0) await fetchStructChart();
|
||||
if (data.value !== undefined) data.value = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* === กระบวนการสร้าง Path ===
|
||||
|
|
@ -93,133 +97,142 @@ const refreshChart = async (data: any) => {
|
|||
* @param chart Array ของ Object ของหน่วยงานย่อยใน Tree นั้น ๆ
|
||||
*/
|
||||
const chartTraverse = (id: any, chart: any): any => {
|
||||
let _returnPath = []
|
||||
for (const child of chart) {
|
||||
if (child.deptID === id) {
|
||||
_returnPath.push({
|
||||
label: child.departmentName,
|
||||
id: child.deptID
|
||||
})
|
||||
return _returnPath
|
||||
} else {
|
||||
if (typeof child.children !== "undefined" &&
|
||||
child.children !== null &&
|
||||
child.children.length > 0) {
|
||||
let _result = chartTraverse(id, child.children)
|
||||
if (typeof _result !== "undefined" && _result !== null) {
|
||||
_returnPath.push({
|
||||
label: child.departmentName,
|
||||
id: child.deptID
|
||||
})
|
||||
return [..._returnPath, ...(_result ?? [])]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let _returnPath = [];
|
||||
for (const child of chart) {
|
||||
if (child.deptID === id) {
|
||||
_returnPath.push({
|
||||
label: child.departmentName,
|
||||
id: child.deptID,
|
||||
});
|
||||
return _returnPath;
|
||||
} else {
|
||||
if (
|
||||
typeof child.children !== "undefined" &&
|
||||
child.children !== null &&
|
||||
child.children.length > 0
|
||||
) {
|
||||
let _result = chartTraverse(id, child.children);
|
||||
if (typeof _result !== "undefined" && _result !== null) {
|
||||
_returnPath.push({
|
||||
label: child.departmentName,
|
||||
id: child.deptID,
|
||||
});
|
||||
return [..._returnPath, ...(_result ?? [])];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const findPath = (id: any) => {
|
||||
let _path = []
|
||||
_path.push({
|
||||
label: dataSourceLock.value.departmentName,
|
||||
id: dataSourceLock.value.deptID
|
||||
})
|
||||
if (dataSourceLock.value.deptID === id) return _path
|
||||
if (dataSourceLock.value.children.length > 0) {
|
||||
let _returnPath = chartTraverse(id, dataSourceLock.value.children)
|
||||
return [..._path, ...(_returnPath ?? [])]
|
||||
}
|
||||
}
|
||||
let _path = [];
|
||||
_path.push({
|
||||
label: dataSourceLock.value.departmentName,
|
||||
id: dataSourceLock.value.deptID,
|
||||
});
|
||||
if (dataSourceLock.value.deptID === id) return _path;
|
||||
if (dataSourceLock.value.children.length > 0) {
|
||||
let _returnPath = chartTraverse(id, dataSourceLock.value.children);
|
||||
return [..._path, ...(_returnPath ?? [])];
|
||||
}
|
||||
};
|
||||
|
||||
const theBreadcrumb = ref()
|
||||
const theBreadcrumb = ref();
|
||||
/**
|
||||
* สร้าง Path Breadcrumbs
|
||||
*/
|
||||
const breadcrumbsGen = () => {
|
||||
if (rootOrgID.value !== 0) {
|
||||
theBreadcrumb.value = []
|
||||
const newPath = findPath(rootOrgID.value)
|
||||
theBreadcrumb.value = newPath
|
||||
}
|
||||
}
|
||||
if (rootOrgID.value !== 0) {
|
||||
theBreadcrumb.value = [];
|
||||
const newPath = findPath(rootOrgID.value);
|
||||
theBreadcrumb.value = newPath;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">แผนภูมิโครงสร้าง</div>
|
||||
<div class="text-dark">
|
||||
<q-card flat bordered class="col-12 q-mt-sm">
|
||||
<div class="q-pa-sm row wrap items-center">
|
||||
<q-btn flat round color="primary" @click="savePNG()" icon="mdi-image">
|
||||
<q-tooltip>
|
||||
ดาวน์โหลด PNG
|
||||
</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn flat round color="red-7" @click="savePDF()" icon="mdi-file-pdf-box">
|
||||
<q-tooltip>
|
||||
ดาวน์โหลด PDF
|
||||
</q-tooltip>
|
||||
</q-btn>
|
||||
<div class="bg-grey-2 q-py-xs q-px-sm rounded-borders">
|
||||
<q-breadcrumbs>
|
||||
<template v-slot:separator>
|
||||
<q-icon
|
||||
size="1.5em"
|
||||
name="chevron_right"
|
||||
color="primary" />
|
||||
</template>
|
||||
<template v-for="link in theBreadcrumb" :key="link.id">
|
||||
<q-breadcrumbs-el :label="link.label" @click="refreshChart(link.id)" class="breadcrumbs-link"/>
|
||||
</template>
|
||||
</q-breadcrumbs>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator/>
|
||||
<div style="overflow-x: auto; overflow-y: auto" class="q-pt-md">
|
||||
<StructChart
|
||||
style="height: 70vh;"
|
||||
ref="chartRef"
|
||||
class="struct"
|
||||
:dataSource="dataSource"
|
||||
@onElementClick="refreshChart"
|
||||
/>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<full-loader :visibility="loader"></full-loader>
|
||||
<div class="toptitle text-dark col-12 row items-center">แผนภูมิโครงสร้าง</div>
|
||||
<div class="text-dark">
|
||||
<q-card flat bordered class="col-12 q-mt-sm">
|
||||
<div class="q-pa-sm row wrap items-center">
|
||||
<q-btn flat round color="primary" @click="savePNG()" icon="mdi-image">
|
||||
<q-tooltip> ดาวน์โหลด PNG </q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="red-7"
|
||||
@click="savePDF()"
|
||||
icon="mdi-file-pdf-box"
|
||||
>
|
||||
<q-tooltip> ดาวน์โหลด PDF </q-tooltip>
|
||||
</q-btn>
|
||||
<div class="bg-grey-2 q-py-xs q-px-sm rounded-borders">
|
||||
<q-breadcrumbs>
|
||||
<template v-slot:separator>
|
||||
<q-icon size="1.5em" name="chevron_right" color="primary" />
|
||||
</template>
|
||||
<template v-for="link in theBreadcrumb" :key="link.id">
|
||||
<q-breadcrumbs-el
|
||||
:label="link.label"
|
||||
@click="refreshChart(link.id)"
|
||||
class="breadcrumbs-link"
|
||||
/>
|
||||
</template>
|
||||
</q-breadcrumbs>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div style="overflow-x: auto; overflow-y: auto" class="q-pt-md">
|
||||
<StructChart
|
||||
style="height: 70vh"
|
||||
ref="chartRef"
|
||||
class="struct"
|
||||
:dataSource="dataSource"
|
||||
@onElementClick="refreshChart"
|
||||
/>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<full-loader :visibility="loader"></full-loader>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.breadcrumbs-link {
|
||||
cursor: pointer;
|
||||
cursor: pointer;
|
||||
}
|
||||
.struct .section-primary .header,.struct .section-secondary .header,.struct .section-tertiary .header {
|
||||
font-size: 1rem !important;
|
||||
.struct .section-primary .header,
|
||||
.struct .section-secondary .header,
|
||||
.struct .section-tertiary .header {
|
||||
font-size: 1rem !important;
|
||||
}
|
||||
|
||||
.struct .section-primary .column-side .side-button,.struct .section-secondary .column-side .side-button, .struct .section-list .column-side .side-button{
|
||||
background-color: #d9d9d96b !important;
|
||||
color:#545459 !important;
|
||||
width: 25px !important;
|
||||
height: 25px !important;
|
||||
font-size: 11px !important;
|
||||
padding: 0px;
|
||||
.struct .section-primary .column-side .side-button,
|
||||
.struct .section-secondary .column-side .side-button,
|
||||
.struct .section-list .column-side .side-button {
|
||||
background-color: #d9d9d96b !important;
|
||||
color: #545459 !important;
|
||||
width: 25px !important;
|
||||
height: 25px !important;
|
||||
font-size: 11px !important;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.struct .section-primary, .section-secondary,.struct .section-list{
|
||||
padding: 6px 15px 6px 15px;
|
||||
.struct .section-primary,
|
||||
.section-secondary,
|
||||
.struct .section-list {
|
||||
padding: 6px 15px 6px 15px;
|
||||
}
|
||||
.struct .section-primary .header{
|
||||
font-weight: 600 !important;
|
||||
.struct .section-primary .header {
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
.struct .section-secondary .header{
|
||||
font-weight: 400 !important;
|
||||
.struct .section-secondary .header {
|
||||
font-weight: 400 !important;
|
||||
}
|
||||
|
||||
|
||||
.struct .subchild-more{
|
||||
background-position: center !important;
|
||||
background-size: 14px !important;
|
||||
.struct .subchild-more {
|
||||
background-position: center !important;
|
||||
background-size: 14px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -820,7 +820,7 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type { OrganizaOption } from "../interface/index/Main";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
// import manageApiErrorMsg from "@/global/user_response_msg";
|
||||
import HistoryTable from "@/components/TableHistory.vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
|
|
@ -857,11 +857,10 @@ const filterHistory = ref<string>(""); //search data table history
|
|||
const modalHistory = ref<boolean>(false); //modal ประวัติการแก้ไขข้อมูล
|
||||
|
||||
//Global Variable
|
||||
const store = useDataStore();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
|
||||
const { loaderPage } = store; //แสดง load windows ขณะเรียก api
|
||||
const { success, messageError, dialogMessage } = mixin;
|
||||
const { success, messageError, dialogMessage, showLoader, hideLoader } = mixin;
|
||||
|
||||
//Notification Component Variable
|
||||
const $q = useQuasar(); // show dialog
|
||||
|
|
@ -1029,7 +1028,7 @@ const loadJsonTree = async (fileName: string) => {
|
|||
manageApiErrorMsg(e);
|
||||
})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1051,12 +1050,12 @@ const loadFileServer = async (node: any) => {
|
|||
manageApiErrorMsg(e);
|
||||
})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const isTreeHasDraft = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
let orgHasDraft = false;
|
||||
let orgPoHasDraft = false;
|
||||
await http
|
||||
|
|
@ -1072,7 +1071,7 @@ const isTreeHasDraft = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
|
||||
await http
|
||||
|
|
@ -1088,7 +1087,7 @@ const isTreeHasDraft = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
|
||||
if (orgHasDraft || orgPoHasDraft) {
|
||||
|
|
@ -1103,7 +1102,7 @@ const isTreeHasDraft = async () => {
|
|||
*/
|
||||
const fetchTreeRoot = async (isDraft: boolean) => {
|
||||
// console.log(isDraft);
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
console.log("Call API14 GetTreeRoot");
|
||||
isShowEditTree.value = isDraft; // to show same tree that we fetch
|
||||
let request = "";
|
||||
|
|
@ -1130,7 +1129,7 @@ const fetchTreeRoot = async (isDraft: boolean) => {
|
|||
// messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
if (isDraft) {
|
||||
// ถ้าไม่ต้องการให้แตก node root on first load ก็ไม่ต้องใส่
|
||||
// ต้องอยู่ตรงนี้ ถ้าอยู่ตรง .then จะ error คาดว่ามันทำงานก่อนที่ tree จะ render เสร็จ แต่ก็อาจจะไม่ใช่
|
||||
|
|
@ -1148,7 +1147,7 @@ const fetchTreeRoot = async (isDraft: boolean) => {
|
|||
const fetchChildrenByParentId = async (node: any) => {
|
||||
// console.log(isDraft);
|
||||
console.log("Call API4");
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
let request = "";
|
||||
if (isShowEditTree.value) {
|
||||
request = config.API.getDraftTreeNode(node.organizationId, node.keyId);
|
||||
|
|
@ -1168,12 +1167,12 @@ const fetchChildrenByParentId = async (node: any) => {
|
|||
manageApiErrorMsg(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const fetchPublishFile = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getPublishFileHistory)
|
||||
.then((res) => {
|
||||
|
|
@ -1191,7 +1190,7 @@ const fetchPublishFile = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1207,7 +1206,7 @@ const onLazyLoad = (node: any) => {
|
|||
*/
|
||||
console.log("Call LazyLoad");
|
||||
await fetchChildrenByParentId(node.node);
|
||||
/** loaderPage(true);
|
||||
/** showLoader();
|
||||
let request = "";
|
||||
if (isShowEditTree.value) {
|
||||
request = config.API.getDraftTreeNode(
|
||||
|
|
@ -1244,7 +1243,7 @@ const onLazyLoad = (node: any) => {
|
|||
// messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});*/
|
||||
|
||||
node.done(node.node.children); //return ค่าให้ q-tree generate children
|
||||
|
|
@ -1299,7 +1298,7 @@ const apiDeleteOrg = () => {
|
|||
// console.log("isShowEditTree", isShowEditTree.value);
|
||||
setTimeout(async () => {
|
||||
//delay for lazyLoad to be able to tricker again
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
isShowEditTree.value = true;
|
||||
await http
|
||||
.delete(config.API.delTreeOrgDraft(delStructureId.value))
|
||||
|
|
@ -1318,7 +1317,7 @@ const apiDeleteOrg = () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await isTreeHasDraft();
|
||||
});
|
||||
}, 20);
|
||||
|
|
@ -1347,7 +1346,7 @@ const apiDeletePosition = () => {
|
|||
isShowEditTree.value = false;
|
||||
setTimeout(async () => {
|
||||
//delay for lazyLoad to be able to tricker again
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
isShowEditTree.value = true;
|
||||
await http
|
||||
.delete(config.API.delTreePositionDraft(delStructureId.value))
|
||||
|
|
@ -1364,7 +1363,7 @@ const apiDeletePosition = () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await isTreeHasDraft();
|
||||
});
|
||||
}, 20);
|
||||
|
|
@ -1377,7 +1376,7 @@ const apiDeletePosition = () => {
|
|||
* ฟังก์ชัน clear data แบบร่าง
|
||||
*/
|
||||
const deleteDraft = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.delTreeOrgPoDraft)
|
||||
.then((res) => {
|
||||
|
|
@ -1389,7 +1388,7 @@ const deleteDraft = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
router.go(0);
|
||||
await isTreeHasDraft();
|
||||
});
|
||||
|
|
@ -1399,7 +1398,7 @@ const deleteDraft = async () => {
|
|||
* ฟังก์ชันเผยแพร่แบบร่าง
|
||||
*/
|
||||
const publishDraft = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.publishOrgPoDraft)
|
||||
.then((res) => {
|
||||
|
|
@ -1425,7 +1424,7 @@ const publishDraft = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await isTreeHasDraft();
|
||||
});
|
||||
};
|
||||
|
|
@ -1536,7 +1535,7 @@ const addStructure = async (node: any) => {
|
|||
});
|
||||
// console.log(node.organizationId);
|
||||
console.log("Call API1");
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
isShowEditTree.value = true; //ต้องกลับมาแสดง editTree อีกครั้ง & trigger lazyLoad โดย setExpanded
|
||||
await http
|
||||
.post(config.API.addTreeDraft, {
|
||||
|
|
@ -1557,7 +1556,7 @@ const addStructure = async (node: any) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
|
||||
popupAddOrganization.value = false;
|
||||
await isTreeHasDraft();
|
||||
|
|
@ -1589,7 +1588,7 @@ const editOrgStructure = async (node: any) => {
|
|||
if (organizCheck == true) {
|
||||
// console.log(node.organizationId);
|
||||
console.log("Call API13");
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
isShowEditTree.value = true; //end prepare for tricker LazyLoad
|
||||
await http
|
||||
.put(config.API.editTreeOrgDraft(node.organizationId), {
|
||||
|
|
@ -1629,7 +1628,7 @@ const editOrgStructure = async (node: any) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
popupEditSelectedOrganization.value = false;
|
||||
await isTreeHasDraft();
|
||||
});
|
||||
|
|
@ -1655,7 +1654,7 @@ const editPositionStructure = async (node: any) => {
|
|||
|
||||
if (positionCheck == true) {
|
||||
console.log("Call API3");
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
isShowEditTree.value = true; //end prepare for tricker LazyLoad
|
||||
await http
|
||||
.put(config.API.editTreePositionDraft(node.organizationPositionId), {
|
||||
|
|
@ -1680,7 +1679,7 @@ const editPositionStructure = async (node: any) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
popupEditSelectedPosition.value = false;
|
||||
await isTreeHasDraft();
|
||||
});
|
||||
|
|
@ -1696,7 +1695,7 @@ const clickHistory = async () => {
|
|||
modalHistory.value = true;
|
||||
// rowsHistory.value = rawHistory.value.filter((f: any) => f.id == row.id);
|
||||
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getTreeHistory)
|
||||
.then((res) => {
|
||||
|
|
@ -1722,7 +1721,7 @@ const clickHistory = async () => {
|
|||
// messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -674,15 +674,13 @@ import type {
|
|||
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
import type { QTableProps } from "quasar";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
import type { QTableProps } from "quasar";
|
||||
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, success, modalError, messageError } = mixin;
|
||||
const { date2Thai, success, modalError, messageError, showLoader, hideLoader } =
|
||||
mixin;
|
||||
const store = useOrganizationalDataStore();
|
||||
const { organizationalData, changeOrganizationalColumns } = store;
|
||||
const initialPagination = ref<Pagination>({
|
||||
|
|
@ -893,7 +891,7 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
|
|||
});
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await fetchOrganization();
|
||||
await fetchOrganizationAgency();
|
||||
await fetchOrganizationGovernmentAgency();
|
||||
|
|
@ -906,7 +904,7 @@ onMounted(async () => {
|
|||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationEmployee)
|
||||
.then((res) => {
|
||||
|
|
@ -1008,7 +1006,7 @@ const fetchData = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1016,7 +1014,7 @@ const fetchData = async () => {
|
|||
* get รายการ โครงสร้าง
|
||||
*/
|
||||
const fetchOrganization = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationMain)
|
||||
.then((res) => {
|
||||
|
|
@ -1075,7 +1073,7 @@ const fetchOrganization = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1083,7 +1081,7 @@ const fetchOrganization = async () => {
|
|||
* หน่วยงานต้นสังกัด
|
||||
*/
|
||||
const fetchOrganizationAgency = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listOrganizationHistoryAgency("หน่วยงาน"))
|
||||
.then((res) => {
|
||||
|
|
@ -1102,7 +1100,7 @@ const fetchOrganizationAgency = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1110,7 +1108,7 @@ const fetchOrganizationAgency = async () => {
|
|||
* ส่วนราชการต้นสังกัด
|
||||
*/
|
||||
const fetchOrganizationGovernmentAgency = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listOrganizationHistoryAgency("ส่วนราชการ"))
|
||||
.then((res) => {
|
||||
|
|
@ -1129,7 +1127,7 @@ const fetchOrganizationGovernmentAgency = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1137,7 +1135,7 @@ const fetchOrganizationGovernmentAgency = async () => {
|
|||
* รหัสหน่วยงาน
|
||||
*/
|
||||
const fetchOrganizationAgencyCode = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationCode)
|
||||
.then((res) => {
|
||||
|
|
@ -1158,13 +1156,13 @@ const fetchOrganizationAgencyCode = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const fetchAgencyCode = async (val: string) => {
|
||||
let option: GovermentOption[] = [];
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.organizationAgencyCode(val))
|
||||
.then((res) => {
|
||||
|
|
@ -1184,7 +1182,7 @@ const fetchAgencyCode = async (val: string) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
return option;
|
||||
};
|
||||
|
|
@ -1193,7 +1191,7 @@ const fetchAgencyCode = async (val: string) => {
|
|||
* get รายการ ตำแหน่ง
|
||||
*/
|
||||
const fetchPosition = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.positionEmployee)
|
||||
.then((res) => {
|
||||
|
|
@ -1285,7 +1283,7 @@ const fetchPosition = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1309,7 +1307,7 @@ const clickSave = async () => {
|
|||
*/
|
||||
const saveData = async () => {
|
||||
modal.value = false;
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.organizationEmployee, {
|
||||
organizationOrganizationId: organizationOrganizationId.value,
|
||||
|
|
@ -1361,7 +1359,7 @@ const saveData = async () => {
|
|||
*/
|
||||
const editData = async () => {
|
||||
modal.value = false;
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.organizationEmployeeId(id.value), {
|
||||
organizationOrganizationId: organizationOrganizationId.value,
|
||||
|
|
@ -1426,7 +1424,7 @@ const clickDelete = (id: string) => {
|
|||
};
|
||||
|
||||
const deleteData = async (id: string) => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.organizationEmployeeId(id))
|
||||
.then((res) => {
|
||||
|
|
@ -1436,7 +1434,7 @@ const deleteData = async (id: string) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await fetchData();
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ import { onMounted, computed, ref, watch } from "vue";
|
|||
import { useQuasar, QForm } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
import TableReport from "@/modules/02_organizational/components/TableReport.vue";
|
||||
import type { Columns } from "@/modules/02_organizational/interface/index/Main";
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -116,13 +116,12 @@ import config from "@/app.config";
|
|||
import type { treeTab } from "@/modules/04_registry/interface/index/Main";
|
||||
import type { ResponseTree } from "@/modules/02_organizational/interface/response/Mapping";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { date2Thai, success, dateToISO, modalError } = mixin;
|
||||
const { date2Thai, success, dateToISO, modalError, showLoader, hideLoader } =
|
||||
mixin;
|
||||
const filter = ref<string>(""); //search data table
|
||||
const visibleColumns = ref<String[]>([]);
|
||||
|
||||
|
|
@ -273,7 +272,7 @@ onMounted(async () => {
|
|||
});
|
||||
|
||||
const nodeTree = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileOrganizRoot)
|
||||
.then((res: any) => {
|
||||
|
|
@ -292,7 +291,7 @@ const nodeTree = async () => {
|
|||
})
|
||||
.catch((e: any) => {})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -306,7 +305,7 @@ const clickTree = () => {
|
|||
};
|
||||
|
||||
const onHistory = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.report2HistoryId(selected.value))
|
||||
.then((res) => {
|
||||
|
|
@ -329,13 +328,13 @@ const onHistory = async () => {
|
|||
);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const doSearch = async () => {
|
||||
//ทำไว้แล้ว เหลือ ใส่ type
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.report2TreeId(selected.value))
|
||||
.then((res) => {
|
||||
|
|
@ -370,7 +369,7 @@ const doSearch = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -386,7 +385,7 @@ const onConfirm = async () => {
|
|||
ok: "ยืนยัน",
|
||||
persistent: true,
|
||||
}).onOk(async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.report2DoneId(selected.value))
|
||||
.then((res) => {
|
||||
|
|
@ -394,7 +393,7 @@ const onConfirm = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
await doSearch();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -574,7 +574,7 @@ import { onMounted, computed, ref, watch } from "vue";
|
|||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
import TableReport from "@/modules/02_organizational/components/TableReport.vue";
|
||||
import DialogHeader from "@/modules/02_organizational/components/DialogHeader.vue";
|
||||
import DialogFooter from "@/modules/02_organizational/components/DialogFooter.vue";
|
||||
|
|
@ -585,13 +585,11 @@ import type { RequestReport2 } from "@/modules/02_organizational/interface/reque
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { date2Thai, success, dateToISO } = mixin;
|
||||
const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin;
|
||||
const id = ref<string>("");
|
||||
const myForm = ref<QForm | null>(null); //form data input
|
||||
|
||||
|
|
@ -669,10 +667,10 @@ const sideWorkOPfilter = ref<DataOption[]>([]);
|
|||
const levelOPfilter = ref<DataOption[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
if (route.params.id != undefined) {
|
||||
id.value = route.params.id.toString();
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
|
||||
await fetchGoverment();
|
||||
// await fetchAgency();
|
||||
|
|
@ -685,12 +683,12 @@ onMounted(async () => {
|
|||
await fetchLevel();
|
||||
|
||||
await fetchData();
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.report2Id(id.value))
|
||||
.then(async (res) => {
|
||||
|
|
@ -750,7 +748,7 @@ const fetchData = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -766,7 +764,7 @@ const checkSave = async () => {
|
|||
|
||||
const saveData = async () => {
|
||||
// console.log(myData.value);
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
const body: RequestReport2 = {
|
||||
organizationShortNameId: myData.value.goverment2,
|
||||
organizationOrganizationId: myData.value.agency2,
|
||||
|
|
@ -787,7 +785,7 @@ const saveData = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -797,7 +795,7 @@ const clickBack = () => {
|
|||
|
||||
//รหัสส่วนราชการ
|
||||
const fetchGoverment = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.organizationShortName)
|
||||
.then((res) => {
|
||||
|
|
@ -823,12 +821,12 @@ const fetchGoverment = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const updateGoverment = async (id: string) => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.getPositionMasterPositionNumberId(id))
|
||||
.then((res) => {
|
||||
|
|
@ -917,13 +915,13 @@ const updateGoverment = async (id: string) => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
// //ตำแหน่งเลขที่
|
||||
const fetchPositionNum = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.getPositionMasterPositionNumber)
|
||||
.then((res) => {
|
||||
|
|
@ -937,13 +935,13 @@ const fetchPositionNum = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
//ตำแหน่งประเภท
|
||||
const fetchCategory = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.positionType)
|
||||
.then((res) => {
|
||||
|
|
@ -957,13 +955,13 @@ const fetchCategory = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
//ตำแหน่งทางการบริหาร
|
||||
const fetchPositionManage = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.positionExecutive)
|
||||
.then((res) => {
|
||||
|
|
@ -977,13 +975,13 @@ const fetchPositionManage = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
//ด้านทางบริหาร
|
||||
const fetchSideManage = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.positionExecutiveSide)
|
||||
.then((res) => {
|
||||
|
|
@ -997,13 +995,13 @@ const fetchSideManage = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
//ตำแหน่งในสายงาน
|
||||
const fetchPositionWork = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.positionPath)
|
||||
.then((res) => {
|
||||
|
|
@ -1017,13 +1015,13 @@ const fetchPositionWork = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
//ด้าน/สาขา
|
||||
const fetchSideWork = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.positionSide)
|
||||
.then((res) => {
|
||||
|
|
@ -1037,13 +1035,13 @@ const fetchSideWork = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
//ระดับตำแหน่ง
|
||||
const fetchLevel = async () => {
|
||||
// loaderPage(true);
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.positionLevel)
|
||||
.then((res) => {
|
||||
|
|
@ -1057,7 +1055,7 @@ const fetchLevel = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {
|
||||
// loaderPage(false);
|
||||
// hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ import { onMounted, ref } from "vue";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import type {
|
||||
|
|
@ -344,14 +344,12 @@ import type {
|
|||
ResponseHistoryHead,
|
||||
} from "@/modules/02_organizational/interface/response/Mapping";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const $q = useQuasar(); // show dia
|
||||
const mixin = useCounterMixin();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const { loaderPage } = dataStore;
|
||||
const { date2Thai, success, dateToISO } = mixin;
|
||||
const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin;
|
||||
const id = ref<string>("");
|
||||
const previous = ref<boolean>(false);
|
||||
const next = ref<boolean>(false);
|
||||
|
|
@ -360,7 +358,7 @@ const historyHead = ref<ResponseHistoryHead[]>([]);
|
|||
const historyData = ref<ResponseHistory[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
if (route.params.id != undefined) {
|
||||
id.value = route.params.id.toString();
|
||||
|
||||
|
|
@ -386,7 +384,7 @@ const clickPreviousNext = async (page: string) => {
|
|||
};
|
||||
|
||||
const fetchHistory = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.report2HistoryId(id.value))
|
||||
.then((res) => {
|
||||
|
|
@ -402,7 +400,7 @@ const fetchHistory = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
if (historyHead.value.length > 1) {
|
||||
next.value = true;
|
||||
previous.value = false;
|
||||
|
|
@ -414,7 +412,7 @@ const fetchHistory = async () => {
|
|||
};
|
||||
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.report2HistoryDetailId(
|
||||
|
|
@ -455,7 +453,7 @@ const fetchData = async () => {
|
|||
})
|
||||
.catch((e) => {})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,116 +1,98 @@
|
|||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">รายงานบัญชี</div>
|
||||
<div class="col-12 row"></div>
|
||||
<q-card flat bordered class="col-12">
|
||||
<div class="row col-12">
|
||||
<q-tabs
|
||||
v-model="tab"
|
||||
no-caps
|
||||
inline-label
|
||||
align="left"
|
||||
active-class="text-primary"
|
||||
class="text-grey-7"
|
||||
>
|
||||
<q-tab name="audit1" label="บัญชี 1" />
|
||||
<q-tab name="audit2" label="บัญชี 2" />
|
||||
<q-tab name="audit3" label="บัญชี 3" />
|
||||
</q-tabs>
|
||||
</div>
|
||||
<q-separator />
|
||||
<q-tab-panels
|
||||
v-model="tab"
|
||||
transition-prev="jump-up"
|
||||
transition-next="jump-up"
|
||||
animated
|
||||
swipeable
|
||||
class="row col-12 text-dark"
|
||||
>
|
||||
<q-tab-panel name="audit1">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<span class="text-subtitle1 text-weight-medium"
|
||||
>รายงานบัญชีฉบับที่ 1</span
|
||||
>
|
||||
<q-select
|
||||
class="col-xs-12 col-sm-6"
|
||||
v-model="goverment"
|
||||
label="รหัสส่วนราชการ"
|
||||
dense
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="govermentOP"
|
||||
option-value="id"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="true"
|
||||
:borderless="true"
|
||||
:outlined="false"
|
||||
:hide-dropdown-icon="true"
|
||||
/>
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-download"
|
||||
round
|
||||
flat
|
||||
color="primary"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<!-- <viewpdf
|
||||
<div class="toptitle text-dark col-12 row items-center">รายงานบัญชี</div>
|
||||
<div class="col-12 row"></div>
|
||||
<q-card flat bordered class="col-12">
|
||||
<div class="row col-12">
|
||||
<q-tabs
|
||||
v-model="tab"
|
||||
no-caps
|
||||
inline-label
|
||||
align="left"
|
||||
active-class="text-primary"
|
||||
class="text-grey-7"
|
||||
>
|
||||
<q-tab name="audit1" label="บัญชี 1" />
|
||||
<q-tab name="audit2" label="บัญชี 2" />
|
||||
<q-tab name="audit3" label="บัญชี 3" />
|
||||
</q-tabs>
|
||||
</div>
|
||||
<q-separator />
|
||||
<q-tab-panels
|
||||
v-model="tab"
|
||||
transition-prev="jump-up"
|
||||
transition-next="jump-up"
|
||||
animated
|
||||
swipeable
|
||||
class="row col-12 text-dark"
|
||||
>
|
||||
<q-tab-panel name="audit1">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<span class="text-subtitle1 text-weight-medium"
|
||||
>รายงานบัญชีฉบับที่ 1</span
|
||||
>
|
||||
<q-select
|
||||
class="col-xs-12 col-sm-6"
|
||||
v-model="goverment"
|
||||
label="รหัสส่วนราชการ"
|
||||
dense
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="govermentOP"
|
||||
option-value="id"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="true"
|
||||
:borderless="true"
|
||||
:outlined="false"
|
||||
:hide-dropdown-icon="true"
|
||||
/>
|
||||
<q-btn size="md" icon="mdi-download" round flat color="primary">
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<!-- <viewpdf
|
||||
:src="pdfSrc"
|
||||
:currentpage="pdfCurrentPage"
|
||||
:totalpage="pdfTotalPage" /> -->
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="audit2">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<span class="text-subtitle1 text-weight-medium"
|
||||
>รายงานบัญชีฉบับที่ 2</span
|
||||
>
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-download"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<!-- <viewpdf
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="audit2">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<span class="text-subtitle1 text-weight-medium"
|
||||
>รายงานบัญชีฉบับที่ 2</span
|
||||
>
|
||||
<q-btn size="md" icon="mdi-download" flat round color="primary">
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<!-- <viewpdf
|
||||
:src="pdfSrc"
|
||||
:currentpage="pdfCurrentPage"
|
||||
:totalpage="pdfTotalPage" /> -->
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="audit3">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<span class="text-subtitle1 text-weight-medium"
|
||||
>รายงานบัญชีฉบับที่ 3</span
|
||||
>
|
||||
<q-btn
|
||||
size="md"
|
||||
icon="mdi-download"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<!-- <viewpdf
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="audit3">
|
||||
<div class="row col-12 items-center q-gutter-md">
|
||||
<span class="text-subtitle1 text-weight-medium"
|
||||
>รายงานบัญชีฉบับที่ 3</span
|
||||
>
|
||||
<q-btn size="md" icon="mdi-download" flat round color="primary">
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<!-- <viewpdf
|
||||
:src="pdfSrc"
|
||||
:currentpage="pdfCurrentPage"
|
||||
:totalpage="pdfTotalPage" /> -->
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
</q-card>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, computed, ref, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
import TableReport from "@/modules/02_organizational/components/TableReport.vue";
|
||||
import DialogHeader from "@/modules/02_organizational/components/DialogHeader.vue";
|
||||
import DialogFooter from "@/modules/02_organizational/components/DialogFooter.vue";
|
||||
|
|
@ -121,13 +103,11 @@ import type { RequestReport2 } from "@/modules/02_organizational/interface/reque
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { date2Thai, success, dateToISO } = mixin;
|
||||
const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin;
|
||||
|
||||
const govermentOP = ref<DataOption[]>([]);
|
||||
const govermentOPfilter = ref<DataOption[]>([]);
|
||||
|
|
@ -135,32 +115,32 @@ const goverment = ref<string>("");
|
|||
const tab = ref<string>("audit1");
|
||||
|
||||
const fetchOrganizationAgency = async () => {
|
||||
loaderPage(true);
|
||||
await http
|
||||
// .get(config.API.organizationAgency)
|
||||
.get(config.API.listOrganizationAgency("หน่วยงาน"))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let option: DataOption[] = [];
|
||||
data.map((r: any) => {
|
||||
option.push({
|
||||
id: r.organizationId.toString(),
|
||||
name: r.organizationName.toString(),
|
||||
});
|
||||
});
|
||||
govermentOP.value = option;
|
||||
govermentOPfilter.value = option;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
});
|
||||
showLoader();
|
||||
await http
|
||||
// .get(config.API.organizationAgency)
|
||||
.get(config.API.listOrganizationAgency("หน่วยงาน"))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let option: DataOption[] = [];
|
||||
data.map((r: any) => {
|
||||
option.push({
|
||||
id: r.organizationId.toString(),
|
||||
name: r.organizationName.toString(),
|
||||
});
|
||||
});
|
||||
govermentOP.value = option;
|
||||
govermentOPfilter.value = option;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
await fetchOrganizationAgency();
|
||||
hideLoader();
|
||||
await fetchOrganizationAgency();
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue