소스 검색

阈值校验

FinalYu 2 년 전
부모
커밋
943cbf44a7
3개의 변경된 파일41개의 추가작업 그리고 27개의 파일을 삭제
  1. 29 12
      chuanyi_client2/src/components/HeaderMain/index.vue
  2. 8 11
      chuanyi_client2/src/views/group_item/index.vue
  3. 4 4
      chuanyi_client2/src/views/login.vue

+ 29 - 12
chuanyi_client2/src/components/HeaderMain/index.vue

@@ -952,10 +952,14 @@ export default {
           // 参数封装
           let params = JSON.parse(JSON.stringify(this.groupBasicForm))
           params.readMode = this.groupRateForm.readMode
-          if (this.groupRateForm.modeValueUnit === '2') { // 分
-            params.modeValue = parseInt(this.groupRateForm.modeValue) * 60
-          } else if (this.groupRateForm.modeValueUnit === '3') { // 时
-            params.modeValue = parseInt(this.groupRateForm.modeValue) * 60 * 60
+          if (params.readMode == 0) {
+            if (this.groupRateForm.modeValueUnit === '2') { // 分
+              params.modeValue = parseInt(this.groupRateForm.modeValue) * 60
+            } else if (this.groupRateForm.modeValueUnit === '3') { // 时
+              params.modeValue = parseInt(this.groupRateForm.modeValue) * 60 * 60
+            } else {
+              params.modeValue = this.groupRateForm.modeValue
+            }
           } else {
             params.modeValue = this.groupRateForm.modeValue
           }
@@ -1061,14 +1065,18 @@ export default {
         this.chooseItemDataView = true
         this.groupDialogTitle = '修改数据组'
         this.groupRateForm.readMode = item.readMode + ''
-        if (parseInt(item.modeValue) % 3600 == 0) { // 时
-          this.groupRateForm.modeValueUnit = '3'
-          this.groupRateForm.modeValue = item.modeValue / 3600
-        } else if (parseInt(item.modeValue) % 60 == 0) { // 分
-          this.groupRateForm.modeValueUnit = '2'
-          this.groupRateForm.modeValue = item.modeValue / 60
-        } else { // 秒
-          this.groupRateForm.modeValueUnit = '1'
+        if (item.readMode == 0) {
+          if (parseInt(item.modeValue) % 3600 == 0) { // 时
+            this.groupRateForm.modeValueUnit = '3'
+            this.groupRateForm.modeValue = item.modeValue / 3600
+          } else if (parseInt(item.modeValue) % 60 == 0) { // 分
+            this.groupRateForm.modeValueUnit = '2'
+            this.groupRateForm.modeValue = item.modeValue / 60
+          } else { // 秒
+            this.groupRateForm.modeValueUnit = '1'
+            this.groupRateForm.modeValue = item.modeValue
+          }
+        } else {
           this.groupRateForm.modeValue = item.modeValue
         }
         this.groupRateForm.valueMode = item.valueCondition + ''
@@ -1423,6 +1431,15 @@ export default {
           })
           return false
         }
+      } else {
+        let regNum = /^(\-)?\d+(\.\d{1,2})?$/
+        if (!regNum.test(this.groupRateForm.modeValue)) {
+          this.$message({
+            message: '频率设置中阈值不合法!',
+            type: 'warning'
+          })
+          return false
+        }
       }
       // if (parseFloat(this.groupRateForm.modeValue) <= 0) {
       //   this.$message({

+ 8 - 11
chuanyi_client2/src/views/group_item/index.vue

@@ -410,21 +410,18 @@ export default {
           })
           return
         }
-        if (this.itemForm.eventMode == '2') {
-          this.itemForm.eventValue = parseInt(this.itemForm.eventValue)
-          if (this.itemForm.eventValue != 0 && this.itemForm.eventValue != 1) {
-            this.$message({
-              message: '布尔类型时阈值只能为0或者1',
-              type: 'warning'
-            })
-            return
-          }
+        if (this.itemForm.eventMode == '2' && this.itemForm.eventValue != 0 && this.itemForm.eventValue != 1) {
+          this.$message({
+            message: '布尔类型时阈值只能为0或者1',
+            type: 'warning'
+          })
+          return
         }
       }
       const loading = showLoading(this, '加载中,请稍候···')
       // 若驱动报表事件任意一项为空,则清空报表事项
-      if (!this.itemForm.eventMode
-          || (this.itemForm.eventValue == null && this.itemForm.eventValue != 0)
+      if ((!this.itemForm.eventMode || this.itemForm.eventMode == 'null')
+          || (this.itemForm.eventValue == null || this.itemForm.eventValue == '')
           || !this.itemForm.tableReportId) {
         this.itemForm.eventMode = null
         this.itemForm.eventValue = null

+ 4 - 4
chuanyi_client2/src/views/login.vue

@@ -45,7 +45,7 @@
             v-model="loginForm.ip"
             type="text"
             auto-complete="off"
-            placeholder="IP"
+            placeholder="IP地址"
         >
           <svg-icon slot="prefix" icon-class="ip" class="el-input__icon input-icon"/>
         </el-input>
@@ -55,7 +55,7 @@
             v-model="loginForm.port"
             type="text"
             auto-complete="off"
-            placeholder="端口"
+            placeholder="端口"
         >
           <svg-icon slot="prefix" icon-class="port" class="el-input__icon input-icon"/>
         </el-input>
@@ -134,11 +134,11 @@ export default {
           {validator: testKeyBySpace}
         ],
         ip: [
-          {required: true, message: 'IP地址不能为空', trigger: 'blur'},
+          {required: true, message: '请输入IP地址', trigger: 'blur'},
           {validator: this.testKeyByIp}
         ],
         port: [
-          {required: true, message: '端口号不能为空', trigger: 'blur'},
+          {required: true, message: '请输入端口号', trigger: 'blur'},
           {validator: this.testKeyByPort}
         ],
       },