Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-01 15:20:01 +07:00
commit b79137c5cc
2 changed files with 146 additions and 89 deletions

View file

@ -87,7 +87,7 @@ const ProductivityArray = computed(() => {
return Array(productivityCount.value).fill("");
});
const OPmain = ref<
Array<{ id: number; title: string; description: string; level: number }>
Array<{ id: number; naem: string; description: string; level: string }>
>([]);
const OPgroup = ref<
Array<{ id: number; title: string; description: string; level: number }>
@ -163,8 +163,8 @@ interface CheckboxItem {
* @param id personal id
*/
async function dataEdit(id: string) {
await myForm.value.validate().then((result: boolean) => {
if (result) {
// await myForm.value.validate().then((result: boolean) => {
// if (result) {
showLoader();
const data = putDataEdit(id);
http
@ -176,10 +176,10 @@ async function dataEdit(id: string) {
getAssign();
hideLoader();
});
} else {
dialogMessageNotify($q, "กรุณากรอกข้อมูลให้ครบ");
}
});
// } else {
// dialogMessageNotify($q, "");
// }
// });
}
/**
@ -305,6 +305,7 @@ async function getUser() {
.get(config.API.orgProfilePlacement(personalId))
.then((res: any) => {
const data = res.data.result;
OPcaretaker.value = data.caregiver.map((item: any) => ({
id: item.id,
name: item.prefix + item.firstName + " " + item.lastName,
@ -369,6 +370,7 @@ async function getUser() {
async function getAssignNew(id: string) {
await http.get(config.API.newAssign(id)).then((res: any) => {
const data = res.data.data;
const monthOption = {
value: data.assign_month,
label: `${data.assign_month} เดือน`,
@ -388,30 +390,66 @@ async function getAssignNew(id: string) {
* get อม สมรรถนะหล
* @param id personal id
*/
const assign_competencyMain = ref<any>();
async function getcompetency(id: string) {
await http.get(config.API.competencyOptions(id)).then((res: any) => {
const data = res.data.data;
OPmain.value = data;
main.value = data[0];
main2.value = data[1];
main3.value = data[2];
main4.value = data[3];
main5.value = data[4];
});
http
.get(config.API.kpiCapacity + `/head`)
.then((res) => {
const data = res.data.result;
assign_competencyMain.value = data;
main.value = data[0];
main2.value = data[1];
main3.value = data[2];
main4.value = data[3];
main5.value = data[4];
console.log(main.value);
})
.catch((err) => {
messageError($q, err);
});
// await http.get(config.API.competencyOptions(id)).then((res: any) => {
// const data = res.data.data;
// console.log(data);
// OPmain.value = data;
// main.value = data[0];
// main2.value = data[1];
// main3.value = data[2];
// main4.value = data[3];
// main5.value = data[4];
// });
}
/**
* get อม สมรรถนะประจากลมงาน
* @param id personal id
*/
const assign_competencyGroupMain = ref<any>();
async function getCompetencyGroup(id: string) {
await http.get(config.API.competencyGroupOptions(id)).then((res: any) => {
const data = res.data.data;
OPgroup.value = data;
group.value = data[0];
group2.value = data[1];
group3.value = data[2];
});
console.log(position.value);
http
.get(config.API.kpiCapacity + `/group?positionName=${position.value}`)
.then((res) => {
const data = res.data.result;
assign_competencyGroupMain.value = data;
OPgroup.value = data;
group.value = data[0];
group2.value = data[1];
group3.value = data[2];
})
.catch((err) => {
messageError($q, err);
});
// await http.get(config.API.competencyGroupOptions(id)).then((res: any) => {
// const data = res.data.data;
// OPgroup.value = data;
// group.value = data[0];
// group2.value = data[1];
// group3.value = data[2];
// });
}
/**
@ -518,11 +556,11 @@ function putDataEdit(id: string) {
if (skill4.value) allSkills.push({ level: skill4.value.level });
const allCompetency = [];
if (main.value) allCompetency.push({ level: main.value.level });
if (main2.value) allCompetency.push({ level: main2.value.level });
if (main3.value) allCompetency.push({ level: main3.value.level });
if (main4.value) allCompetency.push({ level: main4.value.level });
if (main5.value) allCompetency.push({ level: main5.value.level });
if (main.value) allCompetency.push(main.value);
if (main2.value) allCompetency.push(main2.value);
if (main3.value) allCompetency.push(main3.value);
if (main4.value) allCompetency.push(main4.value);
if (main5.value) allCompetency.push(main5.value);
const assign_director = [
{
@ -603,8 +641,8 @@ function putDataEdit(id: string) {
assign_jobs: assign_job.filter((item) => item !== null),
other_desc: OtherLaw.value,
assign_skill: allSkills,
assign_competency: allCompetency,
assign_competency_group: allGroup,
assign_competency: assign_competencyMain.value,
assign_competency_group: assign_competencyGroupMain.value,
other4_desc: Other.value,
other5_no1_desc: Other5.value,
assign_outputs: Productivity_assign.filter((item) => item !== null),
@ -668,12 +706,7 @@ function putData(id: string) {
if (skill3.value) allSkills.push({ level: skill3.value.level });
if (skill4.value) allSkills.push({ level: skill4.value.level });
const allCompetency = [];
if (main.value) allCompetency.push({ level: main.value.level });
if (main2.value) allCompetency.push({ level: main2.value.level });
if (main3.value) allCompetency.push({ level: main3.value.level });
if (main4.value) allCompetency.push({ level: main4.value.level });
if (main5.value) allCompetency.push({ level: main5.value.level });
const allCompetency = assign_competencyMain.value;
const assign_director = [
{
@ -743,8 +776,8 @@ function putData(id: string) {
assign_jobs: assign_job.filter((item) => item !== null),
other_desc: OtherLaw.value,
assign_skill: allSkills,
assign_competency: allCompetency,
assign_competency_group: allGroup,
assign_competency: assign_competencyMain.value,
assign_competency_group: assign_competencyGroupMain.value,
other4_desc: Other.value,
other5_no1_desc: Other5.value,
assign_outputs: Productivity_assign.filter((item) => item !== null),
@ -768,13 +801,17 @@ function putData(id: string) {
* @param id personal id
*/
async function saveData(id: string) {
await myForm.value.validate().then((result: boolean) => {
if (result) {
dialogConfirm($q, async () => await DataSave(id));
} else {
dialogMessageNotify($q, "กรุณากรอกข้อมูลให้ครบ");
}
});
console.log("tests");
const data = putData(id);
console.log("data==>", data);
// await myForm.value.validate().then((result: boolean) => {
// if (result) {
dialogConfirm($q, async () => await DataSave(id));
// } else {
// dialogMessageNotify($q, "");
// }
// });
}
/**
@ -1006,12 +1043,12 @@ function filterFnChairman(val: string, update: any) {
/** เมื่อโหลดหน้า เรียกใช้งานฟังชั่น */
onMounted(async () => {
await getUser();
await getAssignNew(personalId);
await getLaw(personalId);
await getcompetency(personalId);
await getCompetencyGroup(personalId);
await getSkill(personalId);
await getKnowledge(personalId);
await getAssignNew(personalId);
await getcompetency(personalId);
await getCompetencyGroup(personalId);
if (assignId.value !== undefined) {
await getAssign();
}
@ -1019,7 +1056,11 @@ onMounted(async () => {
</script>
<template>
<q-form ref="myForm">
<q-form
greedy
@submit.prevent
@validation-success="assignId !== undefined ? saveEdit(assignId) : saveData(personalId)"
>
<div class="q-pa-sm">
<div class="toptitle text-dark col-12 row items-center">
<q-btn
@ -1098,14 +1139,14 @@ onMounted(async () => {
>
<q-tooltip>ยกเล</q-tooltip>
</q-btn>
<!-- @click="saveEdit(assignId)" -->
<q-btn
dense
flat
class="q-ml-md"
round
color="public"
@click="saveEdit(assignId)"
type="submit"
icon="mdi-content-save-outline"
>
<q-tooltip>นทกขอม</q-tooltip>
@ -1820,8 +1861,10 @@ onMounted(async () => {
<div class="col-12 row q-col-gutter-sm">
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1838,19 +1881,21 @@ onMounted(async () => {
v-model="main"
label="ตัวที่ 1"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1867,19 +1912,21 @@ onMounted(async () => {
v-model="main2"
label="ตัวที่ 2"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1896,19 +1943,21 @@ onMounted(async () => {
v-model="main3"
label="ตัวที่ 3"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1925,13 +1974,13 @@ onMounted(async () => {
v-model="main4"
label="ตัวที่ 4"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
@ -1941,8 +1990,10 @@ onMounted(async () => {
:options="
filterMain(OPmain, [main, main2, main3, main4])
"
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
class="bg-white"
@ -1954,13 +2005,13 @@ onMounted(async () => {
v-model="main5"
label="ตัวที่ 5"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
</div>
</div>
@ -1970,8 +2021,10 @@ onMounted(async () => {
<div class="col-12 row q-col-gutter-sm">
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๒ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1988,19 +2041,21 @@ onMounted(async () => {
v-model="group"
label="ตัวที่ 1"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๒ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -2017,19 +2072,21 @@ onMounted(async () => {
v-model="group2"
label="ตัวที่ 2"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๒ ${item.description}`
"
option-value="id"
map-options
@ -2046,13 +2103,13 @@ onMounted(async () => {
v-model="group3"
label="ตัวที่ 3"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
</div>
</div>
@ -2827,13 +2884,11 @@ onMounted(async () => {
v-show="routeName == 'probationWorkAdd'"
class="flex justify-end q-pa-sm q-gutter-sm"
>
<q-btn
unelevated
label="บันทึก"
color="public"
@click="saveData(personalId)"
/>
<q-btn unelevated label="บันทึก" type="submit" color="public"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</div>
<!-- @click="saveData(personalId)" -->
</div>
</div>
</q-form>