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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
| /**
| * 电池告警信息模块
| * 默认模块名: device
| * @return {[object]} [ 返回一个对象 ]
| */
| loader.define({
| data: {
| vm: ''
| },
| loaded: function(require, exported,module) {
| var bs = bui.store({
| scope: 'page',
| data: {}
| });
| // 定义Vue模块
| this.vm = new Vue({
| el: bs.$el[0],
| data: {
| devices: {
| page: {
| pageSize: 6,
| pageCurr: 1
| },
| pageBtn: {
| pre: true,
| next: false,
| },
| columns: [
| {
| title: '系统',
| minWidth: 140,
| align: 'center',
| key: 'num'
| },
| {
| title: '电池组',
| minWidth: 120,
| align: 'center',
| key: 'battGroupName'
| },
| {
| title: '告警名称',
| minWidth: 240,
| align: 'center',
| key: 'note'
| },
| {
| title: '单体编号',
| minWidth: 90,
| align: 'center',
| key: 'MonNum',
| },
| {
| title: '告警开始时间',
| minWidth: 240,
| align: 'center',
| key: 'alm_start_time'
| },
| {
| title: '告警等级',
| key: 'alm_level',
| minWidth: 120
| }
| ],
| data: []
| }
| },
| methods: {
| searchDevices: function() {
| var self = this;
| var page = this.devices.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;
| console.log(data);
| // 设置不可点击
| if(data.length<6) {
| self.devices.pageBtn.next = true;
| }
| //self.hisTbl.data = data;
| }
| }
| });
| },
| next: function() {
| this.devices.page.pageCurr++;
| this.devices.pageBtn.pre = false;
| this.searchDevices();
| },
| pre: function() {
| this.devices.page.pageCurr--;
| this.devices.pageBtn.next = false;
| this.searchDevices();
| if(this.devices.page.pageCurr == 1) {
| this.devices.pageBtn.pre = true;
| }
| }
| },
| mounted() {
| // 查询设备信息
| this.searchDevices();
| },
| });
| },
| destroyed() {
| // 销毁vue实例
| this.vm.$destroy();
| },
| });
|
|