|
|
@@ -2,41 +2,95 @@
|
|
|
<!--虫情监测列表 -->
|
|
|
<view>
|
|
|
<!-- 搜索框 -->
|
|
|
- <ui-search placeholder="请输入设备ID"></ui-search>
|
|
|
+ <ui-search placeholder="请输入设备ID" @confirm="searchLampList"></ui-search>
|
|
|
<!-- 搜索框end -->
|
|
|
<!-- 监测列表 -->
|
|
|
- <view class="ui-card forecast-item" @click="openDetails()">
|
|
|
- <view class="flex-1 info">
|
|
|
- <view class="font-16 title on">测报灯</view>
|
|
|
- <view class="text">设备ID:87845748629</view>
|
|
|
- <view class="text">最新上报时间:2022-08-31 11:21:01</view>
|
|
|
+ <block v-for="(item,index) in lampList" :key="index">
|
|
|
+ <view class="ui-card forecast-item" @click="openLampDetails(item)">
|
|
|
+ <view class="flex-1 info">
|
|
|
+ <view class="font-16 title" :class="item.is_online?'on':'off'">{{item.device_name}}</view>
|
|
|
+ <view class="text">设备ID:{{item.imei}}</view>
|
|
|
+ <view class="text">最新上报时间:{{ item.uptime | timeFrom}}</view>
|
|
|
+ </view>
|
|
|
+ <ui-state :state="item.is_online"></ui-state>
|
|
|
</view>
|
|
|
- <ui-state state="1"></ui-state>
|
|
|
- </view>
|
|
|
-
|
|
|
+ </block>
|
|
|
<!-- 监测列表end -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ getWormLampList
|
|
|
+ } from '@/api/worm.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
+ // 列表搜索条件
|
|
|
+ params: {
|
|
|
+ device_type_id: 3, //3虫情测报灯 7孢子仪
|
|
|
+ device_id: '', // 搜索项,设备号、设备名称搜索
|
|
|
+ page: 1,
|
|
|
+ page_size: 10,
|
|
|
+ // device_status: // 筛选项 1在线 0离线
|
|
|
+ },
|
|
|
+ total: 0, // 设备总数
|
|
|
+ lampList: [], // 测报灯列表
|
|
|
};
|
|
|
},
|
|
|
- methods:{
|
|
|
+ onLoad() {
|
|
|
+ this.getLampList();
|
|
|
+ },
|
|
|
+ // 触底请求
|
|
|
+ onReachBottom(e) {
|
|
|
+ if (this.lampList.length >= this.total) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.params.page += 1;
|
|
|
+ this.getLampList();
|
|
|
+ },
|
|
|
+ //下拉刷新
|
|
|
+ onPullDownRefresh() {
|
|
|
+ this.refreshLampList();
|
|
|
+ uni.stopPullDownRefresh()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 刷新测试灯列表
|
|
|
+ refreshLampList() {
|
|
|
+ this.params.page = 1;
|
|
|
+ this.lampList = [];
|
|
|
+ this.getLampList();
|
|
|
+ },
|
|
|
+ // 获取测试灯列表
|
|
|
+ async getLampList() {
|
|
|
+ const {
|
|
|
+ ids,
|
|
|
+ nums
|
|
|
+ } = await getWormLampList();
|
|
|
+ this.lampList = [...this.lampList, ...ids];
|
|
|
+ this.total = nums ?? 0;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 测试灯
|
|
|
+ * @param {String} val 搜索内容
|
|
|
+ */
|
|
|
+ searchLampList(val) {
|
|
|
+ this.params.device_id = val;
|
|
|
+ this.refreshLampList();
|
|
|
+ },
|
|
|
// 打开虫情详情列表
|
|
|
- openDetails(){
|
|
|
+ openLampDetails(item) {
|
|
|
+ let params = {
|
|
|
+ equip_name: item.equip_name, //设备名称
|
|
|
+ equip_id: item.equip_id, //设备号
|
|
|
+ address: item.address, //组织地址
|
|
|
+ is_online: item.is_online, //在线状态 0离线 1在线
|
|
|
+ uptime: item.uptime //数据更新时间 秒级时间戳
|
|
|
+ }
|
|
|
uni.navigateTo({
|
|
|
- url:`details?id=`
|
|
|
+ url: `details?params=${JSON.stringify(params)}`
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
-<style lang="scss">
|
|
|
-
|
|
|
-</style>
|