diff --git a/src/modules/18_command/components/Step/1_Detail.vue b/src/modules/18_command/components/Step/1_Detail.vue
index 8475ad36a..7ef602a47 100644
--- a/src/modules/18_command/components/Step/1_Detail.vue
+++ b/src/modules/18_command/components/Step/1_Detail.vue
@@ -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();
});
diff --git a/src/modules/18_command/components/Step/2_ListPersons.vue b/src/modules/18_command/components/Step/2_ListPersons.vue
index b206f24f0..abfd7ec40 100644
--- a/src/modules/18_command/components/Step/2_ListPersons.vue
+++ b/src/modules/18_command/components/Step/2_ListPersons.vue
@@ -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);
diff --git a/src/modules/18_command/components/Step/3_ReceivedCopy.vue b/src/modules/18_command/components/Step/3_ReceivedCopy.vue
index 1813186ee..d8a70db27 100644
--- a/src/modules/18_command/components/Step/3_ReceivedCopy.vue
+++ b/src/modules/18_command/components/Step/3_ReceivedCopy.vue
@@ -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({
-
+
diff --git a/src/modules/18_command/components/Step/4_Attached.vue b/src/modules/18_command/components/Step/4_Attached.vue
index 36fc7af0f..8cb41434a 100644
--- a/src/modules/18_command/components/Step/4_Attached.vue
+++ b/src/modules/18_command/components/Step/4_Attached.vue
@@ -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"
);
}
}
diff --git a/src/modules/18_command/views/detail.vue b/src/modules/18_command/views/detail.vue
index 76c867432..340ced511 100644
--- a/src/modules/18_command/views/detail.vue
+++ b/src/modules/18_command/views/detail.vue
@@ -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 ถูกเรียกใช้งาน
diff --git a/src/plugins/genreport.ts b/src/plugins/genreport.ts
index 0673a76a8..df010ad8c 100644
--- a/src/plugins/genreport.ts
+++ b/src/plugins/genreport.ts
@@ -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"
? {
diff --git a/src/plugins/genreportxlsx.ts b/src/plugins/genreportxlsx.ts
index fcd5342d9..f9c6a8e59 100644
--- a/src/plugins/genreportxlsx.ts
+++ b/src/plugins/genreportxlsx.ts
@@ -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"
? {