Fix Under the hood + adv mode

This commit is contained in:
Thermo_SIM
2021-03-09 12:39:20 +01:00
parent 95559497af
commit 64fbb2e106
13 changed files with 130 additions and 29 deletions
@@ -0,0 +1,13 @@
.labelOnOff {
display: flex;
flex-flow: row;
justify-content: center;
align-items: center;
color: #e8e8e8;
font-size: 18px;
}
.labelOnOff label {
width: 200px;
text-align: end;
padding-right: 10px;
}
@@ -1 +1,16 @@
@import "../../../variable.less";
.labelOnOff{
display: flex;
flex-flow: row;
justify-content: center;
align-items: center;
color: #e8e8e8;
font-size: 18px;
label{
width: 200px;
text-align: end;
padding-right: 10px;
}
}
@@ -2,8 +2,45 @@ import { Component, Vue } from "vue-property-decorator";
import Header from "../../../header/my-header.vue";
import MenuSx from "../../../menu-sx/menu-sx.vue";
import AssiTable from "../../../Assi/components/tables/assi-table/assi-table.vue";
import { underTheHoodService } from "@/services/underTheHoodService";
import { awaiter, messageService } from "@/_base";
import { Modal as modal, ModalHelper } from "@/components/modals";
@Component({
components: { Header, MenuSx, AssiTable }
})
export default class Assi extends Vue {}
export default class Assi extends Vue {
isEditable = false;
isComunicating = false;
async mounted(){
this.isComunicating = true;
this.isEditable = await awaiter (underTheHoodService.GetAxesAdvMode());
this.isComunicating = false;
}
async enableDisable(evt){
this.isComunicating = true;
evt.preventDefault();
if(!this.isEditable)
{
ModalHelper.AskConfirm( this.$options.filters.localize("modal_confirm_title", "Richiesta di conferma"),
this.$options.filters.localize("softkey_confirm", "Confirm?"),
async() => {
await awaiter (underTheHoodService.SetAxesAdvMode(!this.isEditable));
this.isEditable = !this.isEditable;
}, null, "modal");
}
else
{
await awaiter (underTheHoodService.SetAxesAdvMode(!this.isEditable));
this.isEditable = !this.isEditable;
}
this.isComunicating = false;
}
}
@@ -1,6 +1,21 @@
<template>
<div class="column-page-one-column">
<AssiTable></AssiTable>
<AssiTable :isEditable="isEditable"></AssiTable>
<div class="menu">
<div class="load">
</div>
<div class="toReload">
<div class="labelOnOff">
<label>{{'underthehood_label_axis_enabled' | localize('Enabled')}}</label>
<div class="togglebutton">
<label>
<input type="checkbox" :checked="isEditable" :disabled="this.isComunicating" @click='enableDisable'>
<span class="toggle">{{isEditable ?"ON":"OFF"}}</span>
</label>
</div>
</div>
</div>
</div>
</div>
</template>
<style lang="less">
@@ -19,8 +19,10 @@ export default class AsseRowItem extends Vue {
@Prop()
isSlave: boolean;
isSendingCMD = false;
@Prop()
isEditable: boolean;
isSendingCMD = false;
get forcedValue() { return { setpointHMI: this.item.axPos, range: { min: -32768, max: 32767 } }; }
@@ -33,7 +35,7 @@ export default class AsseRowItem extends Vue {
}
getNumber(value){
return value.toFixed(2);;
return value.toFixed(1);
}
openCollapse(){
@@ -41,6 +43,9 @@ export default class AsseRowItem extends Vue {
}
async sendCommand(cmd,ax){
if(!this.isEditable)
return;
this.isSendingCMD = true;
if(this.forcedValue.setpointHMI)
await awaiter (underTheHoodService.sendAxisCommand(ax.id,cmd,this.forcedValue.setpointHMI));
@@ -24,31 +24,26 @@
v-model="forcedValue"
keyboard-position="left"
/>
<button v-if="isvisible(item.enabledWord,1)" @click="sendCommand('MoveAbsolute',item)" :disabled="isSendingCMD">
<button v-if="isvisible(item.enabledWord,1)" @click="sendCommand('MoveAbsolute',item)" :disabled="isSendingCMD || !isEditable">
<label>{{'underthehood_btn_move' | localize("Move")}}</label>
</button>
<button v-if="isvisible(item.enabledWord,8)" @click="sendCommand('Align',item)" :disabled="isSendingCMD">
<button v-if="isvisible(item.enabledWord,8)" @click="sendCommand('Align',item)" :disabled="isSendingCMD || !isEditable">
<label>{{'underthehood_btn_align' | localize("Align")}}</label>
</button>
<button v-if="isvisible(item.enabledWord,16)" @click="sendCommand('Probe',item)" :disabled="isSendingCMD">
<button v-if="isvisible(item.enabledWord,16)" @click="sendCommand('Probe',item)" :disabled="isSendingCMD || !isEditable">
<label>{{'underthehood_btn_probe' | localize("Probe")}}</label>
</button>
<button v-if="isvisible(item.enabledWord,32)" @click="sendCommand('SetSlavePosition',item)" :disabled="isSendingCMD">
<button v-if="isvisible(item.enabledWord,32)" @click="sendCommand('SetSlavePosition',item)" :disabled="isSendingCMD || !isEditable">
<label>{{'underthehood_btn_setslaves' | localize("Set slaves position")}}</label>
</button>
<button v-if="isvisible(item.enabledWord,64)" @click="sendCommand('Reset',item)" :disabled="isSendingCMD">
<button v-if="isvisible(item.enabledWord,64)" @click="sendCommand('Reset',item)" :disabled="isSendingCMD || !isEditable">
<label>{{'underthehood_btn_zero' | localize("Zero")}}</label>
</button>
<button v-if="isvisible(item.enabledWord,2)" @click="sendCommand('JogIncMinus',item)" :disabled="isSendingCMD">
<span class="controlli-icon pointer">
<img src="assets/icons/sotto-cofano/png/ico-bt-minus.png" />
</span>
<button v-if="isvisible(item.enabledWord,2)" @click="sendCommand('JogIncMinus',item)" :disabled="isSendingCMD || !isEditable">
<i class="fa fa-minus"></i>
</button>
<button v-if="isvisible(item.enabledWord,4)" @click="sendCommand('JogIncPlus',item)" :disabled="isSendingCMD">
<span class="controlli-icon pointer">
<img src="assets/icons/sotto-cofano/png/ico-bt-plus.png" />
</span>
<button v-if="isvisible(item.enabledWord,4)" @click="sendCommand('JogIncPlus',item)" :disabled="isSendingCMD || !isEditable">
<i class="fa fa-plus"></i>
</button>
</span>
</td>
@@ -59,6 +59,9 @@
font-size: 18px;
padding: 0 10px;
}
.assi-table .buttons-container > button i {
margin: 0px 10px;
}
.assi-table .buttons-container > button:disabled {
background-image: none;
background-color: #818a8f;
@@ -69,6 +69,9 @@
color: @very-light-pink;
font-size: 18px;
padding: 0 10px;
i{
margin: 0px 10px;
}
&:disabled{
background-image: none;
background-color: #818a8f;
@@ -1,12 +1,17 @@
import { Component, Vue } from "vue-property-decorator";
import { AppModel } from "@/store";
import { underTheHoodService } from "@/services/underTheHoodService";
import { Prop, Watch } from "vue-property-decorator";
import AsseRowItem from "./asse-row-item.vue";
@Component({
components: { AsseRowItem }
})
export default class AssiTable extends Vue {
@Prop()
isEditable: boolean;
groupVisible: string[] = [];
get axis() {
@@ -23,6 +23,7 @@
:hasSlave="hasSlave(item.id)"
:isSlave="false"
:isOpened="groupVisible.includes(item.id)"
:isEditable="isEditable"
@openCollapse="openCollapse(item.id)"
/>
@@ -34,6 +35,7 @@
:hasSlave="false"
:isSlave="true"
:isOpened="groupVisible.includes(item.id)"
:isEditable="isEditable"
@openCollapse="openCollapse(item.id)"
/>
</template>
@@ -33,9 +33,8 @@ export default class Sottocofano extends Vue {
@Watch("isLifted")
@Watch("panel")
async liftedChanged() {
this.ioTimeout = await underTheHoodService.setFastSample(this.isLifted)
if(this.isLifted && this.panel== "io" ){
this.ioTimeout = await underTheHoodService.setFastSample(this.isLifted && this.panel == "io")
if(this.isLifted && this.panel == "io" ){
clearInterval(this.interval);
this.interval = setInterval(() => {
this.checkFastSample();
@@ -7,12 +7,12 @@ export class LogsService extends baseRestService {
async getPage(from,to) {
let result = await this.Get((await this.BASE_URL()) + `CycleLog?from=${from}&to=${to}`) ;
let result = await this.Get((await this.BASE_URL()) + `CycleLog?from=${from}&to=${to}`, true) ;
return result;
}
async Update() {
let result = await this.Get((await this.BASE_URL()) + "CycleLogRefresh");
let result = await this.Get((await this.BASE_URL()) + "CycleLogRefresh", true);
return result;
}
@@ -6,32 +6,41 @@ import { baseRestService } from "@/_base/baseRestService";
export class UnderTheHoodService extends baseRestService {
BASE_URL = async () => (await CONFIGURATION).api.apiServerUrl;
async getChannels() {
let result = await this.Get<server.channels>((await this.BASE_URL()) + "/api/underthehood/channels_io");
let result = await this.Get<server.channels>((await this.BASE_URL()) + "/api/underthehood/channels_io", true);
underTheHoodActions.SetIOChannels(store, result);
return result;
}
async getChannelsConfig() {
let result = await this.Get<{ [id: string]: number[] }>((await this.BASE_URL()) + "/api/configuration/configIO");
let result = await this.Get<{ [id: string]: number[] }>((await this.BASE_URL()) + "/api/configuration/configIO", true);
underTheHoodActions.SetIOChannelsConfig(store, result);
return result;
}
async forceChannel(group: string, item: server.channel, value: number) {
await this.Put((await this.BASE_URL()) + `/api/underthehood/io_force_ch_${group}`, [{ id: item.id, value }]);
await this.Put((await this.BASE_URL()) + `/api/underthehood/io_force_ch_${group}`, [{ id: item.id, value }], true);
}
async resetChannel(group: string, item: server.channel) {
await this.Put((await this.BASE_URL()) + `/api/underthehood/io_reset_ch_${group}`, [item.id]);
await this.Put((await this.BASE_URL()) + `/api/underthehood/io_reset_ch_${group}`, [item.id], true);
}
async setFastSample(value: boolean) {
let result = await this.Put<Date>((await this.BASE_URL()) + `/api/underthehood/io_sample_fast?value=${value}`, {});
let result = await this.Put<Date>((await this.BASE_URL()) + `/api/underthehood/io_sample_fast?value=${value}`, {}, true);
return result;
}
async sendAxisCommand(axisId: number,currCommand: string ,axPos: number) {
await this.Put((await this.BASE_URL()) + `/api/underthehood/SendAxisCommand?AxisId=${axisId}&currCommand=${currCommand}&TargetPos=${axPos}`, {});
await this.Put((await this.BASE_URL()) + `/api/underthehood/SendAxisCommand?AxisId=${axisId}&currCommand=${currCommand}&TargetPos=${axPos}`, {}, true);
}
async SetAxesAdvMode(value: boolean) {
let result = await this.Put((await this.BASE_URL()) + `/api/underthehood/SetAxesAdvMode?value=${value}`, {}, true);
}
async GetAxesAdvMode() {
let result = await this.Get<boolean>((await this.BASE_URL()) + "/api/underthehood/GetAxesAdvMode", true);
return result;
}
}