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