whychdw
2019-10-10 20e9ed291e6ff2eceed90ee41e0a9cb4ccb2a28b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
 * 运维数据
 * 默认模块名: history
 * @return {[object]}  [ 返回一个对象 ]
 */
loader.define({
    data: {
        vm: '',
        loading: '',
    },
    loaded: function(require,exports,module) {
        var bs = bui.store({
            scope: 'page',
            data: {}
        });
        
        // 定义Vue模块
        this.vm = new Vue({
            el: bs.$parent[0],
            data: {
                uiSidebar: '',      // 侧边栏
                devInfos: {         // 设备列表
                    page: {
                        pageSize: 6,
                        pageCurr: 1
                    },
                    title: '设备信息',
                    list: []
                },
            },
            methods: {
                handlerListClick: function(item) {      // 点击设备列表
                    console.log(item);
                    this.uiSidebar.close();
                },
                searchDevice: function() {      // 查询设备信息
                    var self = this;
                    var page = this.devInfos.page;
                    var json = JSON.stringify(page);
                    // 请求后台获取告警
                    ajax({
                        type: 'post',
                        async: true,
                        url: 'BattInfAction!serchDevice',
                        data: 'json='+json,
                        dataType: 'json',
                        success: function(res) {
                            var rs = JSON.parse(res.result);
                            if(rs.code == 1) {
                                var data = rs.data;
                                for(var i=0; i<data.length; i++) {
                                    var _data = data[i];
                                    //console.log(_data);
                                    _data.title = _data.StationName3;
                                }
                                self.devInfos.list = data;
                            }
                        }
                    });
                },
            },
            mounted() {
                // 获取所有设备的信息
                this.searchDevice();
 
                // 侧边栏
                this.uiSidebar = bui.sidebar({
                    id: "#sidebarWrap", //菜单的ID(必须)
                    width: 400,
                    trigger: "#menu",
                    isActive: true,
                });
                // 打开侧边栏
                this.uiSidebar.open();
            },
        });
    },
});