yusheng 3 nedēļas atpakaļ
vecāks
revīzija
05ae315eb4

+ 19 - 3
src/views/warning/warningSetting/components/addWarningDialog.vue

@@ -458,7 +458,7 @@
           deviceId: '',
           deviceName: '',
           deviceCode: '',
-          iotId:'',
+          iotId: '',
           name: '', // 告警名称
           generateDocumentType: null, // 是否生成保修工单
           description: '', // 告警描述
@@ -485,7 +485,7 @@
           ],
           deviceName: [
             { required: true, message: '请选择告警名称', trigger: 'blur' },
-            { required: true, message: '请选择告警名称', trigger: 'change' },
+            { required: true, message: '请选择告警名称', trigger: 'change' }
           ],
           name: [
             { required: true, message: '请输入告警名称', trigger: 'blur' }
@@ -504,7 +504,7 @@
         this.baseInfoForm.deviceId = data.id;
         this.baseInfoForm.deviceName = data.name;
         this.baseInfoForm.deviceCode = data.code;
-        this.iotId== data.iotId;
+        this.iotId == data.iotId;
         this.baseInfoForm.conditions = [];
         getPhysicalModel(data.id).then((res) => {
           this.temperatureList = res.properties;
@@ -644,6 +644,7 @@
 
       // 保存
       async saveWarningSetting() {
+        let is = false;
         if (
           [1, 2, 5].includes(this.baseInfoForm.generateDocumentType) &&
           !this.baseInfoForm?.workItems?.length
@@ -651,6 +652,21 @@
           this.$message.error('规则不能为空!');
           return;
         }
+        if (!this.baseInfoForm?.conditions?.length) {
+          this.$message.error('触发条件不能为空');
+          return;
+        } else {
+          this.baseInfoForm?.conditions.forEach((item, index) => {
+            console.log(item,'item')
+            if (!item.attributeCode || !item.operator || !item.thresholdValue) {
+              is = true;
+            }
+          });
+        }
+        if (is) {
+          this.$message.error('触发条件内容没填写完整,前检查!');
+          return;
+        }
         this.$refs.baseInfoFormRef.validate(async (valid) => {
           if (valid) {
             this.saveLoading = true;