แก้ รายการตัวชี้วัดตามตำแหน่ง
This commit is contained in:
parent
12cd6bedcd
commit
96b24dbb31
2 changed files with 52 additions and 35 deletions
|
|
@ -14,6 +14,7 @@ const $q = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const heightSize = ref<string>("224");
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
const node = ref<any>([]);
|
const node = ref<any>([]);
|
||||||
const expanded = ref<any>([]);
|
const expanded = ref<any>([]);
|
||||||
|
|
@ -32,6 +33,7 @@ const {
|
||||||
success,
|
success,
|
||||||
date2Thai,
|
date2Thai,
|
||||||
calculateDurationYmd,
|
calculateDurationYmd,
|
||||||
|
dialogMessageNotify,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
const title = ref<string>(route.params.id ? "แก้ไข" : "เพิ่ม");
|
const title = ref<string>(route.params.id ? "แก้ไข" : "เพิ่ม");
|
||||||
|
|
||||||
|
|
@ -119,7 +121,7 @@ function selectAgency() {
|
||||||
|
|
||||||
/** บันทึกข้อมูล */
|
/** บันทึกข้อมูล */
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
showLoader();
|
|
||||||
const url = id.value
|
const url = id.value
|
||||||
? config.API.kpiRoleMainList + `/${id.value}`
|
? config.API.kpiRoleMainList + `/${id.value}`
|
||||||
: config.API.kpiRoleMainList;
|
: config.API.kpiRoleMainList;
|
||||||
|
|
@ -145,14 +147,19 @@ function onSubmit() {
|
||||||
orgRevisionId: form.orgRevisionId, //RevisionId หน่วยงาน
|
orgRevisionId: form.orgRevisionId, //RevisionId หน่วยงาน
|
||||||
};
|
};
|
||||||
|
|
||||||
http[id.value ? "put" : "post"](url, body)
|
if (form.nodeId == null) {
|
||||||
.then((res) => {
|
dialogMessageNotify($q, "กรุณาเลือกหน่วยงาน/ส่วนราชการ");
|
||||||
success($q, "บันทึกสำเร็จ");
|
} else {
|
||||||
router.push(`/KPI-indicator-role`);
|
showLoader();
|
||||||
})
|
http[id.value ? "put" : "post"](url, body)
|
||||||
.finally(() => {
|
.then((res) => {
|
||||||
hideLoader();
|
success($q, "บันทึกสำเร็จ");
|
||||||
});
|
router.push(`/KPI-indicator-role`);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -164,8 +171,8 @@ function getDetail() {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
form.position = data.position;
|
form.position = data.position;
|
||||||
form.year = data.year == null ? 0:data.year;
|
form.year = data.year == null ? 0 : data.year;
|
||||||
form.round = data.round;
|
form.round = data.kpiPeriodId;
|
||||||
form.including = data.including;
|
form.including = data.including;
|
||||||
form.includingName = data.includingName;
|
form.includingName = data.includingName;
|
||||||
form.target = data.target;
|
form.target = data.target;
|
||||||
|
|
@ -223,14 +230,11 @@ async function fetchTree(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTicked(val: any) {
|
function updateTicked(val: any) {
|
||||||
console.log(expanded.value);
|
|
||||||
|
|
||||||
ticked.value = [];
|
ticked.value = [];
|
||||||
ticked.value.push(val[val.length - 1]);
|
ticked.value.push(val[val.length - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSelected(data: any) {
|
function updateSelected(data: any) {
|
||||||
console.log(data);
|
|
||||||
nodeId.value = data.orgTreeId;
|
nodeId.value = data.orgTreeId;
|
||||||
orgName.value = data.orgTreeName;
|
orgName.value = data.orgTreeName;
|
||||||
form.node = data.orgLevel;
|
form.node = data.orgLevel;
|
||||||
|
|
@ -241,24 +245,19 @@ function updateSelected(data: any) {
|
||||||
function getRound() {
|
function getRound() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(
|
.get(config.API.kpiPeriod + `?year=${form.year}`)
|
||||||
config.API.kpiPeriod +
|
|
||||||
`?year=${form.year}`
|
|
||||||
)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result.data;
|
const data = res.data.result.data;
|
||||||
roundOp.value = data.map((item: any) => ({
|
roundOp.value = data.map((item: any) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: statusTothai(item.durationKPI),
|
name: statusTothai(item.durationKPI),
|
||||||
}))
|
}));
|
||||||
console.log(roundOp.value)
|
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader()
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function statusTothai(val: string) {
|
function statusTothai(val: string) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "SPECIAL":
|
case "SPECIAL":
|
||||||
|
|
@ -272,12 +271,19 @@ function statusTothai(val: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onResize(size: any) {
|
||||||
|
heightSize.value = `${size.height - 99}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setModel(val: string) {
|
||||||
|
form.position = val;
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchActive();
|
fetchActive();
|
||||||
getOptions();
|
getOptions();
|
||||||
getRound()
|
getRound();
|
||||||
if (id.value !== "") {
|
if (id.value !== "") {
|
||||||
console.log("edit");
|
|
||||||
getDetail();
|
getDetail();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -302,11 +308,13 @@ onMounted(() => {
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<q-select
|
<q-select
|
||||||
dense
|
dense
|
||||||
v-model="form.position"
|
:model-value="form.position"
|
||||||
label="ตำแหน่งในสายงาน"
|
label="ตำแหน่งในสายงาน"
|
||||||
outlined
|
outlined
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
fill-input
|
||||||
|
hide-selected
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกตำแหน่งในสายงาน'}`,]"
|
:rules="[(val:string) => !!val || `${'กรุณาเลือกตำแหน่งในสายงาน'}`,]"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
|
@ -315,6 +323,7 @@ onMounted(() => {
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
:options="positionOp"
|
:options="positionOp"
|
||||||
use-input
|
use-input
|
||||||
|
@input-value="setModel"
|
||||||
@filter="(inputValue:any,doneFn:Function) => filterOption(inputValue, doneFn) "
|
@filter="(inputValue:any,doneFn:Function) => filterOption(inputValue, doneFn) "
|
||||||
>
|
>
|
||||||
<template v-slot:no-option>
|
<template v-slot:no-option>
|
||||||
|
|
@ -334,7 +343,7 @@ onMounted(() => {
|
||||||
autoApply
|
autoApply
|
||||||
year-picker
|
year-picker
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
@update:model-value="form.round = '',getRound()"
|
@update:model-value="(form.round = ''), getRound()"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
<template #year-overlay-value="{ value }">{{
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
|
@ -351,7 +360,6 @@ onMounted(() => {
|
||||||
form.year === 0 ? null : Number(form.year) + 543
|
form.year === 0 ? null : Number(form.year) + 543
|
||||||
"
|
"
|
||||||
:label="`${'ปีงบประมาณ'}`"
|
:label="`${'ปีงบประมาณ'}`"
|
||||||
|
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -443,8 +451,8 @@ onMounted(() => {
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4" style="height: 340px">
|
<div class="col-4">
|
||||||
<q-card flat bordered>
|
<q-card flat bordered class="full-height">
|
||||||
<q-card-section class="bg-grey-3 q-pa-sm">
|
<q-card-section class="bg-grey-3 q-pa-sm">
|
||||||
<div class="text-dark text-body2 text-weight-medium">
|
<div class="text-dark text-body2 text-weight-medium">
|
||||||
หน่วยงาน/ส่วนราชการ
|
หน่วยงาน/ส่วนราชการ
|
||||||
|
|
@ -468,7 +476,10 @@ onMounted(() => {
|
||||||
<q-icon v-else name="search" color="grey-5" />
|
<q-icon v-else name="search" color="grey-5" />
|
||||||
</template>
|
</template>
|
||||||
</q-input>
|
</q-input>
|
||||||
<q-scroll-area visible style="height: 223px; margin-top: 5px">
|
<q-scroll-area
|
||||||
|
visible
|
||||||
|
:style="{ height: `${heightSize}px`, marginTop: '5px' }"
|
||||||
|
>
|
||||||
<q-tree
|
<q-tree
|
||||||
dense
|
dense
|
||||||
:nodes="node"
|
:nodes="node"
|
||||||
|
|
@ -511,8 +522,9 @@ onMounted(() => {
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8" style="height: 340px">
|
<div class="col-8">
|
||||||
<q-card flat bordered>
|
<q-card flat bordered>
|
||||||
|
<q-resize-observer @resize="onResize" />
|
||||||
<q-card-section class="bg-grey-3 q-pa-sm">
|
<q-card-section class="bg-grey-3 q-pa-sm">
|
||||||
<div class="row text-dark text-body2 text-weight-medium">
|
<div class="row text-dark text-body2 text-weight-medium">
|
||||||
<div class="text-center col-4">ระดับคะแนน</div>
|
<div class="text-center col-4">ระดับคะแนน</div>
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,9 @@ function fetchList() {
|
||||||
http
|
http
|
||||||
.get(
|
.get(
|
||||||
config.API.kpiRoleMainList +
|
config.API.kpiRoleMainList +
|
||||||
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&kpiPeriodId=${formFilter.round}&position=${formFilter.position}&year=2024`
|
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&kpiPeriodId=${formFilter.round}&position=${formFilter.position}`
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res);
|
|
||||||
const data = res.data.result.data;
|
const data = res.data.result.data;
|
||||||
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
|
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
|
||||||
rows.value = data;
|
rows.value = data;
|
||||||
|
|
@ -172,7 +171,6 @@ function getRound() {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: statusTothai(item.durationKPI),
|
name: statusTothai(item.durationKPI),
|
||||||
}))
|
}))
|
||||||
console.log(roundOp.value)
|
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader()
|
hideLoader()
|
||||||
|
|
@ -192,6 +190,10 @@ function statusTothai(val: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setModel(val:string){
|
||||||
|
formFilter.position = val
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getOptions();
|
await getOptions();
|
||||||
await getRound();
|
await getRound();
|
||||||
|
|
@ -208,17 +210,20 @@ onMounted(async () => {
|
||||||
<div class="row q-gutter-sm">
|
<div class="row q-gutter-sm">
|
||||||
<q-select
|
<q-select
|
||||||
dense
|
dense
|
||||||
v-model="formFilter.position"
|
:model-value="formFilter.position"
|
||||||
label="ตำแหน่ง"
|
label="ตำแหน่ง"
|
||||||
outlined
|
outlined
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
fill-input
|
||||||
|
hide-selected
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
:options="positionOp"
|
:options="positionOp"
|
||||||
use-input
|
use-input
|
||||||
|
@input-value="setModel"
|
||||||
@filter="(inputValue:any,doneFn:Function) => filterOption(inputValue, doneFn) "
|
@filter="(inputValue:any,doneFn:Function) => filterOption(inputValue, doneFn) "
|
||||||
@update:model-value="fetchList"
|
@update:model-value="fetchList"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue