Browse Source

时间选择框修改 跳转页面传参修改

bobo04052021@163.com 2 months ago
parent
commit
0eecb89dbe
3 changed files with 42 additions and 50 deletions
  1. 16 24
      pages/history/history.vue
  2. 7 1
      pages/home/home.vue
  3. 19 25
      pages/operation/operation.vue

+ 16 - 24
pages/history/history.vue

@@ -20,16 +20,20 @@
       <view class="u-page">
         <div class="flcard">
           <div class="btns">
-            <u-button
-              type="primary"
-              :text="StartTime ? StartTime : '起始时间'"
-              @click="dataShow = true"
-            ></u-button>
-            <u-button
-              type="primary"
-              :text="EndTime ? EndTime : '结束时间'"
-              @click="dataShow1 = true"
-            ></u-button>
+            <uni-datetime-picker
+              :show="dataShow"
+              mode="datetime"
+              @cancel="dataShow = false"
+              @confirm="selectStartTime"
+              v-model="dataTime"
+            ></uni-datetime-picker>
+            <uni-datetime-picker
+              :show="dataShow1"
+              mode="datetime"
+              @cancel="dataShow1 = false"
+              @confirm="selectEndTime"
+              v-model="dataTime"
+            ></uni-datetime-picker>
           </div>
           <div class="btns" style="margin-top: 10px">
             <u-button
@@ -63,20 +67,6 @@
             keyName="label"
             @confirm="selectSkipTime"
           ></u-picker>
-          <u-datetime-picker
-            :show="dataShow"
-            mode="datetime"
-            @cancel="dataShow = false"
-            @confirm="selectStartTime"
-            v-model="dataTime"
-          ></u-datetime-picker>
-          <u-datetime-picker
-            :show="dataShow1"
-            mode="datetime"
-            @cancel="dataShow1 = false"
-            @confirm="selectEndTime"
-            v-model="dataTime"
-          ></u-datetime-picker>
         </div>
         <u-list
           :class="{ emptyhistory: historyData.length === 0 }"
@@ -177,6 +167,7 @@
 import api from "@/api/api";
 import dayjs from "dayjs";
 import DeviceMenu from "../../pages/device/devicemenu/devicemenu";
+import uniDatetimePicker from "../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue";
 export default {
   data() {
     return {
@@ -245,6 +236,7 @@ export default {
   },
   components: {
     DeviceMenu,
+    uniDatetimePicker,
   },
   props: ["showColum", "deviceType"],
   watch: {

+ 7 - 1
pages/home/home.vue

@@ -288,11 +288,17 @@ export default {
       });
     },
     openNewPage(params) {
+      const reqData = {
+        id: params.deviceID,
+        name: params.strinstallpos,
+        type: this.TabCur,
+      };
+      const reqparams = uni.$u.queryParams(reqData);
       this.getShowList(this.TabCur).then(() => {
         if (this.typeList.length > 0) {
           this.$destroy();
           uni.navigateTo({
-            url: `/pages/home/detail/autodoor/autodoor?id=${params.deviceID}&name=${params.strinstallpos}&type=${this.TabCur}`,
+            url: `/pages/home/detail/autodoor/autodoor${reqparams}`,
           });
         }
       });

+ 19 - 25
pages/operation/operation.vue

@@ -4,16 +4,20 @@
       <view class="u-page">
         <div class="flcard">
           <div class="btns">
-            <u-button
-              type="primary"
-              :text="StartTime ? StartTime : '起始时间'"
-              @click="dataShow = true"
-            ></u-button>
-            <u-button
-              type="primary"
-              :text="EndTime ? EndTime : '结束时间'"
-              @click="dataShow1 = true"
-            ></u-button>
+            <uni-datetime-picker
+              :show="dataShow"
+              mode="datetime"
+              @cancel="dataShow = false"
+              @confirm="selectStartTime"
+              v-model="dataTime"
+            ></uni-datetime-picker>
+            <uni-datetime-picker
+              :show="dataShow1"
+              mode="datetime"
+              @cancel="dataShow1 = false"
+              @confirm="selectEndTime"
+              v-model="dataTime"
+            ></uni-datetime-picker>
             <u-icon
               size="30"
               color="#3c9cff"
@@ -21,20 +25,6 @@
               @click="checkHistoryData"
             ></u-icon>
           </div>
-          <u-datetime-picker
-            :show="dataShow"
-            mode="datetime"
-            @cancel="dataShow = false"
-            @confirm="selectStartTime"
-            v-model="dataTime"
-          ></u-datetime-picker>
-          <u-datetime-picker
-            :show="dataShow1"
-            mode="datetime"
-            @cancel="dataShow1 = false"
-            @confirm="selectEndTime"
-            v-model="dataTime"
-          ></u-datetime-picker>
         </div>
         <u-list>
           <u-list-item
@@ -88,6 +78,7 @@
 <script>
 import api from "@/api/api";
 import dayjs from "dayjs";
+import uniDatetimePicker from "../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue";
 export default {
   data() {
     return {
@@ -102,6 +93,9 @@ export default {
       historyData: [],
     };
   },
+  components: {
+    uniDatetimePicker,
+  },
 
   props: ["showColum", "deviceType"],
   watch: {
@@ -199,7 +193,7 @@ export default {
   display: flex;
 }
 .btns > * {
-  margin-right: 10px; /* 根据需要调整间距大小 */
+  margin-right: 5px; /* 根据需要调整间距大小 */
 }
 
 /* 去除最后一个按钮的右边距 */