fix ทดลองงาน
This commit is contained in:
parent
1689c96343
commit
6003547e78
4 changed files with 49 additions and 40 deletions
|
|
@ -88,6 +88,7 @@ const optionsResult = ref<any>([
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
tab: { type: String, require: true },
|
tab: { type: String, require: true },
|
||||||
data: { type: Object, require: true },
|
data: { type: Object, require: true },
|
||||||
|
fetchData: { type: Function, require: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
const isCheckFile = ref<boolean>(false);
|
const isCheckFile = ref<boolean>(false);
|
||||||
|
|
@ -98,11 +99,22 @@ const isCheckFile = ref<boolean>(false);
|
||||||
async function fecthAssign() {
|
async function fecthAssign() {
|
||||||
const data = props.data;
|
const data = props.data;
|
||||||
|
|
||||||
|
const foundData = props?.data?.result.find(
|
||||||
|
(e: any) =>
|
||||||
|
(e.evaluate_no === 1 && props?.tab === "save1") ||
|
||||||
|
(e.evaluate_no === 2 && props?.tab === "save2")
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(foundData);
|
||||||
|
|
||||||
|
if (foundData) {
|
||||||
|
date_start.value = foundData.start_date;
|
||||||
|
date_finish.value = foundData.end_date;
|
||||||
|
}
|
||||||
|
|
||||||
assign.value = data?.assign;
|
assign.value = data?.assign;
|
||||||
person.value = data?.person;
|
person.value = data?.person;
|
||||||
mentors.value = data?.mentors;
|
mentors.value = data?.mentors;
|
||||||
date_start.value = data?.assign.date_start;
|
|
||||||
date_finish.value = data?.assign.date_finish;
|
|
||||||
if (
|
if (
|
||||||
data?.result.develop_complete != null &&
|
data?.result.develop_complete != null &&
|
||||||
data?.result.evaluate_result != null
|
data?.result.evaluate_result != null
|
||||||
|
|
@ -118,40 +130,6 @@ async function fecthAssign() {
|
||||||
}
|
}
|
||||||
commander.value = data?.commander;
|
commander.value = data?.commander;
|
||||||
optionDirector.value = mentors.value;
|
optionDirector.value = mentors.value;
|
||||||
|
|
||||||
// showLoader();
|
|
||||||
// await http
|
|
||||||
// .get(config.API.evaluateReportcreate(id))
|
|
||||||
// .then((res) => {
|
|
||||||
// assign.value = res.data.result.assign;
|
|
||||||
// person.value = res.data.result.person;
|
|
||||||
// mentors.value = res.data.result.mentors;
|
|
||||||
// date_start.value = res.data.result.assign.date_start;
|
|
||||||
// date_finish.value = res.data.result.assign.date_finish;
|
|
||||||
|
|
||||||
// if (
|
|
||||||
// res.data.result.result.develop_complete != null &&
|
|
||||||
// res.data.result.result.evaluate_result != null
|
|
||||||
// ) {
|
|
||||||
// develop.value = res.data.result.result.develop_complete;
|
|
||||||
// result.value = res.data.result.result.evaluate_result;
|
|
||||||
// changeReson52(Number(res.data.result.result.evaluate_result));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// director_id.value = res.data.result.chairman;
|
|
||||||
// director_id2.value = res.data.result.commander;
|
|
||||||
// if (mentors.value.length != 0) {
|
|
||||||
// director_id3.value = mentors.value[0];
|
|
||||||
// }
|
|
||||||
// commander.value = res.data.result.commander;
|
|
||||||
// optionDirector.value = mentors.value;
|
|
||||||
// })
|
|
||||||
// .catch((e) => {
|
|
||||||
// // messageError($q, e);
|
|
||||||
// })
|
|
||||||
// .finally(() => {
|
|
||||||
// hideLoader();
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** get ข้อมูล เก็บไว้ตัวแปร
|
/** get ข้อมูล เก็บไว้ตัวแปร
|
||||||
|
|
@ -229,9 +207,10 @@ async function postData(action: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.post(config.API.createformReport(assignId.value), data)
|
.post(config.API.createformReport(assignId.value), data)
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
|
await props.fetchData?.(assignId.value);
|
||||||
|
// await fecthResult(assignId.value);
|
||||||
success($q, "บันทึกสำเร็จ");
|
success($q, "บันทึกสำเร็จ");
|
||||||
fecthResult(assignId.value);
|
|
||||||
router.push(`/probation/detail/${personalId.value}/${assignId.value}`);
|
router.push(`/probation/detail/${personalId.value}/${assignId.value}`);
|
||||||
status.value = false;
|
status.value = false;
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,18 @@ function nextPage() {
|
||||||
<div class="row col-12 items-center">
|
<div class="row col-12 items-center">
|
||||||
<div class="q-mr-sm">ครั้งที่ {{ i }}</div>
|
<div class="q-mr-sm">ครั้งที่ {{ i }}</div>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="DataStore.mainTab !== 'tab6'"
|
v-if="
|
||||||
|
(DataStore.mainTab === 'tab5' &&
|
||||||
|
i === 1 &&
|
||||||
|
DataStore.isCheckFormReport1) ||
|
||||||
|
(DataStore.mainTab === 'tab5' &&
|
||||||
|
i === 2 &&
|
||||||
|
DataStore.isCheckFormReport2) ||
|
||||||
|
DataStore.mainTab === 'tab2' ||
|
||||||
|
DataStore.mainTab === 'tab3' ||
|
||||||
|
DataStore.mainTab === 'tab4' ||
|
||||||
|
DataStore.mainTab === 'tab8'
|
||||||
|
"
|
||||||
size="12px"
|
size="12px"
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@ import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import genReport from "@/plugins/genreport";
|
import genReport from "@/plugins/genreport";
|
||||||
|
|
||||||
|
const DataStore = useProbationDataStore();
|
||||||
|
|
||||||
const Header = defineAsyncComponent(
|
const Header = defineAsyncComponent(
|
||||||
() =>
|
() =>
|
||||||
import(
|
import(
|
||||||
|
|
@ -48,6 +51,12 @@ async function fecthAssign(id: string) {
|
||||||
tabs.value = res.data.result.result.map((e: any, index: number) => {
|
tabs.value = res.data.result.result.map((e: any, index: number) => {
|
||||||
return { no: index + 1, ...e };
|
return { no: index + 1, ...e };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const report1 = tabs.value.find((e) => e.evaluate_no === 1);
|
||||||
|
const report2 = tabs.value.find((e) => e.evaluate_no === 2);
|
||||||
|
|
||||||
|
DataStore.isCheckFormReport1 = report1?.isResult ?? false;
|
||||||
|
DataStore.isCheckFormReport2 = report2?.isResult ?? false;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -119,7 +128,13 @@ onMounted(() => {
|
||||||
class="mt"
|
class="mt"
|
||||||
>
|
>
|
||||||
<q-tab-panel v-for="item in tabs" :name="`save${item.no}`" :key="item.no">
|
<q-tab-panel v-for="item in tabs" :name="`save${item.no}`" :key="item.no">
|
||||||
<FormReport :tab="tab" :data="dataResult" action="edit" v-if="isLoad" />
|
<FormReport
|
||||||
|
:tab="tab"
|
||||||
|
:data="dataResult"
|
||||||
|
:fetch-data="fecthAssign"
|
||||||
|
action="edit"
|
||||||
|
v-if="isLoad"
|
||||||
|
/>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
</q-tab-panels>
|
</q-tab-panels>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ export const useProbationDataStore = defineStore("probationStore", () => {
|
||||||
const assignOutput = ref<any>([]);
|
const assignOutput = ref<any>([]);
|
||||||
const director = ref<any>([]);
|
const director = ref<any>([]);
|
||||||
const person = ref<any>([]);
|
const person = ref<any>([]);
|
||||||
|
const isCheckFormReport1 = ref<boolean>(false);
|
||||||
|
const isCheckFormReport2 = ref<boolean>(false);
|
||||||
|
|
||||||
const fecthdataAssign = async (data: any) => {
|
const fecthdataAssign = async (data: any) => {
|
||||||
checkLoad.value = data.evaluate.length == 0 ? true : false;
|
checkLoad.value = data.evaluate.length == 0 ? true : false;
|
||||||
|
|
@ -114,5 +116,7 @@ export const useProbationDataStore = defineStore("probationStore", () => {
|
||||||
behavior_no3,
|
behavior_no3,
|
||||||
dataPermissions,
|
dataPermissions,
|
||||||
checkLoad,
|
checkLoad,
|
||||||
|
isCheckFormReport1,
|
||||||
|
isCheckFormReport2,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue