ออกคำสังโครงสร้าง
This commit is contained in:
parent
f891926553
commit
54395379b5
3 changed files with 107 additions and 75 deletions
|
|
@ -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 == ''"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue