แก้ไข Form ทดลองงาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-16 16:25:09 +07:00
parent 7b6c390193
commit df7364f7b8
10 changed files with 2810 additions and 78 deletions

View file

@ -82,11 +82,11 @@ const list2_3 = [
},
];
onMounted(async () => {
fecthAssign(assignId.value);
if (props.tab !== undefined) {
round.value = props.tab.charAt(4);
fetchEvaluate(assignId.value, round.value);
// fetchEvaluate(assignId.value, round.value);
}
fecthAssign(assignId.value);
// console.log(round.value);
// console.log(assignId.value);
});
@ -94,8 +94,7 @@ const fecthAssign = async (id: string) => {
showLoader();
await http
.get(config.API.evaluateCreate(id))
.then((res: any) => {
// console.log(res);
.then(async (res: any) => {
person.value = res.data.data.person;
assign.value = res.data.data.assign;
commander.value = res.data.data.commander;
@ -104,6 +103,11 @@ const fecthAssign = async (id: string) => {
evaluate_no.value = res.data.data.evaluate_no;
start_date.value = res.data.data.start_date;
date_finish.value = res.data.data.end_date;
console.log(props.tab, res.data.data.evaluate_no);
if (res.data.data.evaluate_no > round.value) {
await fetchEvaluate(assignId.value, round.value);
}
})
.catch((e) => {
messageError($q, e);
@ -113,11 +117,11 @@ const fecthAssign = async (id: string) => {
});
};
const fetchEvaluate = async (id: string, round: string) => {
// showLoader();
showLoader();
await http
.get(config.API.evaluatecommader(id, round))
.then((res: any) => {
// console.log(res);
console.log(res);
let data = res.data.data.evaluate;
console.log(data);
start_date.value = data.date_start;
@ -165,11 +169,14 @@ const fetchEvaluate = async (id: string, round: string) => {
status.value = false;
})
.catch((e) => {
messageError($q, e);
console.log(e);
if (e.data.message !== "Data not found!") {
messageError($q, e);
}
})
.finally(() => {
// hideLoader();
hideLoader();
});
};

File diff suppressed because it is too large Load diff

View file

@ -39,20 +39,18 @@ const props = defineProps({
tab: String,
});
onMounted(() => {
console.log(props);
console.log(assignId.value);
fecthAssign(assignId.value);
if (props.tab !== undefined) {
round.value = props.tab.charAt(4);
fetchEvaluate(assignId.value, round.value);
// fetchEvaluate(assignId.value, round.value);
}
fecthAssign(assignId.value);
});
const fecthAssign = async (id: string) => {
showLoader();
await http
.get(config.API.evaluateChairman(id))
.then((res: any) => {
console.log(res);
.then(async (res: any) => {
// console.log(res);
assign.value = res.data.data.assign;
evaluate_no.value = res.data.data.evaluate_no;
start_date.value = res.data.data.start_date;
@ -60,7 +58,10 @@ const fecthAssign = async (id: string) => {
chairman.value = res.data.data.chairman;
commander.value = res.data.data.commander;
mentors.value = res.data.data.mentors;
console.log(mentors.value[0].name);
if (res.data.data.evaluate_no > round.value) {
await fetchEvaluate(assignId.value, round.value);
}
})
.catch((e) => {
messageError($q, e);
@ -122,7 +123,9 @@ const fetchEvaluate = async (id: string, round: string) => {
status.value = false;
})
.catch((e) => {
console.log(e);
if (e.data.message !== "Data not found!") {
messageError($q, e);
}
})
.finally(() => {
hideLoader();

View file

@ -40,18 +40,19 @@ const props = defineProps({
});
onMounted(async () => {
console.log("tab===>",props.tab)
console.log("tab===>", props.tab);
await fecthFormdata(assignId.value);
if (props.tab !== undefined) {
round.value = props.tab.charAt(4);
await fecthFormRound(assignId.value, round.value);
// await fecthFormRound(assignId.value, round.value);
}
await fecthFormdata(assignId.value);
});
const fecthFormdata = async (id: string) => {
await http
.get(config.API.formevaluateRecord(id))
.then((res: any) => {
.then(async (res: any) => {
console.log(res);
evaluate_no.value = res.data.data.evaluate_no;
start_date.value = res.data.data.start_date;
@ -70,6 +71,12 @@ const fecthFormdata = async (id: string) => {
id: e.id,
}));
checkArray.value = list1_1.value.length;
console.log(res.data.data.evaluate_no, round.value);
if (res.data.data.evaluate_no > round.value) {
await fecthFormRound(assignId.value, round.value);
}
})
.catch((e: any) => {
console.log(e);
@ -1321,8 +1328,7 @@ const saveformdata = async (data: any) => {
</div>
<q-toolbar class="text-primary">
<q-space />
<q-btn label="บันทึก" color="secondary" @click="savaForm" />
<!-- v-if="status" -->
<q-btn v-if="status" label="บันทึก" color="secondary" @click="savaForm" />
</q-toolbar>
</div>
</template>

View file

@ -25,6 +25,8 @@ const start_date = ref<Date>(new Date());
const date_finish = ref<Date>(new Date());
const round = ref<number>();
const checkArray = ref<number>(0);
onMounted(async () => {
await fecthFormdata(assignId.value);
});
@ -42,19 +44,30 @@ const fecthFormdata = async (id: string) => {
assign.value = res.data.data.assign;
option.value.push(res.data.data.director);
Autherise.value = res.data.data.director.name;
list1_1.value = res.data.data.assign_output;
evaluate_expenct_level.value = res.data.data.assign_output.map((e) => ({
id: e.id,
labal: e.output_desc,
}));
evaluate_ouptut.value = res.data.data.assign_output.map((e) => ({
id: e.id,
text: "",
}));
checkArray.value = list1_1.value.length;
})
.catch((e: any) => {
console.log(e);
});
};
const list1_1 = [
{ id: "1", label: "ผลผลิตของงานที่คาดหวัง 1" },
{ id: "2", label: "ผลผลิตของงานที่คาดหวัง 2" },
{ id: "3", label: "ผลผลิตของงานที่คาดหวัง 3" },
{ id: "4", label: "ผลผลิตของงานที่คาดหวัง 4" },
{ id: "5", label: "ผลผลิตของงานที่คาดหวัง 5" },
];
const list1_1 = ref<any>([
// { id: "1", label: " 1" },
// { id: "2", label: " 2" },
// { id: "3", label: " 3" },
// { id: "4", label: " 4" },
// { id: "5", label: " 5" },
]);
const list1_2 = [
{ id: "1", label: "ผลผลิตของงานที่เกิดขึ้น 1" },
{ id: "2", label: "ผลผลิตของงานที่เกิดขึ้น 2" },
@ -115,18 +128,18 @@ const period = ref<number>(1);
// part 1
const evaluate_expenct_level = ref<any>([
{ id: "1", label: "ผลผลิตของงานที่คาดหวัง 1", level: 0 },
{ id: "2", label: "ผลผลิตของงานที่คาดหวัง 2", level: 0 },
{ id: "3", label: "ผลผลิตของงานที่คาดหวัง 3", level: 0 },
{ id: "4", label: "ผลผลิตของงานที่คาดหวัง 4", level: 0 },
{ id: "5", label: "ผลผลิตของงานที่คาดหวัง 5", level: 0 },
// { id: "1", label: " 1", level: 0 },
// { id: "2", label: " 2", level: 0 },
// { id: "3", label: " 3", level: 0 },
// { id: "4", label: " 4", level: 0 },
// { id: "5", label: " 5", level: 0 },
]);
const evaluate_ouptut = ref<any>([
{ level: 0, text: "" },
{ level: 0, text: "" },
{ level: 0, text: "" },
{ level: 0, text: "" },
{ level: 0, text: "" },
// { level: 0, text: "" },
// { level: 0, text: "" },
// { level: 0, text: "" },
// { level: 0, text: "" },
// { level: 0, text: "" },
]);
const knowledge_level = ref<number>(0);
const skill_level = ref<number>(0);
@ -187,16 +200,16 @@ const savaForm = () => {
behavio_inproveRef.value.validate();
let hasError = false;
const filterlevel1_1 = evaluate_expenct_level.value.filter(
(e: any) => e.level == 0
);
const filter_ouptut1_2 = evaluate_ouptut.value.filter(
(e: any) => e.level == 0 || e.text == ""
);
// const filterlevel1_1 = evaluate_expenct_level.value.filter(
// (e: any) => e.level == 0
// );
// const filter_ouptut1_2 = evaluate_ouptut.value.filter(
// (e: any) => e.level == 0 || e.text == ""
// );
if (
filterlevel1_1.length != 0 ||
filter_ouptut1_2.length != 0 ||
// filterlevel1_1.length != 0 ||
// filter_ouptut1_2.length != 0 ||
knowledge_level.value === 0 ||
skill_level.value === 0 ||
competency_level.value === 0 ||
@ -350,9 +363,7 @@ const saveformdata = async (data: any) => {
</div>
<div class="col-12 text-top0 row items-center">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
<span class="text-black q-px-sm">{{
"ครั้งที่" + round
}}</span>
<span class="text-black q-px-sm">{{ "ครั้งที่" + round }}</span>
ระหวางวนท
<span class="text-black q-px-sm">{{
date2Thai(start_date)
@ -387,7 +398,7 @@ const saveformdata = async (data: any) => {
<q-list dense v-for="(list, i) in list1_1" :key="i">
<q-item dense tag="label" v-ripple>
<q-item-section>
<q-item-label>{{ list.label }}</q-item-label>
<q-item-label>{{ list.output_desc }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-rating
@ -435,7 +446,7 @@ const saveformdata = async (data: any) => {
class="col-xs-12 col-sm-11 col-md-10 offset-md-1 q-pa-sm bg-grey-1"
>
<q-list dense v-for="(list, i) in list1_2" :key="i">
<q-item dense tag="label" v-ripple>
<q-item dense tag="label" v-ripple v-if="i < checkArray">
<q-item-section>
<!-- <q-item-label>{{ list.label }}</q-item-label> -->
<q-input

View file

@ -56,7 +56,7 @@ const changeTab = (tabVal: string) => {
};
const addData = () => {
router.push(
`/probation/detail/add/${personalId.value}/${assignId.value}`
`/probation/detail/addresult/${personalId.value}/${assignId.value}`
);
};
</script>

View file

@ -1,21 +1,74 @@
<script setup lang="ts">
import { ref, defineAsyncComponent } from "vue";
const tab = ref<string>("save1");
const changeTab = (tabVal: string) => {
tab.value = tabVal
}
import { ref, defineAsyncComponent, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
const Header = defineAsyncComponent(
() => import("@/modules/05_placement/components/probation/FormEvaluation/Header.vue")
() =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/Header.vue"
)
);
const FormEvaluate = defineAsyncComponent(
() => import("@/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue")
)
</script>
() =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue"
)
);
const router = useRouter();
const route = useRoute();
const mixin = useCounterMixin();
const $q = useQuasar();
const { showLoader, hideLoader, messageError, success } = mixin;
const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString());
const tab = ref<string>("save1");
const tabs = ref<any>([]);
const activeTab = ref<string>("tab2");
const changeTab = (tabVal: string) => {
tab.value = tabVal;
};
onMounted(() => {
fecthAssign(assignId.value);
});
const fecthAssign = async (id: string) => {
showLoader();
await http
.get(config.API.evaluateCreate(id))
.then((res: any) => {
if (res.data.data.evaluate_no > 2) {
tabs.value = res.data.data.evaluate;
} else tabs.value.push({ no: 1 }, { no: 2 });
})
.catch((e: any) => {
console.log(e);
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const addData = () => {
router.push(`/probation/detail/addevalua/${personalId.value}/${assignId.value}`);
};
</script>
<template>
<Header :change-tab="changeTab" />
<Header
:change-tab="changeTab"
:activeTab="activeTab"
:loop="tabs.length"
:add-data="addData"
/>
<q-page-container>
<!-- <q-page-container>
<q-tab-panels v-model="tab" animated>
<q-tab-panel name="save1">
<FormEvaluate :tab="tab" />
@ -25,5 +78,16 @@ const FormEvaluate = defineAsyncComponent(
<FormEvaluate :tab="tab"/>
</q-tab-panel>
</q-tab-panels>
</q-page-container> -->
<q-page-container>
<q-tab-panels v-model="tab" animated>
<q-tab-panel
v-for="tabName in tabs"
:key="tabName"
:name="'save' + tabName.no"
>
<FormEvaluate :tab="tab" />
</q-tab-panel>
</q-tab-panels>
</q-page-container>
</template>
</template>

View file

@ -1,9 +1,10 @@
<script setup lang="ts">
import { ref, defineAsyncComponent } from "vue";
const tab = ref<string>("save1");
const changeTab = (tabVal: string) => {
tab.value = tabVal;
};
import { ref, defineAsyncComponent, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
const Header = defineAsyncComponent(
() =>
import(
@ -16,12 +17,56 @@ const FormEvaluateScore = defineAsyncComponent(
"@/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue"
)
);
const router = useRouter();
const route = useRoute();
const mixin = useCounterMixin();
const $q = useQuasar();
const { showLoader, hideLoader, messageError, success } = mixin;
const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString());
const tab = ref<string>("save1");
const tabs = ref<any>([]);
const activeTab = ref<string>("tab2");
onMounted(() => {
fecthAssign(assignId.value);
});
const fecthAssign = async (id: string) => {
showLoader();
await http
.get(config.API.evaluateChairman(id))
.then((res: any) => {
if (res.data.data.evaluate_no > 2) {
tabs.value = res.data.data.evaluate;
} else tabs.value.push({ no: 1 }, { no: 2 });
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const addData = () => {
router.push(`/probation/detail/addevaluascore/${personalId.value}/${assignId.value}`);
};
const changeTab = (tabVal: string) => {
tab.value = tabVal;
};
</script>
<template>
<Header :change-tab="changeTab" />
<Header
:change-tab="changeTab"
:activeTab="activeTab"
:loop="tabs.length"
:add-data="addData"
/>
<q-page-container>
<!-- <q-page-container>
<q-tab-panels v-model="tab" animated>
<q-tab-panel name="save1">
<FormEvaluateScore :tab="tab" />
@ -31,5 +76,16 @@ const FormEvaluateScore = defineAsyncComponent(
<FormEvaluateScore :tab="tab" />
</q-tab-panel>
</q-tab-panels>
</q-page-container> -->
<q-page-container>
<q-tab-panels v-model="tab" animated>
<q-tab-panel
v-for="tabName in tabs"
:key="tabName"
:name="'save' + tabName.no"
>
<FormEvaluateScore :tab="tab" />
</q-tab-panel>
</q-tab-panels>
</q-page-container>
</template>

View file

@ -27,6 +27,18 @@ const transfer = () =>
import("@/modules/05_placement/components/Transfer/transferMain.vue");
const transferbyId = () =>
import("@/modules/05_placement/components/Transfer/transferRegistry.vue");
const FormSaveResultAdd = () =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue"
);
const FormEvaluateAdd = () =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/FormEvaluateAdd.vue"
);
const FormEvaluateScoreAdd = () =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScoreAdd.vue"
);
// คำสั่งช่วยราชการ/ส่งตัวกลับ
const RepatriationOrder = () =>
@ -49,10 +61,7 @@ const receiveDetail2 = () =>
import("@/modules/05_placement/components/Receive/receiveDetail2.vue");
const ReceiveAdd = () =>
import("@/modules/05_placement/components/Receive/FormAdd.vue");
const FormSaveResultAdd = () =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue"
);
//แต่งตั้ง-เลื่อน
const AppointmentMain = () => import("@/modules/05_placement/components/AppointMent/Main.vue");
const AppointmentDetail = () => import("@/modules/05_placement/components/AppointMent/Detail.vue");
@ -122,8 +131,8 @@ export default [
},
},
{
path: "/probation/detail/add/:id/:form",
name: "probationFormAdd",
path: "/probation/detail/addresult/:id/:form",
name: "probationFormAddresult",
component: FormSaveResultAdd,
meta: {
Auth: true,
@ -131,6 +140,26 @@ export default [
Role: "placement",
},
},
{
path: "/probation/detail/addevalua/:id/:form",
name: "probationFormAddevalua",
component: FormEvaluateAdd,
meta: {
Auth: true,
Key: [6.3],
Role: "placement",
},
},
{
path: "/probation/detail/addevaluascore/:id/:form",
name: "probationFormAddevaluascore",
component: FormEvaluateScoreAdd,
meta: {
Auth: true,
Key: [6.3],
Role: "placement",
},
},
{
path: "/probation/work/add",
name: "probationWorkAdd",