Browse Source

新增异常信息

wangming 1 month ago
parent
commit
a3a5e7716d
1 changed files with 65 additions and 18 deletions
  1. 65 18
      src/pagesA/abnormalInfo/abnormalInfo.vue

+ 65 - 18
src/pagesA/abnormalInfo/abnormalInfo.vue

@@ -1,16 +1,32 @@
 <template>
 <template>
     <view class="box">
     <view class="box">
-        <!-- <view class="search-box">
+        <view class="search-box">
             <view class="search-input">
             <view class="search-input">
-                <input
-                    type="text"
-                    placeholder="输入设备全称或简称"
-                    v-model="devName"
-                    placeholder-class="placeholder-style"
-                />
+                <view class="searchPicker">
+                    <picker
+                        mode="date"
+                        :value="createTimeStart"
+                        :start="startDate"
+                        :end="endDate"
+                        @change="bindDateChangeOne"
+                    >
+                        <view class="uni-input">{{
+                            createTimeStart
+                        }}</view> </picker
+                    >-
+                    <picker
+                        mode="date"
+                        :value="createTimeEnd"
+                        :start="startDate"
+                        :end="endDate"
+                        @change="bindDateChangeTwo"
+                    >
+                        <view class="uni-input">{{ createTimeEnd }}</view>
+                    </picker>
+                </view>
             </view>
             </view>
-            <view class="search-btn" @click="searchBox"> 搜索 </view>
-        </view> -->
+            <view class="search-btn" @click="searchBox()"> 搜索 </view>
+        </view>
 
 
         <template v-if="alarmRetentionLists.length > 0">
         <template v-if="alarmRetentionLists.length > 0">
             <view
             <view
@@ -87,12 +103,23 @@ export default {
             onReachJudge: true,
             onReachJudge: true,
             warmTypeList: [],
             warmTypeList: [],
             isInitAlarm: "",
             isInitAlarm: "",
+            createTimeStart: "",
+            createTimeEnd: "",
         };
         };
     },
     },
+    computed: {
+        startDate() {
+            return this.getDate("start");
+        },
+        endDate() {
+            return this.getDate("end");
+        },
+    },
     methods: {
     methods: {
         searchBox() {
         searchBox() {
             this.pageNo = 1;
             this.pageNo = 1;
             this.alarmRetentionLists = [];
             this.alarmRetentionLists = [];
+            this.onReachJudge = true;
             this.getWarnList();
             this.getWarnList();
         },
         },
         getWarnList() {
         getWarnList() {
@@ -106,6 +133,8 @@ export default {
                     {
                     {
                         pageNo: this.pageNo,
                         pageNo: this.pageNo,
                         pageSize: this.pageSize,
                         pageSize: this.pageSize,
+                        createTimeStart: this.createTimeStart,
+                        createTimeEnd: this.createTimeEnd,
                     },
                     },
                     {
                     {
                         header: {
                         header: {
@@ -149,6 +178,26 @@ export default {
                     ?.itemName || "未知"
                     ?.itemName || "未知"
             );
             );
         },
         },
+        getDate(type) {
+            const date = new Date();
+            let year = date.getFullYear();
+            let month = date.getMonth() + 1;
+            let day = date.getDate();
+            if (type === "start") {
+                year = year - 180;
+            } else if (type === "end") {
+                year = year + 180;
+            }
+            month = month > 9 ? month : "0" + month;
+            day = day > 9 ? day : "0" + day;
+            return `${year}-${month}-${day}`;
+        },
+        bindDateChangeOne(e) {
+            this.createTimeStart = e.detail.value;
+        },
+        bindDateChangeTwo(e) {
+            this.createTimeEnd = e.detail.value;
+        },
     },
     },
     onReachBottom() {
     onReachBottom() {
         this.pageNo += 1;
         this.pageNo += 1;
@@ -164,6 +213,8 @@ export default {
     },
     },
     onShow() {
     onShow() {
         this.onReachJudge = true;
         this.onReachJudge = true;
+        this.createTimeStart = this.$time(new Date());
+        this.createTimeEnd = this.$time(new Date());
         Promise.all([this.getWarnList()]).then(() => {
         Promise.all([this.getWarnList()]).then(() => {
             this.getwarmType();
             this.getwarmType();
         });
         });
@@ -219,15 +270,11 @@ export default {
             height: 100%;
             height: 100%;
             padding: 0 20rpx;
             padding: 0 20rpx;
 
 
-            input {
-                width: 100%;
-                height: 100%;
-                font-size: 28rpx;
-            }
-
-            .placeholder-style {
-                color: #999;
-                font-size: 28rpx;
+            .searchPicker {
+                display: flex;
+                padding-top: 20rpx;
+                justify-content: space-between;
+                align-content: center;
             }
             }
         }
         }