|
|
@ -478,13 +478,22 @@ |
|
|
</el-tab-pane> |
|
|
</el-tab-pane> |
|
|
<el-tab-pane label="量产BOM" name="massProductionBOM"> |
|
|
<el-tab-pane label="量产BOM" name="massProductionBOM"> |
|
|
<el-table |
|
|
<el-table |
|
|
:data="flattenedData" |
|
|
|
|
|
|
|
|
:data="projectPartBomList" |
|
|
|
|
|
row-key="levelCode" |
|
|
border |
|
|
border |
|
|
style="width: 100%; margin-top: 5px;" |
|
|
style="width: 100%; margin-top: 5px;" |
|
|
:height="this.height + 50" |
|
|
:height="this.height + 50" |
|
|
ref="projectBomTable" |
|
|
ref="projectBomTable" |
|
|
v-loading="dataListLoading"> |
|
|
|
|
|
|
|
|
v-loading="dataListLoading" |
|
|
|
|
|
:tree-props="{ children: 'children' }"> |
|
|
<!-- 数据列 --> |
|
|
<!-- 数据列 --> |
|
|
|
|
|
<el-table-column |
|
|
|
|
|
label="" |
|
|
|
|
|
prop="" |
|
|
|
|
|
header-align="center" |
|
|
|
|
|
align="right" |
|
|
|
|
|
width="50"> |
|
|
|
|
|
</el-table-column> |
|
|
<el-table-column |
|
|
<el-table-column |
|
|
v-for="(item, index) in columnProjectBomList" |
|
|
v-for="(item, index) in columnProjectBomList" |
|
|
:key="index" |
|
|
:key="index" |
|
|
@ -497,26 +506,8 @@ |
|
|
:min-width="item.columnWidth" |
|
|
:min-width="item.columnWidth" |
|
|
:label="item.columnLabel"> |
|
|
:label="item.columnLabel"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<div v-if="item.columnProp === 'levelCode'"> |
|
|
|
|
|
<span v-if="scope.row.levelCode === '1'">{{ '主BOM' }}</span> |
|
|
|
|
|
<span v-else>{{ scope.row.levelCode }}</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div v-else> |
|
|
|
|
|
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span> |
|
|
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span> |
|
|
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> |
|
|
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> |
|
|
</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 展开/折叠按钮 --> |
|
|
|
|
|
<el-table-column label="操作" align="center" width="80" fixed="right"> |
|
|
|
|
|
<template #default="scope"> |
|
|
|
|
|
<a |
|
|
|
|
|
type="text" |
|
|
|
|
|
@click="toggleRow(scope.row)" |
|
|
|
|
|
v-if="hasChildren(scope.row)"> |
|
|
|
|
|
{{ scope.row.expanded ? '查看子物料' : '查看子物料' }} |
|
|
|
|
|
</a> |
|
|
|
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
@ -1173,6 +1164,7 @@ import moment from 'moment'; |
|
|
import 'moment/locale/zh-cn'; |
|
|
import 'moment/locale/zh-cn'; |
|
|
import {downLoadObjectFile2} from "../../../api/eam/eam_object_list"; |
|
|
import {downLoadObjectFile2} from "../../../api/eam/eam_object_list"; |
|
|
import {EventBus} from "../../../main"; |
|
|
import {EventBus} from "../../../main"; |
|
|
|
|
|
import {arrayToTreeByLevelCode} from "../../../utils/arrayToTreeByLevelCode"; |
|
|
/*打样记录組件*/ |
|
|
/*打样记录組件*/ |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
@ -1326,13 +1318,12 @@ import {EventBus} from "../../../main"; |
|
|
confirmatoryList: [], |
|
|
confirmatoryList: [], |
|
|
projectAllDocumentConfirmatorList: [], |
|
|
projectAllDocumentConfirmatorList: [], |
|
|
projectANotDocumentConfirmatorList: [], |
|
|
projectANotDocumentConfirmatorList: [], |
|
|
projectPartBomList: [], |
|
|
|
|
|
|
|
|
projectPartBomList: [],// 量产BOM原始平面数据数组 |
|
|
confirmatorySelection1: [], |
|
|
confirmatorySelection1: [], |
|
|
confirmatorySelection2: [], |
|
|
confirmatorySelection2: [], |
|
|
proofDocumentListDefinition: [], |
|
|
proofDocumentListDefinition: [], |
|
|
confirmProgressPusherList: [], |
|
|
confirmProgressPusherList: [], |
|
|
confirmProgressDocumentList: [], // 量产BOM原始平面数据数组 |
|
|
|
|
|
flattenedData: [], // 量产BOM渲染的平面数据 |
|
|
|
|
|
|
|
|
confirmProgressDocumentList: [], |
|
|
projectConfirmatorFileList: [], |
|
|
projectConfirmatorFileList: [], |
|
|
viewDocumentFileVisible: false, |
|
|
viewDocumentFileVisible: false, |
|
|
viewMassDocumentFileVisible: false, |
|
|
viewMassDocumentFileVisible: false, |
|
|
@ -2487,6 +2478,24 @@ import {EventBus} from "../../../main"; |
|
|
} |
|
|
} |
|
|
], |
|
|
], |
|
|
columnProjectBomList: [ |
|
|
columnProjectBomList: [ |
|
|
|
|
|
{ |
|
|
|
|
|
userId: this.$store.state.user.name, |
|
|
|
|
|
functionId: 401005, |
|
|
|
|
|
serialNumber: '401005Table1LevelCode', |
|
|
|
|
|
tableId: "401005Table1", |
|
|
|
|
|
tableName: "项目物料表", |
|
|
|
|
|
columnProp: 'levelCode', |
|
|
|
|
|
headerAlign: "center", |
|
|
|
|
|
align: "center", |
|
|
|
|
|
columnLabel: 'BOM层级', |
|
|
|
|
|
columnHidden: false, |
|
|
|
|
|
columnImage: false, |
|
|
|
|
|
columnSortable: false, |
|
|
|
|
|
sortLv: 0, |
|
|
|
|
|
status: true, |
|
|
|
|
|
fixed: '', |
|
|
|
|
|
columnWidth: 100, |
|
|
|
|
|
}, |
|
|
{ |
|
|
{ |
|
|
userId: this.$store.state.user.name, |
|
|
userId: this.$store.state.user.name, |
|
|
functionId: 401005, |
|
|
functionId: 401005, |
|
|
@ -2559,24 +2568,6 @@ import {EventBus} from "../../../main"; |
|
|
fixed: '', |
|
|
fixed: '', |
|
|
columnWidth: 150, |
|
|
columnWidth: 150, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
|
|
|
userId: this.$store.state.user.name, |
|
|
|
|
|
functionId: 401005, |
|
|
|
|
|
serialNumber: '401005Table1LevelCode', |
|
|
|
|
|
tableId: "401005Table1", |
|
|
|
|
|
tableName: "项目物料表", |
|
|
|
|
|
columnProp: 'levelCode', |
|
|
|
|
|
headerAlign: "center", |
|
|
|
|
|
align: "center", |
|
|
|
|
|
columnLabel: 'BOM层级', |
|
|
|
|
|
columnHidden: false, |
|
|
|
|
|
columnImage: false, |
|
|
|
|
|
columnSortable: false, |
|
|
|
|
|
sortLv: 0, |
|
|
|
|
|
status: true, |
|
|
|
|
|
fixed: '', |
|
|
|
|
|
columnWidth: 100, |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
], |
|
|
levelList: [], |
|
|
levelList: [], |
|
|
rules:{ |
|
|
rules:{ |
|
|
@ -5175,7 +5166,7 @@ import {EventBus} from "../../../main"; |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
searchMassProductionBomList() { |
|
|
|
|
|
|
|
|
async fetchBomList() { |
|
|
let inData = { |
|
|
let inData = { |
|
|
site: this.proofingCurrentRow.site, |
|
|
site: this.proofingCurrentRow.site, |
|
|
buNo: this.proofingCurrentRow.buNo, |
|
|
buNo: this.proofingCurrentRow.buNo, |
|
|
@ -5188,43 +5179,19 @@ import {EventBus} from "../../../main"; |
|
|
page: 1, |
|
|
page: 1, |
|
|
limit: 1000 |
|
|
limit: 1000 |
|
|
} |
|
|
} |
|
|
searchMassProductionBomList(inData).then(({data}) => { |
|
|
|
|
|
|
|
|
return searchMassProductionBomList(inData).then(({data}) => { |
|
|
if (data && data.code === 0){ |
|
|
if (data && data.code === 0){ |
|
|
this.projectPartBomList = data.list; |
|
|
|
|
|
// 初始化平面数据 |
|
|
|
|
|
this.flattenedData = this.projectPartBomList.filter(item => item.levelCode.split('.').length === 1); |
|
|
|
|
|
|
|
|
return data.list |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 检查是否有子级 |
|
|
|
|
|
hasChildren(row) { |
|
|
|
|
|
return this.projectPartBomList.some(item => item.levelCode.startsWith(`${row.levelCode}.`)); |
|
|
|
|
|
}, |
|
|
|
|
|
// 展开或收起行 |
|
|
|
|
|
toggleRow(row) { |
|
|
|
|
|
if (row.expanded) { |
|
|
|
|
|
// 收起:移除子级数据 |
|
|
|
|
|
this.flattenedData = this.flattenedData.filter(item => !item.levelCode.startsWith(`${row.levelCode}.`)); |
|
|
|
|
|
row.expanded = false; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 展开:加载子级数据 |
|
|
|
|
|
const children = this.projectPartBomList.filter(item => |
|
|
|
|
|
item.levelCode.startsWith(`${row.levelCode}.`) && |
|
|
|
|
|
item.levelCode.split('.').length === row.levelCode.split('.').length + 1 |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// 插入子级数据 |
|
|
|
|
|
const rowIndex = this.flattenedData.indexOf(row); |
|
|
|
|
|
this.flattenedData.splice(rowIndex + 1, 0, ...children); |
|
|
|
|
|
row.expanded = true; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 列表表格选择替换 |
|
|
// 列表表格选择替换 |
|
|
tabClick (tab, event) { |
|
|
tabClick (tab, event) { |
|
|
// 刷新列表数据 |
|
|
// 刷新列表数据 |
|
|
this.refreshCurrentTabTable() |
|
|
this.refreshCurrentTabTable() |
|
|
}, |
|
|
}, |
|
|
refreshCurrentTabTable () { |
|
|
|
|
|
|
|
|
async refreshCurrentTabTable () { |
|
|
if (this.activeName == 'proofRecord') { |
|
|
if (this.activeName == 'proofRecord') { |
|
|
this.getRowProjectInfo(); |
|
|
this.getRowProjectInfo(); |
|
|
} |
|
|
} |
|
|
@ -5240,9 +5207,19 @@ import {EventBus} from "../../../main"; |
|
|
this.getConfirmProgressPusherList() |
|
|
this.getConfirmProgressPusherList() |
|
|
} |
|
|
} |
|
|
if (this.activeName == 'massProductionBOM' && this.proofingCurrentRow.finalPartNo !== '' && this.proofingCurrentRow.finalPartNo !== null){ |
|
|
if (this.activeName == 'massProductionBOM' && this.proofingCurrentRow.finalPartNo !== '' && this.proofingCurrentRow.finalPartNo !== null){ |
|
|
this.searchMassProductionBomList() |
|
|
|
|
|
|
|
|
this.dataListLoading = true; |
|
|
|
|
|
try { |
|
|
|
|
|
// 模拟从后端获取数据 |
|
|
|
|
|
const flatData = await this.fetchBomList(); |
|
|
|
|
|
// 将平铺数据转换为树形结构 |
|
|
|
|
|
this.projectPartBomList = arrayToTreeByLevelCode(flatData, "levelCode", "children"); |
|
|
|
|
|
// 打印结果 |
|
|
|
|
|
console.log(JSON.stringify(this.projectPartBomList, null, 2)); |
|
|
|
|
|
} finally { |
|
|
|
|
|
this.dataListLoading = false; |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
this.flattenedData = [] |
|
|
|
|
|
|
|
|
this.projectPartBomList = [] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
//获取按钮的权限数据 |
|
|
//获取按钮的权限数据 |
|
|
|