ออกคำสั่ง => คำสั้งปรับโครงสร้าง
This commit is contained in:
parent
dc079e31fd
commit
e9367dea5c
7 changed files with 94 additions and 30 deletions
|
|
@ -221,6 +221,7 @@ const fetchdetailOrder = async () => {
|
|||
const data = res.data.result;
|
||||
|
||||
const orderTypeCode = await data.orderTypeCode.toUpperCase();
|
||||
DataStore.typeOrder = orderTypeCode;
|
||||
await optionsData(orderTypeCode);
|
||||
|
||||
typeOrder.value = typeOrderOption.value.find(
|
||||
|
|
@ -378,6 +379,7 @@ const optionsData = async (commandCode: string) => {
|
|||
const selectCMP = async (selectOrder: OrederResult) => {
|
||||
if (selectOrder != null) {
|
||||
const orderTypeCode = await selectOrder.commandCode.toUpperCase();
|
||||
DataStore.typeOrder = orderTypeCode;
|
||||
optionsData(orderTypeCode);
|
||||
}
|
||||
//01-04
|
||||
|
|
@ -638,7 +640,7 @@ const createListOrder = async (formData: Object, type: string) => {
|
|||
showLoader();
|
||||
await http
|
||||
.post(config.API.orderCPM(type), formData)
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
localStorage.setItem("orderId", data.id);
|
||||
|
||||
|
|
@ -646,17 +648,17 @@ const createListOrder = async (formData: Object, type: string) => {
|
|||
route.name == "disciplineOrderDatail" ||
|
||||
route.name == "disciplineOrderAdd"
|
||||
) {
|
||||
router.push(
|
||||
`/discipline-order/detail/${data.id}?step=${
|
||||
type == "C-PM-38" ? 3 : 2
|
||||
}`
|
||||
); // สร้างเสร็จแล้วให้ไป Step 2
|
||||
router.push(`/discipline-order/detail/${data.id}?step=${2}`); // สร้างเสร็จแล้วให้ไป Step 2
|
||||
} else {
|
||||
router.push(
|
||||
`/order/detail/${data.id}?step=${type == "C-PM-38" ? 3 : 2}`
|
||||
); // สร้างเสร็จแล้วให้ไป Step 2
|
||||
router.push(`/order/detail/${data.id}?step=${2}`); // สร้างเสร็จแล้วให้ไป Step 2
|
||||
}
|
||||
next();
|
||||
if (DataStore.typeOrder === "C-PM-38") {
|
||||
await next();
|
||||
await next();
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -671,7 +673,12 @@ const updateOrder = async (formData: Object, orderId: string, type: string) => {
|
|||
await http
|
||||
.put(config.API.orderCPMUpdate(type, orderId), formData)
|
||||
.then(() => {
|
||||
next(); // แก้ไขเสร็จแล้วให้ไป Step 2
|
||||
if (DataStore.typeOrder === "C-PM-38") {
|
||||
next();
|
||||
next();
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
|
||||
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
|
||||
import { useOrderPlacementDataStore } from "@/modules/10_order/store";
|
||||
|
||||
const DataStore = useOrderPlacementDataStore();
|
||||
// import CurruncyInput from "@/components/CurruncyInput.vue";
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -152,6 +155,7 @@ const fetchOrder = async (id: string) => {
|
|||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
orderTypeCode.value = data.orderTypeCode;
|
||||
DataStore.typeOrder = data.orderTypeCode.toUpperCase();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ import type { RequestCopyOrder } from "@/modules/05_placement/interface/request/
|
|||
import { useRoute } from "vue-router";
|
||||
import type { DataOption } from "@/modules/10_order/interface/index/Main";
|
||||
import DialogOrgSelectOneStep from "@/components/Dialogs/DialogOrgSelectOneStep.vue";
|
||||
import { useOrderPlacementDataStore } from "@/modules/10_order/store";
|
||||
|
||||
const DataStore = useOrderPlacementDataStore();
|
||||
|
||||
const props = defineProps({
|
||||
next: {
|
||||
type: Function,
|
||||
|
|
@ -29,7 +33,14 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const next = () => props.next();
|
||||
const previous = () => props.previous();
|
||||
const previous = async () => {
|
||||
if (DataStore.typeOrder === "C-PM-38") {
|
||||
await props.previous();
|
||||
await props.previous();
|
||||
} else {
|
||||
props.previous();
|
||||
}
|
||||
};
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||
|
|
@ -158,6 +169,7 @@ const conditionId = async () => {
|
|||
: null;
|
||||
if (id !== null) {
|
||||
await getData(id);
|
||||
fetchOrder(id);
|
||||
}
|
||||
};
|
||||
// เรียก้อมูลใน Table
|
||||
|
|
@ -334,6 +346,19 @@ const fetchSaveCopyOrder = async () => {
|
|||
const updateData = (row: DataCopyOrder) => {
|
||||
editRows.value.push(row);
|
||||
};
|
||||
|
||||
//เรียกรายละเอียดของคำสั่ง
|
||||
const fetchOrder = async (id: string) => {
|
||||
await http
|
||||
.get(config.API.detailOrder(id))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
DataStore.typeOrder = data.orderTypeCode.toUpperCase();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ import config from "@/app.config";
|
|||
import axios from "axios";
|
||||
import genReport from "@/plugins/genreport";
|
||||
|
||||
import { useOrderPlacementDataStore } from "@/modules/10_order/store";
|
||||
|
||||
const DataStore = useOrderPlacementDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
date2Thai,
|
||||
|
|
@ -72,7 +75,8 @@ const attachmentStatus = computed(() => {
|
|||
code.value != "c-pm-29" &&
|
||||
code.value != "c-pm-30" &&
|
||||
code.value != "c-pm-31" &&
|
||||
code.value != "c-pm-32"
|
||||
code.value != "c-pm-32" &&
|
||||
code.value != "c-pm-38"
|
||||
? true
|
||||
: false;
|
||||
});
|
||||
|
|
@ -100,7 +104,10 @@ const getCommandDetail = async () => {
|
|||
.get(config.API.detailOrder(orderId.value))
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
|
||||
DataStore.typeOrder = data.orderTypeCode.toUpperCase();
|
||||
const orderTypeCode = await data.orderTypeCode;
|
||||
|
||||
code.value = orderTypeCode ?? "";
|
||||
orderName.value = res.data.result.orderTitle;
|
||||
orderStatusName.value = data.orderStatusName;
|
||||
|
|
@ -284,7 +291,7 @@ const saveUpload = () => {
|
|||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
await postfileOrder();
|
||||
if (attachmentStatus.value) {
|
||||
if (attachmentStatus.value || code.value === "c-pm-38") {
|
||||
await postfileTailer();
|
||||
}
|
||||
await fetchAttachment(orderId.value);
|
||||
|
|
@ -309,7 +316,7 @@ const saveDetail = () => {
|
|||
await fetchReportCover("pdf", orderId.value); // ดึงรายงานคำสั่งใหม่
|
||||
|
||||
// เช็คประเภทคำสั่งถ้าไม่ใช่ type เหล่านี้จะมีแนบท้าย
|
||||
if (attachmentStatus.value) {
|
||||
if (attachmentStatus.value || code.value === "c-pm-38") {
|
||||
// ดึงรายงานในส่วนของแนบท้ายมาใหม่
|
||||
await fetchReportAttachment("pdf", orderId.value);
|
||||
|
||||
|
|
@ -398,7 +405,7 @@ const clickExecute = async (id: string) => {
|
|||
};
|
||||
const validateFormUpload = () => {
|
||||
if (
|
||||
attachmentStatus.value &&
|
||||
(attachmentStatus.value || code.value === "c-pm-38") &&
|
||||
fileOrder.value !== null &&
|
||||
fileTailer.value !== null
|
||||
) {
|
||||
|
|
@ -652,7 +659,7 @@ const viewFileUpload = async (url: string) => {
|
|||
</template>
|
||||
</q-file>
|
||||
</div>
|
||||
<div v-if="attachmentStatus">
|
||||
<div v-if="attachmentStatus || code === 'c-pm-38'">
|
||||
<label class="text-file">เอกสารแนบท้าย</label>
|
||||
<div v-if="TailerPDFUpload != ''" class="text-right">
|
||||
<q-btn
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue