update KPI

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-28 13:44:28 +07:00
parent 48cdac3326
commit 7084c9e839
38 changed files with 473 additions and 416 deletions

View file

@ -8,9 +8,7 @@ import { useCounterMixin } from "@/stores/mixin";
import { useKpiDataStore } from "@/modules/14_KPI/store";
import { checkPermission } from "@/utils/permissions";
/**
* importType
*/
/** importType*/
import type { QTableProps } from "quasar";
import type { DataOption } from "@/modules/14_KPI/interface/index/Main";
import type {
@ -18,21 +16,15 @@ import type {
ResDevelopment,
} from "@/modules/14_KPI/interface/response/index";
/**
* importComponents
*/
/** importComponents*/
import DialogIndividual from "@/modules/14_KPI/components/results/dialogIndividual.vue";
/**
* use
*/
/** use*/
const $q = useQuasar();
const { showLoader, messageError, hideLoader } = useCounterMixin();
const store = useKpiDataStore();
/**
* props
*/
/** props*/
const tab = defineModel<string>("tab", { required: true });
/**
@ -47,9 +39,7 @@ const keyword = ref<string>("");
const modalDetail = ref<boolean>(false);
const devId = ref<string>("");
/**
* Table
*/
/** Table*/
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -142,26 +132,22 @@ const pagination = ref({
rowsPerPage: pageSize.value,
});
/**
* วแปร
*/
/** ตัวแปร*/
const year = ref<number | null>(new Date().getFullYear()); //
const roundOp = ref<DataOption[]>([]); //
/**
* function fetch รายการแผนพฒนาการปฏราชการรายบคคลยอนหล
*/
function fetcDataList() {
/** function fetch รายการแผนพัฒนาการปฏิบัติราชการรายบุคคลย้อนหลัง*/
async function fetcDataList() {
showLoader();
http
await http
.post(config.API.achievementDev, {
page: page.value,
pageSize: pageSize.value,
keyword: keyword.value,
kpiPeriodId: store.formQuery.round ? store.formQuery.round : "",
})
.then((res) => {
const data = res.data.result;
.then(async (res) => {
const data = await res.data.result;
rows.value = data.data;
total.value = data.total;
maxPage.value = Math.ceil(total.value / pageSize.value);
@ -174,20 +160,16 @@ function fetcDataList() {
});
}
/**
* function fetch รอบการประเม
*/
function fetchRoundOption() {
/** function fetch รอบการประเมิน*/
async function fetchRoundOption() {
showLoader();
http
await http
.get(
config.API.kpiPeriod +
`?page=${1}&pageSize=${10}&keyword=${""}&year=${year.value}`
)
.then(async (res) => {
const data = await res.data.result.data;
console.log(res.data.result.data);
if (res.data.result.data.length > 0) {
const list = await data.map((e: ResRound) => ({
id: e.id,
@ -201,7 +183,7 @@ function fetchRoundOption() {
roundOp.value = list;
store.formQuery.round = list[0].id;
fetcDataList();
await fetcDataList();
} else {
roundOp.value = [];
store.formQuery.round = "";
@ -216,17 +198,13 @@ function fetchRoundOption() {
});
}
/**
* function เปลยนรอบการประเม และ เรยกขอมลรายการแผนพฒนาการปฏราชการรายบคคลยอนหล
*/
/** function เปลี่ยนรอบการประเมิน และ เรียกข้อมูลรายการแผนพัฒนาการปฏิบัติราชการรายบุคคลย้อนหลัง*/
function changRound() {
store.formQuery.page = 1;
fetcDataList();
}
/**
* นหาขอม
*/
/** ค้นหาข้อมูล*/
function onSearchData() {
page.value = 1;
fetcDataList();
@ -241,20 +219,16 @@ function onClickView(id: string) {
devId.value = id;
}
/**
* ทำงานเมอมการเปลยนแถวตอหน
*/
/** ทำงานเมื่อมีการเปลี่ยนแถวต่อหน้า*/
watch(pagination, () => {
page.value = 1;
pageSize.value = pagination.value.rowsPerPage;
});
/**
* HookLifecycle
*/
onMounted(() => {
/** HookLifecycle*/
onMounted(async () => {
store.formQuery.round = "";
fetchRoundOption();
await fetchRoundOption();
});
</script>
@ -343,7 +317,6 @@ onMounted(() => {
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
<d-table