Fix riscaldi behaviour

This commit is contained in:
Samuele E. Locatelli
2020-10-10 12:53:40 +02:00
parent 3a991b7d5e
commit a35b7485fb
6 changed files with 34 additions and 7 deletions
@@ -31,6 +31,7 @@ export default class RiscaldiInferiori extends Vue {
changedSelectValue(v){
if(this.uniformChannelValue>=0)
for (const c of this.selectedChannels) c.setpointHMI = this.uniformChannelValue;
this.$emit("warmersChanged");
}
zoomIn() {
@@ -44,21 +45,29 @@ export default class RiscaldiInferiori extends Vue {
(this.$refs.warmers as any).zoomReset();
}
autocomposite(){
(this.$refs.warmers as any).automate();
this.$emit("warmersChanged");
}
add5() {
for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) + 5, 0), 100);
this.$emit("warmersChanged");
}
remove5() {
for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) - 5, 0), 100);
for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) - 5, 0), 100);
this.$emit("warmersChanged");
}
add1() {
for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) + 1, 0), 100);
this.$emit("warmersChanged");
}
remove1() {
for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) - 1, 0), 100);
this.$emit("warmersChanged");
}
selectionChanged(selected: number[]) {
@@ -65,7 +65,7 @@
<div class="input-area grid left">
<button
class="btn btn-success"
@click="$refs.warmers.automate()"
@click="autocomposite()"
>{{'warmers_autocomposition' | localize('Autocomposizione')}}</button>
</div>
<div class="divider"></div>
@@ -29,9 +29,9 @@ export default class RiscaldiSuperiori extends Vue {
selectionMethod = "none"
changedSelectValue(v){
console.log(this.uniformChannelValue);
if(this.uniformChannelValue>=0)
for (const c of this.selectedChannels) c.setpointHMI = this.uniformChannelValue;
this.$emit("warmersChanged");
}
@@ -46,20 +46,28 @@ export default class RiscaldiSuperiori extends Vue {
(this.$refs.warmers as any).zoomReset();
}
autocomposite(){
(this.$refs.warmers as any).automate();
this.$emit("warmersChanged");
}
add5() {
for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) + 5, 0), 100);
this.$emit("warmersChanged");
}
remove5() {
for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) - 5, 0), 100);
this.$emit("warmersChanged");
}
add1() {
for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) + 1, 0), 100);
this.$emit("warmersChanged");
}
remove1() {
for (const c of this.selectedChannels) c.setpointHMI = Math.min(Math.max(parseFloat(c.setpointHMI.toString()) - 1, 0), 100);
this.$emit("warmersChanged");
}
selectionChanged(selected: number[]) {
@@ -65,7 +65,7 @@
<div class="input-area grid left">
<button
class="btn btn-success"
@click="$refs.warmers.automate()"
@click="autocomposite"
>{{'warmers_autocomposition' | localize('Autocomposizione')}}</button>
</div>
<div class="divider"></div>
@@ -18,6 +18,7 @@ import { debounce } from "@/_base/debounce";
export default class ShowRiscaldamentoSuperioreInfo extends Vue {
recipe: Recipe.IRecipe = this.$store.getters.getCurrent();
warmersEdited = false;
show: string = 'upperheaters';
@Prop()
@@ -37,6 +38,7 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
this.isLoading = true;
await recipeService.Cancel();
this.isLoading = false;
this.warmersEdited = false;
// ModalHelper.HideModal();
// this.deferred.resolve(-1);
};
@@ -46,6 +48,10 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
this.debouncedRecipeSave()
};
async warmersChanged() {
this.warmersEdited = true;
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
@@ -79,16 +85,19 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
}
hasChanges() {
if(this.warmersEdited)
return true;
let result = false;
for (const key in this.recipe) {
const el = this.recipe[key] as Recipe.IValue;
if (el.status.visible && el.status.enabled)
if (el.setpointHMI != el.setpointPLC) result = true;
}
/*
for (const key in store.state.warmers.channels) {
const el = store.state.warmers.channels[key];
if (el.setpointHMI != el.setpointPLC) result = true;
}
}*/
return result;
}
@@ -138,6 +147,7 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
await warmersService.Confirm();
await recipeService.Confirm('Heats');
this.isLoading = false;
this.warmersEdited = false;
// ModalHelper.HideModal();
// this.deferred.resolve(1);
};
@@ -23,8 +23,8 @@
<i class="fa fa-remove"></i>
</button>
</div>
<riscaldiinf v-if="show == 'lowerheaters'" :recipe="recipe"></riscaldiinf>
<riscaldisup v-if="show == 'upperheaters'" :recipe="recipe"></riscaldisup>
<riscaldiinf v-if="show == 'lowerheaters'" :recipe="recipe" @warmersChanged="warmersChanged" ></riscaldiinf>
<riscaldisup v-if="show == 'upperheaters'" :recipe="recipe" @warmersChanged="warmersChanged" ></riscaldisup>
<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>