KPI ==> List load

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-29 17:32:47 +07:00
parent 32a56951ba
commit b828b21aea

View file

@ -13,7 +13,6 @@ import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useKpiDataStore } from "@/modules/08_KPI/store"; import { useKpiDataStore } from "@/modules/08_KPI/store";
const commanderOp = ref<any[]>([]);
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const store = useKpiDataStore(); const store = useKpiDataStore();
@ -22,7 +21,7 @@ const { showLoader, hideLoader, messageError, date2Thai, dialogConfirm } =
mixin; mixin;
/** Table*/ /** Table*/
const rows = ref<any>(); const rows = ref<any[]>([]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"createdAt", "createdAt",
"year", "year",
@ -135,14 +134,14 @@ const total = ref<number>(0);
const totalList = ref<number>(1); const totalList = ref<number>(1);
const isRoundClose = ref<boolean>(false); const isRoundClose = ref<boolean>(false);
function fetchRoundOption(type: string) { async function fetchRoundOption(type: string) {
const y = type === "main" ? year.value : yearDialog.value; const y = type === "main" ? year.value : yearDialog.value;
showLoader(); showLoader();
http await http
.get( .get(
config.API.kpiPeriod + `?page=${1}&pageSize=${10}&keyword=${""}&year=${y}` config.API.kpiPeriod + `?page=${1}&pageSize=${10}&keyword=${""}&year=${y}`
) )
.then((res) => { .then(async (res) => {
const data = res.data.result.data; const data = res.data.result.data;
const list = data.map((e: any) => ({ const list = data.map((e: any) => ({
id: e.id, id: e.id,
@ -157,7 +156,7 @@ function fetchRoundOption(type: string) {
if (type === "main") { if (type === "main") {
roundMainOp.value = list; roundMainOp.value = list;
round.value = ""; round.value = "";
fetchList(); await fetchList();
} else { } else {
roundDialgOp.value = list; roundDialgOp.value = list;
formRound.kpiPeriodId = { id: "", name: "", isClosed: false }; formRound.kpiPeriodId = { id: "", name: "", isClosed: false };
@ -171,16 +170,18 @@ function fetchRoundOption(type: string) {
}); });
} }
/** ดึงข้อมูล */ /**
function fetchList() { * fetch รายการขอรบประเมนผลการปฏราชการระดบบคคล
*/
async function fetchList() {
showLoader(); showLoader();
http await http
.get( .get(
config.API.kpiEvaluation + config.API.kpiEvaluation +
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&kpiPeriodId=${round.value}` `?page=${formQuery.page}&pageSize=${formQuery.pageSize}&kpiPeriodId=${round.value}`
) )
.then((res) => { .then(async (res) => {
const data = res.data.result; const data = await res.data.result;
total.value = data.total; total.value = data.total;
totalList.value = Math.ceil(data.total / formQuery.pageSize); totalList.value = Math.ceil(data.total / formQuery.pageSize);
rows.value = data.data; rows.value = data.data;
@ -201,26 +202,6 @@ function changRound() {
function redirectViewDetail(id: string) { function redirectViewDetail(id: string) {
store.tabMain = "1"; store.tabMain = "1";
// store.indicatorWeightTotal = 0;
// store.indicatorWeight1Total = 0;
// store.indicatorWeight2Total = 0;
// store.indicatorPercentVal = 0;
// store.indicatorScore = 0;
// store.indicatorScoreVal = 0;
// store.competencyScore = 0;
// store.competencyScoreVal = 0;
// store.devScore = 0;
// store.devScoreVal = 0;
// store.competencyDevScore = 0;
// store.excusiveCompetencyScore = 0;
// store.excusiveIndicator1PercentVal = 0;
// store.excusiveIndicator1Weight = 0;
// store.excusiveIndicator1ScoreVal = 0;
// store.excusiveIndicator2Weight = 0;
// store.excusiveIndicator2PercentVal = 0;
// store.excusiveIndicator2ScoreVal = 0;
// store.excusiveIndicatorScore = 0;
router.push(`/KPI/${id}`); router.push(`/KPI/${id}`);
} }
@ -346,8 +327,7 @@ function getOrgOp() {
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) });
.finally(() => {});
} }
function filterOption(val: any, update: Function, refData: string) { function filterOption(val: any, update: Function, refData: string) {
@ -378,9 +358,8 @@ function filterOption(val: any, update: Function, refData: string) {
} }
} }
onMounted(() => { onMounted(async () => {
fetchRoundOption("main"); await Promise.all([fetchRoundOption("main"), getOrgOp()]);
getOrgOp();
}); });
</script> </script>
@ -400,19 +379,7 @@ onMounted(() => {
/> />
รายการขอรบประเมนผลการปฏราชการระดบบคคล รายการขอรบประเมนผลการปฏราชการระดบบคคล
</div> </div>
<!-- <div class="toptitle text-white col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.push(`/`)"
/>
รายการขอรบประเมนผลการปฏราชการระดบบคคล
</div> -->
<div class="col-12"> <div class="col-12">
<q-card bordered class="q-pa-md"> <q-card bordered class="q-pa-md">
<div class="row q-col-gutter-sm q-mb-sm"> <div class="row q-col-gutter-sm q-mb-sm">
@ -581,7 +548,7 @@ onMounted(() => {
<q-dialog v-model="modalDialog" persistent> <q-dialog v-model="modalDialog" persistent>
<q-card <q-card
class="col-12" class="col-12"
:style="$q.screen.gt.xs ? 'width: 25vw' : 'width: 100vw'" :style="$q.screen.gt.xs ? 'width: 20vw' : 'width: 100vw'"
> >
<q-form greedy @submit.prevent @validation-success="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader :tittle="'สร้างแบบประเมินผลฯ'" :close="onCloseDialog" /> <DialogHeader :tittle="'สร้างแบบประเมินผลฯ'" :close="onCloseDialog" />