หน้า view แบบ มอบหมายงาน
This commit is contained in:
parent
1cbf5e3f06
commit
b40a617c5a
4 changed files with 337 additions and 84 deletions
|
|
@ -82,6 +82,7 @@
|
|||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
:readonly="routeName !== 'probationWorkAdd'"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
|
|
@ -92,6 +93,9 @@
|
|||
<template #trigger>
|
||||
<q-input
|
||||
dense
|
||||
borderless
|
||||
:readonly="routeName != 'probationWorkAdd'"
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
:rules="[(val) => !!val || 'กรุณาเลือกวันที่']"
|
||||
hide-bottom-space
|
||||
class="full-width datepicker q-mb-md"
|
||||
|
|
@ -100,7 +104,6 @@
|
|||
"
|
||||
:label="`${'ตั้งเเต่วันที่'}`"
|
||||
clearable
|
||||
outlined
|
||||
@clear="clearDateExam"
|
||||
>
|
||||
</q-input>
|
||||
|
|
@ -114,7 +117,7 @@
|
|||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:readonly="isDatePicker2Readonly"
|
||||
:readonly="isDatePicker2Readonly|| routeName !== 'probationWorkAdd'"
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
|
|
@ -127,11 +130,14 @@
|
|||
<template #trigger>
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
borderless
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
readonly
|
||||
class="full-width datepicker q-mb-md"
|
||||
:model-value="
|
||||
date_finish != null ? date2Thai(date_finish) : undefined
|
||||
date_finish != null
|
||||
? date2Thai(date_finish)
|
||||
: undefined
|
||||
"
|
||||
:label="`${'ถึงวันที่'}`"
|
||||
clearable
|
||||
|
|
@ -258,6 +264,7 @@
|
|||
color="red"
|
||||
icon="mdi-trash-can-outline"
|
||||
@click="deleteactivity(index)"
|
||||
v-if="routeName === 'probationWorkAdd'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -293,10 +300,9 @@
|
|||
>
|
||||
<div class="col-11 q-my-xs">
|
||||
<q-select
|
||||
:option-label="
|
||||
(item) => `${item.title}-${item.description}`
|
||||
"
|
||||
:option-value="(level) => level.level_id"
|
||||
:option-label="(item) => `${item.title}-${item.description}`"
|
||||
option-value="id"
|
||||
map-options
|
||||
:rules="
|
||||
index < 3
|
||||
? [(val) => !!val || 'กรุณาเลือกความสามารถ']
|
||||
|
|
@ -316,15 +322,17 @@
|
|||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="index > 2"
|
||||
class="col-xs-12 col-sm-1 flex justify-center items-center"
|
||||
>
|
||||
<q-btn
|
||||
v-if="index > 2"
|
||||
v-if="routeName == 'probationWorkAdd'"
|
||||
flat
|
||||
round
|
||||
color="red"
|
||||
icon="mdi-trash-can-outline"
|
||||
@click="deleteknowledge(index)"
|
||||
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -363,11 +371,13 @@
|
|||
v-if="item.status_select === 1"
|
||||
v-model="item.checked"
|
||||
dense
|
||||
|
||||
:disable="routeName != 'probationWorkAdd'"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="index === 0" class="col-11">
|
||||
<div v-if="index === 0" class="col-11" >
|
||||
{{ item.description }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -554,6 +564,7 @@
|
|||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
borderless
|
||||
map-options
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="skill"
|
||||
label="ด้านที่ 1"
|
||||
|
|
@ -574,6 +585,7 @@
|
|||
`${item.title} - ${item.level_description}`
|
||||
"
|
||||
option-value="id"
|
||||
map-options
|
||||
hide-bottom-space
|
||||
:rules="[
|
||||
(val) => !!val || 'กรุณาเลือกความรู้ความสามารถ',
|
||||
|
|
@ -610,6 +622,7 @@
|
|||
class="bg-white"
|
||||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
map-options
|
||||
borderless
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="skill3"
|
||||
|
|
@ -638,6 +651,7 @@
|
|||
class="bg-white"
|
||||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
map-options
|
||||
borderless
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="skill4"
|
||||
|
|
@ -682,6 +696,7 @@
|
|||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
borderless
|
||||
map-options
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="main"
|
||||
label="ตัวที่ 1"
|
||||
|
|
@ -709,6 +724,7 @@
|
|||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
borderless
|
||||
map-options
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="main2"
|
||||
label="ตัวที่ 2"
|
||||
|
|
@ -735,6 +751,7 @@
|
|||
class="bg-white"
|
||||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
map-options
|
||||
borderless
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="main3"
|
||||
|
|
@ -763,6 +780,7 @@
|
|||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
borderless
|
||||
map-options
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="main4"
|
||||
label="ตัวที่ 4"
|
||||
|
|
@ -790,6 +808,7 @@
|
|||
class="bg-white"
|
||||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
map-options
|
||||
borderless
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="main5"
|
||||
|
|
@ -823,6 +842,7 @@
|
|||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
borderless
|
||||
map-options
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="group"
|
||||
label="ตัวที่ 1"
|
||||
|
|
@ -850,6 +870,7 @@
|
|||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
borderless
|
||||
map-options
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="group2"
|
||||
label="ตัวที่ 2"
|
||||
|
|
@ -868,6 +889,7 @@
|
|||
(item) => `${item.title} - ${item.description}`
|
||||
"
|
||||
option-value="id"
|
||||
map-options
|
||||
hide-bottom-space
|
||||
:rules="[
|
||||
(val) => !!val || 'กรุณาเลือกสมรรถนะประจํากลุ่มงาน',
|
||||
|
|
@ -889,6 +911,7 @@
|
|||
</template></q-select
|
||||
>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1005,6 +1028,7 @@
|
|||
<div class="col-12 row q-gutter-md">
|
||||
<q-card
|
||||
v-for="(item, index) in ProductivityArray"
|
||||
:key="index"
|
||||
flat
|
||||
bordered
|
||||
class="col-12 q-pa-sm bg-grey-1"
|
||||
|
|
@ -1048,6 +1072,7 @@
|
|||
>
|
||||
<q-btn
|
||||
flat
|
||||
v-if="routeName == 'probationWorkAdd'"
|
||||
round
|
||||
color="red"
|
||||
icon="mdi-trash-can-outline"
|
||||
|
|
@ -1122,8 +1147,10 @@
|
|||
<li>
|
||||
อื่นๆ (ถ้ามี)
|
||||
<q-input
|
||||
:readonly="routeName != 'probationWorkAdd'"
|
||||
dense
|
||||
outlined
|
||||
borderless
|
||||
:outlined="routeName == 'probationWorkAdd'"
|
||||
v-model="Other5"
|
||||
label="กรอกอื่นๆ"
|
||||
/>
|
||||
|
|
@ -1234,6 +1261,7 @@
|
|||
v-model="date1"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:readonly="routeName !== 'probationWorkAdd'"
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
|
|
@ -1296,6 +1324,7 @@
|
|||
autoApply
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
:readonly="routeName !== 'probationWorkAdd'"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
|
|
@ -1349,6 +1378,7 @@
|
|||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
:readonly="routeName !== 'probationWorkAdd'"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
|
|
@ -1408,6 +1438,7 @@
|
|||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:readonly="routeName !== 'probationWorkAdd'"
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
|
|
@ -1496,7 +1527,10 @@ const filterData = (options: any[], excludedGroups: any[]) => {
|
|||
};
|
||||
const filtermantor = (options: any[], excludedGroups: any[]) => {
|
||||
return options.filter(
|
||||
(item) => !excludedGroups.some((group) => group && group.personal_id === item.personal_id)
|
||||
(item) =>
|
||||
!excludedGroups.some(
|
||||
(group) => group && group.personal_id === item.personal_id
|
||||
)
|
||||
);
|
||||
};
|
||||
const filterMain = (options: any[], excludedGroups: any[]) => {
|
||||
|
|
@ -1535,7 +1569,7 @@ const main2 = ref<any>();
|
|||
const main3 = ref<any>();
|
||||
const main4 = ref<any>();
|
||||
const main5 = ref<any>();
|
||||
|
||||
const assignId = ref<string>(route.params.form as string);
|
||||
const Other = ref<string>("");
|
||||
const commander = ref<string>("");
|
||||
|
||||
|
|
@ -1636,13 +1670,10 @@ const OPknowledge = ref<
|
|||
Array<{
|
||||
id: number;
|
||||
title: number;
|
||||
options: Array<Option>;
|
||||
description:string;
|
||||
level: string;
|
||||
}>
|
||||
>([]);
|
||||
interface Option {
|
||||
level_id: number;
|
||||
level_desc: string;
|
||||
}
|
||||
const addKnowledge = () => {
|
||||
if (knowledgeCount.value < 6) {
|
||||
knowledgeCount.value++;
|
||||
|
|
@ -1700,8 +1731,8 @@ const getAssignNew = async (id: string) => {
|
|||
monthSelect.value = `${data.assign_month} เดือน`;
|
||||
OPcaretaker.value = data.mentors;
|
||||
OPcommander.value = [data.commander];
|
||||
fullname.value = data.person.name
|
||||
position.value = data.person.OrganizationOrganization
|
||||
fullname.value = data.person.name;
|
||||
position.value = data.person.OrganizationOrganization;
|
||||
});
|
||||
};
|
||||
const getcompetency = async (id: string) => {
|
||||
|
|
@ -1745,6 +1776,7 @@ const getSkill = async (id: string) => {
|
|||
const getLaw = async (id: string) => {
|
||||
await http.get(config.API.lawOptions(id)).then((res: any) => {
|
||||
checkRule.value = res.data.data;
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1756,7 +1788,7 @@ const postDateTime = async () => {
|
|||
})
|
||||
.then(async (res) => {
|
||||
const result = res.data;
|
||||
date_finish.value = result.finish_date;
|
||||
date_finish.value = result.finish_date;
|
||||
})
|
||||
.catch((e) => {})
|
||||
.finally(async () => {
|
||||
|
|
@ -1839,8 +1871,14 @@ const putData = (id: string) => {
|
|||
position: position.value,
|
||||
monthSelect:
|
||||
monthSelect.value !== null ? parseInt(monthSelect.value) : null,
|
||||
date_start: date_start.value instanceof Date ? dateToISO(date_start.value) : new Date(),
|
||||
date_finish: date_finish.value instanceof Date ? dateToISO(date_finish.value) : dateToISO(new Date(date_finish.value)),
|
||||
date_start:
|
||||
date_start.value instanceof Date
|
||||
? dateToISO(date_start.value)
|
||||
: new Date(),
|
||||
date_finish:
|
||||
date_finish.value instanceof Date
|
||||
? dateToISO(date_finish.value)
|
||||
: dateToISO(new Date(date_finish.value)),
|
||||
// caretaker_1: caretaker1.value,
|
||||
// caretaker_2: caretaker2.value,
|
||||
assign_knowledges: know_ledge,
|
||||
|
|
@ -1868,7 +1906,7 @@ const putData = (id: string) => {
|
|||
checked: item.checked,
|
||||
})),
|
||||
};
|
||||
return data
|
||||
return data;
|
||||
};
|
||||
|
||||
const saveData = (id: string) => {
|
||||
|
|
@ -1939,14 +1977,72 @@ const OPresourse = ref<
|
|||
level_description: string;
|
||||
}>
|
||||
>([]);
|
||||
const skillIds = [1, 2, 3, 4];
|
||||
|
||||
onMounted(async () => {
|
||||
const getAssign = async () => {
|
||||
await http.get(config.API.probationsGetAssign(assignId.value)).then((res) => {
|
||||
const data = res.data.data;
|
||||
console.log("ASSIGN-list ==>", data);
|
||||
fullname.value = data.profile.name
|
||||
position.value = data.profile.OrganizationOrganization
|
||||
date_start.value = data.assign.date_start
|
||||
date_finish.value = data.assign.date_finish
|
||||
date1.value = data.assign.experimenter_dated
|
||||
date2.value = data.mentors[0].dated
|
||||
date3.value = data.mentors[1].dated
|
||||
date4.value = data.commander.dated
|
||||
activity_desc.value = data.jobs.map((job:any) => job.activity_desc);
|
||||
goal_desc.value = data.jobs.map((job:any) => job.goal_desc);
|
||||
activityCount.value = data.jobs.length
|
||||
caretaker1.value = data.mentors[0];
|
||||
caretaker2.value = data.mentors[1];
|
||||
|
||||
commander.value = data.commander.name
|
||||
knowledge.value = data.knowledges.map((id:any)=> id.id)
|
||||
knowledgeCount.value = data.knowledges.length
|
||||
other_desc.value = data.assign.other_desc
|
||||
other4_desc.value = data.assign.other4_desc
|
||||
other5_no1_desc.value = data.assign.other5_no1_desc
|
||||
const skills = data.skills.map((skills: any) => ({
|
||||
id: skills.id,
|
||||
title: skills.title,
|
||||
level: skills.level,
|
||||
level_description: skills.description,
|
||||
}));
|
||||
[skill.value, skill2.value, skill3.value, skill4.value] = skills;
|
||||
|
||||
main.value = data.competencys[0]
|
||||
main2.value = data.competencys[1]
|
||||
main3.value = data.competencys[2]
|
||||
main4.value = data.competencys[3]
|
||||
main5.value = data.competencys[4]
|
||||
|
||||
group.value = data.competency_groups[0]
|
||||
group2.value = data.competency_groups[1]
|
||||
group3.value = data.competency_groups[2]
|
||||
|
||||
output_desc.value = data.outputs.map((output: any) => output.output_desc);
|
||||
indicator_desc.value = data.outputs.map((output: any) => output.indicator_desc);
|
||||
productivityCount.value = data.outputs.length;
|
||||
|
||||
checkRule.value = data.laws.map((law: any) => ({
|
||||
id: law.law_id,
|
||||
checked: law.selected,
|
||||
description: law.description,
|
||||
status_select: law.status_select,
|
||||
|
||||
}));
|
||||
console.log("🚀 ~ file: FormAssign.vue:2009 ~ awaithttp.get ~ checkRule:", checkRule.value)
|
||||
})
|
||||
};
|
||||
onMounted(async() => {
|
||||
await getLaw(personalId);
|
||||
await getcompetency(personalId);
|
||||
await getCompetencyGroup(personalId);
|
||||
await getSkill(personalId);
|
||||
await getKnowledge(personalId);
|
||||
await getAssignNew(personalId);
|
||||
await getAssign();
|
||||
});
|
||||
watch(
|
||||
() => [monthSelect.value, date_start.value],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue