|
|
|
@ -1,11 +1,12 @@ |
|
|
|
<script> |
|
|
|
import { |
|
|
|
getBomTreeStructure, |
|
|
|
getBomTreeStructure, searchQuoteBOMAlternativeNo, |
|
|
|
searchQuoteBomList, |
|
|
|
searchQuoteBOMVersion, |
|
|
|
updateQuoteBomList |
|
|
|
} from '../../../../../api/quotation/quoteOfBom' |
|
|
|
import {Decimal} from "decimal.js"; |
|
|
|
import fi from "element-ui/src/locale/lang/fi"; |
|
|
|
export default { |
|
|
|
name:'billOfMateriel', |
|
|
|
props:{ |
|
|
|
@ -207,6 +208,8 @@ export default { |
|
|
|
columnWidth: 90, |
|
|
|
}, |
|
|
|
], |
|
|
|
versionData:{}, |
|
|
|
BOMAlternativeList:[], |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
@ -214,15 +217,17 @@ export default { |
|
|
|
// 请求后端 获得树结构菜单 |
|
|
|
let params = { |
|
|
|
site:this.detail.site, |
|
|
|
testPartNo:this.detail.productNo |
|
|
|
partId:0, |
|
|
|
quoteDetailId:this.detail.quotationDetailId |
|
|
|
} |
|
|
|
this.treeLoading = true |
|
|
|
getBomTreeStructure(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.bomTreeStructure = data.rows; |
|
|
|
this.$nextTick(()=>{ |
|
|
|
this.$refs.tree.setCurrentKey(`${this.selectBom[0]}-${this.selectBom[1]}`) |
|
|
|
this.$refs.tree.setCurrentKey(`${this.selectBom[0]}-${this.selectBom[1]}-${this.selectBom[2]}-${this.selectBom[3]}-${this.selectBom[4]}-${this.selectBom[5]}`) |
|
|
|
}) |
|
|
|
this.searchQuoteBomList(); |
|
|
|
}else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
} |
|
|
|
@ -246,7 +251,7 @@ export default { |
|
|
|
}).catch(() => { |
|
|
|
this.selectBom = JSON.parse(JSON.stringify(this.copyBom)) |
|
|
|
this.$nextTick(()=>{ |
|
|
|
this.$refs.tree.setCurrentKey(`${this.selectBom[0]}-${this.selectBom[1]}`) |
|
|
|
this.$refs.tree.setCurrentKey(`${this.selectBom[0]}-${this.selectBom[1]}-${this.selectBom[2]}-${this.selectBom[3]}-${this.selectBom[4]}-${this.selectBom[5]}`) |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
@ -255,8 +260,8 @@ export default { |
|
|
|
site:this.$store.state.user.site, |
|
|
|
testPartNo: this.detail.productNo, |
|
|
|
version:this.selectBom[0], |
|
|
|
bomType:this.selectBom[1], |
|
|
|
alternativeNo:this.selectBom[2], |
|
|
|
bomType:this.selectBom[2], |
|
|
|
alternativeNo:this.selectBom[1], |
|
|
|
quoteDetailId:this.detail.quotationDetailId |
|
|
|
} |
|
|
|
updateQuoteBomList(params).then(({data})=>{ |
|
|
|
@ -275,20 +280,21 @@ export default { |
|
|
|
this.getInventoryPartBom(); |
|
|
|
return |
|
|
|
} |
|
|
|
this.selectBom = JSON.parse(JSON.stringify(val)) |
|
|
|
this.selectBom = val |
|
|
|
this.getInventoryPartBom(); |
|
|
|
this.searchQuoteBomList(); |
|
|
|
}, |
|
|
|
searchQuoteBomList(){ |
|
|
|
let params = { |
|
|
|
site:this.$store.state.user.site, |
|
|
|
testPartNo: this.detail.productNo, |
|
|
|
partNo: this.selectBom[3], |
|
|
|
version:this.selectBom[0], |
|
|
|
bomType:this.selectBom[1], |
|
|
|
alternativeNo:this.selectBom[2], |
|
|
|
bomType:this.selectBom[2], |
|
|
|
alternativeNo:this.selectBom[1], |
|
|
|
id:this.selectBom[4], |
|
|
|
quoteDetailId:this.detail.quotationDetailId |
|
|
|
} |
|
|
|
this.dataListLoading = true; |
|
|
|
this.bomDetailList=[]; |
|
|
|
searchQuoteBomList(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.bomDetailList = data.rows |
|
|
|
@ -326,37 +332,37 @@ export default { |
|
|
|
}, 0) |
|
|
|
}, |
|
|
|
nodeClick(val){ |
|
|
|
// if (val.list){ |
|
|
|
// this.$nextTick(()=>{ |
|
|
|
// this.$refs.tree.setCurrentKey(`${this.selectBom[0]}-${this.selectBom[1]}`) |
|
|
|
// }) |
|
|
|
// return |
|
|
|
// } |
|
|
|
// let arr = val.value.split('-'); |
|
|
|
// arr[0] = parseInt(arr[0]) |
|
|
|
// this.copyBom = JSON.parse(JSON.stringify(this.selectBom)) |
|
|
|
// this.selectBom = JSON.parse(JSON.stringify(arr)) |
|
|
|
// if (this.copyBom[0] !== this.selectBom[0] || this.copyBom[1] !== this.selectBom[1]){ |
|
|
|
// this.changeSelect() |
|
|
|
// } |
|
|
|
console.log(val) |
|
|
|
this.selectBom = val.value.split("-") |
|
|
|
this.$nextTick(()=>{ |
|
|
|
this.$refs.tree.setCurrentKey(`${this.selectBom[0]}-${this.selectBom[1]}`) |
|
|
|
this.$refs.tree.setCurrentKey(`${this.selectBom[0]}-${this.selectBom[1]}-${this.selectBom[2]}-${this.selectBom[3]}-${this.selectBom[4]}-${this.selectBom[5]}`) |
|
|
|
}) |
|
|
|
this.searchQuoteBomList() |
|
|
|
}, |
|
|
|
clickVersionCheck(){ |
|
|
|
this.handoffVersion = !this.handoffVersion; |
|
|
|
this.handoffVersion = true; |
|
|
|
this.BOMVersionList = []; |
|
|
|
this.versionData = { |
|
|
|
site:this.detail.site, |
|
|
|
partNo:this.selectBom[3], |
|
|
|
version:this.selectBom[0], |
|
|
|
bomType:this.selectBom[2] |
|
|
|
} |
|
|
|
this.searchQuoteBOMVersion(); |
|
|
|
}, |
|
|
|
searchQuoteBOMVersion(){ |
|
|
|
let params = { |
|
|
|
site:this.detail.site, |
|
|
|
quoteDetailId:this.detail.quotationDetailId, |
|
|
|
testPartNo:this.detail.productNo, |
|
|
|
testPartNo:this.selectBom[3], |
|
|
|
} |
|
|
|
this.BOMVersionList = []; |
|
|
|
searchQuoteBOMVersion(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.BOMVersionList = data.rows; |
|
|
|
this.selectionVersion(); |
|
|
|
// 查询替代 |
|
|
|
this.searchBOMAlternative(this.versionData); |
|
|
|
}else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
} |
|
|
|
@ -368,7 +374,69 @@ export default { |
|
|
|
this.BomVersion = JSON.parse(JSON.stringify(row)); |
|
|
|
}, |
|
|
|
searchBOMAlternative(row){ |
|
|
|
|
|
|
|
this.BOMAlternativeList = []; |
|
|
|
searchQuoteBOMAlternativeNo(row).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.BOMAlternativeList = data.rows; |
|
|
|
}else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
} |
|
|
|
}).catch((error)=>{ |
|
|
|
this.$message.error(error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
alternativeRowStyle({row}){ |
|
|
|
if (row.version === parseInt(this.selectBom[0]) && row.bomType === this.selectBom[2] && row.alternativeNo === this.selectBom[1]){ |
|
|
|
return {'background-color': '#E8F7F6', cursor: 'pointer'} |
|
|
|
} |
|
|
|
}, |
|
|
|
versionRowStyle({row}){ |
|
|
|
if (row.version === this.versionData.version && row.bomType === this.versionData.bomType){ |
|
|
|
return {'background-color': '#E8F7F6', cursor: 'pointer'} |
|
|
|
} |
|
|
|
}, |
|
|
|
selectionVersion(){ |
|
|
|
for (let i = 0; i < this.BOMVersionList.length; i++) { |
|
|
|
let BOMVersion = this.BOMVersionList[i] |
|
|
|
if (BOMVersion.version === this.versionData.version && BOMVersion.bomType === this.versionData.bomType){ |
|
|
|
this.versionData = BOMVersion; |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
clickVersionTable(row){ |
|
|
|
this.versionData = row; |
|
|
|
this.searchBOMAlternative(row) |
|
|
|
}, |
|
|
|
clickAlternative(row){ |
|
|
|
let params = { |
|
|
|
site:this.detail.site, |
|
|
|
quoteDetailId:this.detail.quotationDetailId, |
|
|
|
partNo:row.partNo, |
|
|
|
version:row.version, |
|
|
|
bomType:row.bomType, |
|
|
|
id:this.selectBom[4], |
|
|
|
parentId:this.selectBom[5], |
|
|
|
alternativeNo:row.alternativeNo, |
|
|
|
quoteBomDetailList:this.bomDetailList |
|
|
|
} |
|
|
|
updateQuoteBomList(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.selectBom[0] = row.version; |
|
|
|
this.selectBom[2] = row.bomType; |
|
|
|
this.selectBom[1] = row.alternativeNo; |
|
|
|
this.selectBom[3] = row.partNo; |
|
|
|
this.selectBom[4] = data.row.id; |
|
|
|
this.selectBom[5] = data.row.parentId; |
|
|
|
this.$message.success(data.msg) |
|
|
|
this.getInventoryPartBom(); |
|
|
|
this.handoffVersion = false |
|
|
|
}else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
} |
|
|
|
}).catch((error)=>{ |
|
|
|
this.$message.error(error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
@ -376,7 +444,9 @@ export default { |
|
|
|
|
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div style="margin-bottom: 5px" v-if="false"><el-button type="primary" @click="clickVersionCheck">切换版本</el-button></div> |
|
|
|
<div style="margin-bottom: 5px"> |
|
|
|
<el-link style="cursor:pointer;" v-if="this.selectBom.length >= 5" @click="clickVersionCheck">切换版本</el-link> |
|
|
|
</div> |
|
|
|
<el-container> |
|
|
|
<el-aside width="24%" style="padding: 0;" :style="{height: height}" v-loading="treeLoading"> |
|
|
|
<el-tree :data="bomTreeStructure" |
|
|
|
@ -385,14 +455,14 @@ export default { |
|
|
|
:expand-on-click-node="false" |
|
|
|
node-key="value" style="height: 100%" |
|
|
|
default-expand-all |
|
|
|
:current-node-key="`${selectBom[0]}-${selectBom[1]}`" |
|
|
|
:current-node-key="`${selectBom[0]}-${selectBom[1]}-${selectBom[2]}-${selectBom[3]}-${selectBom[4]}-${selectBom[5]}`" |
|
|
|
highlight-current ref="tree" |
|
|
|
></el-tree> |
|
|
|
</el-aside> |
|
|
|
<el-main style="padding: 0"> |
|
|
|
<el-table :data="bomDetailList" :height="height" |
|
|
|
stripe border element-loading-text = "数据正在加载中" |
|
|
|
v-loading="dataListLoading" style="margin-top: 10px"> |
|
|
|
v-loading="dataListLoading"> |
|
|
|
<el-table-column |
|
|
|
v-for="(item,index) in columnDetailList" :key="index" |
|
|
|
:sortable="item.columnSortable" |
|
|
|
@ -411,6 +481,31 @@ export default { |
|
|
|
</el-table> |
|
|
|
</el-main> |
|
|
|
</el-container> |
|
|
|
<el-dialog :visible.sync="handoffVersion" v-drag title="BOM版本切换" @close="()=>{ |
|
|
|
this.BOMVersionList = [] |
|
|
|
this.BOMAlternativeList = [] |
|
|
|
}" append-to-body> |
|
|
|
<el-table :data="BOMVersionList" :row-style="versionRowStyle" ref="BOMVersionTable" style="margin-top: 8px" border :height="240" @row-click="clickVersionTable"> |
|
|
|
<el-table-column label="物料编码" prop="partNo" header-align="center" align="center" show-overflow-tooltip min-width="140"/> |
|
|
|
<el-table-column label="物料描述" prop="componentPartDesc" header-align="center" align="left" show-overflow-tooltip min-width="200"/> |
|
|
|
<el-table-column label="版本" prop="version" header-align="center" align="center" show-overflow-tooltip min-width="60"/> |
|
|
|
<el-table-column label="类型" prop="bomType" header-align="center" align="center" show-overflow-tooltip min-width="100"/> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<el-table :data="BOMAlternativeList" :row-style="alternativeRowStyle" border :height="240" style="margin-top: 8px"> |
|
|
|
<el-table-column label="物料编码" prop="partNo" header-align="center" align="center" show-overflow-tooltip min-width="140"/> |
|
|
|
<el-table-column label="物料描述" prop="componentPartDesc" header-align="center" align="left" show-overflow-tooltip min-width="200"/> |
|
|
|
<el-table-column label="版本" prop="version" header-align="center" align="center" show-overflow-tooltip min-width="60"/> |
|
|
|
<el-table-column label="替代编码" prop="alternativeNo" header-align="center" align="left" show-overflow-tooltip min-width="60"/> |
|
|
|
<el-table-column label="类型" prop="bomType" header-align="center" align="center" show-overflow-tooltip min-width="100"/> |
|
|
|
<el-table-column label="操作" min-width="80" header-align="center" align="center"> |
|
|
|
<template slot-scope="{row,$index}"> |
|
|
|
<span style="color: #888;cursor:no-drop;" v-if="row.version === parseInt(selectBom[0]) && row.bomType === selectBom[2] && row.alternativeNo === selectBom[1]">选择</span> |
|
|
|
<el-link style="cursor:pointer;" v-else @click="clickAlternative(row)">选择</el-link> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
|