班组bug
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2025-10-21 14:27:23
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2025-11-10 17:07:54
|
||||
* @LastEditTime: 2025-11-25 15:14:53
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@@ -73,7 +73,7 @@
|
||||
:limit="10"
|
||||
:table-data="tableData1"></base-table>
|
||||
<base-table
|
||||
v-else
|
||||
v-else
|
||||
:table-props="tableProps2"
|
||||
:page="1"
|
||||
:limit="10"
|
||||
@@ -150,25 +150,45 @@ export default {
|
||||
this.infoData = {};
|
||||
getPlan(id).then((res) => {
|
||||
this.infoData = res.data || {};
|
||||
this.tableData1 = res.data?.groupPlanClassesBaseVOList.sort((a, b) => a.sort - b.sort);
|
||||
this.tableData1 = res.data?.groupPlanClassesBaseVOList.sort(
|
||||
(a, b) => a.sort - b.sort
|
||||
);
|
||||
this.tableData2 = res.data?.groupPlanTeamBaseVOList;
|
||||
this.tableData2.forEach((item, index) => {
|
||||
let lineName = '';
|
||||
lineName = this.setLineName(item.bindLineTree, lineName);
|
||||
this.$set(this.tableData2[index], 'lineName', lineName.slice(0, -1));
|
||||
if (item.isProduction) {
|
||||
lineName = this.setLineName(item.bindLineTree);
|
||||
}
|
||||
this.$set(this.tableData2[index], 'lineName', lineName);
|
||||
});
|
||||
});
|
||||
},
|
||||
//提取绑定的产线工段名展示出来
|
||||
setLineName(val, lineName) {
|
||||
val.forEach((item) => {
|
||||
lineName += item.name + ':';
|
||||
if (item.children && item.children.length > 0) {
|
||||
const childName = this.setLineName(item.children, lineName);
|
||||
lineName = childName;
|
||||
setLineName(val) {
|
||||
if (!val || val.length === 0) return '';
|
||||
|
||||
const currentLevelNames = val.map((item) => item.name);
|
||||
|
||||
// 处理当前层级显示
|
||||
let currentDisplay = '';
|
||||
if (currentLevelNames.length > 1) {
|
||||
currentDisplay = `(${currentLevelNames.join(' 、 ')})`;
|
||||
} else {
|
||||
currentDisplay = currentLevelNames[0];
|
||||
}
|
||||
|
||||
// 查找所有子节点(取第一个有子节点的元素)
|
||||
const childNode = val.find(
|
||||
(item) => item.children && item.children.length > 0
|
||||
);
|
||||
if (childNode) {
|
||||
const childPath = this.setLineName(childNode.children);
|
||||
if (childPath) {
|
||||
return `${currentDisplay} / ${childPath}`;
|
||||
}
|
||||
});
|
||||
return lineName;
|
||||
}
|
||||
|
||||
return currentDisplay;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user