ออกคำสั่ง
This commit is contained in:
parent
73c41d9b01
commit
671c7103ab
7 changed files with 86 additions and 61 deletions
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ถูกเรียกใช้งาน
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
? {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
? {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue