ปรับ ตัวชี้วัด ตามแผน รอ API
This commit is contained in:
parent
789627a6a9
commit
ad66cacc1e
6 changed files with 385 additions and 212 deletions
|
|
@ -7,10 +7,14 @@ import { useRouter } from "vue-router";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import type { NewPagination } from "@/modules/14_KPI/interface/request/Main";
|
||||
import type {
|
||||
NewPagination,
|
||||
FormListMainByRole,
|
||||
} from "@/modules/14_KPI/interface/request/Main";
|
||||
import type { DataOption } from "@/modules/14_KPI/interface/index/Main";
|
||||
|
||||
import DialogHistory from "@/modules/14_KPI/components/DialogHistory.vue";
|
||||
/** use*/
|
||||
const modalHistory = ref<boolean>(false);
|
||||
const total = ref<number>();
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
|
|
@ -56,7 +60,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
]);
|
||||
const visibleColumns = ref<string[]>(["including", "includingName"]);
|
||||
|
||||
const formFilter = reactive({
|
||||
const formFilter = reactive<FormListMainByRole>({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
position: "",
|
||||
|
|
@ -70,13 +74,16 @@ const pagination = ref({
|
|||
});
|
||||
|
||||
/** Option รอบการประเมิน*/
|
||||
const roundOp = ref<DataOption[]>([]);
|
||||
const roundOp = ref<DataOption[]>([
|
||||
{ id: "APR", name: "รอบเมษายน" },
|
||||
{ id: "OCT", name: "รอบตุลาคม" },
|
||||
]);
|
||||
|
||||
function fetchList() {
|
||||
http
|
||||
.get(
|
||||
config.API.kpiRoleMainList +
|
||||
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&kpiPeriodId=${formFilter.round}&position=${formFilter.position}&keyword=${formFilter.keyword}`
|
||||
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&period=${formFilter.round}&position=${formFilter.position}&keyword=${formFilter.keyword}&year=${formFilter.year}`
|
||||
)
|
||||
.then((res) => {
|
||||
const data = res.data.result.data;
|
||||
|
|
@ -172,28 +179,6 @@ function getOptions() {
|
|||
});
|
||||
}
|
||||
|
||||
function getRound() {
|
||||
showLoader();
|
||||
http
|
||||
.get(
|
||||
config.API.kpiPeriod +
|
||||
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&keyword=${formFilter.keyword}&year=${formFilter.year}`
|
||||
)
|
||||
.then((res) => {
|
||||
const data = res.data.result.data;
|
||||
roundOp.value = data.map((item: any) => ({
|
||||
id: item.id,
|
||||
name: statusTothai(item.durationKPI),
|
||||
}));
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function statusTothai(val: string) {
|
||||
switch (val) {
|
||||
case "SPECIAL":
|
||||
|
|
@ -211,9 +196,16 @@ function setModel(val: string) {
|
|||
formFilter.position = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* เปิด dialog history
|
||||
* @param id
|
||||
*/
|
||||
function onClickHistory(id: string) {
|
||||
modalHistory.value = true;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getOptions();
|
||||
await getRound();
|
||||
await fetchList();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -281,10 +273,7 @@ onMounted(async () => {
|
|||
year-picker
|
||||
:enableTimePicker="false"
|
||||
@update:model-value="
|
||||
(formFilter.page = 1),
|
||||
(formFilter.round = ''),
|
||||
getRound(),
|
||||
fetchList()
|
||||
(formFilter.page = 1), (formFilter.round = ''), fetchList()
|
||||
"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
|
|
@ -297,7 +286,7 @@ onMounted(async () => {
|
|||
outlined
|
||||
class="inputgreen"
|
||||
:model-value="
|
||||
formFilter.year === 0
|
||||
formFilter.year === null
|
||||
? 'ทั้งหมด'
|
||||
: Number(formFilter.year) + 543
|
||||
"
|
||||
|
|
@ -311,15 +300,15 @@ onMounted(async () => {
|
|||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
<!-- <template v-if="formFilter.year" v-slot:append>
|
||||
<template v-if="formFilter.year" v-slot:append>
|
||||
<q-icon
|
||||
name="cancel"
|
||||
@click.stop.prevent="
|
||||
(formFilter.year = 0), (formFilter.page = 1), getRound(),fetchList()
|
||||
(formFilter.year = null), (formFilter.page = 1), fetchList()
|
||||
"
|
||||
class="cursor-pointer"
|
||||
/>
|
||||
</template> -->
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
|
|
@ -443,24 +432,68 @@ onMounted(async () => {
|
|||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td>
|
||||
<q-td auto-width>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
icon="edit"
|
||||
color="edit"
|
||||
@click.stop.pervent="onClickAddOrView(true, props.row.id)"
|
||||
color="grey"
|
||||
@click.stop
|
||||
size="14px"
|
||||
icon="more_vert"
|
||||
>
|
||||
<q-tooltip>แก้ไข </q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
icon="delete"
|
||||
color="red"
|
||||
@click.stop.pervent="onClickDelete(props.row.id)"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล </q-tooltip>
|
||||
<q-menu>
|
||||
<q-list style="min-width: 180px">
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop.pervent="onClickAddOrView(true, props.row.id)"
|
||||
>
|
||||
<q-item-section
|
||||
style="min-width: 0px"
|
||||
avatar
|
||||
class="q-py-sm"
|
||||
>
|
||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||
<q-icon
|
||||
color="primary"
|
||||
size="xs"
|
||||
name="mdi-pencil-outline"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>แก้ไขข้อมูล</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="onClickHistory(props.row.id)"
|
||||
>
|
||||
<q-item-section
|
||||
style="min-width: 0px"
|
||||
avatar
|
||||
class="q-py-sm"
|
||||
>
|
||||
<q-tooltip>ประวัติการแก้ไข</q-tooltip>
|
||||
<q-icon color="info" size="xs" name="mdi-history" />
|
||||
</q-item-section>
|
||||
<q-item-section>ประวัติการแก้ไข</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop.pervent="onClickDelete(props.row.id)"
|
||||
>
|
||||
<q-item-section
|
||||
style="min-width: 0px"
|
||||
avatar
|
||||
class="q-py-sm"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
<q-icon color="red" size="xs" name="mdi-delete" />
|
||||
</q-item-section>
|
||||
<q-item-section>ลบข้อมูล</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
|
|
@ -468,6 +501,8 @@ onMounted(async () => {
|
|||
</d-table>
|
||||
</div>
|
||||
</q-card>
|
||||
|
||||
<DialogHistory v-model:modal="modalHistory" />
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue