updated develop form

This commit is contained in:
Warunee Tamkoo 2024-08-06 16:04:14 +07:00
parent b6dde4cfc5
commit 03c41dae6c

View file

@ -19,6 +19,9 @@ const mixin = useCounterMixin();
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin; const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
const projectId = ref<string>(route.params.id.toLocaleString()); const projectId = ref<string>(route.params.id.toLocaleString());
const props = defineProps({
nextStep: { type: Function, required: true },
});
const checkRoutePermission = ref<boolean>( const checkRoutePermission = ref<boolean>(
route.name == "developmentDetailPage" route.name == "developmentDetailPage"
); );
@ -75,21 +78,22 @@ function fetchData(id: string) {
/** function บันทึกข้อมูล*/ /** function บันทึกข้อมูล*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { // dialogConfirm($q, () => {
showLoader(); showLoader();
http http
.put(config.API.developmentMainTab("tab1", projectId.value), formData) .put(config.API.developmentMainTab("tab1", projectId.value), formData)
.then(() => { .then(() => {
fetchData(projectId.value); fetchData(projectId.value);
success($q, "บันทึกข้อมูลสำเร็จ"); // success($q, "");
}) props.nextStep();
.catch((err) => { })
messageError($q, err); .catch((err) => {
}) messageError($q, err);
.finally(() => { })
hideLoader(); .finally(() => {
}); hideLoader();
}); });
// });
} }
/** function fetch หา Id หน่วยงานที่ Active*/ /** function fetch หา Id หน่วยงานที่ Active*/
@ -149,7 +153,13 @@ onMounted(async () => {
<div class="col-12 row no-wrap"> <div class="col-12 row no-wrap">
<div class="col-12 q-py-sm q-px-sm q-gutter-sm"> <div class="col-12 q-py-sm q-px-sm q-gutter-sm">
<div class="text-subtitle2 text-bold">หนวยงาน/วนราชการ</div> <div class="text-subtitle2 text-bold">หนวยงาน/วนราชการ</div>
<q-input :readonly="checkRoutePermission" dense outlined v-model="filter" label="ค้นหา"> <q-input
:readonly="checkRoutePermission"
dense
outlined
v-model="filter"
label="ค้นหา"
>
<template v-slot:append> <template v-slot:append>
<q-icon <q-icon
v-if="filter !== ''" v-if="filter !== ''"
@ -170,7 +180,9 @@ onMounted(async () => {
:filter="filter" :filter="filter"
no-results-label="ไม่พบข้อมูลที่ค้นหา" no-results-label="ไม่พบข้อมูลที่ค้นหา"
no-nodes-label="ไม่มีข้อมูล" no-nodes-label="ไม่มีข้อมูล"
:style="checkRoutePermission ? 'pointer-events: none !important;':''" :style="
checkRoutePermission ? 'pointer-events: none !important;' : ''
"
> >
<template v-slot:default-header="prop"> <template v-slot:default-header="prop">
<q-item <q-item
@ -294,17 +306,29 @@ onMounted(async () => {
</div> </div>
</q-card> </q-card>
<q-separator v-if="!checkRoutePermission"/> <div class="text-center q-pa-sm" v-if="!checkRoutePermission">
<div class="text-right q-pa-sm" v-if="!checkRoutePermission">
<q-btn <q-btn
unelevated disabled
label="บันทึก" rounded
label="ก่อนหน้า"
icon="mdi-chevron-left"
id="onSubmit" id="onSubmit"
type="submit" type="submit"
color="public" color="public"
class="q-px-md" class="q-mr-xs"
style="width: 120px"
>
</q-btn>
<q-btn
rounded
label="ถัดไป"
icon-right="mdi-chevron-right"
id="onSubmit"
type="submit"
color="public"
class="q-ml-xs"
style="width: 120px"
> >
<q-tooltip>นทกขอม</q-tooltip>
</q-btn> </q-btn>
</div> </div>
</q-form> </q-form>