You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
var app = new Vue({
|
|
el: '#app',
|
|
data() {
|
|
return {
|
|
title: "产品",
|
|
url: config.baseUrl + '/Home/IndexData',
|
|
gateway: null,
|
|
events: ['IoTDeviceEntityInserted', 'IoTDeviceEntityUpdated', 'IoTDeviceEntityDeleted']
|
|
};
|
|
},
|
|
mounted: function () {
|
|
app = this;
|
|
this.subscribe();
|
|
this.load();
|
|
},
|
|
beforeDestroy: function () {
|
|
PubSub.unsubscribes(this.events);
|
|
},
|
|
methods: {
|
|
subscribe: function () {
|
|
PubSub.subscribes(this.events, function (method, data) {
|
|
app.load();
|
|
});
|
|
},
|
|
load: function () {
|
|
axios.post(this.url).then(function (response) {
|
|
app.gateway = response.data;
|
|
});
|
|
},
|
|
upload: function () {
|
|
$.get(config.baseUrl + 'Home/Upload', function () {
|
|
alert('操作完成');
|
|
app.load();
|
|
});
|
|
},
|
|
remove: function (gateway, number) {
|
|
if (confirm('确认操作编号为:' + 'number' + '的设备吗?')) {
|
|
$.get(config.baseUrl + '/Gateway/X95")' + '?gateway=' + gateway + '&number=' + number, function () {
|
|
app.load();
|
|
});
|
|
};
|
|
}
|
|
}
|
|
}); |