V-2.7-cartaTerminoCorregida

This commit is contained in:
Andres2908
2020-12-10 13:06:44 -06:00
parent c28de3ebea
commit c9d6bbd128
3 changed files with 67 additions and 16 deletions
+56 -6
View File
@@ -29,12 +29,7 @@
</b-field>
<b-field class="centro">
<b-button
:disabled="file == ''"
class="border-info my-5"
type="is-info"
tag="router-link"
to="/responsable"
<b-button :disabled="file == ''" class="border-info my-5" type="is-info"
>Enviar</b-button
>
</b-field>
@@ -45,7 +40,9 @@
export default {
data() {
return {
isFullPage: true,
file: "",
idServicio: "",
};
},
methods: {
@@ -63,12 +60,65 @@ export default {
type: "is-danger",
});
},
Enviar() {
const loadingComponent = this.$buefy.loading.open({
container: this.isFullPage ? null : this.$refs.element.$el,
});
const data = { idServicio: this.idServicio };
const formData = new FormData();
formData.append("data", JSON.stringify(data));
formData.append("cartaTermino", this.file);
console.log(formData);
axios
.put(`${process.env.api}/servicio/carta_aceptacion`, formData, {
headers: {
"Content-Type": "multipart/form-data",
},
})
.then((res) => {
console.log(res.data);
loadingComponent.close();
this.$buefy.dialog.alert({
title: "Success",
message: "Se enviaron los datos correctamente",
type: "is-success",
hasIcon: true,
icon: "checkbox-marked-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
})
.catch((error) => {
loadingComponent.close();
this.$buefy.dialog.alert({
title: "Error",
message: error.response.data.message,
type: "is-danger",
hasIcon: true,
icon: "alert-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
})
.finally(() => {
this.$router.push("/responsable");
});
},
getIdLocal() {
this.idServicio = localStorage.getItem("idServicio");
},
},
watch: {
file: function(newFile, oldFile) {
this.validarTamaño();
},
},
created() {
this.getIdLocal();
},
};
</script>
+6 -5
View File
@@ -46,6 +46,7 @@ import axios from "axios";
export default {
data() {
return {
isFullPage: true,
file: [],
idServicio: "",
};
@@ -67,9 +68,9 @@ export default {
});
},
Enviar() {
// const loadingComponent = this.$buefy.loading.open({
// container: this.isFullPage ? null : this.$refs.element.$el,
// });
const loadingComponent = this.$buefy.loading.open({
container: this.isFullPage ? null : this.$refs.element.$el,
});
const data = { idServicio: this.idServicio };
const formData = new FormData();
formData.append("data", JSON.stringify(data));
@@ -84,7 +85,7 @@ export default {
.then((res) => {
console.log(res.data);
// loadingComponent.close();
loadingComponent.close();
this.$buefy.dialog.alert({
title: "Success",
message: "Se enviaron los datos correctamente",
@@ -97,7 +98,7 @@ export default {
});
})
.catch((error) => {
// loadingComponent.close();
loadingComponent.close();
this.$buefy.dialog.alert({
title: "Error",
message: error.response.data.message,
+5 -5
View File
@@ -156,7 +156,7 @@
props.row.idStatus == 9
"
>
<span v-if="props.row.cartaTermino === 1">
<span v-if="props.row.cartaTermino != null">
<b-icon
:icon="iconoCarta(props.row.cartaTermino)"
class="tag is-success"
@@ -190,7 +190,7 @@
props.row.idStatus == 9
"
>
<span v-if="props.row.cuestionario === 1">
<span v-if="props.row.cuestionario != null">
<b-icon
:icon="iconoCuestionario(props.row.cuestionario)"
class="tag is-success"
@@ -278,7 +278,7 @@ export default {
return "is-danger";
}
},
botonCuestionario(cuestionario, IdServicio) {
botonCuestionario(cuestionario, idServicio) {
window.localStorage.setItem("idServicio", idServicio);
this.$router.push("/responsable/cuestionario");
if (cuestionario === 1) {
@@ -288,14 +288,14 @@ export default {
}
},
iconoCarta(cartaTermino) {
if (cartaTermino === 1) {
if (cartaTermino != null) {
return "check";
} else {
return "close";
}
},
iconoCuestionario(cuestionario) {
if (cuestionario === 1) {
if (cuestionario != null) {
return "check";
} else {
return "close";