ออกคำสั่ง ==> รายละเอียด API Tab 3

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-13 11:49:49 +07:00
parent 4ef591fd72
commit 8336ba3051
9 changed files with 388 additions and 208 deletions

View file

@ -15,14 +15,18 @@ import DialogPerview from "@/modules/18_command/components/Step/Dialog1_Perview.
const $q = useQuasar();
const route = useRoute();
const store = useCommandDetail();
const { showLoader, hideLoader, success, messageError } = useCounterMixin();
const { showLoader, hideLoader, messageError } = useCounterMixin();
/**
* props
*/
const isChangeData = defineModel<boolean>("isChangeData", { required: true });
const props = defineProps({
const { onCheckChangeData } = defineProps({
onCheckChangeData: { type: Function, required: true },
});
const commandId = ref<string>(route.params.id.toString());
const commandId = ref<string>(route.params.id.toString()); //ID
//
const formData = reactive<FormDataDetail>({
commandNo: "",
commandYear: null,
@ -32,8 +36,13 @@ const formData = reactive<FormDataDetail>({
detailFooter: "",
issue: null,
});
const modalPreview = ref<boolean>(false);
const modalPreview = ref<boolean>(false); //
/**
* งกนดงขอมลรายละเอยดคำส
*
* กำหนดขอมลทไดบมาใหบตวแปร `formData`
*/
async function fetchData() {
showLoader();
await http
@ -56,28 +65,34 @@ async function fetchData() {
});
}
/**
* งกนบนทกขอมลรายละเอยดคำส
*
* และกำหนด isChangeData เป false
*/
async function onSubmit() {
showLoader();
await http
.put(config.API.commandAction(commandId.value, "tab1"), formData)
.then(async () => {
// await fetchData();
// success($q, "");
})
.then(() => {})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
isChangeData.value = false;
});
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
fetchData();
});
/**
* เรยก function ไปใชหนาหล
* งกนทองการนำฟงกนออกไปใชใน Components แม
*/
defineExpose({
onSubmit,
@ -107,7 +122,7 @@ defineExpose({
v-model="formData.commandNo"
hide-bottom-space
:label="`${'คำสั่งเลขที่'}`"
@update:model-value="props.onCheckChangeData()"
@update:model-value="onCheckChangeData()"
/>
</div>
<label class="col-1 flex justify-center items-center text-bold">
@ -123,7 +138,7 @@ defineExpose({
:enableTimePicker="false"
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
@update:model-value="props.onCheckChangeData()"
@update:model-value="onCheckChangeData()"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
@ -167,7 +182,7 @@ defineExpose({
v-model="formData.issue"
hide-bottom-space
:label="`${'คำสั่งเรื่อง'}`"
@update:model-value="props.onCheckChangeData()"
@update:model-value="onCheckChangeData()"
/>
</div>
@ -188,7 +203,7 @@ defineExpose({
>
<template #control>
<q-editor
@update:model-value="props.onCheckChangeData()"
@update:model-value="onCheckChangeData()"
:readonly="store.readonly"
class="full-width"
v-model="formData.detailHeader"
@ -229,7 +244,7 @@ defineExpose({
>
<template #control>
<q-editor
@update:model-value="props.onCheckChangeData()"
@update:model-value="onCheckChangeData()"
:readonly="store.readonly"
class="full-width"
v-model="formData.detailBody"
@ -270,7 +285,7 @@ defineExpose({
>
<template #control>
<q-editor
@update:model-value="props.onCheckChangeData()"
@update:model-value="onCheckChangeData()"
:readonly="store.readonly"
class="full-width"
v-model="formData.detailFooter"