xiaohaizhao 1 gadu atpakaļ
vecāks
revīzija
40b96051d8

+ 47 - 30
pages/facility/detail.vue

@@ -10,34 +10,32 @@
         </cu-custom>
         <My_listbox ref="List" :pullDown="false" @getlist="loadData">
             <view class="head">
-                <view class="name">{{ detail.devicename }}</view>
-                <view class="row">
-                    设备编号:{{ detail.serialnumber || ' --' }}
+                <view class="name">
+                    <text class="status" :style="{ backgroundColor: detail.bgColor }">{{ detail.status
+                    }}</text>
+                    {{ detail.devicename }}
                 </view>
                 <view class="row">
-                    设备状态:<text class="status">{{ detail.status }}</text>
-                </view>
-                <view class="row">
-                    区域:{{ (detail.province + detail.city + detail.county) || ' --' }}
-                </view>
-                <view class="row">
-                    设备地址:{{ detail.address || ' --' }}
+                    设备编号:{{ detail.serialnumber || ' --' }}
                 </view>
                 <view class="row">
-                    注册时间:{{ detail.createdate || ' --' }}
+                    最近上线时间:{{ detail.lastconnecttime || ' --' }}
                 </view>
             </view>
 
             <view class="image">
                 图片预留区域
             </view>
-            <horizontal-direction ref="hd" />
-            <view class="tabs" :style="{ top: tovw(CustomBar) }">
+            <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" />
+            <daily-record ref="设备日志" :w_deviceid="w_deviceid" />
             <preview ref="详情信息" :detail="detail" />
-            <queue ref="操作队列" :w_deviceid="detail.w_deviceid" />
-            <record ref="操作记录" :w_deviceid="detail.w_deviceid" />
+
             <view style="height: 30px;" />
         </My_listbox>
     </view>
@@ -47,25 +45,26 @@
 import horizontalDirection from "./modules/horizontalDirection.vue"
 import tabs from "./modules/tabs.vue"
 import preview from "./modules/preview.vue"
-import record from "./modules/record.vue"
-import queue from "./modules/queue.vue"
+import dailyRecord from "./modules/dailyRecord.vue"
+import control from "./modules/control.vue"
 
 let page = {};
 export default {
-    components: { horizontalDirection, tabs, preview, record, queue },
+    components: { horizontalDirection, tabs, preview, dailyRecord, control },
     name: "facilityD",
     data() {
         return {
             CustomBar: 0,
+            tabsTop: 0,
             w_deviceid: 0,
             detail: {},
-            showTab: '详情信息',
+            showTab: '设备控制',
             tabs: [{
-                name: '详情信息'
+                name: '设备控制'
             }, {
-                name: '操作队列',
+                name: '设备日志'
             }, {
-                name: '操作记录'
+                name: '详情信息'
             }]
         }
     },
@@ -74,7 +73,6 @@ export default {
         this.getDetail(true)
     },
     mounted() {
-        // this.$refs.Dustom.CustomBar
         this.CustomBar = -10;
         this.$refs.List.setHeight();
     },
@@ -88,9 +86,20 @@ export default {
             }).then(res => {
                 console.log("设备详情", res)
                 if (this.cutoff(res.msg)) return;
+                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) {
-                    this.$refs.hd.getList(this.w_deviceid);
+                    this.$refs.hd.getList(this.w_deviceid).then(num => this.tabsTop = num)
                     setTimeout(() => { this.changeTab({ name: this.showTab }, true) }, 100)
                 }
             })
@@ -118,10 +127,10 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.tabs {
+.ceiling {
     position: sticky;
-    box-shadow: rgba(0, 0, 0, 0.45) 0px 25px 20px -20px;
-    z-index: 99;
+    box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px;
+    z-index: 9;
 }
 
 .head {
@@ -139,6 +148,16 @@ export default {
         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;
+        }
     }
 
     .row {
@@ -147,9 +166,7 @@ export default {
         color: #666666;
         margin-bottom: 5px;
 
-        .status {
-            color: #3874F6;
-        }
+
     }
 }
 

+ 5 - 4
pages/facility/index.vue

@@ -8,7 +8,8 @@
                 设备中心
             </block>
         </cu-custom>
-        <My_search :heightReduction="heightReduction" ref="Search" @onFilter="onFilter" @startSearch="startSearch" :filter="filter">
+        <My_search :heightReduction="heightReduction" ref="Search" @onFilter="onFilter" @startSearch="startSearch"
+            :filter="filter">
             <template slot="left">
                 <view class="change" hover-class="navigator-hover" @click="changePage(PageCur == '设备列表' ? '设备地图' : '设备列表')">
                     {{ PageCur == '设备列表' ? '列表' : '地图' }}
@@ -116,13 +117,13 @@ export default {
                 this.list = res.data.map(v => {
                     switch (v.status) {
                         case '在线':
-                            v.bgColor = "#3874F6";
+                            v.bgColor = "#3C9CFF";
                             break;
                         case '禁用':
-                            v.bgColor = "#EB4B5C";
+                            v.bgColor = "#F56C6C";
                             break;
                         default:
-                            v.bgColor = "#BBBBBB";
+                            v.bgColor = "#F9AE3D";
                             break;
                     }
                     return v

+ 29 - 0
pages/facility/modules/control.vue

@@ -0,0 +1,29 @@
+<template>
+    <view v-show="show">
+        设备控制
+        <prodnum-06 v-if="detail.prodnum == '06'" />
+    </view>
+</template>
+
+<script>
+export default {
+    components: {},
+    name: "control",
+    props: {
+        detail: Object
+    },
+    data() {
+        return {
+            show: false,
+            uninitialized: true
+        }
+    },
+    methods: {
+        initialize(init = false) {
+            console.log(this.detail)
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 125 - 0
pages/facility/modules/dailyRecord.vue

@@ -0,0 +1,125 @@
+<template>
+    <view v-show="show">
+        <view class="head">
+            <view class="left" hover-class="navigator-hover" @click="actionShow = true">
+                {{ showPage }} <text class="iconfont icon-xiangxiazhankai" style="margin-left:4px;" />
+            </view>
+            <time-horizon @onConfirm="dateRange" />
+        </view>
+        <record ref="操作记录" :w_deviceid="w_deviceid" />
+        <queue ref="操作队列" :w_deviceid="w_deviceid" />
+        <upload-record ref="上传记录" :w_deviceid="w_deviceid" />
+        <u-action-sheet :actions="actions" cancelText="取消" :show="actionShow" @select="selectClick"
+            :closeOnClickOverlay="true" :closeOnClickAction="false" @close="actionClose" />
+    </view>
+</template>
+
+<script>
+let page = {}
+import record from "./record.vue"
+import queue from "./queue.vue"
+import uploadRecord from "./uploadRecord.vue"
+
+
+export default {
+    components: { record, queue, uploadRecord },
+    name: "dailyRecord",
+    props: {
+        w_deviceid: String
+    },
+    data() {
+        return {
+            show: false,
+            uninitialized: true,
+            showPage: "操作记录",
+            actionShow: false,
+            actions: [{
+                name: '操作记录',
+                loading: false,
+                disabled: true
+            }, {
+                name: '操作队列',
+                loading: false,
+                disabled: false
+            }, {
+                name: '上传记录',
+                loading: false,
+                disabled: false
+            }],
+        }
+    },
+    methods: {
+        initialize(init = false) {
+            this.loadData(init)
+        },
+        actionClose() {
+            this.actionShow = false;
+            setTimeout(() => {
+                this.actions.forEach(option => {
+                    option.disabled = option.name == this.showPage;
+                    option.loading = false;
+                });
+            }, 100)
+        },
+        selectClick(result) {
+            page.show = false;
+            this.showPage = result.name;
+            this.actions.forEach(option => {
+                option.disabled = true;
+                option.loading = option.name == result.name;
+                if (option.name == result.name) this.loadData()
+            });
+        },
+        loadData(init) {
+            page = this.$refs[this.showPage];
+            if ((page.uninitialized && !page.show) || init) {
+                page.show = true;
+                page.getList(true).then(res => {
+                    page.uninitialized = !res;
+                    this.uninitialized = false;
+                    this.actionClose()
+                })
+            } else if (page.show) {
+                page.getList()
+            } else {
+                page.show = true;
+                this.actionClose();
+            }
+        },
+        dateRange(range, fun) {
+            let where = page.where;
+            if (where.begindate == range[0] && where.enddate == range[1]) return fun();
+            this.actions.forEach(v => {
+                let p = this.$refs[v.name];
+                if (p) {
+                    p.where.begindate = range[0];
+                    p.where.enddate = range[1];
+                    p.uninitialized = true;
+                };
+            })
+            page.getList(true).then(res => {
+                page.uninitialized = !res;
+                fun();
+            })
+        }
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.head {
+    height: 40px;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    width: 355px;
+    margin: 0 auto;
+    box-sizing: border-box;
+    padding: 0 10px;
+
+    .left {
+        color: #fff;
+        font-weight: bold;
+    }
+}
+</style>

+ 12 - 9
pages/facility/modules/horizontalDirection.vue

@@ -26,15 +26,18 @@ export default {
     },
     methods: {
         getList(w_deviceid) {
-            this.$Http.basic({
-                "id": 20230711165702,
-                "content": {
-                    w_deviceid
-                }
-            }).then(res => {
-                console.log("设备实时数据查询", res)
-                if (this.cutoff(res.msg)) return;
-                this.list = res.data;
+            return new Promise((resolve, reject) => {
+                this.$Http.basic({
+                    "id": 20230711165702,
+                    "content": {
+                        w_deviceid
+                    }
+                }).then(res => {
+                    console.log("设备实时数据查询", res)
+                    if (this.cutoff(res.msg)) return resolve(0)
+                    this.list = res.data;
+                    resolve(res.data.length ? 49 : 0)
+                })
             })
         }
     }

+ 5 - 2
pages/facility/modules/operateList.vue

@@ -3,10 +3,13 @@
         <view class="item" v-for="item in list" :key="item.rowindex">
             <view class="title">{{ item.funcname || ' --' }}</view>
             <view class="row">
-                时间:{{ item.createdate }}
+                操作人:{{ item.createby }} 操作时间:{{ item.createdate }}
+            </view>
+            <view class="row">
+                最近发送时间:{{ item.lastsendtime }}
             </view>
             <view class="row" v-for="(it, index) in item.content" :key="index">
-                {{ it.title }}:{{ item.value || ' --' }}
+                {{ it.title }}:{{ it.value || ' --' }}
             </view>
         </view>
         <view v-if="!list.length" style="position: relative; z-index: 1 !important;">

+ 6 - 7
pages/facility/modules/preview.vue

@@ -26,12 +26,11 @@
             </view>
             <view class="row" v-if="!reverlAll || detail.status">
                 <view class="row-label">设备状态</view>
-                <view class="row-value" style="color:#3874F6 ;">{{ detail.status || ' --' }}</view>
+                <view class="row-value" :style="{ color: detail.bgColor }">{{ detail.status || ' --' }}</view>
             </view>
-            <view class="row" v-if="!reverlAll || detail.county">
+            <view class="row" v-if="!reverlAll || detail.areaname">
                 <view class="row-label">区域</view>
-                <view class="row-value">{{ detail.county ? detail.province + ',' + detail.city + ',' + detail.county : ' --'
-                }}</view>
+                <view class="row-value">{{ detail.areaname || ' --' }}</view>
             </view>
             <view class="row" v-if="!reverlAll || detail.county">
                 <view class="row-label">省市县</view>
@@ -47,9 +46,9 @@
                 <view class="row-label">所属产品</view>
                 <view class="row-value">{{ detail.prodname || ' --' }}</view>
             </view>
-            <view class="row" v-if="!reverlAll || detail.createdate">
-                <view class="row-label">注册时间</view>
-                <view class="row-value">{{ detail.createdate || ' --' }}</view>
+            <view class="row" v-if="!reverlAll || detail.lastconnecttime">
+                <view class="row-label">最近上线时间</view>
+                <view class="row-value">{{ detail.lastconnecttime || ' --' }}</view>
             </view>
             <view class="row" v-if="!reverlAll || detail.remarks">
                 <view class="row-label">描述</view>

+ 24 - 39
pages/facility/modules/queue.vue

@@ -1,8 +1,5 @@
 <template>
     <view v-show="show">
-        <view class="search">
-            <My_search @onFilter="onFilter" @startSearch="startSearch" />
-        </view>
         <operate-list :list="list" />
     </view>
 </template>
@@ -14,57 +11,45 @@ export default {
     components: { operateList },
     name: "queue",
     props: {
-        w_deviceid: Number || String
+        w_deviceid: String
     },
     data() {
         return {
             show: false,
             uninitialized: true,
-            list: []
+            list: [],
+            "where": {
+                "begindate": "",
+                "enddate": ""
+            }
         }
     },
     methods: {
-        initialize(init) {
-            if (init) {
-                this.getList(true)
-            } else {
-                this.getList()
-            }
-        },
         getList(init = false) {
             if (init) paging = {
                 pageNumber: 1,
                 pageTotal: 1,
             };
-            if (paging.pageNumber > paging.pageTotal) return;
-            this.$Http.basic({
-                "id": 20230701132202,
-                "content": {
-                    "type": 2,
-                    "w_deviceid": this.w_deviceid,
-                    ...paging,
-                    "where": {
-                        "begindate": "",
-                        "enddate": ""
+            return new Promise((resolve) => {
+                if (paging.pageNumber > paging.pageTotal) return resolve()
+                this.$Http.basic({
+                    "id": 20230701132202,
+                    "content": {
+                        "type": 2,
+                        "w_deviceid": this.w_deviceid,
+                        ...paging,
+                        "where": this.where
                     }
-                }
-            }).then(res => {
-                console.log('操作记录', res)
-                if (this.cutoff(res.msg)) return;
-                if (init) this.uninitialized = false;
-                paging.pageNumber = res.pageNumber + 1;
-                paging.pageTotal = res.pageTotal;
-                this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data)
+                }).then(res => {
+                    console.log('操作队列', res)
+                    resolve(!this.cutoff(res.msg));
+                    if (this.cutoff(res.msg)) return;
+                    paging.pageNumber = res.pageNumber + 1;
+                    paging.pageTotal = res.pageTotal;
+                    this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data)
+                })
             })
-        },
-        startSearch(condition) {
-            if (condition == this.condition) return;
-            this.condition = condition;
-            this.getList(true)
-        },
-        onFilter(e) {
-            console.log("开始筛选", e)
-        },
+        }
     },
 }
 </script>

+ 26 - 47
pages/facility/modules/record.vue

@@ -1,8 +1,5 @@
 <template>
     <view v-show="show">
-        <view class="search">
-            <My_search @onFilter="onFilter" @startSearch="startSearch" />
-        </view>
         <operate-list :list="list" />
     </view>
 </template>
@@ -14,67 +11,49 @@ export default {
     components: { operateList },
     name: "record",
     props: {
-        w_deviceid: Number || String
+        w_deviceid: String
     },
     data() {
         return {
             show: false,
             uninitialized: true,
             list: [],
-            condition: ""
+            "where": {
+                "begindate": "",
+                "enddate": ""
+            }
         }
     },
     methods: {
-        initialize(init) {
-            if (init) {
-                this.getList(true)
-            } else {
-                this.getList()
-            }
-        },
         getList(init = false) {
             if (init) paging = {
                 pageNumber: 1,
                 pageTotal: 1,
             };
-            if (paging.pageNumber > paging.pageTotal) return;
-            this.$Http.basic({
-                "id": 20230701132202,
-                "content": {
-                    "type": 0,
-                    "w_deviceid": this.w_deviceid,
-                    ...paging,
-                    "where": {
-                        condition: this.condition,
-                        "begindate": "",
-                        "enddate": ""
+            return new Promise((resolve) => {
+                if (paging.pageNumber > paging.pageTotal) return resolve()
+                this.$Http.basic({
+                    "id": 20230701132202,
+                    "content": {
+                        "type": 0,
+                        "w_deviceid": this.w_deviceid,
+                        ...paging,
+                        where: this.where
                     }
-                }
-            }).then(res => {
-                console.log('操作记录', res)
-                if (this.cutoff(res.msg)) return;
-                if (init) this.uninitialized = false;
-                paging.pageNumber = res.pageNumber + 1;
-                paging.pageTotal = res.pageTotal;
-                this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data)
+                }).then(res => {
+                    console.log('操作记录', res)
+                    resolve(!this.cutoff(res.msg));
+                    if (this.cutoff(res.msg)) return;
+                    if (init) this.uninitialized = false;
+                    paging.pageNumber = res.pageNumber + 1;
+                    paging.pageTotal = res.pageTotal;
+                    this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
+                })
             })
-        },
-        startSearch(condition) {
-            if (condition == this.condition) return;
-            this.condition = condition;
-            this.getList(true)
-        },
-        onFilter(e) {
-            console.log("开始筛选", e)
-        },
+
+        }
     },
 }
 </script>
 
-<style lang="scss" scoped>
-.search {
-    position: sticky;
-    top: 34px;
-    z-index: 998;
-}
-</style>
+<style lang="scss" scoped></style>

+ 124 - 0
pages/facility/modules/uploadRecord.vue

@@ -0,0 +1,124 @@
+<template>
+    <view v-show="show">
+        <view class="item" @click="openModel(item)" hover-class="navigator-hover" v-for="item in list" :key="item.rowindex">
+            <view class="title">{{ item.createdate || ' --' }}</view>
+            <view class="row u-line-3">
+                {{ item.content }}
+            </view>
+        </view>
+
+        <u-modal :show="modleShow" confirmText="复制" cancelText="关闭" :showCancelButton="true" @cancel="onCancel"
+            @confirm="onConfirm">
+            <template slot="default">
+                <view>
+                    <view style="width: 100%;text-align: center;font-weight: bold;margin-bottom: 20px;">
+                        {{ modle.createdate }}
+                    </view>
+                    <view style="word-break: break-all;">
+                        {{ modle.content }}
+                    </view>
+                </view>
+            </template>
+        </u-modal>
+    </view>
+</template>
+
+<script>
+let paging = {}
+export default {
+    name: "uploadRecord",
+    props: {
+        w_deviceid: String
+    },
+    data() {
+        return {
+            show: false,
+            uninitialized: true,
+            list: [],
+            "where": {
+                "begindate": "",
+                "enddate": ""
+            },
+            modle: {},
+            modleShow: false
+        }
+    },
+    methods: {
+        getList(init = false) {
+            if (init) paging = {
+                pageNumber: 1,
+                pageTotal: 1,
+            };
+            return new Promise((resolve) => {
+                if (paging.pageNumber > paging.pageTotal) return resolve()
+                this.$Http.basic({
+                    "id": 20230701132202,
+                    "content": {
+                        "type": 1,
+                        "w_deviceid": this.w_deviceid,
+                        ...paging,
+                        "where": this.where
+                    }
+                }).then(res => {
+                    console.log('上传记录', res)
+                    resolve(!this.cutoff(res.msg));
+                    if (this.cutoff(res.msg)) return;
+                    paging.pageNumber = res.pageNumber + 1;
+                    paging.pageTotal = res.pageTotal;
+                    this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data)
+                })
+            })
+        },
+        openModel(item) {
+            this.modle = item;
+            this.modleShow = true;
+
+        },
+        onCancel() {
+            this.modleShow = false;
+        },
+        onConfirm() {
+            let that = this;
+            uni.setClipboardData({
+                data: this.modle.content,
+                complete: (res) => {
+                    console.log("复制", res)
+                    this.onCancel();
+                },
+            })
+        }
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.item {
+    width: 355px;
+    margin: 0 auto 10px;
+    padding: 10px;
+    background: #fff;
+    border-radius: 4px;
+    box-sizing: border-box;
+
+    .title {
+        line-height: 21px;
+        font-size: 15px;
+        font-family: PingFang SC-Medium, PingFang SC;
+        font-weight: bold;
+        color: #333333;
+        margin-bottom: 10px;
+    }
+
+    .row {
+        line-height: 17px;
+        font-size: 12px;
+        color: #666666;
+        margin-bottom: 5px;
+    }
+}
+
+
+/deep/.u-empty {
+    z-index: 1 !important;
+}
+</style>