|
@@ -1,5 +1,8 @@
|
|
|
<template>
|
|
|
<u-navbar :titleStyle="{ color: '#000' }" :autoBack="true" :title="`${params.productName}(${total})`" :placeholder="true" :safeAreaInsetTop="true" bgColor="#fff">
|
|
|
+ <template #center>
|
|
|
+ <view class="u-navbar__content__title" style="text-align: center; font-size: 16px" @click="popup.show = true"> {{ params.productName }}({{ total }}) </view>
|
|
|
+ </template>
|
|
|
<template #left>
|
|
|
<view class="u-navbar__content__left__item">
|
|
|
<u-icon name="arrow-left" size="20" color="#000"></u-icon>
|
|
@@ -39,7 +42,7 @@
|
|
|
|
|
|
<oa-dropdown :dropdownShow="dropdownShow" :closeOnClickOverlay="true" @close="dropdownShow = false">
|
|
|
<template #content>
|
|
|
- <u-radio-group v-model="radio.value" placement="column" iconPlacement="right" @change="radioChange">
|
|
|
+ <u-radio-group v-model="state.params.deviceStatus" placement="column" iconPlacement="right" @change="radioChange">
|
|
|
<u-radio v-for="item in radio.list" :key="item" :activeColor="proxy.$settingStore.themeColor.color" :label="item.label" :name="item.value"></u-radio>
|
|
|
</u-radio-group>
|
|
|
</template>
|
|
@@ -48,17 +51,32 @@
|
|
|
<view class="menu-list m0">
|
|
|
<view class="list-cell list-cell-arrow" v-for="(base, index) in dataList" :key="index" @click="handleToDevice(base)">
|
|
|
<view class="menu-item">
|
|
|
- <image class="image-bg" style="width: 80rpx; height: 80rpx; margin: auto 10px auto 0" src="@/static/images/device/1.png"></image>
|
|
|
+ <image class="image-bg" style="width: 80rpx; height: 80rpx; margin: auto 20px auto 0" :src="commonStore.deviceManageData.typeImg"></image>
|
|
|
|
|
|
- <view style="width: calc(100% - 51px); display: flex; flex-flow: row wrap; padding-right: 10px">
|
|
|
- <view class="deviceHeader">
|
|
|
- <view class="deviceName text-ellipsis">设备编号:{{ base.deviceId }}</view>
|
|
|
- <view class="deviceStatus" v-if="base.deviceStatus == 1" style="background-color: #16bf00"> 在线 </view>
|
|
|
- <view class="deviceStatus" v-if="base.deviceStatus == 2" style="background-color: red"> 离线 </view>
|
|
|
+ <view class="device-area">
|
|
|
+ <view class="device-area-header">
|
|
|
+ <view class="title text-ellipsis">{{ base.deviceName || "-" }}</view>
|
|
|
+ <!-- <view class="status" v-if="base.deviceStatus == 1" style="background-color: #16bf00"> 在线 </view>
|
|
|
+ <view class="status" v-if="base.deviceStatus == 2" style="background-color: red"> 离线 </view> -->
|
|
|
+ </view>
|
|
|
+ <view class="device-area-content">
|
|
|
+ <span class="title">编号:</span>
|
|
|
+ <span style="color: #a0cfff">{{ base.deviceId }}</span>
|
|
|
+ </view>
|
|
|
+ <view class="device-area-content">
|
|
|
+ <span class="title">状态:</span>
|
|
|
+ <span class="value" :style="{ color: base.deviceStatus == 1 ? '#16bf00' : 'red' }"> {{ base.deviceStatus == 1 ? "在线" : "离线" }}</span>
|
|
|
+ <span class="title ml10">位置:</span>
|
|
|
+ <span class="value" style="color: #a0cfff">
|
|
|
+ {{ base.installAddress || "-" }}
|
|
|
+ </span>
|
|
|
+ <!-- <span class="title ml10">激活状态:</span>
|
|
|
+ <span class="value" :style="{ color: base.serviceStatus == 1 ? '#f29100' : base.serviceStatus == 2 ? '#16bf00' : 'red' }">
|
|
|
+ {{ base.serviceStatus == 1 ? "未激活" : base.serviceStatus == 2 ? "已激活" : "禁用" }}
|
|
|
+ </span> -->
|
|
|
</view>
|
|
|
- <view class="deviceContent">设备名称:{{ base.deviceName }}</view>
|
|
|
- <view class="deviceContent">安装位置:{{ base.installAddress }}</view>
|
|
|
- <!-- <view class="deviceContent">激活状态:{{ base.serviceStatus == 1 ? "未激活" : base.serviceStatus == 2 ? "已激活" : "禁用" }}</view> -->
|
|
|
+
|
|
|
+ <!-- <view class="deviceContent">安装位置:{{ base.installAddress }}</view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -66,6 +84,45 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
</oa-scroll>
|
|
|
+
|
|
|
+ <u-popup :show="popup.show" mode="top" @close="popup.show = false" @open="popupOpen">
|
|
|
+ <u-navbar :titleStyle="{ color: '#000' }" :autoBack="true" :title="`${params.productName}(${total})`" :placeholder="true" :safeAreaInsetTop="true" bgColor="#fff">
|
|
|
+ <template #left>
|
|
|
+ <view class="u-navbar__content__left__item">
|
|
|
+ <u-icon name="arrow-left" size="20" color="#000"></u-icon>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </u-navbar>
|
|
|
+ <view>
|
|
|
+ <oa-scroll
|
|
|
+ customClass="bg-white scroll-height"
|
|
|
+ :pageSize="state1.pageSize"
|
|
|
+ :total="state1.total"
|
|
|
+ :isSticky="false"
|
|
|
+ :refresherLoad="true"
|
|
|
+ :refresherLoadTitle="true"
|
|
|
+ :refresherEnabled="true"
|
|
|
+ :refresherDefaultStyle="'none'"
|
|
|
+ :refresherThreshold="44"
|
|
|
+ :refresherBackground="'#f5f6f7'"
|
|
|
+ @load="load('state1')"
|
|
|
+ @refresh="refresh('state1')"
|
|
|
+ :data-theme="'theme-' + proxy.$settingStore.themeColor.type"
|
|
|
+ style="height: calc(-44px + 40vh)"
|
|
|
+ >
|
|
|
+ <template #default>
|
|
|
+ <view class="deviceManage" style="border-top: 1px solid rgba(0, 0, 0, 0.1)">
|
|
|
+ <u-grid :border="true">
|
|
|
+ <u-grid-item v-for="(item, index) in state1.dataList" :key="index" @click="handleToProduct(item)">
|
|
|
+ <image class="mb15 mt35" style="width: 40px; height: 40px" :src="item.typeImg" mode="aspectFill"></image>
|
|
|
+ <view class="mb15 text-ellipsis" style="width: 100%; text-align: center">{{ item.productName }}</view>
|
|
|
+ </u-grid-item>
|
|
|
+ </u-grid>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </oa-scroll>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
@@ -73,7 +130,7 @@
|
|
|
import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
|
|
|
import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
|
|
|
/*----------------------------------接口引入-----------------------------------*/
|
|
|
-import { dmpDeviceInfo } from "@/api/business/fireIot/deviceManage.js";
|
|
|
+import { dmpProductInfo, dmpDeviceInfo } from "@/api/business/fireIot/deviceManage.js";
|
|
|
/*----------------------------------组件引入-----------------------------------*/
|
|
|
/*----------------------------------store引入-----------------------------------*/
|
|
|
import { useStores, commonStores } from "@/store/modules/index";
|
|
@@ -89,6 +146,7 @@ const state = reactive({
|
|
|
deviceName: "",
|
|
|
productId: "",
|
|
|
productName: "",
|
|
|
+ deviceStatus: undefined,
|
|
|
size: 20,
|
|
|
current: 1,
|
|
|
},
|
|
@@ -98,12 +156,22 @@ const state = reactive({
|
|
|
{ label: "在线", value: "1" },
|
|
|
{ label: "离线", value: "2" },
|
|
|
],
|
|
|
- value: "1",
|
|
|
},
|
|
|
dropdownShow: false,
|
|
|
+
|
|
|
+ popup: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
});
|
|
|
|
|
|
-const { dataList, total, params, radio, dropdownShow } = toRefs(state);
|
|
|
+const { dataList, total, params, radio, dropdownShow, popup } = toRefs(state);
|
|
|
+
|
|
|
+const state1 = reactive({
|
|
|
+ dataList: [],
|
|
|
+ pageSize: 21,
|
|
|
+ current: 1,
|
|
|
+ total: 0,
|
|
|
+});
|
|
|
|
|
|
/**
|
|
|
* @页面初始化
|
|
@@ -132,16 +200,57 @@ function dmpDeviceInfoApi() {
|
|
|
function handleToDevice(event) {
|
|
|
proxy.$tab.navigateTo(`/pages/business/fireIot/deviceManage/components/deviceDetails?productId=${event.productId}&deviceId=${event.deviceId}`);
|
|
|
|
|
|
- commonStore.deviceManageData = event;
|
|
|
- commonStore.deviceManageData.createdTime = event.createdTime ? event.createdTime.replace("T", " ") : "";
|
|
|
- commonStore.deviceManageData.productName = state.params.productName;
|
|
|
+ commonStore.deviceManageData = {
|
|
|
+ ...event,
|
|
|
+ createdTime: event.createdTime ? event.createdTime.replace("T", " ") : "",
|
|
|
+ productName: state.params.productName,
|
|
|
+ typeImg: commonStore.deviceManageData.typeImg,
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+function GetDmpProductInfo() {
|
|
|
+ dmpProductInfo({ productName: "", current: state1.current, size: state1.pageSize }).then((requset) => {
|
|
|
+ if (requset.status === "SUCCESS") {
|
|
|
+ requset.data.records.forEach((el) => {
|
|
|
+ if (!el.typeImg) {
|
|
|
+ el.typeImg = "/static/images/404.png";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (el.deviceCount == null) {
|
|
|
+ el.deviceCount = 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ state1.dataList = requset.data.records;
|
|
|
+ state1.total = requset.data.total;
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @打开弹出层
|
|
|
+ */
|
|
|
+function popupOpen() {
|
|
|
+ GetDmpProductInfo();
|
|
|
+ state.popup.show = true;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @切换产品
|
|
|
+ */
|
|
|
+function handleToProduct(event) {
|
|
|
+ state.params.productName = event.productName;
|
|
|
+ state.params.productId = parseInt(event.id);
|
|
|
+ commonStore.deviceManageData.typeImg = event.typeImg;
|
|
|
+ state.popup.show = false;
|
|
|
+ init();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @单选change事件
|
|
|
*/
|
|
|
function radioChange(e) {
|
|
|
- state.radio.value = e;
|
|
|
+ state.params.deviceStatus = e;
|
|
|
dmpDeviceInfoApi();
|
|
|
state.dropdownShow = false;
|
|
|
}
|
|
@@ -149,18 +258,28 @@ function radioChange(e) {
|
|
|
/**
|
|
|
* @scrollView加载数据
|
|
|
*/
|
|
|
-function load() {
|
|
|
- state.params.size += 10;
|
|
|
- init();
|
|
|
+function load(keys) {
|
|
|
+ if (keys == "state1") {
|
|
|
+ state1.pageSize += 10;
|
|
|
+ GetDmpProductInfo();
|
|
|
+ } else {
|
|
|
+ state.params.size += 10;
|
|
|
+ init();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @scrollView刷新数据
|
|
|
*/
|
|
|
-function refresh() {
|
|
|
- state.params.deviceName = "";
|
|
|
- state.params.size = 20;
|
|
|
- init();
|
|
|
+function refresh(keys) {
|
|
|
+ if (keys == "state1") {
|
|
|
+ state.pageSize = 20;
|
|
|
+ GetDmpProductInfo();
|
|
|
+ } else {
|
|
|
+ state.params.deviceName = "";
|
|
|
+ state.params.size = 20;
|
|
|
+ init();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
onReady(() => {});
|
|
@@ -183,33 +302,49 @@ onLoad((options) => {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.deviceDetailsList-container {
|
|
|
- .deviceHeader {
|
|
|
- min-width: 100%;
|
|
|
- font-size: 15px;
|
|
|
+ :deep() {
|
|
|
+ .list-cell {
|
|
|
+ padding: 14px 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .device-area {
|
|
|
+ width: calc(100% - 51px);
|
|
|
display: flex;
|
|
|
- white-space: nowrap;
|
|
|
+ flex-flow: row wrap;
|
|
|
+ padding-right: 10px;
|
|
|
|
|
|
- .deviceName {
|
|
|
- width: 75%;
|
|
|
- color: #000;
|
|
|
- }
|
|
|
+ &-header {
|
|
|
+ min-width: 100%;
|
|
|
+ font-size: 16px;
|
|
|
+ display: flex;
|
|
|
+ white-space: nowrap;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ width: 75%;
|
|
|
+ color: #000;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
|
|
|
- .deviceStatus {
|
|
|
- max-width: 30%;
|
|
|
- margin-left: 20px;
|
|
|
- font-size: 12px;
|
|
|
- color: #ffffff;
|
|
|
- padding: 0 5px;
|
|
|
- border-radius: 20px;
|
|
|
- line-height: 20px;
|
|
|
+ .status {
|
|
|
+ max-width: 30%;
|
|
|
+ margin-left: 20px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #ffffff;
|
|
|
+ padding: 0 5px;
|
|
|
+ border-radius: 20px;
|
|
|
+ line-height: 20px;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- .deviceContent {
|
|
|
- min-width: 100%;
|
|
|
- margin-top: 10px;
|
|
|
- font-size: 14px;
|
|
|
- color: rgb(102, 102, 102);
|
|
|
+ &-content {
|
|
|
+ min-width: 100%;
|
|
|
+ margin-top: 5px;
|
|
|
+ font-size: 13px;
|
|
|
+ .title {
|
|
|
+ color: rgba(102, 102, 102, 0.7);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|