fix กรรมการและการประชุม

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-10-24 10:04:36 +07:00
parent c10b32e899
commit 95dcc45177
5 changed files with 39 additions and 50 deletions

View file

@ -1,38 +1,31 @@
<script setup lang="ts">
import { reactive, computed, watch } from "vue";
import { reactive, computed, watch, ref } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type { FormData } from "@/modules/11_discipline/interface/request/Director";
import type { FormData } from "@/modules/11_discipline/interface/request/director";
/**
* importComponents
*/
/** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue";
import Form from "@/modules/12_evaluatePersonal/components/Director/Form.vue";
/**
* importStore
*/
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/**
* use
*/
/** use*/
const $q = useQuasar();
const { messageError, showLoader, hideLoader, dialogConfirm, success } =
useCounterMixin();
/**
* props
*/
/** props*/
const modal = defineModel<boolean>("modal", { required: true });
const directorId = defineModel<string>("directorId", { required: true });
const actionType = defineModel<string>("actionType", { required: true });
const props = defineProps({
fetchDataList: { type: Function, required: true },
});
const isLoad = ref<boolean>(false);
// Dialog
const title = computed(() =>
@ -55,12 +48,13 @@ const dataDettail = reactive<FormData>({
/**
* function fetch อมลชอกรรมการ
*/
function fetchData() {
async function fetchData() {
isLoad.value = false;
showLoader();
http
await http
.get(config.API.evaluateDirectorById(directorId.value))
.then((res) => {
const data = res.data.result;
.then(async (res) => {
const data = await res.data.result;
dataDettail.personalId = data.Id;
dataDettail.prefix = data.prefix;
dataDettail.firstname = data.firstName;
@ -71,7 +65,10 @@ function fetchData() {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
isLoad.value = true;
});
}
@ -114,8 +111,8 @@ function onCloseDialog() {
watch(
() => modal.value,
() => {
modal.value && fetchData();
async () => {
modal.value && (await fetchData());
}
);
</script>
@ -125,6 +122,7 @@ watch(
<q-card style="width: 450px">
<DialogHeader :tittle="title" :close="onCloseDialog" />
<Form
v-if="isLoad"
:on-submit="onSubmit"
:data="dataDettail"
:action-type="actionType"

View file

@ -260,13 +260,9 @@ function inputEdit(val: boolean) {
};
}
onMounted(() => {
onMounted(async () => {
if (props.data) {
showLoader();
setTimeout(async () => {
await fetchForm(props.data);
hideLoader();
}, 1000);
await fetchForm(props.data);
}
});
</script>

View file

@ -42,6 +42,7 @@ const pagination = ref({
* function fetch อมลรายการชอกรรมการ
*/
async function getList() {
dataStore.rows = [];
showLoader();
await http
.get(config.API.evaluateDirectorMain())

View file

@ -54,6 +54,7 @@ function onSubmit(formData: FormData) {
});
}
</script>
<template>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="toptitle col-12 row items-center">

View file

@ -1,29 +1,21 @@
<script setup lang="ts">
import { ref, onMounted, reactive, computed } from "vue";
import { ref, onMounted, reactive, computed, onBeforeMount } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import router from "@/router";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importTyep
*/
/** importTyep*/
import type { FormData } from "@/modules/12_evaluatePersonal/interface/index/meeting";
/**
* importComponents
*/
/** importComponents*/
import Form from "@/modules/12_evaluatePersonal/components/Meeting/Form.vue";
/**
* importStore
*/
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/**
* use
*/
/** use*/
const route = useRoute();
const $q = useQuasar();
const {
@ -55,12 +47,13 @@ const data = reactive({
file: [],
});
/**
* function fetch อมลการประช
*/
function fetchData() {
const isLoad = ref<boolean>(false);
/** function fetch ข้อมูลการประชุม*/
async function fetchData() {
isLoad.value = false;
showLoader();
http
await http
.get(config.API.meetingById(personalId.value))
.then(async (res) => {
const dataApi = await res.data.result;
@ -74,11 +67,10 @@ function fetchData() {
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 2000);
isLoad.value = true;
});
}
@ -115,10 +107,11 @@ function onSubmit(formData: FormData) {
});
}
onMounted(() => {
fetchData();
onMounted(async () => {
await fetchData();
});
</script>
<template>
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle col-12 row items-center">
@ -135,6 +128,6 @@ onMounted(() => {
{{ title }}
</div>
<Form :on-submit="onSubmit" :data="data" />
<Form v-if="isLoad" :on-submit="onSubmit" :data="data" />
</div>
</template>