ข้อมูลการประเมิน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-03 15:10:46 +07:00
parent d52e37965f
commit daecd9524a
10 changed files with 106 additions and 176 deletions

View file

@ -506,21 +506,9 @@ onMounted(async () => {
<q-separator />
<q-card-section class="q-pa-sm">
<q-input
dense
outlined
v-model="filterAgency"
label="ค้นหา"
class="inputgreen"
>
<q-input dense outlined v-model="filterAgency" label="ค้นหา">
<template v-slot:append>
<q-icon
v-if="filterAgency !== ''"
name="clear"
class="cursor-pointer"
@click="filterAgency = ''"
/>
<q-icon v-else name="search" color="grey-5" />
<q-icon name="search" />
</template>
</q-input>
<q-tree
@ -530,7 +518,7 @@ onMounted(async () => {
node-key="orgTreeId"
label-key="labelName"
selected-color="primary"
:filter="filterAgency"
:filter="filterAgency.trim()"
no-results-label="ไม่พบข้อมูลที่ค้นหา"
no-nodes-label="ไม่มีข้อมูล"
v-model:expanded="expandedAgency"
@ -575,21 +563,9 @@ onMounted(async () => {
<q-separator />
<q-card-section class="q-pa-sm">
<q-input
dense
outlined
v-model="filter"
label="ค้นหา"
class="inputgreen"
>
<q-input dense outlined v-model="filter" label="ค้นหา">
<template v-slot:append>
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon v-else name="search" color="grey-5" />
<q-icon name="search" />
</template>
</q-input>
<q-tree
@ -599,7 +575,7 @@ onMounted(async () => {
selected-color="primary"
node-key="id"
label-key="name"
:filter="filter"
:filter="filter.trim()"
no-results-label="ไม่พบข้อมูลที่ค้นหา"
no-nodes-label="ไม่มีข้อมูล"
v-model:expanded="expandedPlan"

View file

@ -91,17 +91,17 @@ const roundOp = ref<DataOption[]>([
* @param update พเดทค
* @param refData ดาตาทองการฟลเตอร
*/
function filterOption(val: any, update: Function) {
function filterOption(val: string, update: Function) {
update(() => {
positionOp.value = positionMainOp.value.filter(
(v: any) => v.name.indexOf(val) > -1
(v: DataOption) => v.name.indexOf(val) > -1
);
});
}
/** ดึงข้อมูลตำแหน่ง */
async function getOptions() {
showLoader();
// showLoader();
await http
.get(config.API.orgSalaryPosition)
.then((res) => {
@ -126,7 +126,7 @@ async function getOptions() {
messageError($q, e);
})
.finally(() => {
hideLoader();
// hideLoader();
});
}
@ -438,13 +438,7 @@ onMounted(() => {
class="inputgreen"
>
<template v-slot:append>
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon v-else name="search" color="grey-5" />
<q-icon name="search" color="grey-5" />
</template>
</q-input>
<q-scroll-area
@ -457,7 +451,7 @@ onMounted(() => {
node-key="orgTreeId"
label-key="labelName"
v-model:expanded="expanded"
:filter="filter"
:filter="filter.trim()"
no-results-label="ไม่พบข้อมูลที่ค้นหา"
no-nodes-label="ไม่มีข้อมูล"
>

View file

@ -78,7 +78,9 @@ async function fetchList() {
await http
.get(
config.API.kpiCapacity +
`/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}&type=${store.competencyTypeVal}`
`/edit?page=${formQuery.page}&pageSize=${
formQuery.pageSize
}&keyword=${formQuery.keyword.trim()}&type=${store.competencyTypeVal}`
)
.then(async (res) => {
total.value = res.data.result.total;
@ -103,11 +105,12 @@ async function onViewDetailPage(id: string) {
}
function deleteData(id: string) {
dialogRemove($q, () => {
http
showLoader();
dialogRemove($q, async () => {
await http
.delete(config.API.kpiCapacity + `/${id}`)
.then(() => {
fetchList();
.then(async () => {
await fetchList();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
@ -190,13 +193,7 @@ onMounted(() => {
@keyup.enter="fetchNewList()"
>
<template v-slot:append>
<q-icon v-if="formQuery.keyword == ''" name="search" />
<q-icon
v-if="formQuery.keyword !== ''"
name="clear"
class="cursor-pointer"
@click="(formQuery.keyword = ''), fetchNewList()"
/>
<q-icon name="search" />
</template>
</q-input>
<q-select
@ -210,7 +207,6 @@ onMounted(() => {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>

View file

@ -59,7 +59,9 @@ async function fetchData() {
await http
.get(
config.API.kpiGroup +
`/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}`
`/edit?page=${formQuery.page}&pageSize=${
formQuery.pageSize
}&keyword=${formQuery.keyword.trim()}`
)
.then(async (res) => {
total.value = res.data.result.total;
@ -77,12 +79,13 @@ async function fetchData() {
/** เพิ่มข้อมูล */
async function addData() {
showLoader();
await http
.post(config.API.kpiGroup, {
nameGroupKPI: groupName.value,
})
.then(() => {
fetchData();
.then(async () => {
await fetchData();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
@ -95,12 +98,13 @@ async function addData() {
/** save แก้ไขข้อมูล */
async function editData(id: string) {
showLoader();
await http
.put(config.API.kpiGroupById(id), {
nameGroupKPI: groupName.value,
})
.then(() => {
fetchData();
.then(async () => {
await fetchData();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
@ -113,10 +117,11 @@ async function editData(id: string) {
/** ลบข้อมูล */
async function deleteData(id: string) {
showLoader();
await http
.delete(config.API.kpiGroupById(id))
.then(() => {
fetchData();
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
@ -151,7 +156,7 @@ async function onSubmit() {
dialogConfirm(
$q,
async () => {
editStatus.value ? editData(editId.value) : addData();
editStatus.value ? await editData(editId.value) : await addData();
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
@ -205,14 +210,7 @@ onMounted(async () => {
label="ค้นหา"
@keyup.enter="fetchNewList()"
>
<template v-slot:append>
<q-icon v-if="formQuery.keyword == ''" name="search" />
<q-icon
v-if="formQuery.keyword !== ''"
name="clear"
class="cursor-pointer"
@click="(formQuery.keyword = ''), fetchNewList()"
/> </template
<template v-slot:append> <q-icon name="search" /> </template
></q-input>
<q-select
v-model="visibleColumns"
@ -225,7 +223,6 @@ onMounted(async () => {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>

View file

@ -84,9 +84,6 @@ const {
dialogConfirm,
} = mixin;
const competencyType = ref<string>("ID1");
const filterKeyword = ref<string>("");
const visibleColumns = ref<string[]>(["groupName", "positions", "capacitys"]);
const formQuery = reactive({
@ -102,7 +99,9 @@ async function getData() {
http
.get(
config.API.kpiLink +
`/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}`
`/edit?page=${formQuery.page}&pageSize=${
formQuery.pageSize
}&keyword=${formQuery.keyword.trim()}`
)
.then((res) => {
total.value = res.data.result.total;
@ -116,12 +115,13 @@ async function getData() {
}
async function deleteData(id: string) {
showLoader();
await http
.delete(config.API.kpiLink + `/${id}`)
.then(() => {
.then(async () => {
await getData();
success($q, "ลบข้อมูลสำเร็จ");
close();
getData();
})
.catch((err) => {
messageError($q, err);
@ -211,7 +211,7 @@ async function onEdit(data: any) {
editStatus.value = true;
}
function getDataEdit(id: string) {
async function getDataEdit(id: string) {
showLoader();
http
.get(config.API.kpiLink + `/edit/${id}`)
@ -241,14 +241,20 @@ function onSubmit() {
positions: position.value,
kpiCapacityIds: competency.value?.map((i: any) => i.id),
};
dialogConfirm($q, () => {
dialogConfirm($q, async () => {
showLoader();
http[editStatus.value ? "put" : "post"](url, body)
.then(() => {
.then(async () => {
await getData();
success($q, "บันทึกสำเร็จ");
close();
getData();
})
.finally(() => {});
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
@ -261,7 +267,7 @@ function close() {
competency.value = [];
}
function getOptions() {
async function getOptions() {
http.get(config.API.orgSalaryPosition).then((res) => {
const dataOp = res.data.result;
const uniqueNames = new Set();
@ -371,13 +377,7 @@ onMounted(async () => {
@keyup.enter="fetchNewList()"
>
<template v-slot:append>
<q-icon v-if="formQuery.keyword == ''" name="search" />
<q-icon
v-if="formQuery.keyword !== ''"
name="clear"
class="cursor-pointer"
@click="(formQuery.keyword = ''), fetchNewList()"
/> </template
<q-icon name="search" /> </template
></q-input>
<q-select
v-model="visibleColumns"
@ -390,8 +390,7 @@ onMounted(async () => {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
style="min-width: 140px"
>
</q-select>
</div>
@ -517,6 +516,8 @@ onMounted(async () => {
option-value="id"
:options="groupNameOp"
use-input
hide-selected
fill-input
@filter="(inputValue:any,doneFn:Function) => filterOptionGroup(inputValue, doneFn) "
hide-bottom-space
lazy-rules

View file

@ -11,7 +11,8 @@ import { useRoute } from "vue-router";
const $q = useQuasar();
const route = useRoute();
const { showLoader, hideLoader, success } = useCounterMixin();
const { showLoader, hideLoader, success, dialogConfirm, messageError } =
useCounterMixin();
const dataLevel = ref<any>();
const fieldLabels = {
@ -23,28 +24,40 @@ const fieldLabels = {
};
function onSubmit() {
const body = {
formScore: dataLevel.value.map((item: any) => {
const { level, ...rest } = item;
return rest;
}),
};
dialogConfirm($q, async () => {
showLoader();
const body = {
formScore: dataLevel.value.map((item: any) => {
const { level, ...rest } = item;
return rest;
}),
};
http
.put(config.API.kpiEvaluation, body.formScore)
.then((res) => {
success($q, "บันทึกสำเร็จ");
})
.finally(() => {});
await http
.put(config.API.kpiEvaluation, body.formScore)
.then(async () => {
await getData();
success($q, "บันทึกสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
function getData() {
async function getData() {
showLoader();
http
.get(config.API.kpiEvaluation + `/edit`)
.then((res) => {
dataLevel.value = res.data.result.data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});