Browse Source

MT02bug修复

xiaohaizhao 1 year ago
parent
commit
7fe218af5e
3 changed files with 481 additions and 405 deletions
  1. 282 237
      control/components/prodnum-MT02/modules/division.vue
  2. 196 166
      pages/facility/detail.vue
  3. 3 2
      pages/login/modules/dispose.js

+ 282 - 237
control/components/prodnum-MT02/modules/division.vue

@@ -1,271 +1,316 @@
 <template>
-    <view class="control">
-        <view class="control-title">
-            分时控制
+  <view class="control">
+    <view class="control-title"> 分时控制 </view>
+    <view class="update-line">
+      <view class="label">
+        {{ timeControl.funcname }}
+      </view>
+      <view class="content">
+        {{ timeControl.showValue }}
+        <view
+          class="control-updata-but"
+          hover-class="navigator-hover"
+          @click="onClick(timeControl)"
+          >{{ timeControl.isfeedback ? "待更新" : "更新" }}</view
+        >
+      </view>
+    </view>
+    <view
+      class="item"
+      hover-class="navigator-hover"
+      v-for="item in list"
+      :key="item.index"
+      @click="onClick(item)"
+    >
+      <view class="title">
+        {{ item.funcname }}
+      </view>
+      <view class="row">
+        <view class="box">
+          <view> 开始时间 </view>
+          <view class="content">
+            <view class="value">{{ item.showValue.begin || "--" }}</view>
+          </view>
         </view>
-        <view class="update-line">
-            <view class="label">
-                {{ timeControl.funcname }}
-            </view>
-            <view class="content">
-                {{ timeControl.showValue }}
-                <view class="control-updata-but" hover-class="navigator-hover" @click="onClick(timeControl)">{{
-                    timeControl.isfeedback ? '待更新' : '更新' }}</view>
-            </view>
+        <view class="box">
+          <view> 结束时间 </view>
+          <view class="content">
+            <view class="value">{{ item.showValue.end || "--" }}</view>
+          </view>
         </view>
-        <view class="item" hover-class="navigator-hover" v-for="item in list" :key="item.index" @click="onClick(item)">
-            <view class="title">
-                {{ item.funcname }}
-            </view>
-            <view class="row">
-                <view class="box">
-                    <view>
-                        开始时间
-                    </view>
-                    <view class="content">
-                        <view class="value">{{ item.showValue.begin || '--' }}</view>
-                    </view>
-                </view>
-                <view class="box">
-                    <view>
-                        结束时间
-                    </view>
-                    <view class="content">
-                        <view class="value">{{ item.showValue.end || '--' }}</view>
-                    </view>
-                </view>
-                <view class="box">
-                    <view class="">
-                        压力设置
-                    </view>
-                    <view class="content">
-                        <view class="value">{{ item.showValue.value || '--' }}</view>
-                        <view class="unit">{{ item.params[item.keyList[4]].unit || '' }}</view>
-                    </view>
-                </view>
-            </view>
-            <view v-if="item.isfeedback" class="dot" />
+        <view class="box">
+          <view class=""> 压力设置 </view>
+          <view class="content">
+            <view class="value">{{ item.showValue.value || "--" }}</view>
+            <view class="unit">{{
+              item.params[item.keyList[4]].unit || ""
+            }}</view>
+          </view>
         </view>
-        <My_input ref="MyInput" @customMethod="customMethod">
-            <view class="change-item" v-if="changeItem.funcname">
-                <picker mode="time" :value="changeItem.showValue.begin" :end="endTime" data-name="begin"
-                    @change="timeChange">
-                    <view class="row">
-                        <view class="label">
-                            开始时间:
-                        </view>
-                        <view class="value day-parting-row">{{ changeItem.showValue.begin || ' --' }}
-                        </view>
-                    </view>
-                </picker>
-                <picker mode="time" :start="changeItem.showValue.begin" :value="changeItem.showValue.end" data-name="end"
-                    @change="timeChange">
-                    <view class="row">
-                        <view class="label">
-                            结束时间:
-                        </view>
-                        <view class="value day-parting-row">{{ changeItem.showValue.end || ' --' }}</view>
-                    </view>
-                </picker>
-                <view class="row">
-                    <view class="label">
-                        压力设置:
-                    </view>
-                    <view class="value">
-                        <u-input :placeholder="changeItem.showValue.value || '压力设置'" v-model="changeItem.showValue.value"
-                            :type="changeItem.params[`T${changeItem.index}_P`].num_scale == 0 ? 'number' : 'digit'">
-                            <template slot="suffix">
-                                {{ changeItem.params[`T${changeItem.index}_P`].unit || '' }}
-                            </template>
-                        </u-input>
-                    </view>
-                </view>
-            </view>
-        </My_input>
+      </view>
+      <view v-if="item.isfeedback" class="dot" />
     </view>
+    <My_input ref="MyInput" @customMethod="customMethod">
+      <view class="change-item" v-if="changeItem.funcname">
+        <picker
+          mode="time"
+          :value="changeItem.showValue.begin"
+          :end="endTime"
+          data-name="begin"
+          @change="timeChange"
+        >
+          <view class="row">
+            <view class="label"> 开始时间: </view>
+            <view class="value day-parting-row"
+              >{{ changeItem.showValue.begin || " --" }}
+            </view>
+          </view>
+        </picker>
+        <picker
+          mode="time"
+          :start="changeItem.showValue.begin"
+          :value="changeItem.showValue.end"
+          data-name="end"
+          @change="timeChange"
+        >
+          <view class="row">
+            <view class="label"> 结束时间: </view>
+            <view class="value day-parting-row">{{
+              changeItem.showValue.end || " --"
+            }}</view>
+          </view>
+        </picker>
+        <view class="row">
+          <view class="label"> 压力设置: </view>
+          <view class="value">
+            <u-input
+              :placeholder="changeItem.showValue.value || '压力设置'"
+              v-model="changeItem.showValue.value"
+              :type="
+                changeItem.params[`T${changeItem.index}_P`].num_scale == 0
+                  ? 'number'
+                  : 'digit'
+              "
+            >
+              <template slot="suffix">
+                {{ changeItem.params[`T${changeItem.index}_P`].unit || "" }}
+              </template>
+            </u-input>
+          </view>
+        </view>
+      </view>
+    </My_input>
+  </view>
 </template>
 
 <script>
 export default {
-    name: "division",
-    data() {
-        return {
-            list: [],
-            changeItem: {},
-            timeControl: {},
-            endTime: null
-        }
+  name: "division",
+  data() {
+    return {
+      list: [],
+      changeItem: {},
+      timeControl: {},
+      endTime: null,
+    };
+  },
+  methods: {
+    loadData(newVal) {
+      let reg = /^T\d{1,5}$/,
+        count = 0,
+        list = [];
+      for (const key in newVal.function) {
+        if (reg.test(key)) count++;
+      }
+      for (let i = 1; i <= count; i++) {
+        let obj = newVal.function[`T${i}`],
+          keyList = [
+            `T${i}H`, //开始小时
+            `T${i}M`, //开始分钟
+            `T${i}H1`, //结束小时
+            `T${i}M1`, //结束分钟
+            `T${i}_P`, //压力设置
+          ];
+        let item = {
+          keyList,
+          index: i,
+          inputType: "slot",
+          paramValue: {
+            begin:
+              newVal.paramcmdvalues[`T${i}H`] + newVal.paramcmdvalues[`T${i}M`]
+                ? newVal.paramcmdvalues[`T${i}H`] +
+                  ":" +
+                  newVal.paramcmdvalues[`T${i}M`]
+                : "",
+            end:
+              newVal.paramcmdvalues[`T${i}H1`] +
+              newVal.paramcmdvalues[`T${i}M1`]
+                ? newVal.paramcmdvalues[`T${i}H1`] +
+                  ":" +
+                  newVal.paramcmdvalues[`T${i}M1`]
+                : "",
+            value: newVal.paramcmdvalues[`T${i}_P`],
+          },
+          showValue: {
+            begin:
+              newVal.paramvalues[`T${i}H`] + newVal.paramvalues[`T${i}M`]
+                ? newVal.paramvalues[`T${i}H`] +
+                  ":" +
+                  newVal.paramvalues[`T${i}M`]
+                : "",
+            end:
+              newVal.paramvalues[`T${i}H1`] + newVal.paramvalues[`T${i}M1`]
+                ? newVal.paramvalues[`T${i}H1`] +
+                  ":" +
+                  newVal.paramvalues[`T${i}M1`]
+                : "",
+            value: newVal.paramvalues[`T${i}_P`],
+          },
+          params: {},
+        };
+        keyList.forEach((key) => {
+          item.params[key] = newVal.params[key];
+        });
+        item.isfeedback =
+          newVal.isfeedback &&
+          (item.paramValue.begin ||
+            item.paramValue.end ||
+            item.paramValue.value)
+            ? true
+            : false;
+        list.push(Object.assign(obj, item));
+      }
+      this.list = list;
+      this.timeControl = this.__proto__.getControlItem(["TimeCon"], newVal)[0];
+      this.timeControl.changeItem = ["TimeConOFF", "TimeConON"];
     },
-    methods: {
-        loadData(newVal) {
-            let reg = /^T\d{1,5}$/,
-                count = 0,
-                list = [];
-            for (const key in newVal.function) {
-                if (reg.test(key)) count++
-            }
-            for (let i = 1; i <= count; i++) {
-                let obj = newVal.function[`T${i}`],
-                    keyList = [
-                        `T${i}H`,//开始小时
-                        `T${i}M`,//开始分钟
-                        `T${i}H1`,//结束小时
-                        `T${i}M1`,//结束分钟
-                        `T${i}_P`,//压力设置
-                    ],
-                    item = {
-                        keyList,
-                        index: i,
-                        inputType: "slot",
-                        paramValue: {
-                            begin: newVal.paramcmdvalues[`T${i}H`] + newVal.paramcmdvalues[`T${i}M`] ? newVal.paramcmdvalues[`T${i}H`] + ":" + newVal.paramcmdvalues[`T${i}M`] : "",
-                            end: newVal.paramcmdvalues[`T${i}H1`] + newVal.paramcmdvalues[`T${i}M1`] ? newVal.paramcmdvalues[`T${i}H1`] + ":" + newVal.paramcmdvalues[`T${i}M1`] : "",
-                            value: newVal.paramcmdvalues[`T${i}_P`]
-                        },
-                        showValue: {
-                            begin: newVal.paramvalues[`T${i}H`] + newVal.paramvalues[`T${i}M`] ? newVal.paramvalues[`T${i}H`] + ":" + newVal.paramvalues[`T${i}M`] : "",
-                            end: newVal.paramvalues[`T${i}H1`] + newVal.paramvalues[`T${i}M1`] ? newVal.paramvalues[`T${i}H1`] + ":" + newVal.paramvalues[`T${i}M1`] : "",
-                            value: newVal.paramvalues[`T${i}_P`]
-                        },
-                        params: {}
-                    };
-
-                keyList.forEach(key => {
-                    item.params[key] = newVal.params[key];
-                });
-                item.isfeedback = (newVal.isfeedback && (obj.paramValue.begin || obj.paramValue.end || obj.paramValue.value)) ? true : false;
-                list.push(Object.assign(obj, item))
-            }
-            this.list = list;
-            this.timeControl = this.__proto__.getControlItem(["TimeCon"], newVal)[0]
-            this.timeControl.changeItem = ['TimeConOFF', 'TimeConON']
-        },
-        onClick(item) {
-            console.log("分时控制", item)
-            this.$refs.MyInput.openInput(item, item.inputType != "switch")
-            if (this.changeItem.funcname != item.funcname) this.changeItem = JSON.parse(JSON.stringify(item));
-            this.endTime = this.changeItem.showValue.end == '0:0' ? "" : this.changeItem.showValue.end;
-            let toBeUpdated = [];
-            if (item.paramValue.begin) toBeUpdated.push(`开始时间:${item.paramValue.begin}`);
-            if (item.paramValue.end) toBeUpdated.push(`结束时间:${item.paramValue.begin}`);
-            if (item.paramValue.value) toBeUpdated.push(`压力设置:${item.paramValue.value}`);
-            if (toBeUpdated.length) {
-                model.toBeUpdated = '待更新记录:' + toBeUpdated.join(",")
-            }
-        },
-        timeChange(e) {
-            const name = e.currentTarget.dataset.name;
-            this.changeItem.showValue[name] = e.detail.value;
-        },
-        customMethod() {
-            const {
-                showValue,
-                w_functionid,
-                params,
-                index
-            } = this.changeItem,
-                MyInput = this.$refs.MyInput;
-            if (!showValue.begin) return MyInput.submitBreak("还未填写开始时间")
-            if (!showValue.end) return MyInput.submitBreak("还未填写结束时间")
-            if ((showValue.value + '').length == 0) return MyInput.submitBreak("还未设定压力")
-            showValue.value = (showValue.value - 0).toFixed(params[`T${index}_P`].num_scale)
-            MyInput.submit(w_functionid, {
-                [`T${index}H`]: showValue.begin.split(":")[0],
-                [`T${index}M`]: showValue.begin.split(":")[1],
-                [`T${index}H1`]: showValue.end.split(":")[0],
-                [`T${index}M1`]: showValue.end.split(":")[1],
-                [`T${index}_P`]: showValue.value,
-            })
-        }
-    }
-}
+    onClick(item) {
+      console.log("分时控制", item);
+      this.$refs.MyInput.openInput(item, item.inputType != "switch");
+      if (this.changeItem.funcname != item.funcname)
+        this.changeItem = JSON.parse(JSON.stringify(item));
+      this.endTime =
+        this.changeItem.showValue.end == "0:0"
+          ? ""
+          : this.changeItem.showValue.end;
+      let toBeUpdated = [];
+      if (item.paramValue.begin)
+        toBeUpdated.push(`开始时间:${item.paramValue.begin}`);
+      if (item.paramValue.end)
+        toBeUpdated.push(`结束时间:${item.paramValue.begin}`);
+      if (item.paramValue.value)
+        toBeUpdated.push(`压力设置:${item.paramValue.value}`);
+      if (toBeUpdated.length) {
+        model.toBeUpdated = "待更新记录:" + toBeUpdated.join(",");
+      }
+    },
+    timeChange(e) {
+      const name = e.currentTarget.dataset.name;
+      this.changeItem.showValue[name] = e.detail.value;
+    },
+    customMethod() {
+      const { showValue, w_functionid, params, index } = this.changeItem,
+        MyInput = this.$refs.MyInput;
+      if (!showValue.begin) return MyInput.submitBreak("还未填写开始时间");
+      if (!showValue.end) return MyInput.submitBreak("还未填写结束时间");
+      if ((showValue.value + "").length == 0)
+        return MyInput.submitBreak("还未设定压力");
+      showValue.value = (showValue.value - 0).toFixed(
+        params[`T${index}_P`].num_scale
+      );
+      MyInput.submit(w_functionid, {
+        [`T${index}H`]: showValue.begin.split(":")[0],
+        [`T${index}M`]: showValue.begin.split(":")[1],
+        [`T${index}H1`]: showValue.end.split(":")[0],
+        [`T${index}M1`]: showValue.end.split(":")[1],
+        [`T${index}_P`]: showValue.value,
+      });
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 /* 边框 */
 .day-parting-row {
-    display: flex;
-    align-items: center;
-    flex: 1;
-    width: 0;
-    border: 1px solid #dadbde;
-    border-radius: 4px;
-    padding: 6px 9px;
-    height: 35px;
-    font-size: 14px;
-    box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  flex: 1;
+  width: 0;
+  border: 1px solid #dadbde;
+  border-radius: 4px;
+  padding: 6px 9px;
+  height: 35px;
+  font-size: 14px;
+  box-sizing: border-box;
 }
 
 .item {
-    position: relative;
-    padding: 4px 6px 6px;
-    box-sizing: border-box;
-    background: #fff;
-    border-radius: 4px;
-    margin-bottom: 5px;
-
-    .title {
-        margin-bottom: 6px;
-        font-weight: bold;
-    }
+  position: relative;
+  padding: 4px 6px 6px;
+  box-sizing: border-box;
+  background: #fff;
+  border-radius: 4px;
+  margin-bottom: 5px;
 
-    .row {
-        display: flex;
+  .title {
+    margin-bottom: 6px;
+    font-weight: bold;
+  }
 
-        .box {
-            width: 33.33%;
+  .row {
+    display: flex;
 
-            .content {
-                display: flex;
-                margin-top: 6px;
-                align-items: flex-end;
+    .box {
+      width: 33.33%;
 
-                .value {
-                    width: 0;
-                    flex: 1;
-                    color: #333;
-                    font-size: 16px;
-                    flex-shrink: 0;
-                    font-weight: bold;
-                }
+      .content {
+        display: flex;
+        margin-top: 6px;
+        align-items: flex-end;
 
-                .unit {
-                    font-size: 10px;
-                    color: #666;
-                    flex-shrink: 0;
-                    max-width: 50px;
-                }
-            }
+        .value {
+          width: 0;
+          flex: 1;
+          color: #333;
+          font-size: 16px;
+          flex-shrink: 0;
+          font-weight: bold;
         }
 
-
+        .unit {
+          font-size: 10px;
+          color: #666;
+          flex-shrink: 0;
+          max-width: 50px;
+        }
+      }
     }
+  }
 
-    .dot {
-        position: absolute;
-        right: 2px;
-        top: 2px;
-        width: 10px;
-        height: 10px;
-        background: #D9001B;
-        border-radius: 50%;
-    }
+  .dot {
+    position: absolute;
+    right: 2px;
+    top: 2px;
+    width: 10px;
+    height: 10px;
+    background: #d9001b;
+    border-radius: 50%;
+  }
 }
 
 .change-item {
+  .row {
+    display: flex;
+    align-items: center;
+    line-height: 35px;
+    width: 100%;
+    margin-top: 4px;
 
-    .row {
-        display: flex;
-        align-items: center;
-        line-height: 35px;
-        width: 100%;
-        margin-top: 4px;
-
-        .label {
-            width: 80px;
-            flex-shrink: 0;
-        }
+    .label {
+      width: 80px;
+      flex-shrink: 0;
     }
-
+  }
 }
 </style>

+ 196 - 166
pages/facility/detail.vue

@@ -1,189 +1,219 @@
 <template>
-    <view class="container">
-        <cu-custom ref="Dustom" id="custom"
-            bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png"
-            :isBack="true">
-            <block slot="backText">返回</block>
-            <block slot="content">
-                设备详情
-            </block>
-        </cu-custom>
-        <My_listbox ref="List" :pullDown="false" @getlist="loadData">
-            <view class="head">
-                <view class="name">
-                    <text class="status" :style="{ backgroundColor: detail.bgColor }">{{ detail.status
-                    }}</text>
-                    {{ detail.devicename }}
-                </view>
-                <view class="row">
-                    设备编号:{{ detail.serialnumber || ' --' }}
-                </view>
-                <view class="row">
-                    最近上线时间:{{ detail.lastconnecttime || ' --' }}
-                </view>
-            </view>
-            <preview-image ref="轮播图" :attinfos="detail.attinfos" />
-            <view class="ceiling" :style="{ top: tovw(CustomBar) }">
-                <horizontal-direction ref="hd" />
-            </view>
-            <view class="ceiling" :style="{ top: tovw(CustomBar + tabsTop) }">
-                <tabs :tabs="tabs" @changeTab="changeTab" />
-            </view>
-            <control ref="设备控制" :detail="detail" @onUpdate="getDetail" />
-            <daily-record ref="设备日志" :isfeedback="detail.isfeedback" :w_deviceid="w_deviceid" />
-            <preview ref="详情信息" :detail="detail" />
-            <alerts ref="告警记录" :w_deviceid="w_deviceid" />
-            <view style="height: 30px;" />
-        </My_listbox>
-    </view>
+  <view class="container">
+    <cu-custom
+      ref="Dustom"
+      id="custom"
+      bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png"
+      :isBack="true"
+    >
+      <block slot="backText">返回</block>
+      <block slot="content"> 设备详情 </block>
+    </cu-custom>
+    <My_listbox ref="List" :pullDown="false" @getlist="loadData">
+      <view class="head">
+        <view class="name">
+          <text class="status" :style="{ backgroundColor: detail.bgColor }">{{
+            detail.status
+          }}</text>
+          {{ detail.devicename }}
+        </view>
+        <view class="row"> 设备编号:{{ detail.serialnumber || " --" }} </view>
+        <view class="row">
+          最近上线时间:{{ detail.lastconnecttime || " --" }}
+        </view>
+      </view>
+      <preview-image ref="轮播图" :attinfos="detail.attinfos" />
+      <view class="ceiling" :style="{ top: tovw(CustomBar) }">
+        <horizontal-direction ref="hd" />
+      </view>
+      <view class="ceiling" :style="{ top: tovw(CustomBar + tabsTop) }">
+        <tabs :tabs="tabs" @changeTab="changeTab" />
+      </view>
+      <control ref="设备控制" :detail="detail" @onUpdate="getDetail" />
+      <daily-record
+        ref="设备日志"
+        :isfeedback="detail.isfeedback"
+        :w_deviceid="w_deviceid"
+      />
+      <preview ref="详情信息" :detail="detail" />
+      <alerts ref="告警记录" :w_deviceid="w_deviceid" />
+      <view style="height: 30px" />
+    </My_listbox>
+  </view>
 </template>
 
 <script>
-import horizontalDirection from "./modules/horizontalDirection.vue"
-import tabs from "./modules/tabs.vue"
-import preview from "./modules/preview.vue"
-import dailyRecord from "./modules/dailyRecord.vue"
-import control from "./modules/control.vue"
-import previewImage from "./modules/previewImage.vue"
-import alerts from "./modules/alerts.vue"
+import horizontalDirection from "./modules/horizontalDirection.vue";
+import tabs from "./modules/tabs.vue";
+import preview from "./modules/preview.vue";
+import dailyRecord from "./modules/dailyRecord.vue";
+import control from "./modules/control.vue";
+import previewImage from "./modules/previewImage.vue";
+import alerts from "./modules/alerts.vue";
 
 let page = {};
 export default {
-    components: { horizontalDirection, tabs, preview, dailyRecord, control, previewImage, alerts },
-    name: "facilityD",
-    data() {
-        return {
-            CustomBar: 0,
-            tabsTop: 0,
-            w_deviceid: 0,
-            detail: {},
-            showTab: '设备控制',
-            tabs: [{
-                name: '设备控制'
-            }, {
-                name: '设备日志'
-            }, {
-                name: '告警记录'
-            }, {
-                name: '详情信息'
-            }]
-        }
-    },
-    onLoad(options) {
-        this.w_deviceid = options.id;
-    },
-    mounted() {
-        this.CustomBar = -10;
-        this.$refs.List.setHeight();
-    },
-    onShow() {
-        this.getDetail(true)
-        try {
-            this.$Http.openNetwork = this.$refs.轮播图.openNetwork;
-            this.$Http.slideshowSetData = this.$refs.轮播图.setData;
-        } catch (error) {
-            setTimeout(() => { this.$Http.openNetwork = this.$refs.轮播图.openNetwork; this.$Http.slideshowSetData = this.$refs.轮播图.setData }, 100)
-        };
-    },
-    methods: {
-        getDetail(init = false) {
-            this.$Http.basic({
-                "id": 20230615103902,
-                "content": {
-                    nocache: true,
-                    "w_deviceid": this.w_deviceid
-                }
-            }).then(res => {
-                console.log("设备详情", res)
-                if (this.cutoff(res.msg)) return;
-                if (!res.data.miniapppath) {
-                    res.data.miniapppath = require("../../control/pages").getPageName(res.data.prodnum);
-                    if (!res.data.miniapppath) {
-                        //未匹配到设备控制页
-                        this.showTab = '设备日志';
-                        this.tabs.shift()
-                    }
-                }
-                switch (res.data.status) {
-                    case '在线':
-                        res.data.bgColor = "#007aff";
-                        break;
-                    case '禁用':
-                        res.data.bgColor = "#F56C6C";
-                        break;
-                    default:
-                        res.data.bgColor = "#F9AE3D";
-                        break;
-                }
-                this.detail = res.data;
-                if (init) {
-                    let prodnum = res.data.prodnum;
-                    if (res.data.miniapppath) prodnum = res.data.miniapppath.split("-")[1];
-                    this.$refs.hd.getList(this.w_deviceid, prodnum).then(num => this.tabsTop = num)
-                    setTimeout(() => { this.changeTab({ name: this.showTab }, true) }, 100)
-                }
-            })
+  components: {
+    horizontalDirection,
+    tabs,
+    preview,
+    dailyRecord,
+    control,
+    previewImage,
+    alerts,
+  },
+  name: "facilityD",
+  data() {
+    return {
+      CustomBar: 0,
+      tabsTop: 0,
+      w_deviceid: 0,
+      detail: {},
+      showTab: "设备控制",
+      tabs: [
+        {
+          name: "设备控制",
         },
-        changeTab({ name }, init = false) {
-            this.showTab = name;
-            page.show = false;
-            page = this.$refs[name];
-            this.loadData(init);
+        {
+          name: "设备日志",
         },
-        loadData(init) {
-            // show t =加载 f=变化 
-            if ((page.uninitialized && !page.show) || init) {
-                console.log("首次加载", this.showTab)
-                page.show = true;
-                page.initialize(true)
-            } else if (page.show) {
-                page.initialize()
-            } else {
-                page.show = true;
-            }
-        }
+        {
+          name: "告警记录",
+        },
+        {
+          name: "详情信息",
+        },
+      ],
+    };
+  },
+  onLoad(options) {
+    this.w_deviceid = options.id;
+  },
+  mounted() {
+    this.CustomBar = -10;
+    this.$refs.List.setHeight();
+  },
+  onShow() {
+    this.getDetail(true);
+    try {
+      this.$Http.openNetwork = this.$refs.轮播图.openNetwork;
+      this.$Http.slideshowSetData = this.$refs.轮播图.setData;
+    } catch (error) {
+      setTimeout(() => {
+        this.$Http.openNetwork = this.$refs.轮播图.openNetwork;
+        this.$Http.slideshowSetData = this.$refs.轮播图.setData;
+      }, 100);
     }
-}
+  },
+  methods: {
+    getDetail(init = false) {
+      this.$Http
+        .basic({
+          id: 20230615103902,
+          content: {
+            nocache: true,
+            w_deviceid: this.w_deviceid,
+          },
+        })
+        .then((res) => {
+          console.log("设备详情", res);
+          if (this.cutoff(res.msg)) return;
+          if (!res.data.miniapppath) {
+            res.data.miniapppath = require("../../control/pages").getPageName(
+              res.data.prodnum
+            );
+            if (!res.data.miniapppath) {
+              //未匹配到设备控制页
+              this.showTab = "设备日志";
+              this.tabs.shift();
+            }
+          }
+          console.log("res.data.miniapppath", res.data.miniapppath);
+          switch (res.data.status) {
+            case "在线":
+              res.data.bgColor = "#007aff";
+              break;
+            case "禁用":
+              res.data.bgColor = "#F56C6C";
+              break;
+            default:
+              res.data.bgColor = "#F9AE3D";
+              break;
+          }
+          this.detail = res.data;
+          if (init) {
+            let prodnum = res.data.prodnum;
+            if (res.data.miniapppath)
+              prodnum = res.data.miniapppath.split("-")[1];
+            this.$refs.hd
+              .getList(this.w_deviceid, prodnum)
+              .then((num) => (this.tabsTop = num));
+            setTimeout(() => {
+              this.changeTab({ name: this.showTab }, true);
+            }, 100);
+          }
+        });
+    },
+    changeTab({ name }, init = false) {
+      this.showTab = name;
+      page.show = false;
+      page = this.$refs[name];
+      this.loadData(init);
+    },
+    loadData(init) {
+      // show t =加载 f=变化
+      if ((page.uninitialized && !page.show) || init) {
+        console.log("首次加载", this.showTab);
+        page.show = true;
+        page.initialize(true);
+      } else if (page.show) {
+        page.initialize();
+      } else {
+        page.show = true;
+      }
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .ceiling {
-    position: sticky;
-    z-index: 9;
+  position: sticky;
+  z-index: 9;
 }
 
 .head {
-    width: 355px;
-    background: #FFFFFF;
-    border-radius: 4px;
-    padding: 10px 15px;
-    box-sizing: border-box;
-    margin: 10px auto 0;
+  width: 355px;
+  background: #ffffff;
+  border-radius: 4px;
+  padding: 10px 15px;
+  box-sizing: border-box;
+  margin: 10px auto 0;
 
-    .name {
-        line-height: 20px;
-        font-size: 14px;
-        font-family: PingFang SC-Medium, PingFang SC;
-        font-weight: bold;
-        color: #333333;
-        margin-bottom: 10px;
+  .name {
+    line-height: 20px;
+    font-size: 14px;
+    font-family: PingFang SC-Medium, PingFang SC;
+    font-weight: bold;
+    color: #333333;
+    margin-bottom: 10px;
 
-        .status {
-            display: inline-block;
-            padding: 2px 6px;
-            border-radius: 4px;
-            color: #FFFFFF;
-            margin-right: 5px;
-            font-weight: normal;
-            font-size: 14px;
-        }
+    .status {
+      display: inline-block;
+      padding: 2px 6px;
+      border-radius: 4px;
+      color: #ffffff;
+      margin-right: 5px;
+      font-weight: normal;
+      font-size: 14px;
     }
+  }
 
-    .row {
-        line-height: 17px;
-        font-size: 12px;
-        color: #666666;
-        margin-bottom: 5px;
-    }
+  .row {
+    line-height: 17px;
+    font-size: 12px;
+    color: #666666;
+    margin-bottom: 5px;
+  }
 }
 </style>

+ 3 - 2
pages/login/modules/dispose.js

@@ -77,8 +77,9 @@ function toHome() {
     uni.reLaunch({
         url: '/pages/index/index',
     });
-/*     that.$Socket.initSocket()
-    console.log("Socket", that.$Socket) */
+    count = 0;
+    /*     that.$Socket.initSocket()
+        console.log("Socket", that.$Socket) */
 }
 /* 站点数据查询 */
 module.exports = {