ออกคำสั่ง

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();
});

View file

@ -184,16 +184,17 @@ function filterSelector(val: string, update: Function, filtername: string) {
/** บันทึกข้แมูล ตำแหน่ง */
function savePosition() {
dialogConfirm($q, () => {
dialogConfirm($q, async () => {
const body = {
commandSalaryId: templatePos.value,
positionDetail: position.value,
};
showLoader();
http
await http
.put(config.API.commandAction(commandId.value, "tab2"), body)
.then(async (res) => {
.then(async () => {
await getPersonList();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);

View file

@ -20,7 +20,6 @@ const $q = useQuasar();
const route = useRoute();
const store = useCommandDetail();
const {
dialogMessageNotify,
dialogConfirm,
dialogRemove,
messageError,
@ -169,26 +168,29 @@ async function onSubmitPerson() {
}
function onSubmit() {
const body = rows.value.map((e: DataPerson) => ({
sendCC: e.sendCC,
id: e.id,
}));
dialogConfirm($q, async () => {
const body = rows.value.map((e: DataPerson) => ({
sendCC: e.sendCC,
id: e.id,
}));
showLoader();
http
.put(config.API.commandAction(commandId.value, "tab3"), {
commandSend: body,
})
.then(async () => {
// await fetchData();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
isChangeData.value = false;
});
showLoader();
await http
.put(config.API.commandAction(commandId.value, "tab3"), {
commandSend: body,
})
.then(async () => {
await fetchData();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
isChangeData.value = false;
});
});
}
onMounted(() => {
@ -339,7 +341,12 @@ defineExpose({
<q-separator />
<q-card-actions align="right" v-if="!store.readonly">
<q-btn label="บันทึก" type="submit" color="public" />
<q-btn
label="บันทึก"
type="submit"
color="public"
:disable="rows.length === 0"
/>
</q-card-actions>
</q-form>

View file

@ -55,10 +55,7 @@ async function fetchDataCommand(type: string) {
});
}
/**
* งชนกำหนดคาของ PDF
*
*/
/** ฟังชั่นกำหนดค่าของ PDF*/
async function fetchPDF(data: any, type: string = "docx?folder=command") {
isLoadView.value = false;
await axios
@ -94,13 +91,15 @@ async function downloadCover(type: string) {
genReport(
dataCover.value,
"คำสั่ง คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้",
type
type,
"?folder=command"
);
} else {
genReportXLSX(
dataAttachment.value,
"เอกสารแนบท้าย คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้",
type
type,
"?folder=command"
);
}
}

View file

@ -102,19 +102,19 @@ async function fetchDataCommandList() {
*
* เชคการเปลยนแปลงของขอม าการเปลยนแปลงของขอมลจะบนทกขอม
*/
watch(tabs, (newValue, oldValue) => {
//
if (isChangeData.value) {
const refMap: { [key: string]: any } = {
Detail: childDetailRef,
ListPersons: childListPersonsRef,
ReceivedCopy: childReceivedCopyRef,
Attached: childAttachedRef,
};
// watch(tabs, (newValue, oldValue) => {
// //
// if (isChangeData.value) {
// const refMap: { [key: string]: any } = {
// Detail: childDetailRef,
// ListPersons: childListPersonsRef,
// ReceivedCopy: childReceivedCopyRef,
// Attached: childAttachedRef,
// };
refMap[oldValue]?.value?.onSubmit();
}
});
// refMap[oldValue]?.value?.onSubmit();
// }
// });
/**
* ทำงานเม Components กเรยกใชงาน

View file

@ -9,10 +9,15 @@ const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
async function genReport(data: any, fileName: string, type: string = "docx") {
async function genReport(
data: any,
fileName: string,
type: string = "docx",
folder: string = ""
) {
showLoader();
await axios
.post(`${config.API.reportTemplate}/docx`, data, {
.post(`${config.API.reportTemplate}/docx${folder}`, data, {
headers:
type == "docx"
? {

View file

@ -12,11 +12,12 @@ const { showLoader, hideLoader, messageError } = mixin;
async function genReportXLSX(
data: any,
fileName: string,
type: string = "xlsx"
type: string = "xlsx",
folder: string = ""
) {
showLoader();
await axios
.post(`${config.API.reportTemplate}/xlsx`, data, {
.post(`${config.API.reportTemplate}/xlsx${folder}`, data, {
headers:
type == "xlsx"
? {