- ผูก api ออกคำสั่งให้ครบ loop
- แก้ label
This commit is contained in:
parent
b1c37ad2e0
commit
8f16fadeea
9 changed files with 196 additions and 86 deletions
|
|
@ -10,7 +10,7 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, messageError, showLoader, hideLoader, dialogConfirm } = mixin;
|
||||
const { date2Thai, messageError, showLoader, hideLoader, dialogConfirm, success } = mixin;
|
||||
const route = useRoute();
|
||||
const $q = useQuasar();
|
||||
|
||||
|
|
@ -26,40 +26,82 @@ const date = ref<Date>(new Date());
|
|||
const fileOrder = ref<any>(null);
|
||||
const fileTailer = ref<any>(null);
|
||||
|
||||
const OrderPDF = ref<string>("");
|
||||
const TailerPDF = ref<string>("");
|
||||
const OrderPDFUpload = ref<string>("");
|
||||
const TailerPDFUpload = ref<string>("");
|
||||
|
||||
const orderCoverPdf = ref<string>("");
|
||||
const orderCoverDocs = ref<string>("");
|
||||
const orderAttachmentPdf = ref<string>("");
|
||||
const orderAttachmentXlsx = ref<string>("");
|
||||
|
||||
const statusOrder = ref<string>();
|
||||
|
||||
const orderId = ref<string>(orderId_params.toString());
|
||||
onMounted(async () => {
|
||||
if (orderId.value) {
|
||||
fetchReportCover('pdf', orderId.value);
|
||||
fetchReportCover('docx', orderId.value);
|
||||
fetchReportAttachment('pdf', orderId.value);
|
||||
fetchReportAttachment('xlsx', orderId.value);
|
||||
fetchAttachment(orderId.value);
|
||||
fecthstatusOrder(orderId.value);
|
||||
}
|
||||
});
|
||||
|
||||
const fetchReportCover = async (type: string, orderId: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.reportOrderCover(type, orderId))
|
||||
.then(async (res) => {
|
||||
if (type == 'pdf') {
|
||||
orderCoverPdf.value = res.data.result;
|
||||
viewPDF(orderCoverPdf.value);
|
||||
} else {
|
||||
orderCoverDocs.value = res.data.result;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
// messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const fetchReportAttachment = async (type: string, orderId: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.reportOrderAttachment(type, orderId))
|
||||
.then(async (res) => {
|
||||
if (type == 'pdf') {
|
||||
orderAttachmentPdf.value = res.data.result;
|
||||
} else {
|
||||
orderAttachmentXlsx.value = res.data.result;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
// messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const fetchAttachment = async (orderId: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.attachmentOrder(orderId))
|
||||
.then(async (res) => {
|
||||
let response = res.data.result;
|
||||
// console.log(response);
|
||||
order.value = response.orderNo;
|
||||
years.value = Number(response.orderYear);
|
||||
if (response.date !== undefined) {
|
||||
date.value = response.date;
|
||||
}
|
||||
if (response.orderFileUrl !== null) {
|
||||
// OrderPDF.value = response.orderFileUrl;
|
||||
OrderPDFUpload.value = response.orderFileUrl;
|
||||
|
||||
viewPDF(OrderPDF.value);
|
||||
}
|
||||
if (response.attachmentFileUrl !== null) {
|
||||
// TailerPDF.value = response.attachmentFileUrl;
|
||||
TailerPDFUpload.value = response.attachmentFileUrl;
|
||||
}
|
||||
})
|
||||
|
|
@ -70,6 +112,7 @@ const fetchAttachment = async (orderId: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const fecthstatusOrder = async (orderId: string) => {
|
||||
await http
|
||||
.get(config.API.orderReady(orderId))
|
||||
|
|
@ -78,7 +121,7 @@ const fecthstatusOrder = async (orderId: string) => {
|
|||
statusOrder.value = status.result;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
messageError($q, e);
|
||||
});
|
||||
};
|
||||
const viewPDF = async (pdf: string) => {
|
||||
|
|
@ -104,10 +147,10 @@ const viewPDFUpload = async (pdf: string) => {
|
|||
watch(tab, () => {
|
||||
// console.log(tab.value);
|
||||
if (tab.value === "main") {
|
||||
viewPDF(OrderPDF.value);
|
||||
viewPDF(orderCoverPdf.value);
|
||||
}
|
||||
if (tab.value === "second") {
|
||||
viewPDF(TailerPDF.value);
|
||||
viewPDF(orderAttachmentPdf.value);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -159,6 +202,7 @@ const save = () => {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
const putOrderData = async () => {
|
||||
const orderData = {
|
||||
orderNo: order.value,
|
||||
|
|
@ -168,10 +212,10 @@ const putOrderData = async () => {
|
|||
await http
|
||||
.put(config.API.attachmentOrder(orderId.value), orderData)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
messageError($q, e);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -246,11 +290,11 @@ const viewFileUpload = async (url: string) => {
|
|||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
<q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item clickable v-close-popup type="a" :href="orderCoverPdf" target="_blank">
|
||||
<q-item-section avatar><q-icon color="red" name="mdi-file-pdf" /></q-item-section>
|
||||
<q-item-section>ไฟล์ .PDF</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item clickable v-close-popup type="a" :href="orderCoverDocs" target="_blank">
|
||||
<q-item-section avatar><q-icon color="blue" name="mdi-file-word" /></q-item-section>
|
||||
<q-item-section>ไฟล์ .docx</q-item-section>
|
||||
</q-item>
|
||||
|
|
@ -265,11 +309,11 @@ const viewFileUpload = async (url: string) => {
|
|||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
<q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item clickable v-close-popup type="a" :href="orderAttachmentPdf" target="_blank">
|
||||
<q-item-section avatar><q-icon color="red" name="mdi-file-pdf" /></q-item-section>
|
||||
<q-item-section>ไฟล์ .PDF</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup>
|
||||
<q-item clickable v-close-popup type="a" :href="orderAttachmentXlsx" target="_blank">
|
||||
<q-item-section avatar><q-icon color="green-7" name="mdi-file-excel" /></q-item-section>
|
||||
<q-item-section>ไฟล์ .xls</q-item-section>
|
||||
</q-item>
|
||||
|
|
@ -332,7 +376,8 @@ const viewFileUpload = async (url: string) => {
|
|||
@click="viewFileUpload(OrderPDFUpload)">
|
||||
<q-tooltip>ดูไฟล์คำสั่ง</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn type="a" :href="OrderPDFUpload" size="12px" flat dense color="red" icon="mdi-download" target="_blank">
|
||||
<q-btn type="a" :href="OrderPDFUpload" size="12px" flat dense color="red" icon="mdi-download"
|
||||
target="_blank">
|
||||
<q-tooltip>ดาวน์โหลดเอกสารแนบท้าย</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
|
|
@ -350,7 +395,8 @@ const viewFileUpload = async (url: string) => {
|
|||
@click="viewFileUpload(TailerPDFUpload)">
|
||||
<q-tooltip>ดูไฟล์คำสั่ง</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn type="a" :href="TailerPDFUpload" size="12px" flat dense color="red" icon="mdi-download" target="_blank">
|
||||
<q-btn type="a" :href="TailerPDFUpload" size="12px" flat dense color="red" icon="mdi-download"
|
||||
target="_blank">
|
||||
<q-tooltip>ดาวน์โหลดเอกสารแนบท้าย</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue