ปรับ ออกคำสั่ง
This commit is contained in:
parent
cf8bdb7ce0
commit
46f4173524
3 changed files with 111 additions and 34 deletions
|
|
@ -10,20 +10,16 @@ const route = useRoute();
|
|||
const orderId_params = route.params.orderid;
|
||||
|
||||
const step01 = defineAsyncComponent(
|
||||
() =>
|
||||
import("@/modules/10_order/components/step/step01.vue")
|
||||
() => import("@/modules/10_order/components/step/step01.vue")
|
||||
);
|
||||
const step02 = defineAsyncComponent(
|
||||
() =>
|
||||
import("@/modules/10_order/components/step/step02.vue")
|
||||
() => import("@/modules/10_order/components/step/step02.vue")
|
||||
);
|
||||
const step03 = defineAsyncComponent(
|
||||
() =>
|
||||
import("@/modules/10_order/components/step/step03.vue")
|
||||
() => import("@/modules/10_order/components/step/step03.vue")
|
||||
);
|
||||
const step04 = defineAsyncComponent(
|
||||
() =>
|
||||
import("@/modules/10_order/components/step/step04.vue")
|
||||
() => import("@/modules/10_order/components/step/step04.vue")
|
||||
);
|
||||
|
||||
const router = useRouter();
|
||||
|
|
@ -37,12 +33,12 @@ onUnmounted(() => {
|
|||
|
||||
const nextStep = async () => {
|
||||
stepper.value!.next();
|
||||
localStorage.setItem("currentStep", (step.value + 1).toString());
|
||||
localStorage.setItem("currentStep", step.value.toString());
|
||||
if (orderId.value) {
|
||||
await http
|
||||
.put(config.API.nextStep(orderId.value))
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
.then(() => {
|
||||
router.push(`/order/detail/${orderId.value}?step=${step.value}`);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
|
|
@ -51,12 +47,12 @@ const nextStep = async () => {
|
|||
};
|
||||
const previousStep = async () => {
|
||||
stepper.value!.previous();
|
||||
localStorage.setItem("currentStep", (step.value - 1).toString());
|
||||
localStorage.setItem("currentStep", step.value.toString());
|
||||
if (orderId.value) {
|
||||
await http
|
||||
.put(config.API.prevStep(orderId.value))
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
.then(() => {
|
||||
router.push(`/order/detail/${orderId.value}?step=${step.value}`);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
|
|
@ -70,7 +66,7 @@ const destroyLocalStorage = () => {
|
|||
onMounted(() => {
|
||||
// console.log("route query===>", route.query)
|
||||
if (route.query.step) {
|
||||
step.value = Number(route.query.step)
|
||||
step.value = Number(route.query.step);
|
||||
localStorage.setItem("currentStep", step.value.toString());
|
||||
} else {
|
||||
const currentStep = localStorage.getItem("currentStep");
|
||||
|
|
@ -90,16 +86,55 @@ onMounted(() => {
|
|||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm"
|
||||
@click="router.push('/order'), destroyLocalStorage()" />
|
||||
<q-btn
|
||||
icon="mdi-arrow-left"
|
||||
unelevated
|
||||
round
|
||||
dense
|
||||
flat
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
@click="router.push('/order'), destroyLocalStorage()"
|
||||
/>
|
||||
ออกคำสั่ง
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 q-my-sm q-mt-sm">
|
||||
<q-stepper v-model="step" ref="stepper" color="primary" animated class="step" header-class="bg-grey-1">
|
||||
<q-step :name="1" title="รายละเอียดการออกคำสั่ง" prefix="1" :done="step > 1" :header-nav="step > 1" />
|
||||
<q-step :name="2" title="เลือกรายชื่อ" prefix="2" :done="step > 2" :header-nav="step > 2" />
|
||||
<q-step :name="3" title="เลือกรายชื่อส่งสำเนาคำสั่ง" prefix="3" :done="step > 3" :header-nav="step > 3" />
|
||||
<q-step :name="4" title="รายละเอียดคำสั่งและแนบท้าย" prefix="4" :done="step > 4" :header-nav="step > 4" />
|
||||
<q-stepper
|
||||
v-model="step"
|
||||
ref="stepper"
|
||||
color="primary"
|
||||
animated
|
||||
class="step"
|
||||
header-class="bg-grey-1"
|
||||
>
|
||||
<q-step
|
||||
:name="1"
|
||||
title="รายละเอียดการออกคำสั่ง"
|
||||
prefix="1"
|
||||
:done="step > 1"
|
||||
:header-nav="step > 1"
|
||||
/>
|
||||
<q-step
|
||||
:name="2"
|
||||
title="เลือกรายชื่อ"
|
||||
prefix="2"
|
||||
:done="step > 2"
|
||||
:header-nav="step > 2"
|
||||
/>
|
||||
<q-step
|
||||
:name="3"
|
||||
title="เลือกรายชื่อส่งสำเนาคำสั่ง"
|
||||
prefix="3"
|
||||
:done="step > 3"
|
||||
:header-nav="step > 3"
|
||||
/>
|
||||
<q-step
|
||||
:name="4"
|
||||
title="รายละเอียดคำสั่งและแนบท้าย"
|
||||
prefix="4"
|
||||
:done="step > 4"
|
||||
:header-nav="step > 4"
|
||||
/>
|
||||
<template v-slot:message>
|
||||
<step01 v-if="step === 1" :next="nextStep" :previous="previousStep" />
|
||||
<step02 v-if="step === 2" :next="nextStep" :previous="previousStep" />
|
||||
|
|
|
|||
|
|
@ -247,10 +247,10 @@ const fecthTypeOption = async (actions: string) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await fecthCommand();
|
||||
if (actions == "hasData") {
|
||||
await fetchdetailOrder();
|
||||
}
|
||||
await fecthCommand();
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
|
@ -260,6 +260,8 @@ const fetchdetailOrder = async () => {
|
|||
await http
|
||||
.get(config.API.detailOrder(orderIdString))
|
||||
.then((res: any) => {
|
||||
console.log(res);
|
||||
|
||||
const data = res.data.result;
|
||||
console.log(data);
|
||||
typeOrder.value = typeOrderOption.value.find(
|
||||
|
|
@ -336,7 +338,7 @@ const fetchdetailOrder = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await fecthCommand();
|
||||
// await fecthCommand();
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
|
@ -344,6 +346,8 @@ const fecthCommand = async () => {
|
|||
await http
|
||||
.get(config.API.organizationsOrder())
|
||||
.then((res: any) => {
|
||||
console.log(res);
|
||||
|
||||
byOrderOption.value = res.data.result;
|
||||
})
|
||||
.catch((e: any) => {
|
||||
|
|
@ -412,12 +416,15 @@ const fecthExamRoundOption = async (commandCode: string) => {
|
|||
};
|
||||
|
||||
const submit = async () => {
|
||||
console.log(nameCommand.value);
|
||||
console.log(CommandOption.value);
|
||||
|
||||
let signBy = null;
|
||||
if (!nameCommand.value.length) {
|
||||
signBy = await nameCommand.value.name;
|
||||
} else {
|
||||
const name2 = await CommandOption.value.find(
|
||||
(x: any) => x.id == nameCommand.value.id
|
||||
(x: any) => x.name == nameCommand.value
|
||||
);
|
||||
signBy = await name2?.name;
|
||||
console.log("signBy", signBy);
|
||||
|
|
@ -437,7 +444,7 @@ const submit = async () => {
|
|||
orderBy: byOrder.value,
|
||||
orderByOrganizationName: orderByOrganizationName,
|
||||
registerPosition: "",
|
||||
signatoryBy: signBy,
|
||||
signatoryBy: signBy === "" ? nameCommand.value : signBy,
|
||||
signatoryPosition: positionCommand.value,
|
||||
};
|
||||
if (
|
||||
|
|
@ -525,7 +532,7 @@ const submit = async () => {
|
|||
});
|
||||
}
|
||||
|
||||
console.log(formdata);
|
||||
// console.log(formdata);
|
||||
|
||||
await myForm.value!.validate().then((result: boolean) => {
|
||||
if (result) {
|
||||
|
|
@ -564,6 +571,7 @@ const updateOrder = async (formData: Object, orderId: string, type: string) => {
|
|||
.put(config.API.orderCPMUpdate(type, orderId), formData)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
|
||||
next();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRoute } from "vue-router";
|
||||
|
|
@ -94,6 +94,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
const rows = ref<ResponseData[]>([]);
|
||||
const rows2 = ref<ResponseData[]>([]);
|
||||
const selected = ref<ResponseData[]>([]);
|
||||
const orderTypeCode = ref<string>("");
|
||||
|
||||
onMounted(async () => {
|
||||
await conditionData();
|
||||
|
|
@ -107,6 +108,7 @@ const conditionData = async () => {
|
|||
: null;
|
||||
if (id !== null) {
|
||||
await getData(id);
|
||||
await fetchOrder(id);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -145,7 +147,35 @@ const getData = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const fetchOrder = async (id: string) => {
|
||||
await http
|
||||
.get(config.API.detailOrder(id))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
orderTypeCode.value = data.orderTypeCode;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
};
|
||||
const statuscode = computed(() => {
|
||||
if (
|
||||
orderTypeCode.value === "c-pm-01" ||
|
||||
orderTypeCode.value === "c-pm-02" ||
|
||||
orderTypeCode.value === "c-pm-03" ||
|
||||
orderTypeCode.value === "c-pm-04" ||
|
||||
orderTypeCode.value === "c-pm-05" ||
|
||||
orderTypeCode.value === "c-pm-06" ||
|
||||
orderTypeCode.value === "c-pm-07" ||
|
||||
orderTypeCode.value === "c-pm-08" ||
|
||||
orderTypeCode.value === "c-pm-09" ||
|
||||
orderTypeCode.value === "c-pm-14" ||
|
||||
orderTypeCode.value === "c-pm-21"
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
const dialogDeleteData = async (id: string) => {
|
||||
dialogRemove($q, () => deleteData(id));
|
||||
};
|
||||
|
|
@ -374,14 +404,18 @@ const addlist = async (data: Object) => {
|
|||
};
|
||||
|
||||
const save = async () => {
|
||||
// console.log("save===>", rows.value)
|
||||
// console.log("save===>", rows.value);
|
||||
// console.log(statuscode.value);
|
||||
const check = rows.value.find((x: any) => x.salaryAmount == null);
|
||||
if (selected.value.length > 0 && !check) {
|
||||
if (
|
||||
(selected.value.length > 0 && !check) ||
|
||||
(statuscode.value === true && selected.value.length > 0)
|
||||
) {
|
||||
dialogConfirm($q, () => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
next();
|
||||
});
|
||||
} else if (check) {
|
||||
} else if (check && statuscode.value === false) {
|
||||
dialogMessageNotify($q, "ระบุรายละเอียดการเงินไม่ครบ");
|
||||
} else {
|
||||
dialogMessageNotify($q, "กรุณาเลือกรายชื่อ");
|
||||
|
|
@ -472,7 +506,7 @@ const getClass = (val: boolean) => {
|
|||
<q-th auto-width />
|
||||
<q-th auto-width />
|
||||
<q-th auto-width />
|
||||
<q-th auto-width />
|
||||
<q-th auto-width v-if="statuscode !== true" />
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
|
|
@ -508,7 +542,7 @@ const getClass = (val: boolean) => {
|
|||
<!-- <q-tooltip>เลื่อนลำดับลง</q-tooltip> -->
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td auto-width>
|
||||
<q-td auto-width v-if="statuscode !== true">
|
||||
<q-btn
|
||||
v-if="props.row.salaryAmount === null"
|
||||
dense
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue