Files
cms_thermo_active/Step/wwwroot/src/components/loader.ts
T
2020-03-12 12:32:59 +01:00

106 lines
2.2 KiB
TypeScript

import Vue from "vue";
import Component from "vue-class-component";
import { Modal } from "@/components/modals"
@Component({
name: "loader",
components: { Modal },
props: ["title", "message", "percent", "isVisible"],
computed: {
isCompleted: function () {
return this.percent == 100;
}
}
})
export default class Loader extends Vue {
public title: string;
public message: string;
public percent: number;
public followAxesNumber: boolean = true;
mounted() { }
get nameAxes() {
return this.$store.state.process.axes;
}
get axesInterpoleted() {
return this.$store.state.process.valueAxisSelected.interpolated;
}
get axesMachine() {
return this.$store.state.process.valueAxisSelected.machine;
}
get axesProgrammePos() {
return this.$store.state.process.valueAxisSelected.programmePos;
}
get axesToGo() {
return this.$store.state.process.valueAxisSelected.toGo;
}
get CNCumeas() {
return this.$store.state.machineInfo.unitOfMeasurement;
}
get numAxes() {
if (!this.followAxesNumber)
return null;
var n = this.$store.state.process.axes.length;
if (n == 7)
return '_7';
else if (n == 8)
return '_8';
else if (n == 9)
return '_9';
else if (n > 9)
return '_9 more9';
return null;
}
axes(name, value) {
var nameAxes;
var valueAxes;
var newAxis = [];
nameAxes = name;
valueAxes = value;
var keys = Object.keys(valueAxes);
nameAxes.forEach(element => {
for (var key in valueAxes) {
if (element.id == key) {
var axesElement = {
name: element.name,
value: valueAxes[key],
umeas: this.uMeasure(element.type)
};
newAxis.push(axesElement);
}
}
});
return newAxis;
}
uMeasure(type) {
if(type==="ROTATING")
return "°";
else{
if(type==="LINEAR" && this.CNCumeas){
if(this.CNCumeas === "mm")
return "mm"
if(this.CNCumeas === "inches")
return "In"
return "--"
}
else
return "--";
}
}
GetRoundNumber(){
if(this.CNCumeas === "inches"){
return 4;
}
else {
return 3;
}
}
}