|
|
@ -44,7 +44,7 @@ |
|
|
<div class="project-info-content"> |
|
|
<div class="project-info-content"> |
|
|
<el-table :data="projectList" border style="width: 100%" size="small"> |
|
|
<el-table :data="projectList" border style="width: 100%" size="small"> |
|
|
<el-table-column prop="serialNo" label="序号" width="40" align="center"></el-table-column> |
|
|
<el-table-column prop="serialNo" label="序号" width="40" align="center"></el-table-column> |
|
|
<el-table-column label="物料号" width="120" header-align="center" align="left"> |
|
|
|
|
|
|
|
|
<el-table-column label="物料号" width="110" header-align="center" align="left"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<div> |
|
|
<div> |
|
|
<div class="part-number" :title="scope.row.partCode">{{ truncateText(scope.row.partCode, 15) }} |
|
|
<div class="part-number" :title="scope.row.partCode">{{ truncateText(scope.row.partCode, 15) }} |
|
|
@ -54,11 +54,23 @@ |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column prop="partName" label="零件名称" width="120" header-align="center" align="left"> |
|
|
|
|
|
|
|
|
<el-table-column prop="partName" label="零件名称" width="110" header-align="center" align="left"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<div class="part-name">{{ scope.row.partName }}</div> |
|
|
<div class="part-name">{{ scope.row.partName }}</div> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="操作" width="70" header-align="center" align="center"> |
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
<el-button |
|
|
|
|
|
size="mini" |
|
|
|
|
|
type="text" |
|
|
|
|
|
@click="toggleProjectVisible(scope.row, scope.$index)" |
|
|
|
|
|
style="padding: 0 4px; white-space: nowrap;" |
|
|
|
|
|
> |
|
|
|
|
|
{{ isProjectHidden(scope.row, scope.$index) ? '显示' : '隐藏' }} |
|
|
|
|
|
</el-button> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
@ -129,7 +141,10 @@ |
|
|
|
|
|
|
|
|
<!-- 甘特图内容:每行按该物料时间段数上下分层,行高=层数×每层高度 --> |
|
|
<!-- 甘特图内容:每行按该物料时间段数上下分层,行高=层数×每层高度 --> |
|
|
<div class="gantt-content"> |
|
|
<div class="gantt-content"> |
|
|
<div v-for="(project, projectIndex) in projectList" :key="projectIndex" class="gantt-row" |
|
|
|
|
|
|
|
|
<div |
|
|
|
|
|
v-for="(project, projectIndex) in visibleProjectList" |
|
|
|
|
|
:key="getProjectKey(project, projectIndex)" |
|
|
|
|
|
class="gantt-row" |
|
|
:style="{ minHeight: getRowHeight(project) + 'px' }"> |
|
|
:style="{ minHeight: getRowHeight(project) + 'px' }"> |
|
|
<!-- 项目名称 --> |
|
|
<!-- 项目名称 --> |
|
|
<div class="project-name-cell" :title="project.partCode"> |
|
|
<div class="project-name-cell" :title="project.partCode"> |
|
|
@ -270,6 +285,8 @@ export default { |
|
|
|
|
|
|
|
|
// 项目数据 |
|
|
// 项目数据 |
|
|
projectList:[], |
|
|
projectList:[], |
|
|
|
|
|
// 控制甘特图是否显示指定物料行(左侧表格仍保持展示) |
|
|
|
|
|
hiddenProjectKeys: [], |
|
|
projectList1: [ |
|
|
projectList1: [ |
|
|
{ |
|
|
{ |
|
|
serialNo: 1, |
|
|
serialNo: 1, |
|
|
@ -521,6 +538,14 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
|
|
|
visibleProjectList() { |
|
|
|
|
|
const hiddenSet = new Set(this.hiddenProjectKeys) |
|
|
|
|
|
return (this.projectList || []).filter((p, idx) => { |
|
|
|
|
|
const key = this.getProjectKey(p, idx) |
|
|
|
|
|
if (!key) return true |
|
|
|
|
|
return !hiddenSet.has(key) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
// 生成时间轴天数 |
|
|
// 生成时间轴天数 |
|
|
timelineDays() { |
|
|
timelineDays() { |
|
|
const days = [] |
|
|
const days = [] |
|
|
@ -593,6 +618,26 @@ export default { |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
getProjectKey(project, index) { |
|
|
|
|
|
// 用于保证“同物料(partCode)的多行记录”互不影响隐藏状态 |
|
|
|
|
|
// 优先使用后端唯一 id,其次 serialNo,最后兜底 index |
|
|
|
|
|
const obj = project || {} |
|
|
|
|
|
return obj.projectId || obj.id || obj.partProgressId || obj.serialNo || (obj.partCode ? `${obj.partCode}_${index}` : index) |
|
|
|
|
|
}, |
|
|
|
|
|
isProjectHidden(project, index) { |
|
|
|
|
|
const key = this.getProjectKey(project, index) |
|
|
|
|
|
if (key === undefined || key === null || key === '') return false |
|
|
|
|
|
return (this.hiddenProjectKeys || []).includes(key) |
|
|
|
|
|
}, |
|
|
|
|
|
toggleProjectVisible(project, index) { |
|
|
|
|
|
const key = this.getProjectKey(project, index) |
|
|
|
|
|
if (key === undefined || key === null || key === '') return |
|
|
|
|
|
if (this.isProjectHidden(project, index)) { |
|
|
|
|
|
this.hiddenProjectKeys = (this.hiddenProjectKeys || []).filter((c) => c !== key) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.hiddenProjectKeys = Array.from(new Set([...(this.hiddenProjectKeys || []), key])) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
// 处理日期范围变化 |
|
|
// 处理日期范围变化 |
|
|
handleDateRangeChange(dates) { |
|
|
handleDateRangeChange(dates) { |
|
|
|
|
|
|
|
|
@ -675,6 +720,7 @@ export default { |
|
|
if (this.externalProjectList.length > 0) { |
|
|
if (this.externalProjectList.length > 0) { |
|
|
// 使用外部传入的数据 |
|
|
// 使用外部传入的数据 |
|
|
this.projectList = this.externalProjectList |
|
|
this.projectList = this.externalProjectList |
|
|
|
|
|
this.hiddenProjectKeys = [] |
|
|
if (this.externalLegendItems.length > 0) { |
|
|
if (this.externalLegendItems.length > 0) { |
|
|
this.legendItems = JSON.parse(JSON.stringify(this.externalLegendItems)) |
|
|
this.legendItems = JSON.parse(JSON.stringify(this.externalLegendItems)) |
|
|
} else { |
|
|
} else { |
|
|
@ -711,6 +757,7 @@ export default { |
|
|
if (ganttData && ganttData.code === 0) { |
|
|
if (ganttData && ganttData.code === 0) { |
|
|
const payload = ganttData.projectGanttData || ganttData.data || ganttData |
|
|
const payload = ganttData.projectGanttData || ganttData.data || ganttData |
|
|
this.projectList = (payload && payload.projectList) || this.projectList || [] |
|
|
this.projectList = (payload && payload.projectList) || this.projectList || [] |
|
|
|
|
|
this.hiddenProjectKeys = [] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const legendData = legendRes && legendRes.data !== undefined ? legendRes.data : legendRes |
|
|
const legendData = legendRes && legendRes.data !== undefined ? legendRes.data : legendRes |
|
|
|