fix CurrentPage ==> รายการงานอื่นๆ ที่ได้รับมอบหมาย
This commit is contained in:
parent
d4bbe9ad50
commit
28c3c2273f
1 changed files with 29 additions and 55 deletions
|
|
@ -1,9 +1,13 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, watch } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { updateCurrentPage } from "@/utils/function";
|
||||
|
||||
/** importType*/
|
||||
import type {
|
||||
|
|
@ -13,12 +17,10 @@ import type {
|
|||
} from "@/modules/01_masterdata/interface/index/Main";
|
||||
import type { FormFilterAssignment } from "@/modules/01_masterdata/interface/request/Main";
|
||||
import type { ResAssignment } from "@/modules/01_masterdata/interface/response/Main";
|
||||
import Summary from "@/modules/01_masterdata/components/Indicators/Summary.vue";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
import Summary from "@/modules/01_masterdata/components/Indicators/Summary.vue";
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const { showLoader, hideLoader, dialogRemove, success, messageError } =
|
||||
|
|
@ -65,33 +67,12 @@ const formFilter = reactive<FormFilterAssignment>({
|
|||
const totalList = ref<number>(0); //จำนวนข้อมูลรายการ
|
||||
const maxPage = ref<number>(1);
|
||||
|
||||
const indicatorTotal = ref<any[]>([
|
||||
{
|
||||
value: "kpiPlan",
|
||||
label: "ตัวชี้วัดตามแผน",
|
||||
color: "edit",
|
||||
},
|
||||
{
|
||||
value: "kpiRole",
|
||||
label: "ตัวชี้วัดตามตำแหน่ง",
|
||||
color: "primary",
|
||||
},
|
||||
{
|
||||
value: "kpiSpecial",
|
||||
label: "ตัวชี้วัดงานอื่นๆ ที่ได้รับมอบหมาย",
|
||||
color: "blue",
|
||||
},
|
||||
{
|
||||
value: "total",
|
||||
label: "ทั้งหมด",
|
||||
color: "red",
|
||||
},
|
||||
]);
|
||||
|
||||
function fetchList() {
|
||||
/** ฟังก์ชันดึงข้อมูลรายการงานอื่นๆ ที่ได้รับมอบหมาย*/
|
||||
async function fetchList() {
|
||||
showLoader();
|
||||
rows.value = [];
|
||||
formFilter.year = formFilter.year ? formFilter.year.toString() : null;
|
||||
http
|
||||
await http
|
||||
.post(config.API.kpiSpecial + `/search-edit`, {
|
||||
...formFilter,
|
||||
keyword: formFilter.keyword.trim(),
|
||||
|
|
@ -103,24 +84,36 @@ function fetchList() {
|
|||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
rows.value = [];
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันเปิดดูรายละเอียดงานที่ได้รับมอบหมาย
|
||||
* @param id รหัสงานที่ได้รับมอบหมาย
|
||||
*/
|
||||
function onClickView(id: string = "") {
|
||||
router.push(`/masterdata/indicator-assignment/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันลบงานที่ได้รับมอบหมาย
|
||||
* @param id รหัสงานที่ได้รับมอบหมาย
|
||||
*/
|
||||
function onClickDelete(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.delete(config.API.kpiSpecial + `/${id}`)
|
||||
.then(() => {
|
||||
fetchList();
|
||||
.then(async () => {
|
||||
formFilter.page = await updateCurrentPage(
|
||||
formFilter.page,
|
||||
maxPage.value,
|
||||
rows.value.length
|
||||
);
|
||||
await fetchList();
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -149,27 +142,8 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
function getTotal() {
|
||||
http
|
||||
.post(config.API.indicatorSummary)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
indicatorTotal.value = indicatorTotal.value.map((indicator) => {
|
||||
return {
|
||||
...indicator,
|
||||
total: data[indicator.value],
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getTotal();
|
||||
fetchList();
|
||||
onMounted(async () => {
|
||||
await fetchList();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue