Selaa lähdekoodia

报警规则界面去掉日志。

wubiyu 1 vuosi sitten
vanhempi
commit
1dde50a83d
2 muutettua tiedostoa jossa 21 lisäystä ja 37 poistoa
  1. 5 7
      src/views/warnRule/addDialogCom.vue
  2. 16 30
      src/views/warnRule/dialog.vue

+ 5 - 7
src/views/warnRule/addDialogCom.vue

@@ -128,13 +128,16 @@ export default {
         }
       }
       if (newData.operator == undefined || newData.operator == "") {
-        if (this.sourceTypeList != undefined && this.sourceTypeList.length > 0 && this.sourceTypeList[0].operatorsList != undefined && this.sourceTypeList[0].operatorsList.length > 0) {
+        if (this.sourceTypeList != undefined && this.sourceTypeList.length > 0 
+        && this.sourceTypeList[0].operatorsList != undefined 
+        && this.sourceTypeList[0].operatorsList.length > 0) {
           newData.operator = this.sourceTypeList[0].operatorsList[0].key
         }
       }
       if (newData.value == undefined || newData.value == "") {
         if (this.sourceTypeList != undefined && this.sourceTypeList.length > 0
-          && this.sourceTypeList[0].specsList != undefined && this.sourceTypeList[0].specsList.length > 0) {
+          && this.sourceTypeList[0].specsList != undefined 
+          && this.sourceTypeList[0].specsList.length > 0) {
           newData.value = this.sourceTypeList[0].specsList[0].key
           newData.valueText = this.sourceTypeList[0].specsList[0].value;
         }
@@ -166,10 +169,6 @@ export default {
 
       this.copyToPanelVisible = false;
       this.$forceUpdate();
-      console.log(this.copyToSelects);
-      console.log(this.sourceType);
-      console.log("weekDay", this.weekDay);
-      console.log(this.datas);
       return true;
     },
     sourceTypeItemChanged(item, type) {
@@ -195,7 +194,6 @@ export default {
       this.$forceUpdate();
     },
     timeInput(value) {
-      console.log(value);
       this.$forceUpdate();
     },
     removeClick(item, index) {

+ 16 - 30
src/views/warnRule/dialog.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="edu-training-edit">
-    <DialogCom title="新增告警规则" :visible.sync="isShow" width="67%">
+    <DialogCom :title="title" :visible.sync="isShow" width="67%" @close="onWindowClose">
       <el-form :model="formData" size="small" ref="form" :inline="true" label-position="right" label-width="160px"
         label-suffix=":" :rules="rules">
         <el-form-item label="规则名称" prop="ruleName">
@@ -77,6 +77,7 @@ export default {
       },
       id: params ? params.id : null,
       isShow: false,
+      title:"新增告警规则"
     };
   },
   props: {},
@@ -88,25 +89,6 @@ export default {
 
   },
   methods: {
-    ...mapMutations([]),
-
-    async getAlarmRule() {
-
-    },
-    addComChanged(sourceType) {
-      alert(sourceType);
-    },
-    async refresh(id, other) {
-      if (!id) {
-        // this.reset(other);
-      } else {
-        // getTask(id).then((response) => {
-        //   this.formData = response.data;
-        //   this.open = true;
-        //   this.title = "调阅详情";
-        // });
-      }
-    },
     async show(isAdd, ruleObj) {
       let initData = await iotApi.getAddAlarmRuleInit();
       if (initData.code != 200) {
@@ -118,7 +100,9 @@ export default {
       this.initSourceTypeDics();
       this.selectType = initData.data.sourceTypeList[0].sourceType + '';
       this.selectSystemFields = initData.data.sourceTypeList[0].systemFields;
+     
       if (isAdd) {
+        this.title = "新增告警规则";
         this.formData.ruleName="";
         this.formData.ruleDesc="";
         this.formData.enabled=true;
@@ -126,9 +110,11 @@ export default {
         if (initData.data.sourceTypeList.length > 0) {
           this.ruleExpresses = {};
         }
+        
         this.isShow = true;
       }
       else {
+        this.title = "编辑告警规则";
         if (ruleObj.iotAlarmRule == undefined) {
           this.$message("未获取到报警规则");
           return;
@@ -138,16 +124,13 @@ export default {
         this.formData.ruleDesc = ruleObj.iotAlarmRule.remark;
         this.formData.enabled = ruleObj.iotAlarmRule.enabled == 1 ? true : false;
         this.ruleExpresses = this.convertToRuleExpresses(ruleObj.iotAlarmRuleExpressEditVosBySourceType);
-        console.log("ruleExpresses",this.ruleExpresses);
         this.isShow = true;
-
-        console.log(ruleObj);
       }
 
     },
     convertToRuleExpresses(ruleExpresFromServer) {
       let ruleExpress = {};
-      console.log(ruleExpresFromServer);
+
       if (ruleExpresFromServer == undefined)
         return ruleExpress;
       ruleExpresFromServer.forEach(i => {
@@ -216,7 +199,7 @@ export default {
           })
         }
       });
-      console.log(this.sourceTypeDics);
+      
     },
     onTabClick(e) {
       this.selectSystemFields = this.sourceTypeList[new Number(e.index)].systemFields
@@ -225,8 +208,13 @@ export default {
     onHide() {
       this.isShow = false;
     },
+    onWindowClose()
+    {
+      this.$refs["form"].resetFields();
+      this.$refs["form"].clearValidate();
+    },
     onOk() {
-      console.log("rules", this.ruleExpresses);
+     
       this.$refs["form"].validate((valid) => {
         if (valid) {
           let submit = async () => {
@@ -251,12 +239,12 @@ export default {
                 })
               }
             }
-            console.log(submitData);
+         
             let rh = await iotApi.saveAlarmRule(submitData);
             if (rh.code != 200) {
               this.$message("添加失败");
             }
-            console.log(rh);
+           
             this.isShow = false;
             this.$emit("success");
           }
@@ -264,8 +252,6 @@ export default {
           submit();
         }
         else {
-          alert("error");
-          this.isShow = false;
         }
       });
     }