Merge branch 'develop' into warunee-dev
This commit is contained in:
commit
24381193d0
2 changed files with 63 additions and 20 deletions
|
|
@ -62,6 +62,7 @@ export default {
|
||||||
typeOrder: () => `${order}/order/order-type`,
|
typeOrder: () => `${order}/order/order-type`,
|
||||||
nextStep: (orderId: string) => `${order}/order/next/${orderId}`,
|
nextStep: (orderId: string) => `${order}/order/next/${orderId}`,
|
||||||
prevStep: (orderId: string) => `${order}/order/prev/${orderId}`,
|
prevStep: (orderId: string) => `${order}/order/prev/${orderId}`,
|
||||||
|
executeOrder: (orderId: string) => `${order}/order/execute/${orderId}`,
|
||||||
|
|
||||||
createOrder: () => `${order}/order/detail`,
|
createOrder: () => `${order}/order/detail`,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,7 @@
|
||||||
label="ออกคำสั่ง"
|
label="ออกคำสั่ง"
|
||||||
:color="validateForm() ? 'public' : 'grey'"
|
:color="validateForm() ? 'public' : 'grey'"
|
||||||
:disable="statusOrder == 'N'"
|
:disable="statusOrder == 'N'"
|
||||||
|
@click="clickExecute(orderId)"
|
||||||
/>
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
class="text-dark"
|
class="text-dark"
|
||||||
|
|
@ -417,7 +418,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onUnmounted, computed } from "vue";
|
import { ref, onMounted, onUnmounted, computed, watch } from "vue";
|
||||||
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||||
import type { PDFDocumentLoadingTask } from "pdfjs-dist/types/src/display/api";
|
import type { PDFDocumentLoadingTask } from "pdfjs-dist/types/src/display/api";
|
||||||
import type { QForm } from "quasar";
|
import type { QForm } from "quasar";
|
||||||
|
|
@ -443,38 +444,30 @@ const date = ref<Date>(new Date());
|
||||||
const fileOrder = ref<any>(null);
|
const fileOrder = ref<any>(null);
|
||||||
const fileTailer = ref<any>(null);
|
const fileTailer = ref<any>(null);
|
||||||
|
|
||||||
|
const OrderPDF = ref<string>("");
|
||||||
|
const TailerPDF = ref<string>("");
|
||||||
const statusOrder = ref<string>();
|
const statusOrder = ref<string>();
|
||||||
|
|
||||||
// onUnmounted(() => {
|
const orderId = ref<string>(orderId_params.toString());
|
||||||
// window.removeEventListener("resize", (e: any) => {
|
|
||||||
// myEventHandler(e);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
const orderId = ref<string>("");
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (orderId_params !== undefined) {
|
if (orderId.value) {
|
||||||
orderId.value = orderId_params.toString();
|
|
||||||
fetchAttachment(orderId.value);
|
fetchAttachment(orderId.value);
|
||||||
fecthstatusOrder(orderId.value);
|
fecthstatusOrder(orderId.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// window.addEventListener("resize", (e: any) => {
|
// const pdfData = usePDF();
|
||||||
// myEventHandler(e);
|
|
||||||
// });
|
|
||||||
|
|
||||||
const pdfData = usePDF("/src/assets/05_modules.pdf");
|
// setTimeout(() => {
|
||||||
|
// pdfSrc.value = pdfData.pdf.value;
|
||||||
setTimeout(() => {
|
// numOfPages.value = pdfData.pages.value;
|
||||||
pdfSrc.value = pdfData.pdf.value;
|
// }, 1000);
|
||||||
numOfPages.value = pdfData.pages.value;
|
|
||||||
}, 1000);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchAttachment = async (orderId: string) => {
|
const fetchAttachment = async (orderId: string) => {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.attachmentOrder(orderId))
|
.get(config.API.attachmentOrder(orderId))
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
let response = res.data.result;
|
let response = res.data.result;
|
||||||
console.log(response);
|
console.log(response);
|
||||||
order.value = response.orderNo;
|
order.value = response.orderNo;
|
||||||
|
|
@ -482,6 +475,13 @@ const fetchAttachment = async (orderId: string) => {
|
||||||
if (response.date !== undefined) {
|
if (response.date !== undefined) {
|
||||||
date.value = response.date;
|
date.value = response.date;
|
||||||
}
|
}
|
||||||
|
if (response.orderFileUrl !== null) {
|
||||||
|
OrderPDF.value = response.orderFileUrl;
|
||||||
|
viewPDF(OrderPDF.value);
|
||||||
|
}
|
||||||
|
if (response.attachmentFileUrl !== null) {
|
||||||
|
TailerPDF.value = response.attachmentFileUrl;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -501,6 +501,24 @@ const fecthstatusOrder = async (orderId: string) => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const viewPDF = async (pdf: string) => {
|
||||||
|
const pdfData = await usePDF(`${pdf}`);
|
||||||
|
showLoader();
|
||||||
|
setTimeout(() => {
|
||||||
|
pdfSrc.value = pdfData.pdf.value;
|
||||||
|
numOfPages.value = pdfData.pages.value;
|
||||||
|
hideLoader();
|
||||||
|
}, 1500);
|
||||||
|
};
|
||||||
|
watch(tab, () => {
|
||||||
|
console.log(tab.value);
|
||||||
|
if (tab.value === "main") {
|
||||||
|
viewPDF(OrderPDF.value);
|
||||||
|
}
|
||||||
|
if (tab.value === "second") {
|
||||||
|
viewPDF(TailerPDF.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// const myEventHandler = (e: any) => {
|
// const myEventHandler = (e: any) => {
|
||||||
// console.log("e", e.target.innerWidth);
|
// console.log("e", e.target.innerWidth);
|
||||||
|
|
@ -538,7 +556,6 @@ const onchangePage = (val: any) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
// putOrderData();
|
|
||||||
if (myForm.value !== null) {
|
if (myForm.value !== null) {
|
||||||
myForm.value!.validate().then((success: Boolean) => {
|
myForm.value!.validate().then((success: Boolean) => {
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
@ -556,6 +573,8 @@ const save = () => {
|
||||||
await putOrderData();
|
await putOrderData();
|
||||||
await postfileOrder();
|
await postfileOrder();
|
||||||
await postfileTailer();
|
await postfileTailer();
|
||||||
|
// await fetchAttachment(orderId.value);
|
||||||
|
// await fecthstatusOrder(orderId.value);
|
||||||
})
|
})
|
||||||
.onCancel(() => {})
|
.onCancel(() => {})
|
||||||
.onDismiss(() => {});
|
.onDismiss(() => {});
|
||||||
|
|
@ -589,6 +608,29 @@ const postfileTailer = async () => {
|
||||||
formData.append("File", fileTailer.value);
|
formData.append("File", fileTailer.value);
|
||||||
await http.post(config.API.attachmentOrderId(orderId.value), formData);
|
await http.post(config.API.attachmentOrderId(orderId.value), formData);
|
||||||
};
|
};
|
||||||
|
const clickExecute = async (id: string) => {
|
||||||
|
$q.dialog({
|
||||||
|
title: "ยืนยันการออกคำสั่ง",
|
||||||
|
message: "ต้องการยืนยันการออกคำสั่งข้อมูลนี้ใช่หรือไม่?",
|
||||||
|
cancel: {
|
||||||
|
flat: true,
|
||||||
|
color: "negative",
|
||||||
|
},
|
||||||
|
persistent: true,
|
||||||
|
})
|
||||||
|
.onOk(async () => {
|
||||||
|
await http
|
||||||
|
.put(config.API.executeOrder(id))
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.onCancel(() => {})
|
||||||
|
.onDismiss(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
const validateForm = () => {
|
const validateForm = () => {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue