-
-
{{ record.axle_number }}
-
{{ record.specification }}
-
{{ record.model }}
-
线盘: {{ record.raw_wire_disc || '无' }}
-
完成度: {{ (record.degree_of_completion * 100).toFixed(0) }}%
-
+ :class="[getCompletionClass(record.degree_of_completion), { 'not-running': !record.update_time }]">
+
{{ record.axle_number }} (不在运行)
+
{{ record.specification }}
+
{{ record.model }}
+
线盘: {{ record.raw_wire_disc || '无' }}
+
完成度: {{ (record.degree_of_completion * 100).toFixed(0) }}%
+
总箱数: {{ record.total_number }}
总净重: {{ record.total_net_weight }}kg
总毛重: {{ record.total_gross_weight }}kg
@@ -43,7 +43,7 @@
-
@@ -62,15 +62,50 @@ const props = defineProps({
}
});
+// 设备代码与轴号的映射表
+const equipmentAxlesMap = {
+ 'QB001': ['左边', '右边'],
+ 'QB002': ['左边', '右边'],
+ 'QB003': ['左边', '右边'],
+ 'QB004': ['左1', '左2', '左3', '左4', '左5', '右1', '右2', '右3', '右4', '右5'],
+ 'QB0042': ['左1', '左2', '左3', '左4', '左5', '右1', '右2', '右3', '右4', '右5'],
+ 'QB005': ['左1', '左2', '左3', '左4', '左5', '左6', '右1', '右2', '右3', '右4', '右5', '右6'],
+ 'QB007': ['左边', '右边'],
+ 'QB008': ['左边', '右边'],
+ 'QB009': ['左边', '右边'],
+ 'QB010': ['左边', '右边'],
+ 'QB011': ['左边', '右边'],
+ 'QB012': ['左边', '右边'],
+ 'QB013': ['左边', '右边'],
+ 'QB014': ['左边', '右边'],
+ 'QB015': ['左边', '右边'],
+ 'QB016': ['左边', '右边'],
+ 'QB017': ['左边', '右边'],
+ 'QB018': ['左1', '左2', '右1', '右2'],
+ 'QB019': ['左1', '左2', '右1', '右2'],
+ 'QB020': ['左1', '左2', '右1', '右2'],
+ 'QB024': ['左1', '左2', '左3', '左4', '右1', '右2', '右3', '右4'],
+ 'QB025': ['左边', '右边'],
+ 'QB026': ['左边', '右边'],
+ 'QB027': ['左边', '右边'],
+ 'QB028': ['左1', '左2', '右1', '右2'],
+ 'QB029': ['左边', '右边'],
+ 'QB030': ['左边', '右边'],
+ 'QB031': ['左边', '右边'],
+ 'QB032': ['左边', '右边'],
+ 'QB033': ['左边', '右边'],
+ 'QB034': ['左边', '右边']
+};
+
// 对设备数据进行排序,将不在生产中的设备移到最后
const sortedEquipmentData = computed(() => {
// 创建一个副本以避免修改原始数组
const equipmentCopy = [...props.equipmentData];
return equipmentCopy.sort((a, b) => {
- // 判断设备是否在运行:status_records不为空数组
- const aIsRunning = a.status_records && a.status_records.length > 0;
- const bIsRunning = b.status_records && b.status_records.length > 0;
+ // 使用新的判断函数检查设备是否在运行
+ const aIsRunning = isEquipmentRunning(a);
+ const bIsRunning = isEquipmentRunning(b);
// 如果a在运行而b不在运行,a排在前面
if (aIsRunning && !bIsRunning) return -1;
@@ -83,42 +118,155 @@ const sortedEquipmentData = computed(() => {
// 获取左侧轴信息
const getLeftAxles = (equipment) => {
- if (!equipment.status_records || equipment.status_records.length === 0) return [];
+ if (!equipment.status_records || equipment.status_records.length === 0) {
+ // 如果没有运行记录,返回所有左侧轴的未运行状态
+ const validAxles = equipmentAxlesMap[equipment.equipment_code] || [];
+ return validAxles.filter(axle => axle.includes('左') || axle.includes('left')).map(axleNumber => ({
+ axle_number: axleNumber,
+ specification: '',
+ model: '',
+ raw_wire_disc: '',
+ degree_of_completion: 0,
+ total_number: null,
+ total_net_weight: null,
+ total_gross_weight: null,
+ isRunning: false
+ }));
+ }
- // 获取所有左侧轴记录
- const leftAxles = equipment.status_records.filter(record => {
- const axle = record.axle_number;
- return axle.includes('左') || axle.includes('left');
- });
+ // 获取设备对应的预期轴号列表
+ const validAxles = equipmentAxlesMap[equipment.equipment_code] || [];
+ const validLeftAxles = validAxles.filter(axle =>
+ axle.includes('左') || axle.includes('left')
+ );
+
+ // 记录已经处理的轴号,避免重复显示
+ const processedAxles = new Set();
+ const resultAxles = [];
+
+ // 处理运行中的记录
+ for (const record of equipment.status_records) {
+ if (!record.axle_number) continue;
+
+ // 检查记录中包含哪些左侧轴
+ for (const axleNumber of validLeftAxles) {
+ if (record.axle_number.includes(axleNumber) && !processedAxles.has(axleNumber)) {
+ processedAxles.add(axleNumber);
+ resultAxles.push({
+ ...record,
+ axle_number: axleNumber // 使用实际的轴号而不是复合轴号
+ });
+ }
+ }
+ }
- // 按照左1, 左2, 左3...的顺序排序
- return leftAxles.sort((a, b) => {
- // 提取轴号中的数字,如"左1"提取出1
- const aNum = extractAxleNumber(a.axle_number);
- const bNum = extractAxleNumber(b.axle_number);
- return aNum - bNum;
+ // 添加未运行的左侧轴
+ for (const axleNumber of validLeftAxles) {
+ if (!processedAxles.has(axleNumber)) {
+ resultAxles.push({
+ axle_number: axleNumber,
+ specification: '',
+ model: '',
+ raw_wire_disc: '',
+ degree_of_completion: 0,
+ total_number: null,
+ total_net_weight: null,
+ total_gross_weight: null,
+ isRunning: false
+ });
+ }
+ }
+
+ // 按照有效轴号列表的顺序排序
+ return resultAxles.sort((a, b) => {
+ const aIndex = validLeftAxles.indexOf(a.axle_number);
+ const bIndex = validLeftAxles.indexOf(b.axle_number);
+ return aIndex - bIndex;
});
};
// 获取右侧轴信息
const getRightAxles = (equipment) => {
- if (!equipment.status_records || equipment.status_records.length === 0) return [];
+ if (!equipment.status_records || equipment.status_records.length === 0) {
+ // 如果没有运行记录,返回所有右侧轴的未运行状态
+ const validAxles = equipmentAxlesMap[equipment.equipment_code] || [];
+ return validAxles.filter(axle => axle.includes('右') || axle.includes('right')).map(axleNumber => ({
+ axle_number: axleNumber,
+ specification: '',
+ model: '',
+ raw_wire_disc: '',
+ degree_of_completion: 0,
+ total_number: null,
+ total_net_weight: null,
+ total_gross_weight: null,
+ isRunning: false
+ }));
+ }
- // 获取所有右侧轴记录
- const rightAxles = equipment.status_records.filter(record => {
- const axle = record.axle_number;
- return axle.includes('右') || axle.includes('right');
- });
+ // 获取设备对应的预期轴号列表
+ const validAxles = equipmentAxlesMap[equipment.equipment_code] || [];
+ const validRightAxles = validAxles.filter(axle =>
+ axle.includes('右') || axle.includes('right')
+ );
+
+ // 记录已经处理的轴号,避免重复显示
+ const processedAxles = new Set();
+ const resultAxles = [];
+
+ // 处理运行中的记录
+ for (const record of equipment.status_records) {
+ if (!record.axle_number) continue;
+
+ // 检查记录中包含哪些右侧轴
+ for (const axleNumber of validRightAxles) {
+ if (record.axle_number.includes(axleNumber) && !processedAxles.has(axleNumber)) {
+ processedAxles.add(axleNumber);
+ resultAxles.push({
+ ...record,
+ axle_number: axleNumber // 使用实际的轴号而不是复合轴号
+ });
+ }
+ }
+ }
+
+ // 添加未运行的右侧轴
+ for (const axleNumber of validRightAxles) {
+ if (!processedAxles.has(axleNumber)) {
+ resultAxles.push({
+ axle_number: axleNumber,
+ specification: '',
+ model: '',
+ raw_wire_disc: '',
+ degree_of_completion: 0,
+ total_number: null,
+ total_net_weight: null,
+ total_gross_weight: null,
+ isRunning: false
+ });
+ }
+ }
- // 按照右1, 右2, 右3...的顺序排序
- return rightAxles.sort((a, b) => {
- // 提取轴号中的数字,如"右1"提取出1
- const aNum = extractAxleNumber(a.axle_number);
- const bNum = extractAxleNumber(b.axle_number);
- return aNum - bNum;
+ // 按照有效轴号列表的顺序排序
+ return resultAxles.sort((a, b) => {
+ const aIndex = validRightAxles.indexOf(a.axle_number);
+ const bIndex = validRightAxles.indexOf(b.axle_number);
+ return aIndex - bIndex;
});
};
+// 检查设备是否在运行
+const isEquipmentRunning = (equipment) => {
+ if (!equipment.status_records || equipment.status_records.length === 0) return false;
+
+ // 获取设备对应的预期轴号列表
+ const validAxles = equipmentAxlesMap[equipment.equipment_code] || [];
+
+ // 检查是否有至少一个有效轴号在status_records中
+ return equipment.status_records.some(record =>
+ record.axle_number && validAxles.some(axle => record.axle_number.includes(axle))
+ );
+};
+
// 提取轴号中的数字
const extractAxleNumber = (axleStr) => {
if (!axleStr) return Infinity;
@@ -318,4 +466,21 @@ const getCompletionClass = (degree) => {
color: #909399;
padding: 20px 0;
}
+
+/* 不在运行的轴样式 */
+.axle-item.not-running {
+ background-color: #f5f7fa;
+ opacity: 0.7;
+ border-color: #c0c4cc;
+}
+
+.axle-item.not-running::before {
+ background-color: #c0c4cc;
+}
+
+.not-running-label {
+ font-size: 12px;
+ color: #f56c6c;
+ font-weight: normal;
+}
\ No newline at end of file