Parcourir la source

pms 保养预警/查询

zhangcl il y a 2 mois
Parent
commit
e35e53aeaf
1 fichiers modifiés avec 13 ajouts et 3 suppressions
  1. 13 3
      src/views/pms/iotmainworkorder/IotDeviceMainAlarm.vue

+ 13 - 3
src/views/pms/iotmainworkorder/IotDeviceMainAlarm.vue

@@ -73,9 +73,12 @@
           </el-table-column>
           <el-table-column label="距离保养" align="center">
             <template #default="scope">
-          <span :class="getDistanceClass(scope.row.mainDistance)">
-            {{ scope.row.mainDistance }}
-          </span>
+              <template v-if="hasMaintenancePlan(scope.row.mainDistance)">
+                <span :class="getDistanceClass(scope.row.mainDistance)">
+                  {{ scope.row.mainDistance }}
+                </span>
+              </template>
+              <span v-else>无保养计划</span>
             </template>
           </el-table-column>
           <el-table-column label="所在部门" align="center" prop="deptName" />
@@ -91,6 +94,7 @@
                 type="primary"
                 @click="detail(scope.row)"
                 v-hasPermi="['rq:iot-device:query']"
+                v-if="hasMaintenancePlan(scope.row.mainDistance)"
               >
                 详情
               </el-button>
@@ -244,6 +248,12 @@ const getDistanceClass = (distance: number | string | null) => {
   return '';
 };
 
+// 判断是否有保养计划
+const hasMaintenancePlan = (mainDistance: any) => {
+  // 检查:非null、非undefined、非空字符串
+  return mainDistance != null && mainDistance !== '';
+};
+
 /** 删除按钮操作 */
 const handleDelete = async (id: number) => {
   try {