signalr processo..
This commit is contained in:
@@ -21,7 +21,9 @@ export default class Processo extends Vue {
|
||||
@Prop({ default: 145 })
|
||||
tot: number;
|
||||
|
||||
blocks: server.Modblock[] = [];
|
||||
get blocks(): server.Modblock[] {
|
||||
return store.state.modules.blocks;
|
||||
}
|
||||
|
||||
zoomFactor: number = 1;
|
||||
|
||||
@@ -38,16 +40,11 @@ export default class Processo extends Vue {
|
||||
showAllBlocks: boolean = false;
|
||||
|
||||
async mounted() {
|
||||
let result = await moduleService.GetCurrent();
|
||||
|
||||
let c = await CONFIGURATION;
|
||||
this.showAllBlocks = c.allUIVisible;
|
||||
|
||||
for (const key in result) {
|
||||
if (result.hasOwnProperty(key)) {
|
||||
this.blocks.push(result[key]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import Vue from "vue";
|
||||
import { AlarmsModelActionsInterface } from "../store/alarms.store"
|
||||
import iziToast, { IziToastSettings } from "izitoast";
|
||||
|
||||
import { store, alarmsModelActions, machineStatusActions, machineInfoActions, AppModel, appModelActions } from "@/store";
|
||||
import { store, alarmsModelActions, machineStatusActions, machineInfoActions, AppModel, appModelActions, modulesActions } from "@/store";
|
||||
import { Factory, messageService } from "@/_base";
|
||||
import { signalr_alarms } from "@/@types/signalr.alarms";
|
||||
import { AuthToken } from "@/_base/baseRestService";
|
||||
@@ -104,7 +104,7 @@ export class Hub {
|
||||
this._hub.client.recipeFullData = Hub.recipeFullData;
|
||||
this._hub.client.recipeOverData = Hub.recipeOverData;
|
||||
this._hub.client.prodInfoData = Hub.prodData;
|
||||
// this._hub.client.modulesData = Hub.modulesData;
|
||||
this._hub.client.modulesData = Hub.modulesData;
|
||||
// this._hub.client.warmersData = Hub.warmersData;
|
||||
this._hub.client.gaugeData = Hub.gaugeData;
|
||||
|
||||
@@ -148,17 +148,19 @@ export class Hub {
|
||||
|
||||
}
|
||||
|
||||
public static modulesData(data) {
|
||||
modulesActions.set(store, data);
|
||||
}
|
||||
|
||||
public static recipeFullData(data) {
|
||||
recipeActions.setCurrent(store, data);
|
||||
}
|
||||
|
||||
public static recipeOverData(data) {
|
||||
console.log('recipeOverData', data)
|
||||
recipeActions.setOverview(store, data);
|
||||
}
|
||||
|
||||
public static prodData(data) {
|
||||
console.log('prodData', data)
|
||||
prodActions.setProd(store, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import { recipeStore, RecipeStoreModel } from "./recipe.store";
|
||||
import { prodStore, ProdStoreModel } from "./prod.store";
|
||||
import { usersStore, UsersStoreModel } from "./users.store";
|
||||
import { warmersStore, WarmersStoreModel } from "./warmers.store";
|
||||
import { modulesStore, ModulesStoreModel } from "./modules.store";
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
@@ -48,6 +49,7 @@ export interface AppModel {
|
||||
prod: ProdStoreModel;
|
||||
users: UsersStoreModel;
|
||||
warmers: WarmersStoreModel;
|
||||
modules: ModulesStoreModel;
|
||||
}
|
||||
|
||||
// Mutations Name
|
||||
@@ -98,6 +100,7 @@ const _store = {
|
||||
prod: prodStore,
|
||||
users: usersStore,
|
||||
warmers: warmersStore,
|
||||
modules: modulesStore
|
||||
},
|
||||
|
||||
mutations: {
|
||||
|
||||
@@ -8,6 +8,7 @@ import { LocalizationModel, languageModel, localizationModelActions } from "./lo
|
||||
import { jobEditorStoreActions } from "./jobEditor.store";
|
||||
import { UsersStoreModel, UsersActions } from "./users.store";
|
||||
import { WarmersStoreModel, warmersActions } from "./warmers.store";
|
||||
import { ModulesStoreModel, modulesActions } from "./modules.store";
|
||||
|
||||
export {
|
||||
store,
|
||||
@@ -28,6 +29,7 @@ export {
|
||||
localizationModelActions,
|
||||
AlarmModel,
|
||||
buttonStatus,
|
||||
ModulesStoreModel, modulesActions,
|
||||
jobEditorStoreActions,
|
||||
UsersActions,
|
||||
UsersStoreModel,
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import Vue from "vue";
|
||||
import { CONFIGURATION } from "@/config";
|
||||
|
||||
export interface ModulesStoreModel {
|
||||
blocks: server.Modblock[];
|
||||
}
|
||||
|
||||
|
||||
export interface ModulesActions {
|
||||
set(context, model: { [id: string]: server.Modblock });
|
||||
}
|
||||
|
||||
export interface ModulesGetters {
|
||||
}
|
||||
|
||||
export const modulesStore = {
|
||||
|
||||
state: {
|
||||
blocks: [],
|
||||
} as ModulesStoreModel,
|
||||
|
||||
getters: {
|
||||
},
|
||||
|
||||
mutations: {
|
||||
|
||||
SetCurrent(state: ModulesStoreModel, model: { [id: string]: server.Modblock }) {
|
||||
for (const key in model) {
|
||||
let result = state.blocks.find(i => i.id.toString() == key.toString())
|
||||
if (result)
|
||||
Object.assign(result, model[key])
|
||||
else
|
||||
state.blocks.push(model[key]);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
||||
async set(context, model: { [id: string]: server.Modblock }) {
|
||||
context.commit("SetCurrent", model);
|
||||
},
|
||||
|
||||
} as ModulesActions
|
||||
|
||||
}
|
||||
|
||||
export const modulesActions = modulesStore.actions as ModulesActions;
|
||||
Reference in New Issue
Block a user