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