Fix Thermocamera UI

This commit is contained in:
Samuele E. Locatelli
2020-11-03 21:48:21 +01:00
parent cb3082522c
commit fcec70b367
4 changed files with 27 additions and 7 deletions
@@ -6,7 +6,6 @@ import { store } from '@/store';
@Component({
name: "riscaldisup", components: {
warmers
}
})
@@ -1,8 +1,8 @@
import Vue from 'vue';
import Component from 'vue-class-component';
import { store } from '@/store';
import { Prop,Watch } from 'vue-property-decorator';
import warmers from "./warmers.vue";
import { store } from '@/store';
import { thermocameraService } from "@/services/thermocameraService";
@Component({
@@ -21,6 +21,8 @@ export default class Thermocamera extends Vue {
modeEnabled: Recipe.IValue = {
setpointHMI: this.thermocameraMode,
checkpointHMI: this.thermocameraMode,
range: { min: 0, max: 999999 },
status: {
enabled: true,
@@ -31,6 +33,7 @@ export default class Thermocamera extends Vue {
OnOffEnabled: Recipe.IValue = {
setpointHMI: this.thermocameraOnOff,
checkpointHMI: this.thermocameraOnOff,
range: { min: 0, max: 999999 },
status: {
enabled: true,
@@ -40,18 +43,20 @@ export default class Thermocamera extends Vue {
} as Recipe.IValue;
@Watch("modeEnabled", { deep: true })
@Watch("modeEnabled.setpointHMI", { deep: true })
async ChangedMode(n, o) {
this.$emit("enabChanged");
if(this.modeEnabled.checkpointHMI != this.modeEnabled.setpointHMI)
this.$emit("enabChanged");
if(this.modeEnabled.setpointHMI == 1)
store.state.warmers.tCamStatus.thermoCamMode = true;
else
store.state.warmers.tCamStatus.thermoCamMode = false;
}
@Watch("OnOffEnabled", { deep: true })
@Watch("OnOffEnabled.setpointHMI", { deep: true })
async ChangedOnOff(n, o) {
this.$emit("enabChanged");
if(this.OnOffEnabled.checkpointHMI != this.OnOffEnabled.setpointHMI)
this.$emit("enabChanged");
if(this.OnOffEnabled.setpointHMI == 1)
store.state.warmers.tCamStatus.thermoCamOnOff = true;
else
@@ -60,6 +65,18 @@ export default class Thermocamera extends Vue {
@Watch("warmers", { deep: true })
async ChangedTemps() {
if(store.state.warmers.tCamStatus.thermoCamOnOff)
this.OnOffEnabled.setpointHMI = 1;
else
this.OnOffEnabled.setpointHMI = 0;
if(store.state.warmers.tCamStatus.thermoCamMode)
this.modeEnabled.setpointHMI = 1;
else
this.modeEnabled.setpointHMI = 0;
this.OnOffEnabled.status.enabled = false;
for(const ch of store.state.warmers.channels){
if(ch.tCamTempSet > 0){
@@ -74,6 +91,8 @@ export default class Thermocamera extends Vue {
}
async mounted(){
this.ChangedTemps();
this.modeEnabled.checkpointHMI = this.modeEnabled.setpointHMI;
this.OnOffEnabled.checkpointHMI = this.OnOffEnabled.setpointHMI;
}
get selectedChannels(): Warmers.IChannel[] {
@@ -44,7 +44,6 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
async annulla() {
this.isLoading = true;
await recipeService.Cancel();
await warmersService.GetThermocameraStatus();
this.isLoading = false;
this.warmersEdited = false;
this.tempsEdited = false;
@@ -28,6 +28,7 @@ import { prodService } from "./prodService";
import { recipeService } from "./recipeService";
import { warmersActions } from "@/store/warmers.store";
import { cmsConnectActions } from "@/store/cmsConnect.store";
import { warmersService } from "./warmersService";
declare const PRODUCTION;
@@ -201,6 +202,8 @@ export class Hub {
public static async setpointHmiInvalid(data) {
if (data) {
await recipeService.GetCurrent();
await warmersService.GetChannels();
await warmersService.GetThermocameraStatus();
// await recipeService.GetOverview();
}
}