소스 검색

修改新增模版

wangming 1 개월 전
부모
커밋
2f76cce6b1
5개의 변경된 파일154개의 추가작업 그리고 33개의 파일을 삭제
  1. 2 2
      src/components/js_sdk/index.js
  2. 4 4
      src/pagesA/devices/devices.vue
  3. 16 4
      src/pagesA/healthAlarm/healthAlarm.vue
  4. 107 23
      src/pagesA/playSetting/playSetting.vue
  5. 25 0
      www.json

+ 2 - 2
src/components/js_sdk/index.js

@@ -5,9 +5,9 @@ http.setConfig(config => {
     if (__wxConfig.envVersion == 'develop') {
         let selectedService = uni.getStorageSync("sercviceChoice")
         if (!selectedService || selectedService == 'aloneServe') {
-            // config.baseUrl = "https://api.radar-power.asia:4443/portal-service-server/";
+            config.baseUrl = "https://api.radar-power.asia:4443/portal-service-server/";
         }
-        config.baseUrl = "https://radar-power.cn/portal-service-server/";
+        // config.baseUrl = "https://radar-power.cn/portal-service-server/";
     }
     if (__wxConfig.envVersion == 'trial') {
         let selectedService = uni.getStorageSync("sercviceChoice")

+ 4 - 4
src/pagesA/devices/devices.vue

@@ -30,19 +30,19 @@
                     <image src="../../static/arrTwo.png" mode="" />
                 </view>
                 <view v-if="item.online == 1">
-                    <view class="online" v-if="item.judge">
+                    <view class="online" v-if="item.existFlag == 1">
                         <view class="cardInfo">当前有人</view>
                         <view class="wcTimes" v-if="item.wcTimes"
                             >今日卫生间使用频率{{ item.wcTimes }}次</view
                         >
                     </view>
                     <view class="cardTwo" v-else>
-                        <view class="cardError" v-if="item.lastTargetTime"
+                        <view class="cardError" v-if="item.presenceChangeTime"
                             >当前无人</view
                         >
-                        <view class="endTime" v-if="item.lastTargetTime"
+                        <view class="endTime" v-if="item.presenceChangeTime"
                             >离开时间
-                            {{ forMateTime(item.lastTargetTime) }}</view
+                            {{ forMateTime(item.presenceChangeTime) }}</view
                         >
                         <view class="cardError" v-else>当前无人</view>
                     </view>

+ 16 - 4
src/pagesA/healthAlarm/healthAlarm.vue

@@ -99,9 +99,10 @@ export default {
         },
         confirmSelect() {
             if (this.selectedIndex !== null) {
-                let selectedPlan = this.planList.find(
+                let selectePlans = this.planList.find(
                     (plan) => plan.name == this.planListName[this.selectedIndex]
                 );
+                let selectedPlan = {};
                 selectedPlan.clientId = this.devInfo.clientId;
                 if (!selectedPlan.alarmTimePlan) {
                     this.$set(selectedPlan, "alarmTimePlan", {});
@@ -116,7 +117,20 @@ export default {
                     ),
                     1
                 );
+                selectedPlan.alarmTimePlan.timeRange =
+                    selectePlans.alarmTimePlanTpl.timeRange;
+                selectedPlan.alarmTimePlan.monthDays =
+                    selectePlans.alarmTimePlanTpl.monthDays;
+                selectedPlan.alarmTimePlan.weekdays =
+                    selectePlans.alarmTimePlanTpl.weekdays;
+                selectedPlan.name = selectePlans.name;
+                selectedPlan.enable = 1;
+                selectedPlan.linkagePushWechatService = 1;
+                selectedPlan.eventVal = selectePlans.eventVal;
 
+                // selectedPlan.alarmPlanId = selectePlans.id;
+
+                // console.log(selectedPlan, 888888888);
                 this.$http
                     .post(
                         "wap/alarm/plan/save",
@@ -172,9 +186,7 @@ export default {
                 )
                 .then((res) => {
                     if (res.data.code == 200) {
-                        if (res.data.data.length > 0) {
-                            this.selectedPlan = res.data.data;
-                        }
+                        this.selectedPlan = res.data.data;
                     }
                 });
         },

+ 107 - 23
src/pagesA/playSetting/playSetting.vue

@@ -10,6 +10,25 @@
                 placeholder="请输入计划名称"
             />
         </view>
+        <!-- <view class="input-container">
+            <text class="input-label">触发阈值:</text>
+            <input
+                class="input-field"
+                type="number"
+                v-model="thresholdTime"
+                placeholder="请输入触发阈值"
+            />
+        </view>
+
+        <view class="input-container">
+            <text class="input-label">归并时间:</text>
+            <input
+                class="input-field"
+                type="number"
+                v-model="mergeTime"
+                placeholder="请输入归并时间"
+            />
+        </view> -->
 
         <!-- 事件类型选择 -->
         <view class="select-container">
@@ -18,7 +37,7 @@
                 class="input-field"
                 type="text"
                 v-model="eventType.eventDesc"
-                placeholder="请输入计划类型"
+                placeholder="请选择计划类型"
                 disabled="true"
             />
         </view>
@@ -88,12 +107,16 @@
         </view>
 
         <!-- 告警提醒 -->
-        <view class="switch-container">
+        <view class="switch-container" style="margin-top: 20rpx">
             <text class="input-label">告警联动(服务号推送):</text>
             <switch
-                v-model="isAlarmActive"
+                :value="linkagePushWechatService"
+                @change="onChangeLian"
+                :active-value="1"
+                :inactive-value="0"
+                size="24px"
                 active-color="#07c160"
-                inactive-color="#ccc"
+                inactive-color="#eeeff1"
             />
         </view>
 
@@ -101,9 +124,13 @@
         <view class="switch-container">
             <text class="input-label">是否启用:</text>
             <switch
-                v-model="isEnabled"
+                :value="enable"
+                @change="onChangeQi"
+                :active-value="1"
+                :inactive-value="0"
+                size="24px"
                 active-color="#07c160"
-                inactive-color="#ccc"
+                inactive-color="#eeeff1"
             />
         </view>
 
@@ -129,15 +156,68 @@ export default {
             planInfo: {},
             warmTypeList: [],
             eventType: "",
+            linkagePushWechatService: 1,
+            enable: 1,
             timeRange: [],
+            thresholdTime: 300,
+            mergeTime: 30,
+            remark: "",
         };
     },
     methods: {
         saveTemplate() {
-            uni.showToast({
-                title: "保存成功",
-                icon: "success",
-            });
+            let planInfo = {
+                alarmPlanId: this.planInfo.id,
+                name: this.planInfo.name,
+                clientId: this.planInfo.clientId,
+                eventVal: this.planInfo.eventVal,
+                thresholdTime: this.thresholdTime,
+                mergeTime: this.mergeTime,
+                linkagePushWechatService: this.linkagePushWechatService,
+                enable: this.enable,
+                alarmTimePlan: {
+                    id: this.planInfo.alarmTimePlan.id,
+                    startDate: this.startDate,
+                    stopDate: this.stopDate,
+                    timeRange: JSON.stringify(this.timeRange),
+                    monthDays: this.planInfo.alarmTimePlan.monthDays,
+                    weekdays: this.planInfo.alarmTimePlan.weekdays,
+                },
+            };
+            if (
+                this.planInfo.eventVal == 5 ||
+                this.planInfo.eventVal == 4 ||
+                this.planInfo.eventVal == 8
+            ) {
+                planInfo.param = JSON.stringify(this.timeRange);
+            }
+
+            console.log(planInfo, 9999);
+
+            this.$http
+                .post(
+                    "wap/alarm/plan/save",
+                    { ...planInfo },
+                    {
+                        header: {
+                            "Content-Type": "application/json",
+                            token: uni.getStorageSync("tokenValue") || "",
+                        },
+                    }
+                )
+                .then((res) => {
+                    if (res.data.code == 200) {
+                        uni.showToast({
+                            title: "保存成功",
+                            icon: "success",
+                        });
+                        setTimeout(() => {
+                            uni.navigateBack({
+                                delta: 1,
+                            });
+                        }, 1000);
+                    }
+                });
         },
         handlePlanInfo() {
             console.log(this.planInfo, 9999999);
@@ -172,34 +252,38 @@ export default {
                 end_time: this.effectiveEnd,
             });
         },
-
         removeTime(index) {
             this.timeRange.splice(index, 1);
         },
+        onChangeLian(e) {
+            let newValue = e.detail.value == true ? 1 : 0;
+            this.linkagePushWechatService = newValue.toString();
+        },
+        onChangeQi(e) {
+            let newValue = e.detail.value == true ? 1 : 0;
+            this.enable = newValue.toString();
+        },
     },
     onLoad(options) {
         this.planInfo = JSON.parse(options.planInfo);
+
+        console.log(this.planInfo, 9999999);
         this.startDate =
             this.planInfo?.alarmTimePlan.startDate?.slice(0, 10) || "";
         this.stopDate =
             this.planInfo?.alarmTimePlan.stopDate?.slice(0, 10) || "";
-        // if (this.planInfo.alarmTimePlan.timeRange) {
-        //     const fixedTimeRange =
-        //         this.planInfo.alarmTimePlan.timeRange.replace(/\]\[/g, "},{");
-        //     const correctedString = "[" + fixedTimeRange + "]";
-        //     try {
-        //         this.timeRange = JSON.parse(correctedString);
-        //         console.log(this.timeRange, 8870);
-        //     } catch (e) {
-        //         console.error("JSON解析失败:", e);
-        //     }
-        // }
+
         if (this.planInfo.alarmTimePlan.timeRange) {
             this.timeRange = JSON.parse(this.planInfo.alarmTimePlan.timeRange);
         }
-        this.timeRange = JSON.parse(this.timeRange);
+        this.eventType = this.planInfo.eventVal;
+        this.linkagePushWechatService = this.planInfo.linkagePushWechatService;
+        this.enable = this.planInfo.enable;
     },
     onShow() {
+        this.linkagePushWechatService =
+            this.planInfo.linkagePushWechatService == 1 ? true : false;
+        this.enable = this.planInfo.enable == 1 ? true : false;
         this.getWarnType();
     },
 };

+ 25 - 0
www.json

@@ -0,0 +1,25 @@
+{
+    "id": 2107846690,
+    "uuid": "73c41f7c-4740-4f6e-81a3-69ea90e9610d",
+    "name": "wm测试告警计划",
+    "clientId": "94A9900B0B51",
+    "enable": null,
+    "region": null,
+    "eventVal": null,
+    "alarmTimePlanId": 908238896,
+    "thresholdTime": null,
+    "mergeTime": null,
+    "param": null,
+    "linkagePushWechatService": null,
+    "createTime": "2025-09-10 10:18:20",
+    "updateTime": "2025-09-10 10:18:20",
+    "remark": null,
+    "alarmTimePlan": {
+        "id": 908238896,
+        "startDate": "2025-09-10 10:18:18",
+        "stopDate": "2026-09-10 10:18:18",
+        "timeRange": "[{\"start_time\":\"01:01\",\"end_time\":\"04:03\"},{\"start_time\":\"01:01\",\"end_time\":\"04:03\"},{\"start_time\":\"01:01\",\"end_time\":\"04:03\"},{\"start_time\":\"04:03\",\"end_time\":\"20:03\"}]",
+        "monthDays": "[]",
+        "weekdays": "[1,2,3,4,5,6,7]"
+    }
+}