Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-01-30 16:56:37 +07:00
commit ffb1351754
4 changed files with 49 additions and 40 deletions

View file

@ -88,6 +88,7 @@ const optionsResult = ref<any>([
const props = defineProps({
tab: { type: String, require: true },
data: { type: Object, require: true },
fetchData: { type: Function, require: true },
});
const isCheckFile = ref<boolean>(false);
@ -98,11 +99,22 @@ const isCheckFile = ref<boolean>(false);
async function fecthAssign() {
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;
person.value = data?.person;
mentors.value = data?.mentors;
date_start.value = data?.assign.date_start;
date_finish.value = data?.assign.date_finish;
if (
data?.result.develop_complete != null &&
data?.result.evaluate_result != null
@ -118,40 +130,6 @@ async function fecthAssign() {
}
commander.value = data?.commander;
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
@ -229,9 +207,10 @@ async function postData(action: string) {
showLoader();
await http
.post(config.API.createformReport(assignId.value), data)
.then(() => {
.then(async () => {
await props.fetchData?.(assignId.value);
// await fecthResult(assignId.value);
success($q, "บันทึกสำเร็จ");
fecthResult(assignId.value);
router.push(`/probation/detail/${personalId.value}/${assignId.value}`);
status.value = false;
})

View file

@ -82,7 +82,18 @@ function nextPage() {
<div class="row col-12 items-center">
<div class="q-mr-sm">ครงท {{ i }}</div>
<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"
flat
dense

View file

@ -4,10 +4,13 @@ import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
const DataStore = useProbationDataStore();
const Header = defineAsyncComponent(
() =>
import(
@ -48,6 +51,12 @@ async function fecthAssign(id: string) {
tabs.value = res.data.result.result.map((e: any, index: number) => {
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) => {
messageError($q, e);
@ -119,7 +128,13 @@ onMounted(() => {
class="mt"
>
<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-panels>

View file

@ -17,6 +17,8 @@ export const useProbationDataStore = defineStore("probationStore", () => {
const assignOutput = ref<any>([]);
const director = ref<any>([]);
const person = ref<any>([]);
const isCheckFormReport1 = ref<boolean>(false);
const isCheckFormReport2 = ref<boolean>(false);
const fecthdataAssign = async (data: any) => {
checkLoad.value = data.evaluate.length == 0 ? true : false;
@ -114,5 +116,7 @@ export const useProbationDataStore = defineStore("probationStore", () => {
behavior_no3,
dataPermissions,
checkLoad,
isCheckFormReport1,
isCheckFormReport2,
};
});