wangming преди 1 месец
родител
ревизия
ecbfe07194
променени са 1 файла, в които са добавени 55 реда и са изтрити 2 реда
  1. 55 2
      src/pagesA/playSetting/playSetting.vue

+ 55 - 2
src/pagesA/playSetting/playSetting.vue

@@ -69,7 +69,7 @@
         </view>
 
         <!-- 生效时段 -->
-        <view class="time-container">
+        <view class="time-container" v-if="judgeFlage != 'noneFlag'">
             <text class="input-label">生效时段:</text>
             <view class="time-picker-container">
                 <picker
@@ -161,11 +161,45 @@ export default {
             timeRange: [],
             thresholdTime: 300,
             mergeTime: 30,
+            judgeFlage: "",
             remark: "",
         };
     },
     methods: {
         saveTemplate() {
+            // 1 2 3 9
+            // 允许多个时间
+            // 5 7
+            // 只有一个时间
+            // 4 6 8
+            // 不配生效时间
+
+            if (this.judgeFlage == "noneFlag") {
+                this.timeRange = [
+                    {
+                        start_time: "00:00",
+                        end_time: "23:59",
+                    },
+                ];
+            } else if (this.judgeFlage == "one" && this.timeRange.length > 1) {
+                uni.showModal({
+                    title: "提示",
+                    content: "此事件类型只能选择一个生效时段",
+                    showCancel: false,
+                });
+                return;
+            }
+            if (this.enable == true) {
+                this.enable = 1;
+            } else {
+                this.enable = 0;
+            }
+            if (this.linkagePushWechatService == true) {
+                this.linkagePushWechatService = 1;
+            } else {
+                this.linkagePushWechatService = 0;
+            }
+
             let planInfo = {
                 alarmPlanId: this.planInfo.id,
                 name: this.planInfo.name,
@@ -208,7 +242,7 @@ export default {
                 .then((res) => {
                     if (res.data.code == 200) {
                         uni.showToast({
-                            title: "保存成功",
+                            title: "修改成功",
                             icon: "success",
                         });
                         setTimeout(() => {
@@ -216,6 +250,12 @@ export default {
                                 delta: 1,
                             });
                         }, 1000);
+                    } else {
+                        uni.showToast({
+                            title: res.data.message,
+                            icon: "none",
+                            duration: 1500,
+                        });
                     }
                 });
         },
@@ -279,6 +319,19 @@ export default {
         this.eventType = this.planInfo.eventVal;
         this.linkagePushWechatService = this.planInfo.linkagePushWechatService;
         this.enable = this.planInfo.enable;
+
+        if (this.eventType == 4 || this.eventType == 6 || this.eventType == 8) {
+            this.judgeFlage = "noneFlag";
+        } else if (this.eventType == 5 || this.eventType == 7) {
+            this.judgeFlage = "one";
+        } else if (
+            this.eventType == 1 ||
+            this.eventType == 2 ||
+            this.eventType == 3 ||
+            this.eventType == 9
+        ) {
+            this.judgeFlage = "more";
+        }
     },
     onShow() {
         this.linkagePushWechatService =