|
@@ -181,7 +181,7 @@
|
|
<el-table-column :label="t('mainPlan.remainKm')"
|
|
<el-table-column :label="t('mainPlan.remainKm')"
|
|
align="center" prop="remainKm" :width="columnWidths.remainKm">
|
|
align="center" prop="remainKm" :width="columnWidths.remainKm">
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
- {{ row.remainKm !== null ? row.remainKm.toFixed(2) : '-' }}
|
|
|
|
|
|
+ {{ row.remainKm != null ? row.remainKm.toFixed(2) : '-' }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -203,7 +203,7 @@
|
|
<el-table-column :label="t('mainPlan.remainH')"
|
|
<el-table-column :label="t('mainPlan.remainH')"
|
|
align="center" prop="remainH" :width="columnWidths.remainH">
|
|
align="center" prop="remainH" :width="columnWidths.remainH">
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
- {{ row.remainH !== null ? row.remainH.toFixed(2) : '-' }}
|
|
|
|
|
|
+ {{ row.remainH != null ? row.remainH.toFixed(2) : '-' }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
@@ -641,7 +641,6 @@ import dayjs from 'dayjs'
|
|
import MaterialListDrawer from "@/views/pms/iotmainworkorder/SelectedMaterialDrawer.vue";
|
|
import MaterialListDrawer from "@/views/pms/iotmainworkorder/SelectedMaterialDrawer.vue";
|
|
import WorkOrderMaterial from "@/views/pms/iotmainworkorder/WorkOrderMaterial.vue";
|
|
import WorkOrderMaterial from "@/views/pms/iotmainworkorder/WorkOrderMaterial.vue";
|
|
import DeviceBomMaterials from "@/views/pms/iotmainworkorder/DeviceBomMaterials.vue";
|
|
import DeviceBomMaterials from "@/views/pms/iotmainworkorder/DeviceBomMaterials.vue";
|
|
-import { IotDevicePersonApi, IotDevicePersonVO } from '@/api/pms/iotdeviceperson'
|
|
|
|
import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
|
|
import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
|
|
// 引入图标
|
|
// 引入图标
|
|
import { View, Clock, Box, Document } from '@element-plus/icons-vue';
|
|
import { View, Clock, Box, Document } from '@element-plus/icons-vue';
|
|
@@ -868,13 +867,6 @@ const handleSizeChange = (newSize: number) => {
|
|
currentPage.value = 1 // 重置到第一页
|
|
currentPage.value = 1 // 重置到第一页
|
|
}
|
|
}
|
|
|
|
|
|
-// 列宽调整后的处理
|
|
|
|
-const handleHeaderDragEnd = () => {
|
|
|
|
- nextTick(() => {
|
|
|
|
- tableRef.value?.doLayout();
|
|
|
|
- });
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
// 运行时间周期 全局校验方法(在submitForm中调用)
|
|
// 运行时间周期 全局校验方法(在submitForm中调用)
|
|
const validateAllRunningTimes = (): boolean => {
|
|
const validateAllRunningTimes = (): boolean => {
|
|
let isValid = true;
|
|
let isValid = true;
|
|
@@ -1047,65 +1039,12 @@ const queryParams = reactive({
|
|
workOrderId: id
|
|
workOrderId: id
|
|
})
|
|
})
|
|
|
|
|
|
-/** 获取当前所有设备ID集合 */
|
|
|
|
-const getCurrentDeviceIds = (): number[] => {
|
|
|
|
- return [...new Set(list.value.map(item => item.deviceId))]
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/** 更新责任人显示 */
|
|
|
|
-function updateDevicePersonsDisplay() {
|
|
|
|
- const allNames = new Set<string>()
|
|
|
|
- devicePersonsMap.value.forEach(names => {
|
|
|
|
- names.forEach(name => allNames.add(name))
|
|
|
|
- })
|
|
|
|
- formData.value.devicePersons = Array.from(allNames).join(', ')
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * 根据选择的设备查询所有设备关联的 责任人姓名 逗号分隔
|
|
|
|
- */
|
|
|
|
-async function getDevicePersons() {
|
|
|
|
- // 获取当前已经选择的设备ID集合
|
|
|
|
- const existDeviceIds = getCurrentDeviceIds()
|
|
|
|
- if (existDeviceIds.length === 0) {
|
|
|
|
- formData.value.devicePersons = ''
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- // 调用接口获取数据
|
|
|
|
- const params = {
|
|
|
|
- deviceIds: existDeviceIds.join(',') // 明确传递数组参数
|
|
|
|
- }
|
|
|
|
- const res = await IotDevicePersonApi.getPersonsByDeviceIds(params)
|
|
|
|
- const personsData = res || []
|
|
|
|
- // 清空旧数据
|
|
|
|
- devicePersonsMap.value.clear()
|
|
|
|
- // 处理接口数据
|
|
|
|
- personsData.forEach((item: { deviceId: number; personName: string }) => {
|
|
|
|
- if (!devicePersonsMap.value.has(item.deviceId)) {
|
|
|
|
- devicePersonsMap.value.set(item.deviceId, new Set())
|
|
|
|
- }
|
|
|
|
- devicePersonsMap.value.get(item.deviceId)?.add(item.personName)
|
|
|
|
- })
|
|
|
|
- // 生成展示字符串
|
|
|
|
- updateDevicePersonsDisplay()
|
|
|
|
- } catch (error) {
|
|
|
|
- console.error('获取设备责任人失败:', error)
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// 获取指定bomNodeId的物料数量
|
|
// 获取指定bomNodeId的物料数量
|
|
const getMaterialCount = (bomNodeId: number) => {
|
|
const getMaterialCount = (bomNodeId: number) => {
|
|
console.log('当前BOM节点:' + bomNodeId)
|
|
console.log('当前BOM节点:' + bomNodeId)
|
|
return materialList.value.filter(item => item.bomNodeId === bomNodeId).length
|
|
return materialList.value.filter(item => item.bomNodeId === bomNodeId).length
|
|
}
|
|
}
|
|
|
|
|
|
-const hasDelay = (row) => {
|
|
|
|
- return row.delayKilometers > 0 ||
|
|
|
|
- row.delayNaturalDate > 0 ||
|
|
|
|
- row.delayDuration > 0
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
const handleDeleteMaterial = (material) => {
|
|
const handleDeleteMaterial = (material) => {
|
|
// 根据唯一标识查找要删除的物料索引
|
|
// 根据唯一标识查找要删除的物料索引
|
|
const index = materialList.value.findIndex(item =>
|
|
const index = materialList.value.findIndex(item =>
|
|
@@ -1281,7 +1220,7 @@ const calculateRemainKm = (row: IotMaintenanceBomVO) => {
|
|
mileageValue > 0 &&
|
|
mileageValue > 0 &&
|
|
row.nextRunningKilometers > 0;
|
|
row.nextRunningKilometers > 0;
|
|
|
|
|
|
- if (!isValid) return null;
|
|
|
|
|
|
+ if (!isValid) return 0;
|
|
const result = row.nextRunningKilometers - (mileageValue - row.lastRunningKilometers);
|
|
const result = row.nextRunningKilometers - (mileageValue - row.lastRunningKilometers);
|
|
return parseFloat(result.toFixed(2));
|
|
return parseFloat(result.toFixed(2));
|
|
};
|
|
};
|
|
@@ -1307,7 +1246,7 @@ const calculateRemainH = (row: IotMaintenanceBomVO) => {
|
|
row.lastRunningTime > 0 &&
|
|
row.lastRunningTime > 0 &&
|
|
runTimeValue > 0 &&
|
|
runTimeValue > 0 &&
|
|
row.nextRunningTime > 0;
|
|
row.nextRunningTime > 0;
|
|
- if (!isValid) return null;
|
|
|
|
|
|
+ if (!isValid) return 0;
|
|
const result = row.nextRunningTime - (runTimeValue - row.lastRunningTime);
|
|
const result = row.nextRunningTime - (runTimeValue - row.lastRunningTime);
|
|
return parseFloat(result.toFixed(2));
|
|
return parseFloat(result.toFixed(2));
|
|
};
|
|
};
|
|
@@ -1333,7 +1272,7 @@ const calculateRemainDay = (row: IotMaintenanceBomVO) => {
|
|
row.nextNaturalDate > 0;
|
|
row.nextNaturalDate > 0;
|
|
|
|
|
|
if (!isValid) {
|
|
if (!isValid) {
|
|
- return null;
|
|
|
|
|
|
+ return '-';
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -1370,11 +1309,6 @@ const getStatusText = (row: any) => {
|
|
return t('mainPlan.maintaining');
|
|
return t('mainPlan.maintaining');
|
|
};
|
|
};
|
|
|
|
|
|
-// 监听数据变化重新计算
|
|
|
|
-/* watch(() => list.value, () => {
|
|
|
|
- calculateMaintItemsWidth()
|
|
|
|
-}, { deep: true }) */
|
|
|
|
-
|
|
|
|
// 计算属性 - 检查当前页是否有开启的里程规则
|
|
// 计算属性 - 检查当前页是否有开启的里程规则
|
|
const hasMileageRuleInCurrentPage = computed(() => {
|
|
const hasMileageRuleInCurrentPage = computed(() => {
|
|
return paginatedList.value.some(row => row.mileageRule === 0);
|
|
return paginatedList.value.some(row => row.mileageRule === 0);
|