my_enterprise_win.html
14.7 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>我的单位_win</title>
<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
<link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
<link rel="stylesheet" type="text/css" href="../../css/home.css"/>
<link rel="stylesheet" type="text/css" href="../../css/element.css"/>
<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
<style>
html,
body{
background: #F4F6F9;
height: 100%;
width: 100%;
}
.el-collapse-item__wrap{
height: auto;
}
/* .collapse-top{
margin-right: 15px;
} */
.panel-bg {
margin-right: 0px;
margin-left: 0px;
margin-top: 0px;
border-radius:0px;
}
.el-collapse-item__content{
padding-bottom:5px;
}
.collapse-item-top {
margin-top: 10px;
}
.group-panel {
margin-top: 0.1rem;
margin-left: 15px;
margin-right: 15px;
margin-bottom: 0.1rem;
height: auto;
}
</style>
<style scoped>
.el-collapse-item__arrow.is-active {
transform: rotate(90deg);
font-size: 20px;
}
.el-collapse-item__arrow, .el-tabs__nav {
transform: rotate(0deg);
border: none;
box-shadow:0px 0px 0px 0px #FFFFFF;
}
/* .el-collapse-item__arrow1, .el-tabs__nav1 {
transform: rotate(0deg);
font-size: 0px;
} */
</style>
</head>
<body>
<div id="root">
<template>
<!-- <children-item v-for="item in groupList" :key="item.id" :todo="item"></children-item> -->
<div v-if="groupList.length >= 0">
<div v-for="(info1,i1) in groupList"><!-- 第一层列表 -->
<el-collapse >
<el-collapse-item v-if="info1.hasChildren" class="store01001-operate-info-panel collapse-item-top el-collapse-item__arrow1"><!-- 有子节点的第一层下拉列表 -->
<template slot="title">
<span class="group-list-panel-title" style="padding-left: .9375rem;">{{ info1.name | projectNameFilter }}</span>
</template>
<!-- start 上一层的item中写入这一层的list -->
<div class="store01001-operate-info-pan el panel-bg" v-for="(info2, i2) in info1.children"> <!-- 第二层列表 -->
<el-collapse v-model="info2.id" @change="changeCollapse">
<el-collapse-item v-if="info2.hasChildren" > <!-- 有子节点的第二层下拉列表 -->
<template slot="title">
<div style="margin-left: .9375rem;">
<img v-if="info2.openList" src="../../image/icon-arrow-view.png" style="height: 14px;float: left;margin-top: 17px;" /><!-- ../../image/icon-arrow-view.png -->
<img v-if="!info2.openList" src="../../image/icon-arrow-hidden.png" style="height: 14px;float: left;margin-top: 17px;" /><!-- ../../image/icon-arrow-view.png -->
<span class="group-list-panel-title" > {{ info2.name }}</span>
<!-- <el-row>
<el-col :span=3>
</el-col>
<el-col :span=21>
</el-col>
</el-row> -->
</div>
</template>
<div class="store01001-operate-info-panel panel-bg" v-for="(info3, i3) in info2.children"> <!-- 第三层列表 -->
<el-collapse>
<el-collapse-item v-if="info3.hasChildren"> <!-- 有子节点的第三层下拉列表 -->
<template slot="title">
<span class="group-list-panel-title" style="padding-left: .9375rem;">{{ info3.name }}</span>
</template>
</el-collapse-item>
<div class="group-panel" v-else>
<div class="group-list-panel" tapmode @click="chooseToHandle(info3)">
<div class="group-list-inside-panel">
<el-row>
<el-col :span=12>
<span class="group-list-panel-title">{{ info3.name }}</span>
</el-col>
<el-col :span=11>
<div class="group-list-panel-subtitle">{{ info3.count }}个设备</div>
</el-col>
<el-col :span=1>
<i class="aui-iconfont aui-icon-right"></i>
</el-col>
</el-row>
<div class="group-list-line"></div>
<el-row style="padding-bottom: 10px;">
<el-col :span=1>
<img src="../../image/icon_badgeDot_green.png" style="height: 6px;" />
</el-col>
<el-col :span=6><span class="group-normal-span">在线: {{ info3.online_count }}</span></el-col>
<el-col :span=2> </el-col>
<el-col :span=1>
<img src="../../image/icon_badgeDot_red.png" style="height: 6px;" />
</el-col>
<el-col :span=6><span class="group-normal-span">离线: {{ info3.count - info3.online_count }}</span></el-col>
</el-row>
</div>
</div>
</div>
</el-collapse>
</div>
</el-collapse-item>
<div class="group-panel" v-else>
<div class="group-list-panel" tapmode @click="chooseToHandle(info2)">
<div class="group-list-inside-panel">
<el-row>
<el-col :span=12>
<span class="group-list-panel-title">{{ info2.name }}</span>
</el-col>
<el-col :span=11>
<div class="group-list-panel-subtitle">{{ info2.count }}个设备</div>
</el-col>
<el-col :span=1>
<i class="aui-iconfont aui-icon-right"></i>
</el-col>
</el-row>
<div class="group-list-line"></div>
<el-row style="padding-bottom: 10px;">
<el-col :span=1>
<img src="../../image/icon_badgeDot_green.png" style="height: 6px;" />
</el-col>
<el-col :span=6><span class="group-normal-span">在线: {{ info2.online_count }}</span></el-col>
<el-col :span=2> </el-col>
<el-col :span=1>
<img src="../../image/icon_badgeDot_red.png" style="height: 6px;" />
</el-col>
<el-col :span=6><span class="group-normal-span">离线: {{ info2.count - info2.online_count }}</span></el-col>
</el-row>
</div>
</div>
</div>
</el-collapse>
</div>
<!-- end -->
</el-collapse-item>
<div class="group-panel" v-else>
<div class="group-list-panel" tapmode @click="chooseToHandle(info1)">
<div class="group-list-inside-panel">
<el-row>
<el-col :span=12>
<span class="group-list-panel-title">{{ info1.name }}</span>
</el-col>
<el-col :span=11>
<div class="group-list-panel-subtitle">{{ info1.count }}个设备</div>
</el-col>
<el-col :span=1>
<i class="aui-iconfont aui-icon-right"></i>
</el-col>
</el-row>
<div class="group-list-line"></div>
<el-row style="padding-bottom: 10px;">
<el-col :span=1>
<img src="../../image/icon_badgeDot_green.png" style="height: 6px;" />
</el-col>
<el-col :span=6><span class="group-normal-span">在线: {{ info1.online_count }}</span></el-col>
<el-col :span=2> </el-col>
<el-col :span=1>
<img src="../../image/icon_badgeDot_red.png" style="height: 6px;" />
</el-col>
<el-col :span=6><span class="group-normal-span">离线: {{ info1.count - info1.online_count }}</span></el-col>
</el-row>
</div>
</div>
</div>
<div style="height: 10px;"></div>
</el-collapse>
</div>
</div>
<div v-if="groupList.length === 0">
<div class="no-list-data" style="top: 2rem;bottom: 13rem;">
<img src="../../image/img-unit-null.png" />
</div>
</div>
</template>
</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/element.js"></script>
<script type="text/javascript" src="../../script/ctrl.js"></script>
<script type="text/javascript" src="../../script/fastclick.js "></script>
<script type="text/javascript">
var vm,
that;
apiready = function(){
$(function() {
FastClick.attach(document.body);
});
vm = new Vue({
el: '#root',
data: {
userId: api.getPrefs({sync: true,key: 'userID'}),
token: api.getPrefs({sync: true,key: 'userToken'}),
userType: Number(api.getPrefs({sync: true,key: 'userType'})),
groupList: [],
queryParam: {
limit: 10,
page: 1,
userId: api.getPrefs({sync: true,key: 'userID'}),
parentId: 9999,
},
hasNext: true,
},
created() {
that = this
api.setRefreshHeaderInfo({
bgColor: '#F4F6F9',
textColor: 'rgba(55,57,78,1)',
textDown: '下拉刷新单位项目列表...',
textUp: '松开刷新...'
}, function(ret, err) {
that.initenterPriseGroups(true)//false:上拉加载 true:重新加载
});
api.addEventListener({
name:'scrolltobottom',
extra:{
threshold:0 //设置距离底部多少距离时触发,默认值为0,数字类型
}
}, function(ret, err){
that.initenterPriseGroups(false)
});
this.initenterPriseGroups(true)
},
filters: {
projectNameFilter(v) {
if (v.length > 10) {
return v.substring(0,15) + '...'
}
}
},
methods: {
async initenterPriseGroups(reflush) {
if (reflush) {//重新加载 清除查询条件
this.queryParam.page = 1
this.groupList = []
this.hasNext = true
}else {//下拉加载 page+1
if (this.hasNext) {
this.queryParam.page += 1
}else {
api.toast({msg: '暂无更多数据!',duration: 2000,location: 'bottom'});
return;
}
}
let dataRes = await get_enterprise_tree_single_node(this.queryParam, this.token)
if (dataRes.code === 0) {
let handleList = dataRes.data.list.rows
if (handleList.length > 0) {
handleList.forEach(list1 => {
if (list1.hasChildren) {
list1.children.forEach(list2 => {
if (list2.hasChildren) {
list2.openList = false
}
});
}
this.groupList.push(list1)
});
}
this.hasNext = dataRes.data.next
}
api.refreshHeaderLoadDone();
},
changeCollapse(val) {
this.groupList.forEach(list1 => {
if (list1.hasChildren) {
list1.children.forEach(list2 => {
if (typeof list2.id === 'object') {
if ( list2.hasChildren && list2.id[0] === val[0]) {
if (val.length === 1) { //折叠闭合,不进行操作
list2.id = val[0]
list2.openList = false
}else {
list2.openList = true
}
}
}
});
}
});
},
chooseToHandle(info) {
if (info.count > 0) {
api.openWin({
name: 'enterprise_detail_win',
url: './enterprise_detail_win.html',
bounces: false,
animation: {
type:"movein", //动画类型(详见动画类型常量)
subType:"from_right", //动画子类型(详见动画子类型常量)
duration:300 //动画过渡时间,默认300毫秒
},
pageParam: {groupInfo : info}
});
}else {
api.toast({msg: '暂无更多数据!',duration: 2000,location: 'bottom'});
}
}
}
})
};
</script>
</html>