This commit is contained in:
=
2021-02-26 19:53:47 +01:00
parent 5a0518af42
commit 152a5489ee
2 changed files with 48 additions and 17 deletions
@@ -16,7 +16,7 @@ import { recipeService } from "@/services/recipeService";
import { warmersService } from "@/services/warmersService";
import { debounce } from "@/_base/debounce";
@Component({ components: { modal: Modal, stepfooter: StepFooter, riscaldiinf: RiscaldiInf, riscaldisup: RiscaldiSup, sostdecomp: SostDecomp,thermocamera:Thermocamera } })
@Component({ components: { modal: Modal, stepfooter: StepFooter, riscaldiinf: RiscaldiInf, riscaldisup: RiscaldiSup, sostdecomp: SostDecomp, thermocamera: Thermocamera } })
export default class ShowRiscaldamentoSuperioreInfo extends Vue {
recipe: Recipe.IRecipe = this.$store.getters.getCurrent();
@@ -30,7 +30,7 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
@Prop()
value: string;
isLoading: boolean = false;
mounted() {
@@ -68,10 +68,34 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
async enabChanged() {
this.tempEnabledEdited = true;
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get lowerHasErrors() {
return (this.recipe.heats_lowerheaters_max_time.status.visible && this.recipe.heats_lowerheaters_max_time.status.hasError) ||
(this.recipe.heats_lowerheaters_movement_enabled.status.visible && this.recipe.heats_lowerheaters_movement_enabled.status.hasError) ||
(this.recipe.heats_lowerheaters_enabled.status.visible && this.recipe.heats_lowerheaters_enabled.status.hasError) ||
(this.recipe.heats_lowerheaters_oscillation.status.visible && this.recipe.heats_lowerheaters_oscillation.status.hasError);
}
get upperHasErrors() {
return (this.recipe.heats_upperheaters_max_time.status.visible && this.recipe.heats_upperheaters_max_time.status.hasError) ||
(this.recipe.heats_upperheaters_movement_enabled.status.visible && this.recipe.heats_upperheaters_movement_enabled.status.hasError) ||
(this.recipe.heats_upperheaters_enabled.status.visible && this.recipe.heats_upperheaters_enabled.status.hasError) ||
(this.recipe.heats_upperheaters_oscillation.status.visible && this.recipe.heats_upperheaters_oscillation.status.hasError);
}
get decoSumHasErrors() {
return (this.recipe.heats_decomsustain_type.status.visible && this.recipe.heats_decomsustain_type.status.hasError) ||
(this.recipe.heats_decomsustain_decompression_flow.status.visible && this.recipe.heats_decomsustain_decompression_flow.status.hasError) ||
(this.recipe.heats_decomsustain_min_blowing_time.status.visible && this.recipe.heats_decomsustain_min_blowing_time.status.hasError) ||
(this.recipe.heats_decomsustain_sustain_delay.status.visible && this.recipe.heats_decomsustain_sustain_delay.status.hasError) ||
(this.recipe.heats_decomsustain_decompression_delay.status.visible && this.recipe.heats_decomsustain_decompression_delay.status.hasError) ||
(this.recipe.heats_decomsustain_decompression_duration.status.visible && this.recipe.heats_decomsustain_decompression_duration.status.hasError) ||
(this.recipe.heats_decomsustain_smoke_function_enabled.status.visible && this.recipe.heats_decomsustain_smoke_function_enabled.status.hasError);
}
get payload() {
return {
heats_lowerheaters_max_time: this.recipe.heats_lowerheaters_max_time,
@@ -103,7 +127,7 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
}
hasChanges() {
if(this.warmersEdited || this.tempsEdited|| this.tempEnabledEdited)
if (this.warmersEdited || this.tempsEdited || this.tempEnabledEdited)
return true;
let result = false;
for (const key in this.recipe) {
@@ -127,7 +151,7 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
return result;
}
takeScreenshot() {
messageService.publishToChannel("take-screenshot");
}
@@ -166,17 +190,17 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
// recipeActions.setCurrent(store, this.recipe);
this.isLoading = true;
if(this.warmersEdited){
if (this.warmersEdited) {
await warmersService.Update(store.state.warmers.channels.reduce((p, c) => { p[c.idChannel] = c.setpointHMI; return p; }, {}));
}
if(this.tempsEdited)
if (this.tempsEdited)
await warmersService.UpdateTemp(store.state.warmers.channels.reduce((p, c) => { p[c.idChannel] = c.tCamTempSet; return p; }, {}));
if(this.warmersEdited || this.tempEnabledEdited){
if (this.warmersEdited || this.tempEnabledEdited) {
await warmersService.UpdateEnable(store.state.warmers.channels.reduce((p, c) => { p[c.idChannel] = c.tCamActive; return p; }, {}));
}
if(this.warmersEdited || this.tempsEdited || this.tempEnabledEdited)
if (this.warmersEdited || this.tempsEdited || this.tempEnabledEdited)
await warmersService.Confirm();
await recipeService.Confirm('Heats');
@@ -3,17 +3,17 @@
<modal type="riscaldi-info">
<div class="tab-header" slot="header-buttons">
<button
:class="{'active':show == 'upperheaters'}"
:class="{'active':show == 'upperheaters', error:upperHasErrors}"
@click="show = 'upperheaters'"
v-if="isUpperheatersEnabled()"
>{{'upperheaters' | localize('Riscaldi superiori')}}</button>
<button
:class="{'active':show == 'lowerheaters'}"
:class="{'active':show == 'lowerheaters', error:lowerHasErrors}"
@click="show = 'lowerheaters'"
v-if="isLowerheatersEnabled()"
>{{'lowerheaters' | localize('Riscaldi inferiori')}}</button>
<button
:class="{'active':show == 'decomsustain'}"
:class="{'active':show == 'decomsustain', error:decoSumHasErrors}"
@click="show = 'decomsustain'"
v-if="isDecomsustainEnabled()"
>{{'decomsustain' | localize("Sostentamento/Decompressione")}}</button>
@@ -31,12 +31,19 @@
<i class="fa fa-remove"></i>
</button>
</div>
<riscaldiinf v-if="show == 'lowerheaters'" :recipe="recipe" @warmersChanged="warmersChanged" ></riscaldiinf>
<riscaldisup v-if="show == 'upperheaters'" :recipe="recipe" @warmersChanged="warmersChanged" ></riscaldisup>
<thermocamera v-if="show == 'termocamera'" :recipe="recipe" @tempsChanged="tempsChanged" @enabChanged="enabChanged" ></thermocamera>
<riscaldiinf v-if="show == 'lowerheaters'" :recipe="recipe" @warmersChanged="warmersChanged"></riscaldiinf>
<riscaldisup v-if="show == 'upperheaters'" :recipe="recipe" @warmersChanged="warmersChanged"></riscaldisup>
<thermocamera
v-if="show == 'termocamera'"
:recipe="recipe"
@tempsChanged="tempsChanged"
@enabChanged="enabChanged"
></thermocamera>
<sostdecomp v-if="show == 'decomsustain'" :recipe="recipe"></sostdecomp>
<footer>
<div v-if="isLoading"><i class="loader fa fa-circle-o-notch fa-spin"></i></div>
<div v-if="isLoading">
<i class="loader fa fa-circle-o-notch fa-spin"></i>
</div>
<button
class="btn"
@click="annulla()"