ออกคำสั่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-10-09 14:33:20 +07:00
parent 73c41d9b01
commit 671c7103ab
7 changed files with 86 additions and 61 deletions

View file

@ -15,7 +15,14 @@ import DialogPerview from "@/modules/18_command/components/Step/Dialog1_Perview.
const $q = useQuasar();
const route = useRoute();
const store = useCommandDetail();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
date2Thai,
success,
dialogConfirm,
} = useCounterMixin();
/**
* props
@ -60,19 +67,22 @@ async function fetchCheckIdofficer() {
* และกำหนด isChangeData เป false
*/
async function onSubmit() {
showLoader();
await http
.put(config.API.commandAction(commandId.value, "tab1"), formData)
.then(() => {
props.fetchDataCommandList();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
isChangeData.value = false;
});
dialogConfirm($q, async () => {
showLoader();
await http
.put(config.API.commandAction(commandId.value, "tab1"), formData)
.then(async () => {
await props.fetchDataCommandList();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
isChangeData.value = false;
});
});
}
/**
@ -87,7 +97,9 @@ onMounted(() => {
formData.issue = props.formCommandList.issue;
formData.commandAffectDate = props.formCommandList.commandAffectDate;
formData.commandExcecuteDate = props.formCommandList.commandExcecuteDate;
formData.isBangkok = props.formCommandList.isBangkok;
formData.isBangkok = !isIdofficer.value
? null
: props.formCommandList.isBangkok;
fetchCheckIdofficer();
});