|
|
|
@ -152,7 +152,7 @@
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
alert(error, '警告', function () { })
|
|
|
|
|
alert(error)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -170,7 +170,7 @@
|
|
|
|
|
init();
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
alert(error, '警告', function () { })
|
|
|
|
|
alert(error)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function init() {
|
|
|
|
@ -186,7 +186,7 @@
|
|
|
|
|
},
|
|
|
|
|
server: localStorage.getItem('server'),
|
|
|
|
|
token: localStorage.getItem('token'),
|
|
|
|
|
model: null
|
|
|
|
|
model: data
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
@ -199,40 +199,24 @@
|
|
|
|
|
this.$f7ready((f7) => {
|
|
|
|
|
app = this.$f7;
|
|
|
|
|
});
|
|
|
|
|
this.load();
|
|
|
|
|
connect();
|
|
|
|
|
this.$nextTick(function () {
|
|
|
|
|
UpdateCamera();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
load: function () {
|
|
|
|
|
var url = this.server + '/IoTCenter/App/GetNode';
|
|
|
|
|
var data = new FormData();
|
|
|
|
|
data.append('number', new URI().search(true).number);
|
|
|
|
|
data.append('token', this.token);
|
|
|
|
|
axios.post(url, data)
|
|
|
|
|
.then(function (response) {
|
|
|
|
|
console.log(response);
|
|
|
|
|
var data = response.data;
|
|
|
|
|
vm.model = data;
|
|
|
|
|
Vue.nextTick(function () {
|
|
|
|
|
UpdateCamera();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
app.dialog.alert(error, '警告', function () { })
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
HasDevices(name) {
|
|
|
|
|
return Enumerable
|
|
|
|
|
.from(vm.model.Devices)
|
|
|
|
|
.from(this.model.Devices)
|
|
|
|
|
.any(function (o) { return o.Name === name });
|
|
|
|
|
},
|
|
|
|
|
GetDevices(name) {
|
|
|
|
|
return Enumerable.from(vm.model.Devices)
|
|
|
|
|
return Enumerable.from(this.model.Devices)
|
|
|
|
|
.where(function (o) { return o.Name == name; })
|
|
|
|
|
.toArray();
|
|
|
|
|
},
|
|
|
|
|
GetDataValue(number, name) {
|
|
|
|
|
var device = Enumerable.from(vm.model.Devices)
|
|
|
|
|
var device = Enumerable.from(this.model.Devices)
|
|
|
|
|
.where(function (o) { return o.Number === number; })
|
|
|
|
|
.firstOrDefault();
|
|
|
|
|
if (device != null) {
|
|
|
|
@ -435,13 +419,17 @@
|
|
|
|
|
.withUrl(wsUrl)
|
|
|
|
|
.build();
|
|
|
|
|
function connect() {
|
|
|
|
|
if (debug) { console.log('start connect to server:' + Date()); }
|
|
|
|
|
connection.start().then(function () {
|
|
|
|
|
if (debug) {
|
|
|
|
|
console.log('start connect to server:' + Date());
|
|
|
|
|
}
|
|
|
|
|
if (connection.state === signalR.HubConnectionState.Disconnected) {
|
|
|
|
|
connection.start().then(function () {
|
|
|
|
|
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
console.error(err.toString());
|
|
|
|
|
setTimeout(connect, 15 * 1000);
|
|
|
|
|
});
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
console.error(err.toString());
|
|
|
|
|
setTimeout(connect, 15 * 1000);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
connection.on('Connected', function (id) {
|
|
|
|
|
connectionId = id;
|
|
|
|
@ -458,7 +446,7 @@
|
|
|
|
|
'NodeEntityDeleted' ||
|
|
|
|
|
method == 'DeviceEntityInserted' ||
|
|
|
|
|
method == 'DeviceEntityDeleted') {
|
|
|
|
|
vm.load();
|
|
|
|
|
loadData();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|