api put/pver
This commit is contained in:
parent
85632ec16c
commit
dc2457d9ed
2 changed files with 34 additions and 5 deletions
|
|
@ -60,6 +60,8 @@ export default {
|
||||||
detailOrder: (orderId: string) => `${order}/order/detail/${orderId}`,
|
detailOrder: (orderId: string) => `${order}/order/detail/${orderId}`,
|
||||||
deleteOrder: (orderId: string) => `${order}/order/${orderId}`,
|
deleteOrder: (orderId: string) => `${order}/order/${orderId}`,
|
||||||
typeOrder: () => `${order}/order/order-type`,
|
typeOrder: () => `${order}/order/order-type`,
|
||||||
|
nextStep: (orderId: string) => `${order}/order/next/${orderId}`,
|
||||||
|
prevStep: (orderId: string) => `${order}/order/prev/${orderId}`,
|
||||||
|
|
||||||
createOrder: () => `${order}/order/detail`,
|
createOrder: () => `${order}/order/detail`,
|
||||||
|
|
||||||
|
|
@ -93,7 +95,6 @@ export default {
|
||||||
|
|
||||||
attachmentOrderId: (orderId: string) =>
|
attachmentOrderId: (orderId: string) =>
|
||||||
`${order}/order/attachment/order-file/${orderId}`,
|
`${order}/order/attachment/order-file/${orderId}`,
|
||||||
|
|
||||||
attachmentFileId: (orderId: string) =>
|
attachmentFileId: (orderId: string) =>
|
||||||
`${order}/order/attachment/file/${orderId}`,
|
`${order}/order/attachment/file/${orderId}`,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,12 @@ import { useRouter } from "vue-router";
|
||||||
import { ref, defineAsyncComponent, onMounted, onUnmounted } from "vue";
|
import { ref, defineAsyncComponent, onMounted, onUnmounted } from "vue";
|
||||||
import type { QStepper } from "quasar";
|
import type { QStepper } from "quasar";
|
||||||
import { useProbationDataStore } from "@/modules/05_placement/store";
|
import { useProbationDataStore } from "@/modules/05_placement/store";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const orderId_params = route.params.orderid;
|
||||||
const probationData = useProbationDataStore();
|
const probationData = useProbationDataStore();
|
||||||
const { stepOrder, setStepOrder } = probationData;
|
const { stepOrder, setStepOrder } = probationData;
|
||||||
|
|
||||||
|
|
@ -89,19 +94,38 @@ const step04 = defineAsyncComponent(
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const step = ref<number>(1);
|
const step = ref<number>(1);
|
||||||
const stepper = ref<QStepper>();
|
const stepper = ref<QStepper>();
|
||||||
|
const orderId = ref<string>("");
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
destroyLocalStorage();
|
destroyLocalStorage();
|
||||||
});
|
});
|
||||||
|
const nextStep = async () => {
|
||||||
const nextStep = () => {
|
|
||||||
stepper.value!.next();
|
stepper.value!.next();
|
||||||
localStorage.setItem("currentStep", step.value.toString());
|
localStorage.setItem("currentStep", step.value.toString());
|
||||||
|
if (orderId.value) {
|
||||||
|
await http
|
||||||
|
.put(config.API.nextStep(orderId.value))
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
const previousStep = async () => {
|
||||||
const previousStep = () => {
|
|
||||||
stepper.value!.previous();
|
stepper.value!.previous();
|
||||||
localStorage.setItem("currentStep", step.value.toString());
|
localStorage.setItem("currentStep", step.value.toString());
|
||||||
|
if (orderId.value) {
|
||||||
|
await http
|
||||||
|
.put(config.API.prevStep(orderId.value))
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const destroyLocalStorage = () => {
|
const destroyLocalStorage = () => {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
|
|
@ -111,6 +135,10 @@ onMounted(() => {
|
||||||
if (currentStep) {
|
if (currentStep) {
|
||||||
step.value = Number(currentStep);
|
step.value = Number(currentStep);
|
||||||
}
|
}
|
||||||
|
if (orderId_params !== undefined) {
|
||||||
|
orderId.value = orderId_params.toString();
|
||||||
|
console.log(orderId.value);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue