| | |
| | | import { getDeviceLedger } from "@/api/equipmentManagement/ledger"; |
| | | import { getBaseParamList } from "@/api/basicData/parameterMaintenance.js"; |
| | | |
| | | // 工序列表数据 |
| | | const processValueList = ref([]); |
| | | // 工序列表原始数据 |
| | | const processListRaw = ref([]); |
| | | // 已配置参数的工序ID集合(统一转成字符串比较,避免ID类型不一致) |
| | | const processIdsWithParam = ref(new Set()); |
| | | // 工序列表:已配置参数的工序排在前面,其余保持原有顺序排在后面 |
| | | const processValueList = computed(() => { |
| | | return [...processListRaw.value].sort((a, b) => { |
| | | const aRank = processIdsWithParam.value.has(String(a.id)) ? 0 : 1; |
| | | const bRank = processIdsWithParam.value.has(String(b.id)) ? 0 : 1; |
| | | return aRank - bRank; |
| | | }); |
| | | }); |
| | | const selectedProcess = ref(null); |
| | | const processLoading = ref(false); |
| | | const deviceOptions = ref([]); |
| | |
| | | }, |
| | | ]); |
| | | |
| | | // 刷新“已配置参数”的工序标记 |
| | | const refreshProcessParamFlags = () => { |
| | | return getProcessParamList({}) |
| | | .then(res => { |
| | | const list = res.data || []; |
| | | processIdsWithParam.value = new Set( |
| | | (Array.isArray(list) ? list : []) |
| | | .map(item => item.technologyOperationId) |
| | | .filter(id => id !== null && id !== undefined) |
| | | .map(id => String(id)) |
| | | ); |
| | | }) |
| | | .catch(error => { |
| | | console.error("获取工序参数列表失败", error); |
| | | }); |
| | | }; |
| | | |
| | | // 获取工序列表 |
| | | const getProcessList = () => { |
| | | processLoading.value = true; |
| | | getProcessListApi({ size: -1, current: -1 }) |
| | | .then(res => { |
| | | processValueList.value = res.data.records || []; |
| | | console.log( |
| | | processValueList.value, |
| | | "reprocessValueList.value==========s" |
| | | ); |
| | | Promise.all([ |
| | | getProcessListApi({ size: -1, current: -1 }), |
| | | refreshProcessParamFlags(), |
| | | ]) |
| | | .then(([res]) => { |
| | | processListRaw.value = res.data.records || []; |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("获取工序列表失败"); |
| | |
| | | .then(() => { |
| | | ElMessage.success("删除成功"); |
| | | getParamList(selectedProcess.value.id); |
| | | refreshProcessParamFlags(); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("删除失败"); |
| | |
| | | ElMessage.success("添加成功"); |
| | | paramDialogVisible.value = false; |
| | | getParamList(selectedProcess.value.id); |
| | | refreshProcessParamFlags(); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("添加失败"); |