Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajout du onMounted dans le SuppSteps #109

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions src/views/Suppression/SuppSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<v-stepper-item
:color="currentStep >= 0 ? '#295494' : ''"
:complete="currentStep > 0"
editable
:editable="currentStep > 0"
icon="mdi-numeric-1"
title="Séléction du RCR"
:subtitle="demande ? 'Demande n°'+demande.id : 'Demande'"
Expand All @@ -17,7 +17,7 @@
<v-stepper-item
:color="currentStep >= 1 ? '#295494' : ''"
:complete="currentStep > 1"
editable
:editable="currentStep > 1"
icon="mdi-numeric-2"
title="PPN/RCR/EPN"
:subtitle="typeFileSelected ? 'Fichier '+ typeFileSelected : 'fichier envoyé'"
Expand All @@ -27,7 +27,7 @@
<v-stepper-item
:color="currentStep >= 2 ? '#295494' : ''"
:complete="currentStep > 2"
editable
:editable="currentStep > 2"
icon="mdi-numeric-3"
title="Envoi"
subtitle="du fichier"
Expand Down Expand Up @@ -135,17 +135,14 @@
</template>

<script setup>
import { ref } from 'vue';
import { onMounted, ref } from 'vue';
import TypeFile from '@/components/Supp/TypeFile.vue';
import SelectFile from '@/components/SelectFile.vue';
import demandesService from '@/service/DemandesService';
import DownloadFile from "@/components/Modif/DownloadFile.vue";
import router from '@/router'
import Rcr from '@/components/Rcr.vue';




const currentStep = ref(0);
const demande = ref();

Expand All @@ -165,6 +162,36 @@ const alertMessage = ref('');
const alertType = ref('success');
const dialog = ref(false);

onMounted(()=>{
if (props.id) {
demandesService.getDemande(props.id, "SUPP")
.then(response => {
demande.value = response.data;
switch (demande.value.etatDemande) {
case 'En préparation':
currentStep.value = 1;
rcrSelected.value = demande.value.rcr;
if (demande.value.typeSuppression){
typeFileSelected.value = demande.value.typeSuppression;
}
break;
case 'Préparée':
rcrSelected.value = demande.value.rcr;
typeFileSelected.value = demande.value.typeSuppression;
currentStep.value = 1;
break;
case 'A compléter':
rcrSelected.value = demande.value.rcr;
typeFileSelected.value = demande.value.typeSuppression;
currentStep.value = 2;
break;
}
}).catch(() => {
router.replace("/suppression");
})
}
})


function createDemande() {
if (demande.value && (rcrSelected.value === demande.value.rcr)) {
Expand Down
Loading