Browse Source

Merge branch 'fanghuisheng' of uskycloud/usky-web-mobile into master

fanghuisheng 1 week ago
parent
commit
17a9dcdbc1

+ 21 - 20
src/pages/business/fireIot/deviceManage/components/deviceDetails.vue

@@ -93,7 +93,7 @@
                 <span style="margin: auto 0"> {{ item.commandName }}</span>
                 <span style="margin: auto 0 auto auto"> {{ item.commandValue }}</span>
               </view>
-              <u-slider v-model="item.commandValue" :min="item.minimum" :max="item.maximum" height="5px" @change="selectItem(item)"></u-slider>
+              <u-slider v-model="item.commandValue" :min="item.minimum" :max="item.maximum" :step="item.dataType == 4 ? 0.1 : 1" height="5px" @change="selectItem(item)"></u-slider>
             </view>
           </view>
         </view>
@@ -200,6 +200,7 @@ function init() {
         deviceuuid: [commonStore.deviceManageData.deviceUuid],
       }).then((requset) => {
         if (requset.status != "SUCCESS") return;
+        if (requset.data.length <= 0) return;
         state.metricsValue = requset.data[0].metrics;
         Object.keys(state.metricsValue).forEach((key) => {
           state.realTimeData.forEach((el) => {
@@ -281,28 +282,28 @@ function historyMetricsApi() {
     deviceuuid: [commonStore.deviceManageData.deviceUuid],
     metrics: state.checkbox.value.length > 0 ? state.checkbox.value : state.metrics,
   }).then((requset) => {
-    if (requset.status === "SUCCESS") {
-      var metrics = requset.data[0].metrics;
-
-      state.checkbox.list.forEach((el) => {
-        metrics.forEach((e) => {
-          if (el.attributeCode.toLowerCase() == e.metric) {
-            e.attributeName = el.attributeName;
-          }
-        });
-      });
-
-      metrics.forEach((el) => {
-        el.data = [];
-        if (el.metricItems.length > 0) {
-          el.metricItems.forEach((e) => {
-            el.data.push([e.timestamp, e.value]);
-          });
+    if (requset.status != "SUCCESS") return;
+    if (requset.data.length <= 0) return;
+
+    var metrics = requset.data[0].metrics;
+    state.checkbox.list.forEach((el) => {
+      metrics.forEach((e) => {
+        if (el.attributeCode.toLowerCase() == e.metric) {
+          e.attributeName = el.attributeName;
         }
       });
+    });
 
-      state.ecahrtsDate = metrics;
-    }
+    metrics.forEach((el) => {
+      el.data = [];
+      if (el.metricItems.length > 0) {
+        el.metricItems.forEach((e) => {
+          el.data.push([e.timestamp, e.value]);
+        });
+      }
+    });
+
+    state.ecahrtsDate = metrics;
   });
 }
 

+ 17 - 3
src/pages/business/fireIot/deviceManage/components/deviceDetailsList.vue

@@ -111,14 +111,29 @@
         style="height: calc(-44px + 40vh)"
       >
         <template #default>
-          <view class="deviceManage" style="border-top: 1px solid rgba(0, 0, 0, 0.1)">
+          <view class="flex p15" @click="handleToProduct({ typeImg: '/static/images/404.png', productName: '全部', deviceCount: 0 })" style="border-top: 1px solid rgba(0, 0, 0, 0.1)">
+            <image class="mr15" style="width: 35px; height: 35px" src="/static/images/404.png" mode="aspectFill"></image>
+            <view class="text-ellipsis" style="margin: auto 0; text-align: center">
+              <span> 全部 </span>
+            </view>
+          </view>
+
+          <view class="flex p15" v-for="(item, index) in state1.dataList" :key="index" @click="handleToProduct(item)" style="border-top: 1px solid rgba(0, 0, 0, 0.1)">
+            <image class="mr15" style="width: 35px; height: 35px" :src="item.typeImg" mode="aspectFill"></image>
+            <view class="text-ellipsis" style="margin: auto 0; text-align: center">
+              <span> {{ item.productName }}</span>
+              <span>({{ item.deviceCount || 0 }})</span>
+            </view>
+          </view>
+
+          <!-- <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>
+          </view> -->
         </template>
       </oa-scroll>
     </view>
@@ -220,7 +235,6 @@ function GetDmpProductInfo() {
           el.deviceCount = 0;
         }
       });
-
       state1.dataList = requset.data.records;
       state1.total = requset.data.total;
     }

+ 22 - 29
src/pages/index.vue

@@ -49,7 +49,22 @@
         </u-transition>
 
         <!-- 轮播图 -->
-        <u-swiper v-if="state.swiperBool" :list="state.swiperList" :interval="state.swiperTime" indicatorMode="line" radius="0" height="160" indicator circular keyName="url" @click="swiperClick">
+        <u-swiper
+          v-if="state.swiperBool"
+          :list="state.swiperList"
+          :interval="state.swiperTime"
+          indicatorMode="line"
+          radius="0"
+          height="160"
+          indicator
+          circular
+          keyName="url"
+          @click="
+            (index) => {
+              proxy.$common.swiperToPage(index, state.swiperList);
+            }
+          "
+        >
         </u-swiper>
         <image v-if="!state.swiperBool" style="width: 100%; height: 160px" src="@/static/images/index/banner1.png"></image>
 
@@ -236,28 +251,6 @@ async function init(options) {
   //#endif
 }
 
-/**
- * @轮播图点击事件
- */
-function swiperClick(list) {
-  if (typeof state.swiperList[list] == "object") {
-    let linkType = state.swiperList[list].linkType;
-    let url = state.swiperList[list].link;
-
-    if (url) {
-      if (linkType == 1) {
-        uni.navigateTo({
-          url: url,
-        });
-      } else {
-        uni.navigateTo({
-          url: "/pages/common/webview/index?url=" + url,
-        });
-      }
-    }
-  }
-}
-
 /**
  * @九宫格页面跳转
  */
@@ -279,12 +272,12 @@ function navItemClick(item) {
     storageSystem.set("homeList", state);
 
     if (item.path.indexOf("http") != -1) {
-      if(item.path.indexOf("token") > 0){
-        proxy.$common.toPage(1,null,item)
-      }else{
+      if (item.path.indexOf("token") > 0) {
+        proxy.$common.toPage(1, null, item);
+      } else {
         uni.navigateTo({
           url: `/pages/common/webview/index?url=${item.path}`,
-        })
+        });
       }
     } else {
       uni.navigateTo({
@@ -308,13 +301,13 @@ function navItemClick(item) {
 // function connected() {
 //   refresh();
 //   uni.setNavigationBarColor({
-//     frontColor: "#FFFFFF", //字体颜色
+//     frontColor: "#FFFFFF", //设置安全区字体颜色
 //   });
 // }
 
 // function disconnected() {
 //   uni.setNavigationBarColor({
-//     frontColor: "#000000", //字体颜色
+//     frontColor: "#000000", //设置安全区字体颜色
 //   });
 // }
 

+ 46 - 23
src/plugins/common.plugins.js

@@ -319,41 +319,64 @@ export default {
    * @param {类型} item (菜单内容)
    * @returns
    */
-  toPage(type,to,item) {
+  toPage(type, to, item) {
     var name = uni.getStorageSync("storage_data").name
     let form = "https://manager.usky.cn/mobile/#/"
     let path = "https://oa.usky.cn/mobile/#/login?token"
-    if(name){
-      var params = { 
-          user:name,
-          time:new Date().getTime(),
-          form:"SAAS_mob"
+    if (name) {
+      var params = {
+        user: name,
+        time: new Date().getTime(),
+        form: "SAAS_mob"
       }
       var jm = encrypt(JSON.stringify(params))
       //#ifdef H5 
-        if(type == "1"){
-          window.open(`${item.path}=${encodeURIComponent(jm)}?form=${form}`)
-        }
-        if(type == "2"){
-          location.href = `${path}=${encodeURIComponent(jm)}?form=${form}?toPage=${to}`
-        }
+      if (type == "1") {
+        window.open(`${item.path}=${encodeURIComponent(jm)}?form=${form}`)
+      }
+      if (type == "2") {
+        location.href = `${path}=${encodeURIComponent(jm)}?form=${form}?toPage=${to}`
+      }
       //#endif
       //#ifdef APP-PLUS || MP-WEIXIN 
-        if(type == "1"){
-          uni.navigateTo({
-            url: `/pages/common/webview/index?url=${item.path}=${encodeURIComponent(jm)}?form=${form}`,
-          });
-        }
-        if(type == "2"){
-          uni.navigateTo({
-            url: `/pages/common/webview/index?url=${path}=${encodeURIComponent(jm)}?form=${form}?toPage=${to}`,
-          });
-        }
+      if (type == "1") {
+        uni.navigateTo({
+          url: `/pages/common/webview/index?url=${item.path}=${encodeURIComponent(jm)}?form=${form}`,
+        });
+      }
+      if (type == "2") {
+        uni.navigateTo({
+          url: `/pages/common/webview/index?url=${path}=${encodeURIComponent(jm)}?form=${form}?toPage=${to}`,
+        });
+      }
       //#endif
-    }else{
+    } else {
       uni.navigateTo({
         url: "/pages/index",
       });
     }
   },
+  /**
+   * 轮播图点击跳转页面
+   * @param { 下标 } index 
+   * @param { 集合 } event
+   */
+  swiperToPage(index, event) {
+    if (typeof event[index] == "object") {
+      let linkType = event[index].linkType;
+      let url = event[index].link;
+
+      if (url) {
+        if (linkType == 1) {
+          uni.navigateTo({
+            url: url,
+          });
+        } else {
+          uni.navigateTo({
+            url: "/pages/common/webview/index?url=" + url,
+          });
+        }
+      }
+    }
+  }
 };