ออกคำสั่ง => คำสั้งปรับโครงสร้าง
This commit is contained in:
parent
dc079e31fd
commit
e9367dea5c
7 changed files with 94 additions and 30 deletions
|
|
@ -5,6 +5,11 @@ import type { QStepper } from "quasar";
|
|||
import { useRoute } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useOrderPlacementDataStore } from "@/modules/10_order/store";
|
||||
|
||||
const DataStore = useOrderPlacementDataStore();
|
||||
const route = useRoute();
|
||||
|
||||
const orderId_params = route.params.orderid;
|
||||
|
|
@ -29,6 +34,7 @@ const orderId = ref<string>("");
|
|||
|
||||
onUnmounted(() => {
|
||||
destroyLocalStorage();
|
||||
DataStore.typeOrder = "";
|
||||
});
|
||||
//
|
||||
const nextStep = async () => {
|
||||
|
|
@ -78,6 +84,7 @@ const previousStep = async () => {
|
|||
const destroyLocalStorage = () => {
|
||||
localStorage.clear();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (route.query.step) {
|
||||
step.value = Number(route.query.step);
|
||||
|
|
@ -132,6 +139,7 @@ onMounted(() => {
|
|||
:header-nav="step > 1"
|
||||
/>
|
||||
<q-step
|
||||
v-if="DataStore.typeOrder !== 'C-PM-38'"
|
||||
:name="2"
|
||||
title="เลือกรายชื่อ"
|
||||
prefix="2"
|
||||
|
|
@ -139,25 +147,30 @@ onMounted(() => {
|
|||
:header-nav="step > 2"
|
||||
/>
|
||||
<q-step
|
||||
:name="3"
|
||||
:name="DataStore.typeOrder !== 'C-PM-38' ? 3 : 2"
|
||||
title="เลือกรายชื่อส่งสำเนาคำสั่ง"
|
||||
prefix="3"
|
||||
:done="step > 3"
|
||||
:header-nav="step > 3"
|
||||
:prefix="DataStore.typeOrder !== 'C-PM-38' ? '3' : '2'"
|
||||
:done="DataStore.typeOrder !== 'C-PM-38' ? step > 3 : step > 2"
|
||||
:header-nav="DataStore.typeOrder !== 'C-PM-38' ? step > 3 : step > 2"
|
||||
/>
|
||||
<q-step
|
||||
:name="4"
|
||||
:name="DataStore.typeOrder !== 'C-PM-38' ? 4 : 3"
|
||||
title="รายละเอียดคำสั่งและแนบท้าย"
|
||||
prefix="4"
|
||||
:done="step > 4"
|
||||
:header-nav="step > 4"
|
||||
:prefix="DataStore.typeOrder !== 'C-PM-38' ? '4' : '3'"
|
||||
:done="DataStore.typeOrder !== 'C-PM-38' ? step > 4 : step > 3"
|
||||
:header-nav="DataStore.typeOrder !== 'C-PM-38' ? step > 4 : step > 3"
|
||||
/>
|
||||
<template v-slot:message>
|
||||
<template v-slot:message v-if="DataStore.typeOrder !== 'C-PM-38'">
|
||||
<step01 v-if="step === 1" :next="nextStep" :previous="previousStep" />
|
||||
<step02 v-if="step === 2" :next="nextStep" :previous="previousStep" />
|
||||
<step03 v-if="step === 3" :next="nextStep" :previous="previousStep" />
|
||||
<step04 v-if="step === 4" :next="nextStep" :previous="previousStep" />
|
||||
</template>
|
||||
<template v-slot:message v-else>
|
||||
<step01 v-if="step === 1" :next="nextStep" :previous="previousStep" />
|
||||
<step03 v-if="step === 2" :next="nextStep" :previous="previousStep" />
|
||||
<step04 v-if="step === 3" :next="nextStep" :previous="previousStep" />
|
||||
</template>
|
||||
</q-stepper>
|
||||
</q-card>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import type { complaintLists } from "@/modules/10_order/interface/response/Order
|
|||
import type { DataOption1 } from "@/modules/10_order/interface/index/Main";
|
||||
|
||||
export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
|
||||
const typeOrder = ref<string>("");
|
||||
interface placementOrder {
|
||||
mappingPosition: { columns: String[] };
|
||||
}
|
||||
|
|
@ -179,6 +180,8 @@ export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
|
|||
return "คำสั่งให้ลูกจ้างประจำได้รับค่าตอบแทนพิเศษ";
|
||||
case "C-PM-38":
|
||||
return "แต่งตั้งข้าราชการให้ดำรงตำแหน่ง"; // คำสั่งปรับโครงสร้าง
|
||||
// case "C-PM-39":
|
||||
// return "คำสั่งปรับโครงสร้าง";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
|
@ -199,5 +202,6 @@ export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
|
|||
nameOrderFilter,
|
||||
complaintLists,
|
||||
complaintOption,
|
||||
typeOrder,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ const OriginalDataFetch = async () => {
|
|||
};
|
||||
|
||||
// redirect ไปยัง step ปัจจุบัน
|
||||
const redirectToPage = (id?: string, status?: string) => {
|
||||
const redirectToPage = (id?: string, status?: string, name?: string) => {
|
||||
let step = 1;
|
||||
switch (status) {
|
||||
case "จัดทำร่างคำสั่ง":
|
||||
|
|
@ -167,10 +167,10 @@ const redirectToPage = (id?: string, status?: string) => {
|
|||
step = 2;
|
||||
break;
|
||||
case "เลือกผู้ได้รับสำเนาคำสั่ง":
|
||||
step = 3;
|
||||
step = name === "คำสั่งปรับโครงสร้าง" ? 2 : 3;
|
||||
break;
|
||||
default:
|
||||
step = 4;
|
||||
step = name === "คำสั่งปรับโครงสร้าง" ? 3 : 4;
|
||||
break;
|
||||
}
|
||||
router.push(`/order/detail/${id}?step=${step}`);
|
||||
|
|
@ -495,7 +495,11 @@ const paginationLabel = (start: string, end: string, total: string) => {
|
|||
:props="props"
|
||||
class="cursor-pointer"
|
||||
@click="
|
||||
redirectToPage(props.row.orderId, props.row.OrderStatus)
|
||||
redirectToPage(
|
||||
props.row.orderId,
|
||||
props.row.OrderStatus,
|
||||
props.row.OrderType
|
||||
)
|
||||
"
|
||||
>
|
||||
<q-td key="Order" :props="props">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue