modali m155 m156
This commit is contained in:
@@ -39,7 +39,7 @@ messageService.subscribeToChannel("show-contact-info", () => { ModalHelper.ShowM
|
||||
|
||||
// messageService.subscribeToChannel("show-axes-calibration", () => { ModalHelper.ShowNcModal(AxesCalibration); });
|
||||
// messageService.subscribeToChannel("hide-axes-calibration", () => { ModalHelper.HideNcModal(AxesCalibration); });
|
||||
// messageService.subscribeToChannel("show-m155-questions", () => { ModalHelper.ShowNextM155Modal(); });
|
||||
messageService.subscribeToChannel("show-m155-questions", () => { ModalHelper.ShowNextM155Modal(); });
|
||||
// messageService.subscribeToChannel("show-nochange-page", () => {
|
||||
// ModalHelper.ShowMessage(
|
||||
// Vue.filter('localize')("modal_nochangepage_title", "Operazione non possibile"),
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { AppModel } from "src/store";
|
||||
import { Modal, ModalHelper } from "src/components/modals";
|
||||
import Component from "vue-class-component";
|
||||
import Vue from "vue";
|
||||
import { Hub } from "src/services";
|
||||
import { Factory, messageService } from "src/_base";
|
||||
import { Watch } from "vue-property-decorator";
|
||||
|
||||
@Component({ components: { modal: Modal } })
|
||||
export default class M155Dialog extends Vue{
|
||||
|
||||
data = null;
|
||||
value = 0;
|
||||
|
||||
MULTIPLE_BUTTONS = "MULTIPLE_BUTTONS";
|
||||
REAL = "REAL";
|
||||
SHOW_VAL = "SHOW_VAL"
|
||||
|
||||
mounted(){
|
||||
this.data = ModalHelper.M155ModalData.data;
|
||||
this.value = 0;
|
||||
messageService.subscribeToChannel("show-modal-nc", args => {
|
||||
this.data = ModalHelper.M155ModalData.data;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
get process(){
|
||||
if(this.data)
|
||||
return this.data.process;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Watch("data")
|
||||
dataChanged(){
|
||||
this.value = 0;
|
||||
}
|
||||
|
||||
ischecked(k){
|
||||
return k == this.value;
|
||||
}
|
||||
check(k){
|
||||
return this.value = k;
|
||||
}
|
||||
canSendAnswer(){
|
||||
if(this.getType == this.REAL)
|
||||
return this.value != null && this.value != undefined;
|
||||
else
|
||||
return this.value && this.value != 0;
|
||||
}
|
||||
get getType(){
|
||||
if(this.data)
|
||||
return this.data.type
|
||||
|
||||
return ""
|
||||
}
|
||||
hide() {
|
||||
ModalHelper.M155ModalData.data.toDisplay = false;
|
||||
ModalHelper.HideThisM155Modal(ModalHelper.M155ModalData.data.processId);
|
||||
}
|
||||
answer(){
|
||||
Hub.Current.WriteM155Response(this.data.process,this.value);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<modal :title="'modal_m155_title' | localize('Message from Process %d',process)" class="m155" :class="{'multiple': getType != REAL}" name="modal" >
|
||||
<div v-if="data">
|
||||
<h2 v-if="getType != SHOW_VAL">{{data.message}}</h2>
|
||||
<div class="content-real" v-if="getType == REAL">
|
||||
<span>{{'modal_m155_value' | localize("Value: ")}}</span>
|
||||
<input type="number" min="0" max="4294967295" v-model="value">
|
||||
</div>
|
||||
|
||||
<div class="content-real-showval" v-if="getType == SHOW_VAL">
|
||||
<span>{{data.message}}</span>
|
||||
<input type="number" min="0" max="4294967295" v-model="data.value" disabled="disabled">
|
||||
</div>
|
||||
|
||||
<div v-if="getType != REAL" >
|
||||
<div class="content-btn" v-for="(t,k) in data.buttons" :key="'m155_'+k" @click="check(k)">
|
||||
<input type="radio" name="radio-group" :checked="ischecked(k)" >
|
||||
<label for="datefixed">{{t}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<div class="pull-left">
|
||||
<button class="btn" @click="hide()">{{'modal_m155_hide_window' | localize("Hide")}}</button>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-success" @click="answer()" :disabled="!canSendAnswer()">{{'confirm_request_confirm' | localize("Confirm")}}</button>
|
||||
</div>
|
||||
</footer>
|
||||
</modal>
|
||||
</template>
|
||||
<script src="./m155-dialog.ts" lang="ts"></script>
|
||||
|
||||
@@ -12,6 +12,7 @@ export {
|
||||
MachineInfoDialog,
|
||||
ContactInfoDialog,
|
||||
UserInfoDialog,
|
||||
M155Questions,
|
||||
UserInfo,
|
||||
CmsconnectInfoDialog
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { Factory, messageService } from "@/_base";
|
||||
import ConfirmModal from "./modal-confirm.vue";
|
||||
import { Deferred } from "@/services/Deferred";
|
||||
import { M155Questions } from "src/app_modules/machine";
|
||||
import { processStore, processModelActions } from "@/store/runningProcess.store";
|
||||
import { store } from "@/store";
|
||||
declare let $: any;
|
||||
@@ -57,6 +58,9 @@ export class ModalHelper {
|
||||
isMessage: false
|
||||
};
|
||||
|
||||
public static M155ModalData = {
|
||||
data: null
|
||||
};
|
||||
|
||||
public static MaintenancePasswordData = {
|
||||
maintenance: null,
|
||||
@@ -101,6 +105,37 @@ export class ModalHelper {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
public static ShowNextM155Modal() {
|
||||
ModalHelper.M155ModalData.data = null;
|
||||
for (let i = 0; i < processStore.state.m155messages.length; i++) {
|
||||
if (processStore.state.m155messages[i].toDisplay) {
|
||||
ModalHelper.M155ModalData.data = processStore.state.m155messages[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ModalHelper.M155ModalData.data) {
|
||||
messageService.publishToChannel("show-modal-nc", M155Questions);
|
||||
}
|
||||
else {
|
||||
messageService.publishToChannel("hide-modal-nc", M155Questions);
|
||||
}
|
||||
}
|
||||
|
||||
public static HideThisM155Modal(processId) {
|
||||
processModelActions.hideM155Messsage(store, processId);
|
||||
}
|
||||
|
||||
|
||||
public static ShowM155ModaloOfProcess(proc: number) {
|
||||
if (!ModalHelper.M155ModalData.data) {
|
||||
let find = processStore.state.m155messages.find(X => X.process == proc)
|
||||
if (find) {
|
||||
ModalHelper.M155ModalData.data = find;
|
||||
messageService.publishToChannel("show-modal-nc", M155Questions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static HideModal(modalname: string = "modal") {
|
||||
messageService.publishToChannel("hide-" + modalname);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user