41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
(function(){
|
|
|
|
Vue.component('pdo-panel',{
|
|
props: {
|
|
processdata: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
},
|
|
computed: {
|
|
},
|
|
data: function(){
|
|
return {}
|
|
},
|
|
methods: {
|
|
promptNewValue: function(slave, index, subindex, datatype, initialValue){
|
|
console.log(index, subindex, datatype, initialValue);
|
|
let newValue = window.prompt(`new value for ${slave}:${index.toString(16)}.${subindex}`, initialValue);
|
|
console.log(newValue);
|
|
if (newValue)
|
|
{
|
|
this.$emit("write", { Slave: slave, Index: index, SubIndex: subindex, Value: newValue});
|
|
}
|
|
}
|
|
},
|
|
template: `
|
|
<div class="panel">
|
|
<h2>Prozessdaten</h2>
|
|
<article v-for="sdo,key in processdata">
|
|
<div>{{sdo.Descriptor.SlaveId}}:{{sdo.Descriptor.Index.toString(16).toUpperCase()}}.{{sdo.SubIndex}} {{ sdo.Name }} ({{sdo.DataType}})</div>
|
|
<div
|
|
class="value"
|
|
@dblclick="promptNewValue(sdo.Descriptor.SlaveId, sdo.Descriptor.Index, sdo.SubIndex, sdo.DataType, sdo.Value);"
|
|
>{{ sdo.Value }}</div>
|
|
</article>
|
|
</div>
|
|
`,
|
|
});
|
|
|
|
|
|
})(); |