车间能级提升-智能设备管理系统
baoshiwei
2025-07-11 1524fa42ddf01fd72207a8a4b4667a48e4f233aa
eims-ui/apps/web-antd/src/views/eims/predictive-maintenance/smt-machine-detail.vue
@@ -153,28 +153,30 @@
      </a-row> -->
      <a-row :gutter="16" class="mt-4">
        <a-col :span="8">
          <div id="ambientTemperatureHumidityChart" style="height: 300px;"></div>
        </a-col>
        <a-col :span="8">
          <div id="motorTemperatureChart" style="height: 300px;"></div>
        </a-col>
        <a-col :span="8">
          <div id="motorVibrationChart" style="height: 300px;"></div>
        </a-col>
        <a-col :span="8">
          <div id="nozzleVacuumChart" style="height: 300px;"></div>
        </a-col>
      </a-row>
      <!-- 贴装头/吸嘴 -->
      <a-row :gutter="16" class="mt-4">
 <a-col :span="8">
                    <div id="nozzleVacuumChart" style="height: 300px;"></div>
        </a-col>
        <a-col :span="8">
          <div id="nozzleFlowChart" style="height: 300px;"></div>
        </a-col>
        <a-col :span="8">
          <div id="placementSpeedChart" style="height: 300px;"></div>
        </a-col>
            <a-col :span="8">
          <div id="ambientTemperatureHumidityChart" style="height: 300px;"></div>
        </a-col>
      </a-row>
@@ -220,6 +222,7 @@
  AppstoreOutlined,
  FieldTimeOutlined
} from '@ant-design/icons-vue';
import img from '#/assets/images/JUKI.png'
export default defineComponent({
  name: 'SmtMachineDetail',
@@ -230,10 +233,10 @@
      deviceType: '贴片机',
      deviceId: 'GPC2012A101',
      installDate: '2012-06-08',
      serviceLife: 8,
      serviceLife: 15,
      status: '运行中',
      statusColor: '#52c41a',
      imageUrl: '/src/assets/images/JUKI.png' // 添加设备图片路径
      imageUrl: img // 添加设备图片路径
    });
    const healthData = reactive({
@@ -244,10 +247,17 @@
      riskColor: '#52c41a',
      xAxisTravel: 300.179,
      yAxisTravel: 233.392,
      tapeJamCount: 15,
      tapeJamCount: 6,
      materialJamCount: 15,
      panelCount: 2480,
      downtime: 4.5
      downtime: 4.5,
      // 用于累加的数据
      accumulatedXAxisTravel: 300.179,
      accumulatedYAxisTravel: 233.392,
      accumulatedTapeJamCount: 6,
      accumulatedMaterialJamCount: 15,
      accumulatedPanelCount: 2480,
      accumulatedDowntime: 4.5
    });
    const maintenanceColumns = [
@@ -324,16 +334,16 @@
        key: 'name'
      },
      {
        title: '当前寿命',
        title: '理论寿命',
        dataIndex: 'currentLife',
        key: 'currentLife',
        customRender: ({ text }: { text: number }) => `${text}小时`
        // customRender: ({ text }: { text: number }) => `${text}小时`
      },
      {
        title: '预测剩余寿命',
        dataIndex: 'remainingLife',
        key: 'remainingLife',
        customRender: ({ text }: { text: number }) => `${text}小时`
        // customRender: ({ text }: { text: number }) => `${text}小时`
      },
      {
        title: '状态',
@@ -347,22 +357,22 @@
      {
        key: '1',
        name: 'X轴伺服电机',
        currentLife: 5000,
        remainingLife: 1500,
        currentLife: '15000小时',
        remainingLife: '4354小时',
        status: '良好'
      },
      {
        key: '2',
        name: '吸嘴',
        currentLife: 1000,
        remainingLife: 50,
        status: '预警'
        currentLife: '1000000次',
        remainingLife: '425000次',
        status: '良好'
      },
      {
        key: '3',
        name: '飞达',
        currentLife: 8000,
        remainingLife: 2000,
        currentLife: '96个月',
        remainingLife: '48个月',
        status: '良好'
      }
    ]);
@@ -370,21 +380,21 @@
    const historyData = reactive([
      {
        id: '1',
        date: '2024-02-15',
        date: '2025-05-15',
        type: '定期保养',
        description: '完成季度保养,检查运动系统润滑',
        color: 'green'
      },
      {
        id: '2',
        date: '2024-01-20',
        date: '2025-01-20',
        type: '故障维修',
        description: '修复吸嘴堵塞问题',
        color: 'red'
      },
      {
        id: '3',
        date: '2023-12-01',
        date: '2024-12-01',
        type: '定期保养',
        description: '完成年度保养,校准视觉系统',
        color: 'green'
@@ -408,6 +418,38 @@
      console.log('处理维护建议:', record);
      // 实际项目中这里会调用API处理维护建议
    };
    let healthDataInterval: number | undefined;
    const updateHealthData = () => {
      healthData.accumulatedXAxisTravel = parseFloat((healthData.accumulatedXAxisTravel + Math.random() * 0.01).toFixed(3));
      healthData.accumulatedYAxisTravel = parseFloat((healthData.accumulatedYAxisTravel + Math.random() * 0.01).toFixed(3));
      healthData.accumulatedTapeJamCount = healthData.accumulatedTapeJamCount + Math.random() * 0.005;
      healthData.accumulatedMaterialJamCount = healthData.accumulatedMaterialJamCount + Math.random() * 0.005;
      healthData.accumulatedPanelCount =healthData.accumulatedPanelCount + Math.random() * 0.1;
      healthData.accumulatedDowntime = parseFloat((healthData.accumulatedDowntime + Math.random() * 0.01).toFixed(1));
      // 更新显示的数据
      healthData.xAxisTravel = healthData.accumulatedXAxisTravel;
      healthData.yAxisTravel = healthData.accumulatedYAxisTravel;
      healthData.tapeJamCount = Math.round(healthData.accumulatedTapeJamCount);
      healthData.materialJamCount = Math.round(healthData.accumulatedMaterialJamCount);
      healthData.panelCount = Math.round( healthData.accumulatedPanelCount);
      healthData.downtime = healthData.accumulatedDowntime;
    };
    onMounted(() => {
      // 初始更新一次数据
      updateHealthData();
      // 每5秒更新一次设备数据
      healthDataInterval = setInterval(updateHealthData, 5000);
    });
    onUnmounted(() => {
      if (healthDataInterval) {
        clearInterval(healthDataInterval);
      }
    });
    return {
      deviceInfo,
@@ -549,29 +591,29 @@
    // initChart('xAxisMotorCurrentChart', 'X轴电机电流', [], 'A', 10, 1);
    // initChart('yAxisMotorCurrentChart', 'Y轴电机电流', [], 'A', 10, 1);
    // initChart('zAxisMotorCurrentChart', 'Z轴电机电流', [], 'A', 8, 0.8);
    initChart('motorTemperatureChart', '电机温度', [
      { name: '温度', data: [], unit: '°C', baseValue: 45, fluctuation: 2, color: '#5470C6' },
    initChart('motorTemperatureChart', '产量', [
      { name: '产量', data: [], unit: 'pcs/h', baseValue: 175, fluctuation: 25, color: '#5470C6' },
    ]);
    initChart('motorVibrationChart', '电机振动', [
      { name: '振动', data: [], unit: 'mm/s', baseValue: 5, fluctuation: 0.5, color: '#5470C6' },
    initChart('motorVibrationChart', '抛料率', [
      { name: '抛料率', data: [], unit: '%', baseValue: 0.15, fluctuation: 0.01, color: '#5470C6' },
    ], );
        initChart('nozzleVacuumChart', '吸嘴真空压力', [
          { name: '压力', data: [], unit: 'kPa', baseValue: -39, fluctuation: 5, color: '#5470C6' },
          { name: '压力', data: [], unit: 'kPa', baseValue: -45, fluctuation: 5, color: '#5470C6' },
        ],);
    // initChart('beltTensionChart', '皮带张力', [], 'N', 50, 5);
    // 贴装头/吸嘴监测
    initChart('nozzleFlowChart', '吸嘴流量', [
      { name: '流量', data: [], unit: 'L/min', baseValue: 5, fluctuation: 0.5, color: '#5470C6' },
    initChart('nozzleFlowChart', '吸嘴吹气压力', [
      { name: '压力', data: [], unit: 'kPa', baseValue: 20, fluctuation: 5, color: '#5470C6' },
    ]);
    initChart('placementSpeedChart', '贴装速度', [
      { name: '速度', data: [], unit: 'mm/s', baseValue: 100, fluctuation: 10, color: '#5470C6' },
      { name: '速度', data: [], unit: 'chips/h', baseValue: 9000, fluctuation: 1500, color: '#5470C6' },
    ]);
    const ambientTemperatureData: any[] = [];
    const ambientHumidityData: any[] = [];
    initChart('ambientTemperatureHumidityChart', '环境温湿度', [
      { name: '温度', data: ambientTemperatureData, unit: '°C', baseValue: 25, fluctuation: 2, color: '#5470C6' },
      { name: '温度', data: ambientTemperatureData, unit: '°C', baseValue: 25, fluctuation: 1, color: '#5470C6' },
      { name: '湿度', data: ambientHumidityData, unit: '%', baseValue: 60, fluctuation: 5, color: '#91cc75' }
    ]);
    // initChart('placementAccuracyChart', '贴装精度', [], 'μm', 50, 5);