소스 검색

pms 保养计划 累计注气量 累计注水量 与 累计运行时长 累计运行公里数 干扰问题

zhangcl 4 주 전
부모
커밋
e766cf0372
2개의 변경된 파일40개의 추가작업 그리고 26개의 파일을 삭제
  1. 20 13
      src/views/pms/maintenance/IotMaintenancePlan.vue
  2. 20 13
      src/views/pms/maintenance/IotMaintenancePlanEdit.vue

+ 20 - 13
src/views/pms/maintenance/IotMaintenancePlan.vue

@@ -313,16 +313,19 @@
       <div class="form-group"
            v-if="(configDialog.current?.runningTimeRule === 0 || configDialog.current?.mileageRule === 0)
             && (configDialog.current?.timeAccumulatedAttrs?.length || configDialog.current?.mileageAccumulatedAttrs?.length)
-            && !configDialog.current.totalRunTime && !configDialog.current.totalMileage" >
+            && (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime))
+            && (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage))" >
         <div class="group-title">{{ t('mainPlan.accumulatedParams') }}</div>
         <!-- 累计运行时长 -->
         <el-form-item
           v-if="configDialog.current?.runningTimeRule === 0
-          && configDialog.current?.timeAccumulatedAttrs?.length && !configDialog.current.totalRunTime"
+          && configDialog.current?.timeAccumulatedAttrs?.length
+          && (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime))"
           :label="t('mainPlan.accumulatedRunTime')"
           prop="accumulatedTimeOption"
           :rules="[{
-            required: configDialog.current?.runningTimeRule === 0 && configDialog.current?.timeAccumulatedAttrs?.length,
+            required: configDialog.current?.runningTimeRule === 0 && configDialog.current?.timeAccumulatedAttrs?.length
+            && (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime)),
             message: '请选择累计运行时长',
             trigger: 'change'
           }]"
@@ -345,11 +348,13 @@
         <!-- 累计运行公里数 -->
         <el-form-item
           v-if="configDialog.current?.mileageRule === 0
-          && configDialog.current?.mileageAccumulatedAttrs?.length && !configDialog.current.totalMileage"
+          && configDialog.current?.mileageAccumulatedAttrs?.length
+          && (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage))"
           :label="t('mainPlan.accumulatedMileage')"
           prop="accumulatedMileageOption"
           :rules="[{
-            required: configDialog.current?.mileageRule === 0 && configDialog.current?.mileageAccumulatedAttrs?.length,
+            required: configDialog.current?.mileageRule === 0 && configDialog.current?.mileageAccumulatedAttrs?.length
+            && (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage)),
             message: '请选择累计运行公里数',
             trigger: 'change'
           }]"
@@ -507,8 +512,8 @@ const checkRowFilled = (row: IotMaintenanceBomVO) => {
       row.nextRunningKilometers > 0 &&
       row.kiloCycleLead > 0 &&
     // 检查累计里程参数是否已选择(当条件满足时)
-    (!(row.mileageAccumulatedAttrs?.length && !row.totalMileage) ||
-      (row.mileageAccumulatedAttrs?.length && !row.totalMileage && row.type)));
+    (!(row.mileageAccumulatedAttrs?.length && (row.totalMileage==null || isNaN(row.totalMileage))) ||
+      (row.mileageAccumulatedAttrs?.length && (row.totalMileage==null || isNaN(row.totalMileage)) && row.type)));
 
   // 检查运行时间规则
   const runningTimeFilled = row.runningTimeRule !== 0
@@ -517,8 +522,8 @@ const checkRowFilled = (row: IotMaintenanceBomVO) => {
       row.nextRunningTime > 0 &&
       row.timePeriodLead > 0  &&
       // 检查累计时间参数是否已选择(当条件满足时)
-      (!(row.timeAccumulatedAttrs?.length && !row.totalRunTime) ||
-        (row.timeAccumulatedAttrs?.length && !row.totalRunTime && row.code)));
+      (!(row.timeAccumulatedAttrs?.length && (row.totalRunTime==null || isNaN(row.totalRunTime))) ||
+        (row.timeAccumulatedAttrs?.length && (row.totalRunTime==null || isNaN(row.totalRunTime)) && row.code)));
 
   // 检查自然日期规则
   const naturalDateFilled = row.naturalDateRule !== 0
@@ -591,14 +596,16 @@ const saveConfig = () => {
     // 累计运行时长配置 校验逻辑
     if (configDialog.current.runningTimeRule === 0 &&
       configDialog.current.timeAccumulatedAttrs?.length &&
-      !configDialog.form.accumulatedTimeOption) {
+      !configDialog.form.accumulatedTimeOption &&
+      (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime)) ) {
       message.error('请选择累计运行时长');
       return;
     }
     // 累计运行公里数配置 校验逻辑
     if (configDialog.current.mileageRule === 0 &&
       configDialog.current.mileageAccumulatedAttrs?.length &&
-      !configDialog.form.accumulatedMileageOption) {
+      !configDialog.form.accumulatedMileageOption &&
+      (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage)) ) {
       message.error('请选择累计运行公里数');
       return;
     }
@@ -953,7 +960,7 @@ const validateTableData = (): boolean => {
     // 累计参数校验逻辑
     if (row.mileageRule === 0 &&
       row.mileageAccumulatedAttrs?.length &&
-      !row.totalMileage &&
+      (row.totalMileage==null || isNaN(row.totalMileage)) &&
       !row.type) {
       errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行公里数参数`)
       isValid = false
@@ -961,7 +968,7 @@ const validateTableData = (): boolean => {
 
     if (row.runningTimeRule === 0 &&
       row.timeAccumulatedAttrs?.length &&
-      !row.totalRunTime &&
+      (row.totalRunTime==null || isNaN(row.totalRunTime)) &&
       !row.code) {
       errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行时长参数`)
       isValid = false

+ 20 - 13
src/views/pms/maintenance/IotMaintenancePlanEdit.vue

@@ -399,16 +399,19 @@
       <div class="form-group"
            v-if="(configDialog.current?.runningTimeRule === 0 || configDialog.current?.mileageRule === 0)
             && (configDialog.current?.timeAccumulatedAttrs?.length || configDialog.current?.mileageAccumulatedAttrs?.length)
-            && !configDialog.current.totalRunTime && !configDialog.current.totalMileage" >
+            && (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime))
+            && (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage))" >
         <div class="group-title">{{ t('mainPlan.accumulatedParams') }}</div>
         <!-- 累计运行时长 -->
         <el-form-item
           v-if="configDialog.current?.runningTimeRule === 0
-          && configDialog.current?.timeAccumulatedAttrs?.length && !configDialog.current.totalRunTime"
+          && configDialog.current?.timeAccumulatedAttrs?.length
+          && (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime))"
           :label="t('mainPlan.accumulatedRunTime')"
           prop="accumulatedTimeOption"
           :rules="[{
-            required: configDialog.current?.runningTimeRule === 0 && configDialog.current?.timeAccumulatedAttrs?.length,
+            required: configDialog.current?.runningTimeRule === 0 && configDialog.current?.timeAccumulatedAttrs?.length
+            && (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime)),
             message: '请选择累计运行时长',
             trigger: 'change'
           }]"
@@ -431,11 +434,13 @@
         <!-- 累计运行公里数 -->
         <el-form-item
           v-if="configDialog.current?.mileageRule === 0
-          && configDialog.current?.mileageAccumulatedAttrs?.length && !configDialog.current.totalMileage"
+          && configDialog.current?.mileageAccumulatedAttrs?.length
+          && (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage))"
           :label="t('mainPlan.accumulatedMileage')"
           prop="accumulatedMileageOption"
           :rules="[{
-            required: configDialog.current?.mileageRule === 0 && configDialog.current?.mileageAccumulatedAttrs?.length,
+            required: configDialog.current?.mileageRule === 0 && configDialog.current?.mileageAccumulatedAttrs?.length
+            && (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage)),
             message: '请选择累计运行公里数',
             trigger: 'change'
           }]"
@@ -640,14 +645,16 @@ const saveConfig = () => {
     // 累计运行时长配置 校验逻辑
     if (configDialog.current.runningTimeRule === 0 &&
       configDialog.current.timeAccumulatedAttrs?.length &&
-      !configDialog.form.accumulatedTimeOption) {
+      !configDialog.form.accumulatedTimeOption &&
+      (configDialog.current.totalRunTime == null || isNaN(configDialog.current.totalRunTime)) ) {
       message.error('请选择累计运行时长');
       return;
     }
     // 累计运行公里数配置 校验逻辑
     if (configDialog.current.mileageRule === 0 &&
       configDialog.current.mileageAccumulatedAttrs?.length &&
-      !configDialog.form.accumulatedMileageOption) {
+      !configDialog.form.accumulatedMileageOption &&
+      (configDialog.current.totalMileage == null || isNaN(configDialog.current.totalMileage)) ) {
       message.error('请选择累计运行公里数');
       return;
     }
@@ -1070,8 +1077,8 @@ const checkRowFilled = (row: IotMaintenanceBomVO) => {
       row.nextRunningKilometers > 0 &&
       row.kiloCycleLead > 0 &&
       // 检查累计里程参数是否已选择(当条件满足时)
-      (!(row.mileageAccumulatedAttrs?.length && !row.totalMileage) ||
-        (row.mileageAccumulatedAttrs?.length && !row.totalMileage && row.type)));
+      (!(row.mileageAccumulatedAttrs?.length && (row.totalMileage==null || isNaN(row.totalMileage))) ||
+        (row.mileageAccumulatedAttrs?.length && (row.totalMileage==null || isNaN(row.totalMileage)) && row.type)));
 
   // 检查运行时间规则
   const runningTimeFilled = row.runningTimeRule !== 0
@@ -1080,8 +1087,8 @@ const checkRowFilled = (row: IotMaintenanceBomVO) => {
       row.nextRunningTime > 0 &&
       row.timePeriodLead > 0  &&
       // 检查累计时间参数是否已选择(当条件满足时)
-      (!(row.timeAccumulatedAttrs?.length && !row.totalRunTime) ||
-        (row.timeAccumulatedAttrs?.length && !row.totalRunTime && row.code)));
+      (!(row.timeAccumulatedAttrs?.length && (row.totalRunTime==null || isNaN(row.totalRunTime))) ||
+        (row.timeAccumulatedAttrs?.length && (row.totalRunTime==null || isNaN(row.totalRunTime)) && row.code)));
 
   // 检查自然日期规则
   const naturalDateFilled = row.naturalDateRule !== 0
@@ -1351,7 +1358,7 @@ const validateTableData = (): boolean => {
     // 累计参数校验逻辑
     if (row.mileageRule === 0 &&
       row.mileageAccumulatedAttrs?.length &&
-      !row.totalMileage &&
+      (row.totalMileage==null || isNaN(row.totalMileage)) &&
       !row.type) {
       errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行公里数参数`)
       isValid = false
@@ -1359,7 +1366,7 @@ const validateTableData = (): boolean => {
 
     if (row.runningTimeRule === 0 &&
       row.timeAccumulatedAttrs?.length &&
-      !row.totalRunTime &&
+      (row.totalRunTime==null || isNaN(row.totalRunTime)) &&
       !row.code) {
       errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行时长参数`)
       isValid = false