no message

This commit is contained in:
setthawutttty 2023-08-09 12:09:46 +07:00
parent f4aa92634e
commit 44ab2aa17e
6 changed files with 463 additions and 249 deletions

View file

@ -1,6 +1,8 @@
import env from "../index"; import env from "../index";
const dataOptions = `${env.API_PROBATION_URI}/data-options`; const dataOptions = `${env.API_PROBATION_URI}/data-options`;
const personal = `${env.API_PROBATION_URI}/personal`; const personal = `${env.API_PROBATION_URI}/personal`;
const calculate = `${env.API_PROBATION_URI}/calculate`;
const finish = `${env.API_PROBATION_URI}/assign`;
export default { export default {
competencyOptions: () => `${dataOptions}/competency`, competencyOptions: () => `${dataOptions}/competency`,
@ -8,7 +10,11 @@ export default {
knowledgeOptions: () => `${dataOptions}/knowledge`, knowledgeOptions: () => `${dataOptions}/knowledge`,
skillOptions: () => `${dataOptions}/skill`, skillOptions: () => `${dataOptions}/skill`,
lawOptions: () => `${dataOptions}/law`, lawOptions: () => `${dataOptions}/law`,
personalList: () => `${personal}/list`,
personal: (personalId:string) => `${personal}?personal_id=${personalId}`,
newAssign: (personalId:string) => `${dataOptions}/new-assign?personal_id=${personalId}`,
calculateDate: () => `${calculate}/assign-finish`,
saveFinish: (personalId:string) => `${finish}/probation-assign?personal_id=${personalId}`,
personalAdd: () => `${personal}/add`, personalAdd: () => `${personal}/add`,
// clearPosition: (personalId:string) => `${placement}/position/clear/${personalId}` // clearPosition: (personalId:string) => `${placement}/position/clear/${personalId}`
}; };

View file

@ -67,6 +67,7 @@
dense dense
borderless borderless
option-label="label" option-label="label"
option-value="value"
:outlined="routeName === 'probationWorkAdd'" :outlined="routeName === 'probationWorkAdd'"
v-model="monthSelect" v-model="monthSelect"
:label="`ระยะเวลากี่เดือน`" :label="`ระยะเวลากี่เดือน`"
@ -154,6 +155,7 @@
<div class="col-12 row q-col-gutter-md"> <div class="col-12 row q-col-gutter-md">
<q-select <q-select
:rules="[(val) => !!val || 'กรุณาเลือกผู้ดูเเล']" :rules="[(val) => !!val || 'กรุณาเลือกผู้ดูเเล']"
option-value="personal_id"
:options="OPcaretaker" :options="OPcaretaker"
class="col-xs-12 col-sm-6" class="col-xs-12 col-sm-6"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
@ -163,10 +165,13 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="caretaker1" v-model="caretaker1"
:label="`ผู้ดูแลคนที่ 1`" :label="`ผู้ดูแลคนที่ 1`"
option-label="name"
/> />
<q-select <q-select
:rules="[(val) => !!val || 'กรุณาเลือกผู้ดูเเล']" :rules="[(val) => !!val || 'กรุณาเลือกผู้ดูเเล']"
:options="OPcaretaker" :options="OPcaretaker"
option-value="personal_id"
option-label="name"
hide-bottom-space hide-bottom-space
class="col-xs-12 col-sm-6" class="col-xs-12 col-sm-6"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
@ -552,10 +557,18 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="skill" v-model="skill"
label="ด้านที่ 1" label="ด้านที่ 1"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.level_description }}
</div>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
ellipsis-2-lines
:option-label=" :option-label="
(item) => (item) =>
`${item.title} - ${item.level_description}` `${item.title} - ${item.level_description}`
@ -573,7 +586,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="skill2" v-model="skill2"
label="ด้านที่ 2" label="ด้านที่ 2"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.level_description }}
</div>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
@ -594,7 +614,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="skill3" v-model="skill3"
label="ด้านที่ 3" label="ด้านที่ 3"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.level_description }}
</div>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
@ -615,7 +642,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="skill4" v-model="skill4"
label="ด้านที่ 4" label="ด้านที่ 4"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.level_description }}
</div>
</template></q-select
>
</div> </div>
</div> </div>
</div> </div>
@ -641,7 +675,9 @@
option-value="id" option-value="id"
hide-bottom-space hide-bottom-space
:rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']" :rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']"
:options="filterMain(OPmain,[main2,main3,main4,main5])" :options="
filterMain(OPmain, [main2, main3, main4, main5])
"
class="bg-white" class="bg-white"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -649,7 +685,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="main" v-model="main"
label="ตัวที่ 1" label="ตัวที่ 1"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
@ -659,7 +702,9 @@
option-value="id" option-value="id"
hide-bottom-space hide-bottom-space
:rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']" :rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']"
:options="filterMain(OPmain,[main,main3,main4,main5])" :options="
filterMain(OPmain, [main, main3, main4, main5])
"
class="bg-white" class="bg-white"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -667,7 +712,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="main2" v-model="main2"
label="ตัวที่ 2" label="ตัวที่ 2"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
@ -677,7 +729,9 @@
option-value="id" option-value="id"
hide-bottom-space hide-bottom-space
:rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']" :rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']"
:options="filterMain(OPmain,[main,main2,main4,main5])" :options="
filterMain(OPmain, [main, main2, main4, main5])
"
class="bg-white" class="bg-white"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -685,7 +739,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="main3" v-model="main3"
label="ตัวที่ 3" label="ตัวที่ 3"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
@ -695,7 +756,9 @@
option-value="id" option-value="id"
hide-bottom-space hide-bottom-space
:rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']" :rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']"
:options="filterMain(OPmain,[main,main2,main3,main5])" :options="
filterMain(OPmain, [main, main2, main3, main5])
"
class="bg-white" class="bg-white"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -703,14 +766,23 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="main4" v-model="main4"
label="ตัวที่ 4" label="ตัวที่ 4"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
hide-bottom-space hide-bottom-space
:rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']" :rules="[(val) => !!val || 'กรุณาเลือกสมรรถนะ']"
:options="filterMain(OPmain,[main,main2,main3,main4])" :options="
filterMain(OPmain, [main, main2, main3, main4])
"
:option-label=" :option-label="
(item) => `${item.title} - ${item.description}` (item) => `${item.title} - ${item.description}`
" "
@ -722,7 +794,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="main5" v-model="main5"
label="ตัวที่ 5" label="ตัวที่ 5"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</div> </div>
</div> </div>
</div> </div>
@ -731,7 +810,6 @@
<div class="col-12 row q-col-gutter-sm"> <div class="col-12 row q-col-gutter-sm">
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
:option-label=" :option-label="
(item) => `${item.title} - ${item.description}` (item) => `${item.title} - ${item.description}`
" "
@ -740,7 +818,7 @@
:rules="[ :rules="[
(val) => !!val || 'กรุณาเลือกสมรรถนะประจํากลุ่มงาน', (val) => !!val || 'กรุณาเลือกสมรรถนะประจํากลุ่มงาน',
]" ]"
:options="filterData(OPgroup,[group2,group3])" :options="filterData(OPgroup, [group2, group3])"
class="bg-white" class="bg-white"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -748,7 +826,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="group" v-model="group"
label="ตัวที่ 1" label="ตัวที่ 1"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
@ -760,7 +845,7 @@
:rules="[ :rules="[
(val) => !!val || 'กรุณาเลือกสมรรถนะประจํากลุ่มงาน', (val) => !!val || 'กรุณาเลือกสมรรถนะประจํากลุ่มงาน',
]" ]"
:options="filterData(OPgroup,[group,group3])" :options="filterData(OPgroup, [group, group3])"
class="bg-white" class="bg-white"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -768,7 +853,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="group2" v-model="group2"
label="ตัวที่ 2" label="ตัวที่ 2"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-select <q-select
@ -780,7 +872,7 @@
:rules="[ :rules="[
(val) => !!val || 'กรุณาเลือกสมรรถนะประจํากลุ่มงาน', (val) => !!val || 'กรุณาเลือกสมรรถนะประจํากลุ่มงาน',
]" ]"
:options="filterData(OPgroup,[group,group2])" :options="filterData(OPgroup, [group, group2])"
class="bg-white" class="bg-white"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -788,7 +880,14 @@
:outlined="routeName == 'probationWorkAdd'" :outlined="routeName == 'probationWorkAdd'"
v-model="group3" v-model="group3"
label="ตัวที่ 3" label="ตัวที่ 3"
/> >
<template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</div> </div>
</div> </div>
</div> </div>
@ -1179,6 +1278,8 @@
<div class="col-12 row q-col-gutter-md"> <div class="col-12 row q-col-gutter-md">
<q-select <q-select
:options="OPcaretaker" :options="OPcaretaker"
option-value="personal_id"
option-label="name"
class="col-xs-12 col-sm-8" class="col-xs-12 col-sm-8"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -1229,6 +1330,8 @@
</div> </div>
<q-select <q-select
:options="OPcaretaker" :options="OPcaretaker"
option-value="personal_id"
option-label="name"
class="col-xs-12 col-sm-8" class="col-xs-12 col-sm-8"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -1287,7 +1390,9 @@
</div> </div>
<div class="col-12 row q-col-gutter-md"> <div class="col-12 row q-col-gutter-md">
<q-select <q-select
:options="OPcaretaker" :options="OPcommander"
option-value="personal_id"
option-label="name"
class="col-xs-12 col-sm-8" class="col-xs-12 col-sm-8"
:readonly="routeName != 'probationWorkAdd'" :readonly="routeName != 'probationWorkAdd'"
dense dense
@ -1345,14 +1450,19 @@
v-show="routeName == 'probationWorkAdd'" v-show="routeName == 'probationWorkAdd'"
class="flex justify-end q-pa-sm q-gutter-sm" class="flex justify-end q-pa-sm q-gutter-sm"
> >
<q-btn unelevated label="บันทึก" color="public" @click="saveData()" /> <q-btn
unelevated
label="บันทึก"
color="public"
@click="saveData(personalId)"
/>
</div> </div>
</q-card> </q-card>
</div> </div>
</q-form> </q-form>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { ref, computed, watch, onMounted } from "vue"; import { ref, computed, watch, onMounted } from "vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
@ -1370,13 +1480,26 @@ const val1 = ref([
const router = useRouter(); const router = useRouter();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { date2Thai, notifyError } = mixin; const {
date2Thai,
notifyError,
dateToISO,
success,
messageError,
showLoader,
hideLoader,
} = mixin;
const filterData = (options: any[], excludedGroups: any[]) => { const filterData = (options: any[], excludedGroups: any[]) => {
return options.filter((item) => !excludedGroups.some((group) => group && group.id === item.id)); return options.filter(
(item) => !excludedGroups.some((group) => group && group.id === item.id)
);
}; };
const filterMain = (options: any[], excludedGroups: any[]) => { const filterMain = (options: any[], excludedGroups: any[]) => {
return options.filter((item) => !excludedGroups.some((group) => group && group.id === item.id)); return options.filter(
(item) => !excludedGroups.some((group) => group && group.id === item.id)
);
}; };
const route = useRoute();
const checkValidate = ref<boolean>(false); const checkValidate = ref<boolean>(false);
const myForm = ref<any>(null); const myForm = ref<any>(null);
const fullnameFoot = ref<string>(""); const fullnameFoot = ref<string>("");
@ -1384,12 +1507,12 @@ const positionFoot = ref<string>("");
const caretakerFoot = ref<string>(""); const caretakerFoot = ref<string>("");
const caretakerFoot2 = ref<string>(""); const caretakerFoot2 = ref<string>("");
const id = ref<number>(); const id = ref<number>();
const personal_id = ref<string>(); const personalId = route.params.personalId as string;
const fullname = ref<string>(); const fullname = ref<string>();
const knowledge_skill_map_no = ref<string[]>([]); const knowledge_skill_map_no = ref<string[]>([]);
const round_no = ref<number>(); const round_no = ref<number>();
const date_start = ref<Date | null>(null); const date_start = ref<Date>();
const date_finish = ref<Date | null>(null); const date_finish = ref<Date>();
const behavior_desc = ref<string>(); const behavior_desc = ref<string>();
const other_desc = ref<object>({}); const other_desc = ref<object>({});
const other4_desc = ref<string>(); const other4_desc = ref<string>();
@ -1408,7 +1531,6 @@ const main3 = ref<any>();
const main4 = ref<any>(); const main4 = ref<any>();
const main5 = ref<any>(); const main5 = ref<any>();
const Other = ref<string>(""); const Other = ref<string>("");
const commander = ref<string>(""); const commander = ref<string>("");
@ -1447,19 +1569,36 @@ const routeName = router.currentRoute.value.name;
const name = ref<string>(""); const name = ref<string>("");
const position = ref<string>(""); const position = ref<string>("");
const monthSelect = ref<number>(); const monthSelect = ref<number | string>();
const caretaker1 = ref<string>(""); const caretaker1 = ref<string>("");
const caretaker2 = ref<string>(""); const caretaker2 = ref<string>("");
const OPcaretaker = [ const OPcaretaker = ref<
"นางสาวรัชภรณ์ ภักดี", {
"นางสาวทวิดา กมลเวชชี", personal_id: string;
"test1", name: string;
"test2", PositionId: string;
"test3", PositionLevelId: string;
"test4", PositionLineId: string;
]; OrganizationOrganization: string;
const monthOp = [{ value: "6", label: "6 เดือน" }]; }[]
>([]);
const OPcommander = ref<
{
personal_id: string;
name: string;
PositionId: string;
PositionLevelId: string;
PositionLineId: string;
OrganizationOrganization: string;
}[]
>([]);
interface MonthOption {
value: number;
label: string;
}
const monthOp: MonthOption[] = [];
//-----------------(3.1)-----------// //-----------------(3.1)-----------//
const activityCount = ref<number>(2); const activityCount = ref<number>(2);
const activityDataArray = ref<any[]>([]); const activityDataArray = ref<any[]>([]);
@ -1486,10 +1625,10 @@ const resetActivity = () => {
//-----------------(3.2)-----------// //-----------------(3.2)-----------//
const knowledgeCount = ref<number>(3); const knowledgeCount = ref<number>(3);
const knowledge = ref<any[]>(Array.from({ length: knowledgeCount.value }, () => null)); const knowledge = ref<any[]>([]);
const OPknowledge = ref< const OPknowledge = ref<
Array<{ Array<{
knowledge_id: number; id: number;
title: number; title: number;
options: Array<Option>; options: Array<Option>;
}> }>
@ -1543,7 +1682,21 @@ interface CheckboxItem {
} }
const checkRule = ref<CheckboxItem[]>([]); const checkRule = ref<CheckboxItem[]>([]);
const getcompetency = async () => { const getAssignNew = async (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} เดือน`,
};
console.log("Assign-New", data);
monthOp.push(monthOption);
monthSelect.value = `${data.assign_month} เดือน`;
OPcaretaker.value = data.mentors;
OPcommander.value = [data.commander];
});
};
const getcompetency = async () => {
await http.get(config.API.competencyOptions()).then((res: any) => { await http.get(config.API.competencyOptions()).then((res: any) => {
const data = res.data.data; const data = res.data.data;
OPmain.value = data; OPmain.value = data;
@ -1587,7 +1740,24 @@ const getLaw = async () => {
}); });
}; };
const putData = () => { const postDateTime = async () => {
await http
.post(config.API.calculateDate(), {
month: monthSelect.value !== null ? parseInt(monthSelect.value) : null,
start_date: dateToISO(date_start.value as Date),
})
.then(async (res) => {
const result = res.data;
date_finish.value = result.finish_date;
})
.catch((e) => {})
.finally(async () => {
hideLoader();
});
};
const putData = (id: string) => {
const GUID = id;
const assign_job = activityArray.value.map((item, index) => { const assign_job = activityArray.value.map((item, index) => {
const activityDesc = activity_desc.value[index]?.trim(); const activityDesc = activity_desc.value[index]?.trim();
const goalDesc = goal_desc.value[index]?.trim(); const goalDesc = goal_desc.value[index]?.trim();
@ -1607,7 +1777,6 @@ const putData = () => {
level: item ? item.level : null, level: item ? item.level : null,
})); }));
const Productivity_assign = ProductivityArray.value.map((item, index) => { const Productivity_assign = ProductivityArray.value.map((item, index) => {
const outputDesc = output_desc.value[index]?.trim(); const outputDesc = output_desc.value[index]?.trim();
const indicatorDesc = indicator_desc.value[index]?.trim(); const indicatorDesc = indicator_desc.value[index]?.trim();
@ -1615,88 +1784,94 @@ const putData = () => {
if (outputDesc !== "" && indicatorDesc !== "") { if (outputDesc !== "" && indicatorDesc !== "") {
return { return {
id: index + 1, id: index + 1,
activity_desc: outputDesc, output_desc: outputDesc,
goal_desc: indicatorDesc, indicator_desc: indicatorDesc,
}; };
} else { } else {
return null; return null;
} }
}); });
const groupData = group.value
? { id: group.value.id, level: group.value.level }
: null;
const group2Data = group2.value
? { id: group2.value.id, level: group2.value.level }
: null;
const group3Data = group3.value
? { id: group3.value.id, level: group3.value.level }
: null;
const skillData = skill.value const allGroup = [];
? { id: skill.value.id, level: skill.value.level } if (group.value)
: null; allGroup.push({ id: group.value.id, level: group.value.level });
const skill2Data = skill2.value if (group2.value)
? { id: skill2.value.id, level: skill2.value.level } allGroup.push({ id: group2.value.id, level: group2.value.level });
: null; if (group3.value)
const skill3Data = skill3.value allGroup.push({ id: group3.value.id, level: group3.value.level });
? { id: skill3.value.id, level: skill3.value.level }
: null;
const skill4Data = skill4.value
? { id: skill4.value.id, level: skill4.value.level }
: null;
const mainData = main.value const allSkills = [];
? { id: main.value.id, level: main.value.level } if (skill.value)
: null; allSkills.push({ id: skill.value.id, level: skill.value.level });
const main2Data = main2.value if (skill2.value)
? { id: main2.value.id, level: main2.value.level } allSkills.push({ id: skill2.value.id, level: skill2.value.level });
: null; if (skill3.value)
const main3Data = main3.value allSkills.push({ id: skill3.value.id, level: skill3.value.level });
? { id: main3.value.id, level: main3.value.level } if (skill4.value)
: null; allSkills.push({ id: skill4.value.id, level: skill4.value.level });
const main4Data = main4.value
? { id: main4.value.id, level: main4.value.level } const allCompetency = [];
: null; if (main.value)
const main5Data = main5.value allCompetency.push({ id: skill.value.id, level: main.value.level });
? { id: main5.value.id, level: main5.value.level } if (main2.value)
: null; allCompetency.push({ id: main2.value.id, level: main2.value.level });
if (main3.value)
allCompetency.push({ id: main3.value.id, level: main3.value.level });
if (main4.value)
allCompetency.push({ id: main4.value.id, level: main4.value.level });
if (main5.value)
allCompetency.push({ id: main5.value.id, level: main5.value.level });
const assign_director = [
{
personal_id: caretakerFoot.value.personal_id,
role: "mentor",
dated: date2.value instanceof Date ? dateToISO(date2.value) : null,
},
{
personal_id: caretakerFoot2.value.personal_id,
role: "mentor",
dated: date3.value instanceof Date ? dateToISO(date3.value) : null,
},
{
personal_id: commander.value.personal_id,
role: "commander",
dated: date4.value instanceof Date ? dateToISO(date4.value) : null,
},
];
const data = { const data = {
personalId: GUID,
fullname: fullname.value, fullname: fullname.value,
position: position.value, position: position.value,
monthSelect: monthSelect.value !== undefined ? parseInt((monthSelect.value as any).value) : null, monthSelect:monthSelect.value !== null ? parseInt(monthSelect.value) : null,
date_start: date_start.value, date_start:
date_start.value instanceof Date
? dateToISO(date_start.value)
: new Date(),
date_finish: date_finish.value, date_finish: date_finish.value,
caretaker_1: caretaker1.value, // caretaker_1: caretaker1.value,
caretaker_2: caretaker2.value, // caretaker_2: caretaker2.value,
knowledge: know_ledge, assign_knowledges: know_ledge,
assign_job: assign_job.filter((item) => item !== null), assign_jobs: assign_job.filter((item) => item !== null),
otherlaw: OtherLaw.value, other_desc: OtherLaw.value,
skill: skillData, assign_skill: allSkills,
skill_2: skill2Data, assign_competency: allCompetency,
skill_3: skill3Data, assign_competency_group: allGroup,
skill_4: skill4Data, other4_desc: Other.value,
main: mainData, other5_no1_desc: Other5.value,
main_2: main2Data, assign_outputs: Productivity_assign.filter((item) => item !== null),
main_3: main3Data, // commander: commander.value,
main_4: main4Data, assign_director: assign_director,
main_5: main5Data, experimenter_dated: date1.value instanceof Date ? dateToISO(date1.value) : new Date(),
group: groupData, // date_2: date2.value instanceof Date ? dateToISO(date2.value) : new Date(),
group_2: group2Data, // date_3: date3.value instanceof Date ? dateToISO(date3.value) : new Date(),
group_3: group3Data, // date_4: date4.value instanceof Date ? dateToISO(date4.value) : new Date(),
other: Other.value,
other_5: Other5.value,
productivity_assign: Productivity_assign.filter((item) => item !== null),
commander: commander.value,
date_1: date1.value,
date_2: date2.value,
date_3: date3.value,
date_4: date4.value,
fullname_foot: fullnameFoot.value, fullname_foot: fullnameFoot.value,
position_foot: positionFoot.value, position_foot: positionFoot.value,
caretaker_foot: caretakerFoot.value, // caretaker_foot: caretakerFoot.value,
caretaker_foot2: caretakerFoot2.value, // caretaker_foot2: caretakerFoot2.value,
checkarray: checkRule.value assign_law: checkRule.value
.filter((item) => item.checked === 1) .filter((item) => item.checked === 1)
.map((item) => ({ .map((item) => ({
id: item.id, id: item.id,
@ -1706,16 +1881,8 @@ const putData = () => {
console.log("test", data); console.log("test", data);
}; };
const saveData = async () => { const saveData = (id: string) => {
// myForm.value.resetValidation(); myForm.value.validate().then((result: boolean) => {
// nameRef.value.validate();
// positionRef.value.validate();
// monthRef.value.validate();
// startDateRef.value.validate();
// caregiverRef1.value.validate();
// caregiverRef2.value.validate();
// workInfopRef.value.validate();
myForm.value.validate().then(async (result: boolean) => {
if (result) { if (result) {
$q.dialog({ $q.dialog({
title: "บันทึกข้อมูล", title: "บันทึกข้อมูล",
@ -1726,20 +1893,24 @@ const saveData = async () => {
}, },
}) })
.onOk(async () => { .onOk(async () => {
// putData(); const data = putData(id);
await http
.post(config.API.saveFinish(id), data)
.then(async (res) => {})
.catch((e) => {})
.finally(async () => {
hideLoader();
});
}) })
.onCancel(() => {}) .onCancel(() => {})
.onDismiss(() => {}); .onDismiss(() => {});
} else { } else {
//
putData();
notifyError($q, "กรุณากรอกข้อมูลให้ครบ"); notifyError($q, "กรุณากรอกข้อมูลให้ครบ");
} }
}); });
}; };
const OtherLaw = ref<string>(""); const OtherLaw = ref<string>("");
const skill = ref<any>(); const skill = ref<any>();
const skill2 = ref<any>(); const skill2 = ref<any>();
const skill3 = ref<any>(); const skill3 = ref<any>();
@ -1783,6 +1954,20 @@ onMounted(async () => {
await getCompetencyGroup(); await getCompetencyGroup();
await getSkill(); await getSkill();
await getKnowledge(); await getKnowledge();
await getAssignNew(personalId);
});
watch(
() => [monthSelect.value, date_start.value],
() => {
if (monthSelect.value !== undefined && date_start.value !== undefined) {
postDateTime();
}
}
);
watch(knowledge.value, () => {
knowledge.value.forEach((item) => {
OPknowledge.value = OPknowledge.value.filter((e) => e.id != item.id);
});
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -1813,4 +1998,12 @@ onMounted(async () => {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.q-item span {
white-space: normal;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
</style> </style>

View file

@ -84,7 +84,7 @@
<q-tr <q-tr
:props="props" :props="props"
class="cursor-pointer" class="cursor-pointer"
@click="router.push(`/probation/detail/${props.rowIndex + 1}`)" @click="router.push(`/probation/detail/${props.row.personal_id}`)"
> >
<q-td v-for="col in props.cols" :key="col.name" :props="props"> <q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'"> <div v-if="col.name == 'no'">
@ -257,12 +257,12 @@ const pagination = ref({
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"no", "no",
"name", "name",
"position", "position_line",
"level", "position_level",
"institution", "organization",
"time", "probation_no",
"status", "order_number",
"orderNum", "probation_status",
]); // ]); //
// //
@ -286,114 +286,63 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "position", name: "position_line",
align: "left", align: "left",
label: "ตำแหน่งในสายงาน", label: "ตำแหน่งในสายงาน",
sortable: true, sortable: true,
field: "position", field: "position_line",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "level", name: "position_level",
align: "left", align: "left",
label: "ระดับ", label: "ระดับ",
sortable: true, sortable: true,
field: "level", field: "position_level",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "institution", name: "organization",
align: "left", align: "left",
label: "สังกัด", label: "สังกัด",
sortable: true, sortable: true,
field: "institution", field: "organization",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "time", name: "probation_no",
align: "center", align: "center",
label: "ครั้งที่ทดลองงาน", label: "ครั้งที่ทดลองงาน",
sortable: true, sortable: true,
field: "time", field: "probation_no",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "orderNum", name: "order_number",
align: "center", align: "center",
label: "เลขที่คําสั่งบรรจุแต่งตั้ง", label: "เลขที่คําสั่งบรรจุแต่งตั้ง",
sortable: true, sortable: true,
field: "orderNum", field: "order_number",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "status", name: "probation_status",
align: "left", align: "left",
label: "สถานะทดลองงาน", label: "สถานะทดลองงาน",
sortable: true, sortable: true,
field: "status", field: "probation_status",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
]); ]);
// () // ()
const rows = ref<FormMainProbation[]>([ const rows = ref<FormMainProbation[]>([]);
{
no: "1",
name: "นายสมคิด ยอดใจ ",
position: "นักวิชาการพัสดุ",
level: "ปฏิบัติการ",
institution: "กลุ่มงานโครงสร้างและอัตรากำลัง ๒",
time: "1",
status: "อยู่ระหว่างการทดลองงาน",
orderNum: "11/2566",
},
{
no: "2",
name: "นายเกียรติศักดิ์ บัณฑิต",
position: "นักวิชาการพัสดุ",
level: "ปฏิบัติการ",
institution: "กลุ่มงานโครงสร้างและอัตรากำลัง ๒",
time: "1",
status: "อยู่ระหว่างการทดลองงาน",
orderNum: "11/2566",
},
{
no: "3",
name: "นางสาวกัณฐิมา กาฬสินธุ์",
position: "นักจัดการงานทั่วไป",
level: "ปฏิบัติการ",
institution: "กลุ่มงานช่วยนักบริหาร",
time: "1",
status: "อยู่ระหว่างการทดลองงาน",
orderNum: "11/2566",
},
{
no: "4",
name: "นางสาวเมขลา กระจ่างมนตรี",
position: "นักจัดการงานทั่วไป",
level: "ปฏิบัติการ",
institution: "กลุ่มงานช่วยนักบริหาร",
time: "1",
status: "ไม่ผ่านการทดลอง",
orderNum: "11/2566",
},
{
no: "5",
name: "นางสาวฐิติรัตน์ พงษ์ศิริ",
position: "นักจัดการงานทั่วไป",
level: "ปฏิบัติการ",
institution: "กลุ่มงานช่วยนักบริหาร",
time: "1",
status: "ผ่านการทดลองงาน",
orderNum: "11/2566",
},
]);
// 2 // 2
const columns2 = ref<QTableProps["columns"]>([ const columns2 = ref<QTableProps["columns"]>([
@ -483,28 +432,37 @@ const rows2 = ref<FormMainProbation2[]>([
// }, // },
]); ]);
onMounted(async () => {}); onMounted(async () => {
getpersonalList();
watch(modal, () => {
if (modal.value === true) {
fecthOrganiz();
}
}); });
const fecthOrganiz = async () => { // watch(modal, () => {
// if (modal.value === true) {
// getpersonalList();
// }
// });
const getpersonalList = async () => {
showLoader(); showLoader();
await http await http
.get(config.API.profileOrganizRoot) .get(config.API.personalList())
.then((res) => { .then((res) => {
console.log(res); const data = res.data.data;
let id = res.data.result[0].id; rows.value = data.map((item: FormMainProbation) => ({
if (id !== "") { personal_id: item.personal_id,
findlist(id); name: item.name,
} position_line: item.position_line,
}) position_line_id: item.position_line_id,
.catch((e) => { position_level: item.position_level,
messageError($q, e); position_level_id: item.position_level_id,
organization: item.organization,
probation_no: item.probation_no,
order_number: item.order_number,
probation_status: item.probation_status,
}));
console.log("(data)", data);
}) })
.catch(() => {})
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
@ -559,15 +517,11 @@ const clickAdd = (id: string) => {
.onOk(async () => { .onOk(async () => {
const postData = { const postData = {
personal_id: id, personal_id: id,
} };
console.log("postData:", postData); console.log("postData:", postData);
await http await http.post(config.API.personalAdd(), postData).then((res) => {
.post(config.API.personalAdd(), postData) console.log("res:", res);
.then((res) => { });
console.log("res:", res);
});
}) })
.onCancel(() => {}) .onCancel(() => {})
.onDismiss(() => {}); .onDismiss(() => {});

View file

@ -34,19 +34,19 @@
<div class="col-xs-6 col-sm-3 row items-center"> <div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12 q-pl-md"> <div class="col-12 q-pl-md">
<div class="col-12 text-top">ตำแหนงในสายงาน</div> <div class="col-12 text-top">ตำแหนงในสายงาน</div>
<div class="col-12 text-detail">{{ position }}</div> <div class="col-12 text-detail">{{ position_line }}</div>
</div> </div>
</div> </div>
<div class="col-xs-6 col-sm-2 row items-center"> <div class="col-xs-6 col-sm-2 row items-center">
<div class="col-12"> <div class="col-12">
<div class="col-12 text-top">ระด</div> <div class="col-12 text-top">ระด</div>
<div class="col-12 text-detail">{{ level }}</div> <div class="col-12 text-detail">{{ position_level }}</div>
</div> </div>
</div> </div>
<div class="col-xs-6 col-sm-3 row items-center"> <div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12"> <div class="col-12">
<div class="col-12 text-top">งก</div> <div class="col-12 text-top">งก</div>
<div class="col-12 text-detail">{{ institution }}</div> <div class="col-12 text-detail">{{ organization }}</div>
</div> </div>
</div> </div>
<div class="col-xs-6 col-sm-3 row items-center"> <div class="col-xs-6 col-sm-3 row items-center">
@ -55,18 +55,18 @@
<div class="col-12 text-detail"> <div class="col-12 text-detail">
<q-icon <q-icon
size="20px" size="20px"
v-if="status == 'อยู่ระหว่างการทดลองงาน'" v-if="probation_status == 'PENDING'"
name="mdi-timer-sand" name="mdi-timer-sand"
color="deep-orange" color="deep-orange"
/> />
<q-icon <q-icon
size="20px" size="20px"
v-else-if="status == 'ไม่ผ่านการทดลอง'" v-else-if="probation_status == 'ไม่ผ่านการทดลอง'"
name="mdi-close" name="mdi-close"
color="red" color="red"
/> />
<q-icon size="20px" v-else name="mdi-check" color="teal" /> <q-icon size="20px" v-else name="mdi-check" color="teal" />
{{ status }} {{ probation_status == 'PENDING' ? 'อยู่ในระหว่างการทดลองงาน' : '' }}
</div> </div>
</div> </div>
</div> </div>
@ -78,7 +78,7 @@
<div class="row col-12 q-col-gutter-sm"> <div class="row col-12 q-col-gutter-sm">
<div> <div>
<q-btn <q-btn
@click="router.push(`/probation/add`)" @click="router.push(`/probation/add/${personalId}`)"
size="12px" size="12px"
flat flat
round round
@ -191,17 +191,26 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { ref, useAttrs } from "vue"; import { ref, useAttrs,onMounted } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { FormProbationDetail } from "@/modules/05_placement/interface/request/Main"; import type { FormProbationDetail } from "@/modules/05_placement/interface/request/Main";
import type { FormProbationPersonal } from "@/modules/05_placement/interface/request/Main";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin();
const { messageError, success, showLoader, hideLoader } = mixin;
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const personalId = ref<string>(route.params.id as string);
const name = ref<string>("นายสมคิด ยอดใจ"); const name = ref<string>("");
const position = ref<string>("นักจัดการงานทั่วไป"); const position_line = ref<string>("");
const level = ref<string>("ชำนาญการพิเศษ"); const position_level = ref<string>("");
const institution = ref<string>("ฝ่ายบริหารงานทั่วไป"); const organization = ref<string>("");
const status = ref<string>("อยู่ระหว่างการทดลองงาน"); const probation_status = ref<string>("");
const pagination = ref({ const pagination = ref({
sortBy: "desc", sortBy: "desc",
@ -314,6 +323,42 @@ const paginationLabel = (start: string, end: string, total: string) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total; if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total; else return start + "-" + end + " ใน " + total;
}; };
const getpersonalList = async () => {
showLoader();
await http
.get(config.API.personal(personalId.value))
.then((res) => {
const data = res.data.data;
name.value = data.name
position_line.value = data.position_line
position_level.value = data.position_level
organization.value = data.organization
probation_status.value = data.probation_status
// rows.value = data.map((item: FormProbationPersonal) => ({
// personal_id: item.personal_id,
// name: item.name,
// position_line: item.position_line,
// position_line_id: item.position_line_id,
// position_level: item.position_level,
// position_level_id: item.position_level_id,
// organization: item.organization,
// probation_no: item.probation_no,
// order_number: item.order_number,
// probation_status: item.probation_status,
// }));
console.log("(data)", data);
})
.catch(() => {})
.finally(() => {
hideLoader();
});
};
onMounted(async () => {
await getpersonalList()
console.log()
})
</script> </script>
<style lang="scss" scope> <style lang="scss" scope>
.q-img { .q-img {

View file

@ -24,14 +24,17 @@ interface FormOrderPlacementMainData {
} }
interface FormMainProbation { interface FormMainProbation {
no: string; personal_id: number,
name: string; ordering: number,
position: string; name: string,
level: string; position_line: string,
institution: string; position_line_id: string,
time: string; position_level: string,
status: string; position_level_id: string,
orderNum: string; organization: string,
probation_no: number,
order_number: string,
probation_status: string
} }
interface FormMainProbation2 { interface FormMainProbation2 {
no: string; no: string;
@ -47,8 +50,21 @@ interface FormProbationDetail {
intendant: string; intendant: string;
commander: string; commander: string;
} }
interface FormProbationPersonal {
personal_id: string,
name: string,
position_line: string,
position_line_id: string,
position_level: string,
position_level_id: string,
organization: string,
probation_no: number,
order_number: string,
probation_status: string
}
export type { FormPlacementMainData }; export type { FormPlacementMainData };
export type { FormOrderPlacementMainData }; export type { FormOrderPlacementMainData };
export type { FormMainProbation }; export type { FormMainProbation };
export type { FormMainProbation2 }; export type { FormMainProbation2 };
export type { FormProbationDetail }; export type { FormProbationDetail };
export type { FormProbationPersonal };

View file

@ -165,7 +165,7 @@ export default [
}, },
}, },
{ {
path: "/probation/add", path: "/probation/add/:personalId",
name: "probationWorkAdd", name: "probationWorkAdd",
component: probationFormAssign, component: probationFormAssign,
meta: { meta: {