Browse Source

feat(sensor): translocation

Casper Dai 2 năm trước cách đây
mục cha
commit
22668e523c

BIN
src/assets/icon_shift.png


+ 1 - 1
src/constant.js

@@ -35,7 +35,7 @@ export const AssetTag = {
 }
 
 export const AssetTagInfo = {
-  [AssetTag.AD]: '素材',
+  [AssetTag.AD]: '广告',
   [AssetTag.PUBLICITY]: '公益',
   [AssetTag.LOCAL_PUBLICITY]: '地方宣传',
   [AssetTag.SHIM]: '垫片'

+ 15 - 0
src/scss/bem/_ishas.scss

@@ -98,3 +98,18 @@
 .is-ratio--16_9 {
   padding-top: $padding--16_9;
 }
+
+.has-info {
+  position: relative;
+  margin-bottom: 18px;
+
+  &::after {
+    content: attr(data-info);
+    position: absolute;
+    left: 0;
+    bottom: -18px;
+    color: $gray;
+    font-size: 12px;
+    line-height: 1;
+  }
+}

+ 0 - 15
src/scss/bem/_utility.scss

@@ -162,21 +162,6 @@
   color: #ff0000;
 }
 
-.has-info {
-  position: relative;
-  margin-bottom: 18px;
-
-  &::after {
-    content: attr(data-info);
-    position: absolute;
-    left: 0;
-    bottom: -18px;
-    color: $gray;
-    font-size: 12px;
-    line-height: 1;
-  }
-}
-
 .u-events--none {
   pointer-events: none !important;
 }

+ 14 - 5
src/views/device/detail/components/external/Sensors/Sensor.vue

@@ -97,6 +97,9 @@ export default {
       return ThirdPartyDeviceInfo[this.type]
     },
     sorted () {
+      if (this.type === ThirdPartyDevice.TRANSLOCATION_SENSOR) {
+        return this.list
+      }
       return this.list.slice().sort((a, b) => Number(a.value) < Number(b.value) ? 1 : -1)
     },
     sensorType () {
@@ -139,7 +142,7 @@ export default {
       getSensorRecords({
         deviceId: this.deviceId,
         sensorType: this.type,
-        startTime: now - 30000,
+        startTime: now - 10000,
         endTime: now
       }, { custom: true }).then(({ data }) => {
         this.list = this.transfromData(data)
@@ -165,13 +168,12 @@ export default {
     transformSensorData (data) {
       const { port, type, value, time } = data
       return {
-        port,
-        value,
+        port, value,
         time: parseTime(time, '{y}-{m}-{d} {h}:{i}:{s}'),
-        info: this.transformValue(type, value)
+        info: this.transformValue(type, value, data)
       }
     },
-    transformValue (type, value) {
+    transformValue (type, value, data) {
       switch (type) {
         case ThirdPartyDevice.SMOKE_SENSOR:
           return `${value}ppm`
@@ -181,6 +183,9 @@ export default {
           return `${value}Lux`
         case ThirdPartyDevice.FLOODING_SENSOR:
           return value ? '是' : '否'
+        case ThirdPartyDevice.TRANSLOCATION_SENSOR:
+          console.log(data)
+          return `x ${data.xvalue?.toFixed(3)}  y ${data.yvalue?.toFixed(3)}  z ${data.zvalue?.toFixed(3)}`
         default:
           return value
       }
@@ -212,6 +217,10 @@ export default {
   &.sensor_12 {
     background-image: url("~@/assets/icon_flooding.png");
   }
+
+  &.sensor_13 {
+    background-image: url("~@/assets/icon_shift.png");
+  }
 }
 
 .o-sensor {

+ 2 - 1
src/views/device/detail/components/external/Sensors/index.vue

@@ -32,7 +32,8 @@ export default {
         { type: ThirdPartyDevice.SMOKE_SENSOR, title: '烟雾', color: '#8400ff' },
         { type: ThirdPartyDevice.TEMPERATURE_SENSOR, title: '温度', color: '#ff0000' },
         { type: ThirdPartyDevice.LIGHT_SENSOR, title: '光照', color: '#ffa200' },
-        { type: ThirdPartyDevice.FLOODING_SENSOR, title: '水浸', color: '#409eff' }
+        { type: ThirdPartyDevice.FLOODING_SENSOR, title: '水浸', color: '#409eff' },
+        { type: ThirdPartyDevice.TRANSLOCATION_SENSOR, title: '位移', color: '#00b781' }
       ]
     }
   },

+ 51 - 33
src/views/realm/settings/components/DeviationThresholdConfigDialog.vue

@@ -6,41 +6,59 @@
   >
     <div class="c-grid-form auto u-align-self--center">
       <div class="c-grid-form__label">X轴初始值</div>
-      <el-input-number
-        v-model="config.val1"
-        controls-position="right"
-        :step-strictly="0.01"
-      />
-      <div class="c-grid-form__label">X轴阈值</div>
-      <el-input-number
-        v-model="config.val2"
-        controls-position="right"
-        :step-strictly="0.01"
-      />
+      <div class="l-flex--row">
+        <el-input-number
+          v-model="config.val1"
+          class=" c-sibling-item"
+          controls-position="right"
+          :step="0.001"
+          step-strictly
+        />
+        <div class="c-sibling-item farther">X轴阈值</div>
+        <el-input-number
+          v-model="config.val2"
+          class=" c-sibling-item far"
+          controls-position="right"
+          :step="0.001"
+          step-strictly
+        />
+      </div>
       <div class="c-grid-form__label">Y轴初始值</div>
-      <el-input-number
-        v-model="config.val3"
-        controls-position="right"
-        :step-strictly="0.01"
-      />
-      <div class="c-grid-form__label">Y轴阈值</div>
-      <el-input-number
-        v-model="config.val4"
-        controls-position="right"
-        :step-strictly="0.01"
-      />
+      <div class="l-flex--row">
+        <el-input-number
+          v-model="config.val3"
+          class=" c-sibling-item"
+          controls-position="right"
+          :step="0.001"
+          step-strictly
+        />
+        <div class="c-sibling-item farther">Y轴阈值</div>
+        <el-input-number
+          v-model="config.val4"
+          class=" c-sibling-item far"
+          controls-position="right"
+          :step="0.001"
+          step-strictly
+        />
+      </div>
       <div class="c-grid-form__label">Z轴初始值</div>
-      <el-input-number
-        v-model="config.val5"
-        controls-position="right"
-        :step-strictly="0.01"
-      />
-      <div class="c-grid-form__label">Z轴阈值</div>
-      <el-input-number
-        v-model="config.val6"
-        controls-position="right"
-        :step-strictly="0.01"
-      />
+      <div class="l-flex--row">
+        <el-input-number
+          v-model="config.val5"
+          class=" c-sibling-item"
+          controls-position="right"
+          :step="0.001"
+          step-strictly
+        />
+        <div class="c-sibling-item farther">Z轴阈值</div>
+        <el-input-number
+          v-model="config.val6"
+          class=" c-sibling-item far"
+          controls-position="right"
+          :step="0.001"
+          step-strictly
+        />
+      </div>
     </div>
   </confirm-dialog>
 </template>

+ 12 - 4
src/views/realm/settings/components/TemperatureThresholdConfigDialog.vue

@@ -5,34 +5,42 @@
     @confirm="onSave"
   >
     <div class="c-grid-form auto u-align-self--center">
-      <div class="c-grid-form__label">一级预警</div>
+      <div class="c-grid-form__label">一级预警阈值</div>
       <el-input-number
         v-model="config.level1"
         controls-position="right"
         :min="0"
         step-strictly
       />
-      <div class="c-grid-form__label">二级预警</div>
+      <div />
+      <div class="u-color--error dark">一级预警,发送提示性预警</div>
+      <div class="c-grid-form__label">二级预警阈值</div>
       <el-input-number
         v-model="config.level2"
         controls-position="right"
         :min="0"
         step-strictly
       />
-      <div class="c-grid-form__label">三级预警</div>
+      <div />
+      <div class="u-color--error dark">二级预警,发送中级预警,开启风机;低于一级预警阈值后关闭风机</div>
+      <div class="c-grid-form__label">三级预警阈值</div>
       <el-input-number
         v-model="config.level3"
         controls-position="right"
         :min="0"
         step-strictly
       />
-      <div class="c-grid-form__label">四级预警</div>
+      <div />
+      <div class="u-color--error dark">三级预警,发送紧急预警</div>
+      <div class="c-grid-form__label">四级预警阈值</div>
       <el-input-number
         v-model="config.level4"
         controls-position="right"
         :min="0"
         step-strictly
       />
+      <div />
+      <div class="u-color--error dark">四级预警,发送紧急预警,关闭大屏电源</div>
     </div>
   </confirm-dialog>
 </template>

+ 4 - 3
src/views/realm/settings/components/UnattendConfigDialog.vue

@@ -4,9 +4,10 @@
     title="无人值守设置"
     @confirm="onSave"
   >
+    <div class="u-color--error dark u-align-self--center">关闭时将不进行传感器预警推送</div>
     <div class="c-grid-form auto u-align-self--center">
       <span class="c-grid-form__label">启用</span>
-      <div class="l-flex--row">
+      <div class="l-flex--row c-grid-form__option has-info--error">
         <el-switch
           v-model="enable"
           active-color="#13ce66"
@@ -39,7 +40,7 @@ export default {
           this.$temp = this.enable
         } else {
           this.enable = false
-          this.$temp = null
+          this.$temp = false
         }
         this.$refs.configDialog.show()
       })
@@ -49,7 +50,7 @@ export default {
         done()
         return
       }
-      updateTenantAttribute(UNATTEND, this.enable ? '1' : '0').then(done)
+      updateTenantAttribute(UNATTEND, this.enable ? '0' : '1').then(done)
     }
   }
 }

+ 4 - 4
src/views/realm/settings/index.vue

@@ -24,15 +24,15 @@
     <div class="c-sibling-item--v l-grid--info mini">
       <button
         class="o-button"
-        @click="onPowerConfig"
+        @click="onUnattendConfig"
       >
-        电源标签
+        无人值守
       </button>
       <button
         class="o-button"
-        @click="onUnattendConfig"
+        @click="onPowerConfig"
       >
-        无人值守
+        电源标签
       </button>
       <button
         class="o-button"