|
@@ -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();
|
|
|
},
|
|
|
};
|