Zimo 3 дней назад
Родитель
Сommit
0503f29f6b
2 измененных файлов с 26 добавлено и 28 удалено
  1. 4 0
      src/api/pms/device/index.ts
  2. 22 28
      src/views/pms/iotmainworkorder/IotDeviceMainAlarm.vue

+ 4 - 0
src/api/pms/device/index.ts

@@ -152,6 +152,10 @@ export const IotDeviceApi = {
   exportIotDevice: async (params) => {
     return await request.download({ url: `/rq/iot-device/export-excel`, params })
   },
+
+  exportIotDeviceMainAlarm: async (params) => {
+    return await request.download({ url: `/pms/iot-main-work-order/exportMaintenances`, params })
+  },
   getIotDeviceTdPage: async (params: any) => {
     return await request.get({ url: `/rq/iot-device/td/page`, params })
   },

+ 22 - 28
src/views/pms/iotmainworkorder/IotDeviceMainAlarm.vue

@@ -37,11 +37,10 @@
 
           <el-form-item>
             <el-button @click="handleQuery"
-              ><Icon icon="ep:search" class="mr-5px" />
-              {{ t('file.search') }}</el-button
+              ><Icon icon="ep:search" class="mr-5px" /> {{ t('file.search') }}</el-button
             >
             <el-button @click="resetQuery"
-              ><Icon icon="ep:refresh" class="mr-5px" />  {{ t('file.reset') }}</el-button
+              ><Icon icon="ep:refresh" class="mr-5px" /> {{ t('file.reset') }}</el-button
             >
             <el-button
               type="success"
@@ -125,17 +124,17 @@
       </ContentWrap>
     </el-col>
   </el-row>
-  <DeviceAlarmBomList ref="modelFormRef" :flag = "flag" />
+  <DeviceAlarmBomList ref="modelFormRef" :flag="flag" />
 </template>
 
 <script setup lang="ts">
 import download from '@/utils/download'
 import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
-import { IotMainWorkOrderApi, IotMainWorkOrderVO } from '@/api/pms/iotmainworkorder'
-import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
+import { IotMainWorkOrderApi } from '@/api/pms/iotmainworkorder'
+import { DICT_TYPE } from '@/utils/dict'
 import DeptTree from '@/views/system/user/DeptTree.vue'
-import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
-import DeviceAlarmBomList from "@/views/pms/iotmainworkorder/DeviceAlarmBomList.vue";
+import { useCache } from '@/hooks/web/useCache'
+import DeviceAlarmBomList from '@/views/pms/iotmainworkorder/DeviceAlarmBomList.vue'
 
 /** 设备台账 列表 */
 defineOptions({ name: 'IotDeviceMainAlarm' })
@@ -219,35 +218,33 @@ const resetQuery = () => {
 }
 
 const getDistanceClass = (distance: number | string | null) => {
-  if (distance === null || distance === undefined) return '';
+  if (distance === null || distance === undefined) return ''
 
   // 如果是数字类型,直接处理
   if (typeof distance === 'number') {
-    return distance < 0 ? 'negative-distance' :
-      distance > 0 ? 'positive-distance' : '';
+    return distance < 0 ? 'negative-distance' : distance > 0 ? 'positive-distance' : ''
   }
 
   // 如果是字符串,提取数字部分
   if (typeof distance === 'string') {
     // 使用正则提取数字部分(包括负号、小数点和科学计数法)
-    const numericPart = distance.match(/[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/)?.[0];
+    const numericPart = distance.match(/[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/)?.[0]
 
     // 如果提取到数字部分,转换为数值
     if (numericPart) {
-      const num = parseFloat(numericPart);
-      return num < 0 ? 'negative-distance' :
-        num > 0 ? 'positive-distance' : '';
+      const num = parseFloat(numericPart)
+      return num < 0 ? 'negative-distance' : num > 0 ? 'positive-distance' : ''
     }
   }
 
-  return '';
-};
+  return ''
+}
 
 // 判断是否有保养计划
 const hasMaintenancePlan = (mainDistance: any) => {
   // 检查:非null、非undefined、非空字符串
-  return mainDistance != null && mainDistance !== '';
-};
+  return mainDistance != null && mainDistance !== ''
+}
 
 const handleDetail = (id: number) => {
   push({ name: 'DeviceDetailInfo', params: { id } })
@@ -265,10 +262,10 @@ const openBomForm = async (row) => {
     model: row.model // 新增 model 属性
   }
   if (row.workOrderId) {
-    flag.value = 'workOrder';
+    flag.value = 'workOrder'
     modelFormRef.value.open(row.workOrderId, flag.value, row.id)
   } else if (row.planId) {
-    flag.value = 'plan';
+    flag.value = 'plan'
     modelFormRef.value.open(row.planId, flag.value, deviceInfo)
   }
 }
@@ -276,12 +273,9 @@ const openBomForm = async (row) => {
 /** 导出按钮操作 */
 const handleExport = async () => {
   try {
-    // 导出的二次确认
-    await message.exportConfirm()
-    // 发起导出
     exportLoading.value = true
-    const data = await IotDeviceApi.exportIotDevice(queryParams)
-    download.excel(data, '设备台账.xls')
+    const data = await IotDeviceApi.exportIotDeviceMainAlarm(queryParams)
+    download.excel(data, '保养查询.xls')
   } catch {
   } finally {
     exportLoading.value = false
@@ -296,7 +290,7 @@ onMounted(() => {
 <style scoped>
 /* 正数样式 - 淡绿色 */
 .positive-distance {
-  color: #67c23a;  /* element-plus 成功色 */
+  color: #67c23a; /* element-plus 成功色 */
   background-color: rgba(103, 194, 58, 0.1); /* 10% 透明度的淡绿色背景 */
   padding: 2px 8px;
   border-radius: 4px;
@@ -305,7 +299,7 @@ onMounted(() => {
 
 /* 负数样式 - 淡红色 */
 .negative-distance {
-  color: #f56c6c;  /* element-plus 危险色 */
+  color: #f56c6c; /* element-plus 危险色 */
   background-color: rgba(245, 108, 108, 0.1); /* 10% 透明度的淡红色背景 */
   padding: 2px 8px;
   border-radius: 4px;