ออกคำสังโครงสร้าง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-10-08 10:35:55 +07:00
parent f891926553
commit 54395379b5
3 changed files with 107 additions and 75 deletions

View file

@ -37,32 +37,53 @@ const commandYear = ref<number>(new Date().getFullYear());
const commandAffectDate = ref<Date | null>(null); //
const commandExcecuteDate = ref<Date | null>(null); //
/**
* งกนสรางคำสงใหม
*/
/** ฟังก์ชันบันทึกและไปยังหน้าคำสั่ง*/
function onSubmit() {
dialogConfirm($q, () => {});
dialogConfirm($q, async () => {
showLoader();
const body = {
commandYear: commandYear.value,
commandNo: commandNo.value,
commandTypeId: commandType.value,
commandAffectDate: commandAffectDate.value,
commandExcecuteDate: commandExcecuteDate.value,
persons: [],
};
await http
.post(config.API.command + `/person`, body)
.then(async (res) => {
const id = await res.data.result;
router.push(`/command/edit/${id}`);
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
/** ปิด popup */
/**
* งกนป popup สรางคำส
* และกำหนดตวแปรใหเปนค Defult
*/
function closeModal() {
modal.value = false;
clearValue();
}
function clearValue() {
commandNo.value = "";
commandYear.value = new Date().getFullYear();
commandAffectDate.value = null;
commandExcecuteDate.value = null;
}
/** ดึงข้อมูลคำสั่ง */
/** ฟังก์ชันดึงข้อมูลคำสั่ง */
async function fetchCommandType() {
const data = await storeCommand.getCommandTypes(); // get store
// filter code
commandOp.value = await data.filter(
(v: any) => v.code == props.commandTypeCode
(v: ListCommand) => v.code == props.commandTypeCode
);
commandType.value = commandOp.value[0].id;
}
@ -250,16 +271,6 @@ watch(modal, () => {
<q-separator />
<q-card-actions align="right">
<!-- <q-btn
label="บันทึกและเลือกรายชื่อต่อ"
@click="() => onSubmit(false)"
:disable="
selectCreate === 'NEW' ? commandType == '' : selected.length == 0
"
color="blue"
>
<q-tooltip>นทกและเลอกรายชอต</q-tooltip>
</q-btn> -->
<q-btn
label="บันทึกและไปยังหน้าคำสั่ง"
:disable="commandType == ''"