123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- var _this;
- var nowTime, nowEnna;
- new Vue({
- el: '#app',
- data: function() {
- return {
- queryParem: {
- devID: "",
- endTime: "",
- beginTime: "",
- type: null,
- pageNum: 1,
- pageSize: 12
- },
- onlineData: [],
- allTotal: 0,
- setupForm: {
- insertInterval: 0,
- cheakInterval: 0
- },
- setupRules: {
- insertInterval: [{
- required: true,
- message: '请输入接收间隔',
- trigger: 'blur'
- }],
- cheakInterval: [{
- required: true,
- message: '请输入检测间隔',
- trigger: 'change'
- }],
- },
- dialogVisible: false,
- typeOption: [{
- value: '1',
- label: '心跳'
- }, {
- value: '2',
- label: '掉线'
- }, {
- value: '3',
- label: '重连'
- }]
- }
- },
- created() {
- _this = this;
- nowTime = parseTime(new Date(), '{y}-{m}-{d}');
- nowEnna = JSON.parse(localStorage.getItem("nowShip"));
- _this.queryParem.endTime = nowTime;
- _this.queryParem.beginTime = nowTime;
- _this.getList();
- },
- mounted() {
- window.addEventListener('message', (data) => {
- nowEnna = JSON.parse(localStorage.getItem("nowShip"));
- _this.queryParem.pageNum = 1;
- _this.getList();
- })
- },
- methods: {
- getList() {
- if(nowEnna !=null && nowEnna != "null"&&nowEnna.en_name != ""&&nowEnna.en_name != null){
- const loading = this.$loading({
- background: 'rgba(0, 0, 0, 0.4)'
- })
- setTimeout(()=>{
- _this.queryParem.devID = nowEnna.en_name;
- let _data = _this.queryParem;
- getHeartbeat(_this.queryParem).then((_res)=>{
- _this.allTotal = _res.total;
- _this.onlineData = _res.rows;
- loading.close()
- })
- },200)
- }else{
- _this.allTotal = 0;
- _this.onlineData = [];
- }
- },
- getHBInfo(){
- _this.setupForm = {};
- getHeartbeatInfo().then((res) => {
- if(res.code == 200){
- _this.setupForm = res.data;
- _this.dialogVisible = true;
- }
- })
- },
- handleCurrentChange(val){
- if(val != _this.queryParem.pageNum){
- _this.queryParem.pageNum = val;
- _this.getList();
- }
- },
- searchQuery(){
- if(_this.queryParem.beginTime.length){
- _this.queryParem.endTime = _this.queryParem.beginTime;
- _this.queryParem.pageNum = 1;
- _this.getList();
- }
- },
- resetQuery(){
- _this.queryParem.endTime = nowTime;
- _this.queryParem.beginTime = nowTime;
- _this.queryParem.type = null;
- _this.queryParem.pageNum = 1;
- _this.getList();
- },
- changeType(val){
- _this.queryParem.pageNum = 1;
- _this.getList();
- },
- updateHBInfo(){
- updateHeartbeatInfo(_this.setupForm).then((res) => {
- if(res.code == 200){
- _this.$message({
- showClose: true,
- message: '更新成功!!!',
- type: 'success'
- });
- _this.dialogVisible = false;
- }
- })
- }
- }
- })
|