Yue 2 anni fa
parent
commit
5c154623b5

+ 16 - 0
src/api/_mobile.ts

@@ -47,6 +47,22 @@ class mobileApi {
   getCompanyById(id: string) {
     return Rs.post(`/sys/query/getCompanyById/${id}`)
   }
+  getCompanyDevice(id: string) {
+    return Rs.post(`/sys/query/getPurAndFanMonitor/${id}`)
+  }
+  getCompany(
+    param: any = {
+      pageIndex: 1,
+      pageSize: 5,
+      params: {},
+    }
+  ) {
+    return Rs.post({
+      url: "/sys/query/getCompany",
+      data: param,
+      loading: true,
+    })
+  }
   getCompanyListByOrg(
     param: any = {
       pageIndex: 1,

+ 158 - 31
src/pages/index/index.vue

@@ -1,9 +1,11 @@
 <script setup lang="ts">
 import appStore from "@/stores"
 import route from "@/route"
+import apis from "@/api"
 
 const title = ref("餐饮油烟监控平台")
-const showTitle = ref(true)
+const showLogo = ref(true)
+const showCompany = ref(false)
 const user = computed(() => {
   return appStore.authStore.getUser()
 })
@@ -11,39 +13,59 @@ const user = computed(() => {
 function jumpMap() {
   route.navigate("map")
 }
-onLoad(() => {
+const companyInfo = ref<Array<any>>([])
+function getCompany() {
+  apis.mobileApi.getCompanyDevice(user.value.companyId).then((res) => {
+    console.log("RES", res)
+    if (res.data.monitor1 && res.data.monitor1.length) {
+      for (let i = 0; i < res.data.monitor1.length; i++) {
+        const d1 = res.data.monitor1[i]
+        const d2 = res.data.monitor2[i]
+        const d = {
+          type1: d1.status == "运行" ? "success" : "error",
+          name1: d1.name,
+          time1: d1.time,
+          status1: d1.status,
+          image1:
+            d1.status == "运行" ? "/static/images/operation-state/01.gif" : "/static/images/operation-state/01.png",
+          type2: d2.status == "运行" ? "success" : "error",
+          name2: d2.name,
+          time2: d2.time,
+          status2: d2.status,
+          image2:
+            d2.status == "运行" ? "/static/images/operation-state/02.gif" : "/static/images/operation-state/02.png",
+        }
+        companyInfo.value.push(d)
+      }
+    }
+  })
+}
+
+function init() {
   if (route.checkAuth()) {
     uni.hideTabBar()
     setTimeout(() => {
       if (user.value.userType == 1) {
-        //route.navigate("over")
         uni.setTabBarItem({
           index: 0,
           pagePath: "/pages_overview/over",
         })
+        route.switchTab("work")
       } else if (user.value.userType == 2) {
-        //route.navigate("company_chart")
-        uni.setTabBarItem({
-          index: 0,
-          pagePath: "/pages_company/chart",
-        })
+        showLogo.value = false
+        showCompany.value = true
+        getCompany()
       }
       uni.showTabBar()
-
-      route.switchTab("work")
-
-      // if (user.value.userType == 1) {
-      //   //route.navigate("over")
-      // } else if (user.value.userType == 2) {
-      //   //route.navigate("company_chart")
-      // }
     }, 1000)
   }
-})
+}
+
+onLoad(init)
 </script>
 
 <template>
-  <view v-if="showTitle" class="content">
+  <view v-if="showLogo" class="content">
     <image class="logo" src="/static/logos/logo.png" />
     <view class="text-area">
       <text class="title">{{ title }}</text>
@@ -55,11 +77,44 @@ onLoad(() => {
     </view>
   </view>
 
-  <view v-else>
+  <view v-else-if="showCompany">
     <!-- <web-view src="/pages_overview/over" v-if="user.userType == 1"></web-view>
     <web-view src="/pages_company/chart" v-else-if="user.userType == 2"></web-view> -->
+    <view class="devices">
+      <view class="box" v-for="(v, i) in companyInfo" :key="i">
+        <uni-section :title="`净化设施 ${i + 1}`" type="line"></uni-section>
+        <view class="body">
+          <view class="item" :class="v.type1">
+            <view class="img"><image :src="v.image1" mode="scaleToFill" /></view>
+            <view class="right">
+              <view class="name">
+                {{ v.name1 }}
+                <span class="tag-view"><uni-tag :text="v.status1" :type="v.type1" /></span>
+              </view>
+              <view class="time">
+                净化器运行
+                <span>{{ v.time1 }}</span>
+              </view>
+            </view>
+          </view>
+          <view class="item" :class="v.class1">
+            <view class="img"><image :src="v.image2" mode="scaleToFill" /></view>
+            <view class="right">
+              <view class="name">
+                {{ v.name2 }}
+                <span class="tag-view"><uni-tag :text="v.status2" :type="v.type2" /></span>
+              </view>
+              <view class="time">
+                风机运行
+                <span>{{ v.time2 }}</span>
+              </view>
+            </view>
+          </view>
+        </view>
+      </view>
+    </view>
     <movable-area class="movableArea">
-      <movable-view class="movableView" direction="all" x="680rpx" y="700rpx">
+      <movable-view class="movableView" direction="all" x="680rpx" y="600rpx">
         <image src="/static/images/map.png" mode="widthFix" @click="jumpMap"></image>
       </movable-view>
     </movable-area>
@@ -68,7 +123,7 @@ onLoad(() => {
 
 <style lang="scss">
 page {
-  background-color: #fafafa;
+  background-color: #f5f5f5;
 }
 .content {
   display: flex;
@@ -89,19 +144,91 @@ page {
 .text-area {
   display: flex;
   justify-content: center;
-}
+  .title {
+    font-size: 36rpx;
+    color: #50cd89;
+  }
 
-.title {
-  font-size: 36rpx;
-  color: #50cd89;
+  .name {
+    margin-top: 200px;
+    font-size: 46rpx;
+    font-weight: 600;
+    color: #50cd89;
+    opacity: 0.5;
+  }
 }
+.devices {
+  display: flex;
+  flex-direction: column;
+  .box {
+    display: flex;
+    flex-direction: column;
+    .body {
+      padding: 10px 5px;
+      background-color: #f9f9f9;
+    }
+    .item {
+      display: flex;
+      padding: 10px;
+      &:not(:last-child) {
+        border-bottom: 2px solid #eee;
+      }
+
+      .img {
+        width: 70px;
+        height: 70px;
+        padding: 8px;
+        background-color: rgba(80, 205, 137, 0.15);
+        border-radius: 50%;
+        margin: 0 15px;
+        image {
+          width: 100%;
+          height: 100%;
+        }
+      }
+
+      .right {
+        padding: 10px 10px;
+        font-size: 16px;
+        display: flex;
+        flex-direction: column;
+        align-items: flex-start;
+        justify-content: space-between;
+        .name {
+          font-weight: 600;
+        }
+        .tag-view {
+          padding-left: 10px;
+        }
+        .time {
+          color: #666;
+          span {
+            padding-left: 3px;
+            color: #3c3c3c;
+          }
+        }
+      }
 
-.name {
-  margin-top: 200px;
-  font-size: 46rpx;
-  font-weight: 600;
-  color: #50cd89;
-  opacity: 0.5;
+      &.success {
+        .img {
+          background-color: rgba(80, 205, 137, 0.15);
+        }
+      }
+      &.error {
+        .img {
+          background-color: rgba(221, 82, 77, 0.25);
+        }
+      }
+    }
+  }
+}
+:deep(.devices) {
+  .uni-section__content-title {
+    span {
+      font-size: 18px;
+      font-weight: 600;
+    }
+  }
 }
 .movableArea {
   position: fixed;

+ 2 - 2
src/pages_company/components/c_alarm.vue

@@ -136,14 +136,14 @@ onReady(() => {
         <view class="alarm-list_item" v-for="(item, index) in alarmList" :key="index">
           <view class="left">
             <text class="name">{{ item.device_name }}</text>
-            <text class="address">{{ item.warn_type_name }}</text>
+            <text class="address">{{ item.warn_time }}</text>
           </view>
           <view class="right">
             <text v-if="item.warn_value">
               超标值:
               <text class="num">{{ item.warn_value }}</text>
             </text>
-            <text class="">{{ item.abnormal_state_name }}</text>
+            <text class="">{{ item.warn_type_name }}</text>
           </view>
         </view>
         <uni-load-more

+ 43 - 32
src/pages_online/map.vue

@@ -30,7 +30,7 @@ const search: any = {
 // }
 function getInfo() {
   search.params.org_id = appStore.authStore.user.orgId
-  apis.mobileApi.getCompanyListByOrg(search).then(({ rows, total }) => {
+  apis.mobileApi.getCompany(search).then(({ rows }) => {
     companyData.value = rows
     if (rows && rows.length) {
       message.loading("正在加载数据...")
@@ -68,26 +68,29 @@ function getInfo() {
 function markerClick(e: any) {
   showMarkerWindow.value = false
   const markerId = e.detail.markerId
-  var item = companyData.value.find((v: any) => v.company_id == markerId)
-  if (item) {
-    getTargetInfo(item)
-  } else {
-    uni.showToast({
-      title: "暂未有该商户信息",
-    })
-  }
+  getMarkInfo(markerId)
 }
-function getTargetInfo(item: any) {
-  targetInfo.value.name = item.name
-  targetInfo.value.address = item.address
-  targetInfo.value.corporation_name = item.corporation_name
-  targetInfo.value.phone = item.phone
-  targetInfo.value.smoke = item.smoke
-  targetInfo.value.smoke_over = item.smoke_over
-  targetInfo.value.voc_density = item.voc_density
-  targetInfo.value.voc_over = item.voc_over
-  showMarkerWindow.value = true
+
+function getMarkInfo(markerId: string) {
+  apis.mobileApi.getCompanyById(markerId).then((res) => {
+    if (res) {
+      const item = res.data
+      targetInfo.value.name = item.name
+      targetInfo.value.address = item.address
+      targetInfo.value.contact = item.contact
+      targetInfo.value.phone = item.phone
+      targetInfo.value.operate_status = item.operate_status == 0 ? "营业" : item.operate_status == 1 ? "间休" : "停业"
+      targetInfo.value.stove_num = item.stove_num
+      targetInfo.value.outlet_num = item.outlet_num
+      showMarkerWindow.value = true
+    } else {
+      uni.showToast({
+        title: "暂未有该商户信息",
+      })
+    }
+  })
 }
+
 const h = ref(800)
 const mh = ref(800)
 
@@ -143,7 +146,12 @@ onLoad(init)
         <image class="img" src="/static/images/close.png"></image>
       </view>
       <scroll-view class="info-box" :scroll-y="true" style="height: 100%">
-        <uni-section :title="targetInfo.name">
+        <uni-section title="商户名称">
+          <template #right>
+            <span>{{ targetInfo.name }}</span>
+          </template>
+        </uni-section>
+        <uni-section title="商户地址">
           <template #right>
             <span>{{ targetInfo.address }}</span>
           </template>
@@ -151,27 +159,30 @@ onLoad(init)
         <uni-section title="联系人">
           <template #right>
             <span style="">
-              {{ targetInfo.corporation_name }}
+              {{ targetInfo.contact }}
               <br />
               {{ targetInfo.phone }}
             </span>
           </template>
         </uni-section>
-        <uni-section title="油烟">
+        <uni-section title="营业状态">
           <template #right>
             <span>
-              {{ targetInfo.smoke }}
-              <br />
-              超标:{{ targetInfo.smoke_over }}
+              {{ targetInfo.operate_status }}
             </span>
           </template>
         </uni-section>
-        <uni-section title="颗粒物">
+        <uni-section title="灶头数">
           <template #right>
             <span>
-              {{ targetInfo.voc_density }}
-              <br />
-              超标:{{ targetInfo.voc_over }}
+              {{ targetInfo.stove_num }}
+            </span>
+          </template>
+        </uni-section>
+        <uni-section title="排口数">
+          <template #right>
+            <span>
+              {{ targetInfo.outlet_num }}
             </span>
           </template>
         </uni-section>
@@ -193,7 +204,7 @@ onLoad(init)
 
 .marker-info {
   background: #fff;
-  height: 265px;
+  height: 285px;
   width: calc(100vw - 4px);
   position: absolute;
   bottom: 0px;
@@ -203,8 +214,8 @@ onLoad(init)
   padding: 15px;
   border-radius: 10px 10px 0 0;
   border-top: 5px solid $uni-color-primary;
-  border-left: 2px solid $uni-color-primary;
-  border-right: 2px solid $uni-color-primary;
+  border-left: 3px solid $uni-color-primary;
+  border-right: 3px solid $uni-color-primary;
   border-bottom: none;
   .close-btn {
     position: absolute;

BIN
src/static/images/operation-state/01.gif


BIN
src/static/images/operation-state/01.png


BIN
src/static/images/operation-state/02.gif


BIN
src/static/images/operation-state/02.png