แก้ออกคำสั่งวินัย

This commit is contained in:
Warunee Tamkoo 2024-01-16 16:44:36 +07:00
parent 743401b19e
commit 9b0ab95165
7 changed files with 180 additions and 107 deletions

View file

@ -37,7 +37,10 @@ const nextStep = async () => {
await http
.put(config.API.nextStep(orderId.value))
.then(() => {
if (route.name == "disciplineOrderDatail") {
if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
router.push(
`/discipline-order/detail/${orderId.value}?step=${step.value + 1}`
);
@ -56,7 +59,10 @@ const previousStep = async () => {
await http
.put(config.API.prevStep(orderId.value))
.then(() => {
if (route.name == "disciplineOrderDatail") {
if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
router.push(
`/discipline-order/detail/${orderId.value}?step=${step.value - 1}`
);
@ -101,7 +107,8 @@ onMounted(() => {
color="primary"
class="q-mr-sm"
@click="
route.name == 'disciplineOrderDatail' || route.name == 'disciplineOrderAdd'
route.name == 'disciplineOrderDatail' ||
route.name == 'disciplineOrderAdd'
? router.push(`/discipline-order`)
: router.push(`/order`)
"

View file

@ -136,13 +136,6 @@ onMounted(async () => {
} else {
await fecthTypeOption("noData");
}
if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
await getComplaint();
}
});
//
watch(byOrder, async () => {
@ -222,8 +215,12 @@ const fetchdetailOrder = async () => {
let orderIdString = orderId.toString();
await http
.get(config.API.detailOrder(orderIdString))
.then((res) => {
.then(async (res: any) => {
const data = res.data.result;
const orderTypeCode = await data.orderTypeCode.toUpperCase();
await optionsData(orderTypeCode);
typeOrder.value = typeOrderOption.value.find(
(e) => e.id === data.orderTypeValue
);
@ -294,8 +291,6 @@ const fetchdetailOrder = async () => {
result.value = data.result;
refRaw.value = data.refRaw;
complaintId.value = data.complaintId;
fecthExamRoundOption(data.orderTypeCode);
})
.catch((e) => {
messageError($q, e);
@ -317,62 +312,71 @@ const fecthCommand = async () => {
});
};
const optionsData = async (commandCode: string) => {
const orderTypeCode = await commandCode.toUpperCase();
if (orderTypeCode === "C-PM-10") {
nodeTree();
}
nameOrder.value = DataStore.nameOrderFilter(orderTypeCode);
// 01 - 04
if (
orderTypeCode == "C-PM-01" ||
orderTypeCode == "C-PM-02" ||
orderTypeCode == "C-PM-03" ||
orderTypeCode == "C-PM-04"
) {
fecthExamRoundOption(orderTypeCode);
}
//
if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
await getComplaint();
}
// console.log(DataStore.complaintLists)
DataStore.complaintOption = [];
if (orderTypeCode == "C-PM-25" || orderTypeCode == "C-PM-26") {
await DataStore.complaintLists
.filter((x: complaintLists) => x.isDisciplinary === true)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
} else if (orderTypeCode == "C-PM-32") {
await DataStore.complaintLists
.filter(
(x: complaintLists) =>
x.isInvestigate === true ||
x.isDisciplinary === true ||
x.isResult === true
)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
} else if (
orderTypeCode == "C-PM-19" ||
orderTypeCode == "C-PM-20" ||
orderTypeCode == "C-PM-27" ||
orderTypeCode == "C-PM-28" ||
orderTypeCode == "C-PM-29" ||
orderTypeCode == "C-PM-30" ||
orderTypeCode == "C-PM-31"
) {
await DataStore.complaintLists
.filter((x: complaintLists) => x.isResult === true)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
}
};
const selectCMP = async (selectOrder: OrederResult) => {
if (selectOrder != null) {
fecthExamRoundOption(selectOrder.commandCode);
if (selectOrder.commandCode === "C-PM-10") {
nodeTree();
}
nameOrder.value = DataStore.nameOrderFilter(selectOrder.commandCode);
// 01 - 04
if (
selectOrder.commandCode == "C-PM-01" ||
selectOrder.commandCode == "C-PM-02" ||
selectOrder.commandCode == "C-PM-03" ||
selectOrder.commandCode == "C-PM-04"
) {
fecthExamRoundOption(selectOrder.commandCode);
}
//
// console.log(DataStore.complaintLists)
DataStore.complaintOption = [];
if (
selectOrder.commandCode == "C-PM-25" ||
selectOrder.commandCode == "C-PM-26"
) {
await DataStore.complaintLists
.filter((x: complaintLists) => x.isDisciplinary === true)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
} else if (selectOrder.commandCode == "C-PM-32") {
await DataStore.complaintLists
.filter(
(x: complaintLists) =>
x.isInvestigate === true ||
x.isDisciplinary === true ||
x.isResult === true
)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
} else if (
selectOrder.commandCode == "C-PM-19" ||
selectOrder.commandCode == "C-PM-20" ||
selectOrder.commandCode == "C-PM-27" ||
selectOrder.commandCode == "C-PM-28" ||
selectOrder.commandCode == "C-PM-29" ||
selectOrder.commandCode == "C-PM-30" ||
selectOrder.commandCode == "C-PM-31"
) {
await DataStore.complaintLists
.filter((x: complaintLists) => x.isResult === true)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
}
const orderTypeCode = await selectOrder.commandCode.toUpperCase();
optionsData(orderTypeCode);
}
//01-04
examRound.value = "";
@ -635,7 +639,15 @@ const createListOrder = async (formData: Object, type: string) => {
.then((res) => {
const data = res.data.result;
localStorage.setItem("orderId", data.id);
router.push(`/order/detail/${data.id}?step=${2}`); // Step 2
if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
router.push(`/discipline-order/detail/${data.id}?step=${2}`); // Step 2
} else {
router.push(`/order/detail/${data.id}?step=${2}`); // Step 2
}
next();
success($q, "บันทึกข้อมูลสำเร็จ");
})