1
|
|
-<template>
|
2
|
|
- <view class="status-page">
|
3
|
|
- <view style="margin-left:15rpx;background-color: #f8f9fa;position:fixed;top:0rpx;z-index: 99999;">
|
4
|
|
- <view style="height:35rpx;background-color: #f8f9fa;"></view>
|
5
|
|
- <view class="u-flex search-top">
|
6
|
|
- <view class="search-main">
|
7
|
|
- <u--input @change="inputChanged" prefixIcon="search" placeholder="请输入组态名称" border="surround"
|
8
|
|
- shape="circle"></u--input>
|
9
|
|
- </view>
|
10
|
|
- </view>
|
11
|
|
- </view>
|
12
|
|
- <view style="height:35rpx"></view>
|
13
|
|
- <!-- 公共组件-每个页面必须引入 -->
|
14
|
|
- <public-module></public-module>
|
15
|
|
- <!-- 自带分页组件 -->
|
16
|
|
- <mescroll-body ref="mescrollRef" :up="upOption" @init="mescrollInit" :down="downOption" @down="downCallback"
|
17
|
|
- @up="upCallback">
|
18
|
|
- <view class="configuation-container">
|
19
|
|
- <view class="configuation-item">
|
20
|
|
- <view @click="openConfigDetail(item.id)" v-for="(item, index) in list" :key="index" class="item">
|
21
|
|
- <image class="image" :src="item.icon || defaultConfigImage"></image>
|
22
|
|
- <text class="name">{{ item.name }}</text>
|
23
|
|
- </view>
|
24
|
|
- </view>
|
25
|
|
- </view>
|
26
|
|
- <mescroll-empty v-if="!list.length" />
|
27
|
|
- </mescroll-body>
|
28
|
|
- <!-- 自带分页组件 -->
|
29
|
|
- <view style="height: 60rpx;"></view>
|
30
|
|
- </view>
|
31
|
|
-</template>
|
32
|
|
-
|
33
|
|
-<script>
|
34
|
|
- import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
|
35
|
|
- import api from '@/api/index.js'
|
36
|
|
-
|
37
|
|
- export default {
|
38
|
|
- mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
|
39
|
|
- data() {
|
40
|
|
- return {
|
41
|
|
- defaultConfigImage: '../../../static/test.png',
|
42
|
|
- page: {
|
43
|
|
- num: 0,
|
44
|
|
- size: 10
|
45
|
|
- },
|
46
|
|
- downOption: {
|
47
|
|
- auto: true //是否在初始化后,自动执行downCallback; 默认true
|
48
|
|
- },
|
49
|
|
- upOption: {
|
50
|
|
- auto: false // 不自动加载
|
51
|
|
- },
|
52
|
|
- list: []
|
53
|
|
- };
|
54
|
|
- },
|
55
|
|
- onLoad() {
|
56
|
|
- // 隐藏原生的tabbar
|
57
|
|
- uni.hideTabBar();
|
58
|
|
- uni.setStorageSync('getConfiguration', {
|
59
|
|
- isConfiguration: false
|
60
|
|
- });
|
61
|
|
- },
|
62
|
|
- onUnload() {
|
63
|
|
- uni.setStorageSync('getConfiguration', {
|
64
|
|
- isConfiguration: false
|
65
|
|
- });
|
66
|
|
- uni.removeStorageSync('getConfiguration');
|
67
|
|
- },
|
68
|
|
- methods: {
|
69
|
|
- inputChanged(e) {
|
70
|
|
- this.page.num = 1;
|
71
|
|
- this.loadData(1, e);
|
72
|
|
- },
|
73
|
|
- openConfigDetail(e) {
|
74
|
|
- uni.navigateTo({
|
75
|
|
- url: 'configurationDetail?configId=' + e
|
76
|
|
- });
|
77
|
|
- },
|
78
|
|
- /*下拉刷新的回调 */
|
79
|
|
- downCallback() {
|
80
|
|
- //联网加载数据
|
81
|
|
- this.page.num = 1;
|
82
|
|
- this.loadData(1);
|
83
|
|
- },
|
84
|
|
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
|
85
|
|
- upCallback() {
|
86
|
|
- //联网加载数据
|
87
|
|
- this.page.num += 1;
|
88
|
|
- this.loadData(this.page.num);
|
89
|
|
- },
|
90
|
|
- async loadData(pageNo, organizationV) {
|
91
|
|
- let httpData = {
|
92
|
|
- page: pageNo,
|
93
|
|
- pageSize: 10,
|
94
|
|
- name: organizationV,
|
95
|
|
- platform: 'phone'
|
96
|
|
- };
|
97
|
|
- const res = await api.homeApi.getConfigurationApi({
|
98
|
|
- params: httpData,
|
99
|
|
- custom: {
|
100
|
|
- load: false
|
101
|
|
- }
|
102
|
|
- })
|
103
|
|
- if (res) {
|
104
|
|
- uni.stopPullDownRefresh();
|
105
|
|
- this.mescroll.endByPage(res.items.length, res.total);
|
106
|
|
- this.cameraTotal = res.total;
|
107
|
|
- if (pageNo == 1) {
|
108
|
|
- this.list = res.items;
|
109
|
|
- } else {
|
110
|
|
- this.list = this.list.concat(res.items);
|
111
|
|
- }
|
112
|
|
- }
|
113
|
|
- }
|
114
|
|
- }
|
115
|
|
- };
|
116
|
|
-</script>
|
117
|
|
-
|
118
|
|
-<style lang="scss" scoped>
|
119
|
|
- @import '../static/configuration.scss';
|
120
|
|
-</style> |
|
1
|
+<template>
|
|
2
|
+ <view class="status-page">
|
|
3
|
+ <view style="margin-left:15rpx;background-color: #f8f9fa;position:fixed;top:0rpx;z-index: 99999;">
|
|
4
|
+ <view style="height:35rpx;background-color: #f8f9fa;"></view>
|
|
5
|
+ <view class="u-flex search-top">
|
|
6
|
+ <view class="search-main">
|
|
7
|
+ <u--input @change="inputChanged" prefixIcon="search" placeholder="请输入组态名称" border="surround"
|
|
8
|
+ shape="circle"></u--input>
|
|
9
|
+ </view>
|
|
10
|
+ </view>
|
|
11
|
+ </view>
|
|
12
|
+ <view style="height:35rpx"></view>
|
|
13
|
+ <!-- 公共组件-每个页面必须引入 -->
|
|
14
|
+ <public-module></public-module>
|
|
15
|
+ <!-- 自带分页组件 -->
|
|
16
|
+ <mescroll-body ref="mescrollRef" :up="upOption" @init="mescrollInit" :down="downOption" @down="downCallback"
|
|
17
|
+ @up="upCallback">
|
|
18
|
+ <view class="configuation-container">
|
|
19
|
+ <view class="configuation-item">
|
|
20
|
+ <view @click="openConfigDetail(item)" v-for="(item, index) in list" :key="index" class="item">
|
|
21
|
+ <image class="image" :src="item.icon || defaultConfigImage"></image>
|
|
22
|
+ <text class="name">{{ item.name }}</text>
|
|
23
|
+ </view>
|
|
24
|
+ </view>
|
|
25
|
+ </view>
|
|
26
|
+ <mescroll-empty v-if="!list.length" />
|
|
27
|
+ </mescroll-body>
|
|
28
|
+ <!-- 自带分页组件 -->
|
|
29
|
+ <view style="height: 60rpx;"></view>
|
|
30
|
+ </view>
|
|
31
|
+</template>
|
|
32
|
+
|
|
33
|
+<script>
|
|
34
|
+ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
|
|
35
|
+ import api from '@/api/index.js'
|
|
36
|
+ import {
|
|
37
|
+ createScadaPageLink
|
|
38
|
+ } from './help';
|
|
39
|
+
|
|
40
|
+ export default {
|
|
41
|
+ mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
|
|
42
|
+ data() {
|
|
43
|
+ return {
|
|
44
|
+ defaultConfigImage: '../../../static/test.png',
|
|
45
|
+ page: {
|
|
46
|
+ num: 0,
|
|
47
|
+ size: 10
|
|
48
|
+ },
|
|
49
|
+ downOption: {
|
|
50
|
+ auto: true //是否在初始化后,自动执行downCallback; 默认true
|
|
51
|
+ },
|
|
52
|
+ upOption: {
|
|
53
|
+ auto: false // 不自动加载
|
|
54
|
+ },
|
|
55
|
+ list: []
|
|
56
|
+ };
|
|
57
|
+ },
|
|
58
|
+ onLoad() {
|
|
59
|
+ // 隐藏原生的tabbar
|
|
60
|
+ uni.hideTabBar();
|
|
61
|
+ uni.setStorageSync('getConfiguration', {
|
|
62
|
+ isConfiguration: false
|
|
63
|
+ });
|
|
64
|
+ },
|
|
65
|
+ onUnload() {
|
|
66
|
+ uni.setStorageSync('getConfiguration', {
|
|
67
|
+ isConfiguration: false
|
|
68
|
+ });
|
|
69
|
+ uni.removeStorageSync('getConfiguration');
|
|
70
|
+ },
|
|
71
|
+ methods: {
|
|
72
|
+ inputChanged(e) {
|
|
73
|
+ this.page.num = 1;
|
|
74
|
+ this.loadData(1, e);
|
|
75
|
+ },
|
|
76
|
+ openConfigDetail(e) {
|
|
77
|
+ const href = createScadaPageLink(e)
|
|
78
|
+ uni.navigateTo({
|
|
79
|
+ url: 'configurationDetail?configurationHref=' + href
|
|
80
|
+ });
|
|
81
|
+ },
|
|
82
|
+ /*下拉刷新的回调 */
|
|
83
|
+ downCallback() {
|
|
84
|
+ //联网加载数据
|
|
85
|
+ this.page.num = 1;
|
|
86
|
+ this.loadData(1);
|
|
87
|
+ },
|
|
88
|
+ /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
|
|
89
|
+ upCallback() {
|
|
90
|
+ //联网加载数据
|
|
91
|
+ this.page.num += 1;
|
|
92
|
+ this.loadData(this.page.num);
|
|
93
|
+ },
|
|
94
|
+ async loadData(pageNo, organizationV) {
|
|
95
|
+ let httpData = {
|
|
96
|
+ page: pageNo,
|
|
97
|
+ pageSize: 10,
|
|
98
|
+ name: organizationV,
|
|
99
|
+ platform: 'phone'
|
|
100
|
+ };
|
|
101
|
+ const res = await api.homeApi.getConfigurationApi({
|
|
102
|
+ params: httpData,
|
|
103
|
+ custom: {
|
|
104
|
+ load: false
|
|
105
|
+ }
|
|
106
|
+ })
|
|
107
|
+ if (res) {
|
|
108
|
+ uni.stopPullDownRefresh();
|
|
109
|
+ this.mescroll.endByPage(res.items.length, res.total);
|
|
110
|
+ this.cameraTotal = res.total;
|
|
111
|
+ if (pageNo == 1) {
|
|
112
|
+ this.list = res.items;
|
|
113
|
+ } else {
|
|
114
|
+ this.list = this.list.concat(res.items);
|
|
115
|
+ }
|
|
116
|
+ }
|
|
117
|
+ }
|
|
118
|
+ }
|
|
119
|
+ };
|
|
120
|
+</script>
|
|
121
|
+
|
|
122
|
+<style lang="scss" scoped>
|
|
123
|
+ @import '../static/configuration.scss';
|
|
124
|
+</style> |
|
|
\ No newline at end of file |
...
|
...
|
|