Webservice auf neue Logik umgebaut
This commit is contained in:
parent
0c84fb7b6d
commit
fac7665f8f
@ -1,11 +1,13 @@
|
|||||||
import { BaseModel } from "@/modules/shared/models/Basemodel";
|
import { BaseModel } from "@/modules/shared/models/Basemodel";
|
||||||
|
import { View } from "./View";
|
||||||
|
|
||||||
export class Process extends BaseModel {
|
export class Process extends BaseModel {
|
||||||
constructor({ id, name, description } = {}) {
|
constructor({ id, name, description, views = [] } = {}) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
this.views = views.map((view) => new View(view));
|
||||||
this.topic = "system_process";
|
this.topic = "system_process";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
22
src/modules/process/models/process/View.js
Normal file
22
src/modules/process/models/process/View.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { BaseModel } from "@/modules/shared/models/Basemodel";
|
||||||
|
|
||||||
|
export class View extends BaseModel {
|
||||||
|
constructor({ id, name, layout } = {}) {
|
||||||
|
super();
|
||||||
|
this.id = id ?? null;
|
||||||
|
this.name = name ?? "";
|
||||||
|
this.layout = layout ?? {}; // Layout-JSON oder ähnliche Struktur
|
||||||
|
this.topic = "system_processView";
|
||||||
|
}
|
||||||
|
|
||||||
|
getPublicFields() {
|
||||||
|
return ["id", "name", "layout"];
|
||||||
|
}
|
||||||
|
|
||||||
|
toJSON() {
|
||||||
|
return this.getPublicFields().reduce((obj, key) => {
|
||||||
|
obj[key] = this[key];
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,7 +9,7 @@
|
|||||||
v-model="processObject.description"
|
v-model="processObject.description"
|
||||||
></textarea>
|
></textarea>
|
||||||
<ProcessTableComponent
|
<ProcessTableComponent
|
||||||
:viewProp="objectData"
|
:viewProp="processObject.views"
|
||||||
:tableTitleProp="'Ansichten'"
|
:tableTitleProp="'Ansichten'"
|
||||||
></ProcessTableComponent>
|
></ProcessTableComponent>
|
||||||
<ProcessTableComponent
|
<ProcessTableComponent
|
||||||
@ -21,8 +21,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ProcessTableComponent from "@/modules/process/components/process/ProcessTableComponent.vue";
|
import ProcessTableComponent from "@/modules/process/components/process/ProcessTableComponent.vue";
|
||||||
import { getObject } from "@/utils/getObject.js";
|
import socketService from "@/modules/shared/services/WebSocketService";
|
||||||
//import { getSpecificObject } from "@/utils/getSpecificObject";
|
import { View } from "@/modules/process/models/process/View";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ProcessOverviewComponent",
|
name: "ProcessOverviewComponent",
|
||||||
// Verwendete Komponenten
|
// Verwendete Komponenten
|
||||||
@ -45,7 +46,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
processObject: {},
|
processObject: {},
|
||||||
objectData: {},
|
objectData: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -59,17 +60,27 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.processObject = { ...this.object };
|
this.processObject = { ...this.object };
|
||||||
console.log(this.processObject);
|
console.log(this.processObject);
|
||||||
this.wsHandler = getObject(
|
socketService.subscribe(
|
||||||
|
"system_processView",
|
||||||
|
"_id",
|
||||||
|
{ "processLink.transientValue": this.processObject.id },
|
||||||
|
(val) => {
|
||||||
|
val.forEach((element) => {
|
||||||
|
let curView = new View({ id: element }).makeReactive();
|
||||||
|
curView.subscribe(["name"]);
|
||||||
|
this.processObject.views.push(curView);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
/*this.wsHandler = getObject(
|
||||||
"system_processView",
|
"system_processView",
|
||||||
["name", "description"],
|
["name", "description"],
|
||||||
(id, updated) => {
|
(id, updated) => {
|
||||||
this.objectData = { ...this.objectData, [id]: updated };
|
this.objectData = { ...this.objectData, [id]: updated };
|
||||||
}
|
}
|
||||||
);
|
);*/
|
||||||
},
|
|
||||||
beforeUnmount() {
|
|
||||||
this.specificObjectHandler?.unsubscribe();
|
|
||||||
},
|
},
|
||||||
|
beforeUnmount() {},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,9 @@ export default {
|
|||||||
);*/
|
);*/
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeUnmount() {},
|
beforeUnmount() {
|
||||||
|
console.log(this.objectData);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user