You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
614 lines
20 KiB
614 lines
20 KiB
<script>
|
|
import {
|
|
queryQuoteDetailBomTree,
|
|
queryQuoteDetailBomTreeLevel,
|
|
queryQuoteDetailBomTreeAlternative
|
|
} from "@/api/quote/quoteDetailBomTree";
|
|
import {queryQuoteDetailBom} from "@/api/quote/quoteDetailBom";
|
|
import {changeQuoteDetailBomTree} from "../../../../../api/quote/quoteDetailBomTree";
|
|
import {updateQuoteDetailBom} from "../../../../../api/quote/quoteDetailBom";
|
|
|
|
export default {
|
|
name: "quoteDetailBom",
|
|
props: {
|
|
quoteDetail: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
},
|
|
model: {
|
|
prop: "quoteDetail",
|
|
event: "update"
|
|
},
|
|
data() {
|
|
return {
|
|
isAllBom: false,
|
|
dataList: [],
|
|
treeData: [],
|
|
columns: [
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4LineSequence',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'lineSequence',
|
|
headerAlign: "center",
|
|
align: "center",
|
|
columnLabel: '序号',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 50,
|
|
}, {
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4PartNo',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'partNo',
|
|
headerAlign: "center",
|
|
align: "left",
|
|
columnLabel: '产品编码',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 120,
|
|
}, {
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4ComponentPart',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'componentPart',
|
|
headerAlign: "center",
|
|
align: "left",
|
|
columnLabel: '零部件编码',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 120,
|
|
}, {
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4PartDesc',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'partDesc',
|
|
headerAlign: "center",
|
|
align: "left",
|
|
columnLabel: '物料名称',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 160,
|
|
}, {
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4QtyPerAssembly',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'qtyPerAssembly',
|
|
headerAlign: "center",
|
|
align: "right",
|
|
columnLabel: '单位用量',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 90,
|
|
}, {
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4ComponentScrap',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'componentScrap',
|
|
headerAlign: "center",
|
|
align: "right",
|
|
columnLabel: '调机用量',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 90,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4ShrinkageFactor',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'shrinkageFactor',
|
|
headerAlign: "center",
|
|
align: "right",
|
|
columnLabel: '损耗率%',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 90,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4YieldRate',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'yieldRate',
|
|
headerAlign: "center",
|
|
align: "right",
|
|
columnLabel: '良率%',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 90,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4AttritionRate',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'attritionRate',
|
|
headerAlign: "center",
|
|
align: "right",
|
|
columnLabel: '报价成本损耗',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 90,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4PrintUnitName',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'printUnit',
|
|
headerAlign: "center",
|
|
align: "center",
|
|
columnLabel: '单位',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 90,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4UnitPrice',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'unitPrice',
|
|
headerAlign: "center",
|
|
align: "right",
|
|
columnLabel: '单位标准成本',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 90,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4ActualPrice',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'actualPrice',
|
|
headerAlign: "center",
|
|
align: "right",
|
|
columnLabel: '单位报价成本',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 90,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4QuoteUnitPrice',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'quoteUnitPrice',
|
|
headerAlign: "center",
|
|
align: "right",
|
|
columnLabel: '材料标准总成本',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: 'right',
|
|
columnWidth: 100,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 5011,
|
|
serialNumber: '5011Table4ActualQuotePrice',
|
|
tableId: "5011Table4",
|
|
tableName: "报价材料信息",
|
|
columnProp: 'actualQuotePrice',
|
|
headerAlign: "center",
|
|
align: "right",
|
|
columnLabel: '材料报价总成本',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: 'right',
|
|
columnWidth: 100,
|
|
},
|
|
],
|
|
props: {
|
|
children: 'list',
|
|
label: (data, node) => {
|
|
return `${data.partNo}-${data.engChgLevel}-${data.alternativeNo}-${data.bomType}`;
|
|
},
|
|
},
|
|
queryLoading: false,
|
|
queryTreeLoading: false,
|
|
versionVisible: false,
|
|
versionList: [],
|
|
alternativeList: [],
|
|
bomEngChgLevel: {
|
|
partNo: '',
|
|
bomType: '',
|
|
buNo: '',
|
|
site: '',
|
|
engChgLevel: null,
|
|
},
|
|
quoteDetailBom:{},
|
|
quoteDetailBomVisible:false,
|
|
preValue:undefined,
|
|
}
|
|
},
|
|
methods: {
|
|
handleQueryQuoteDetailBomTree() {
|
|
let params = {
|
|
id: this.quoteDetail.id,
|
|
}
|
|
this.queryTreeLoading = true;
|
|
queryQuoteDetailBomTree(params).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.treeData = data.rows;
|
|
if (this.treeData.length > 0) {
|
|
this.$nextTick(() => {
|
|
this.$refs.tree.setCurrentKey(this.treeData[0].id);
|
|
this.handleQueryQuoteDetailBom();
|
|
})
|
|
}
|
|
this.queryTreeLoading = false;
|
|
} else {
|
|
this.$message.warning(data.msg);
|
|
this.queryTreeLoading = false;
|
|
}
|
|
}).catch((error) => {
|
|
this.$message.error(error);
|
|
})
|
|
},
|
|
nodeClick(data) {
|
|
this.handleQueryQuoteDetailBom();
|
|
},
|
|
handleQueryQuoteDetailBom() {
|
|
let params = {
|
|
quoteDetailId: this.quoteDetail.id,
|
|
treeId: this.$refs.tree.getCurrentKey(),
|
|
allTree: this.isAllBom,
|
|
}
|
|
this.queryLoading = true;
|
|
queryQuoteDetailBom(params).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.dataList = data.rows;
|
|
} else {
|
|
this.$message.warning(data.msg);
|
|
}
|
|
this.queryLoading = false;
|
|
}).catch((error) => {
|
|
this.$message.error(error);
|
|
this.queryLoading = false;
|
|
})
|
|
},
|
|
handleCheckedVersion() {
|
|
let node = this.$refs.tree.getCurrentNode();
|
|
if (node) {
|
|
this.bomEngChgLevel = {
|
|
partNo: node.partNo,
|
|
bomType: node.bomType,
|
|
buNo: node.buNo,
|
|
site: node.site,
|
|
engChgLevel: node.engChgLevel,
|
|
alternativeNo: node.alternativeNo,
|
|
}
|
|
}
|
|
this.handleQueryQuoteDetailBomTreeVersion();
|
|
this.versionVisible = true
|
|
},
|
|
handleQueryQuoteDetailBomTreeVersion() {
|
|
let params = {
|
|
...this.bomEngChgLevel,
|
|
engChgLevel: '',
|
|
alternativeNo: '',
|
|
}
|
|
queryQuoteDetailBomTreeLevel(params).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.versionList = data.rows;
|
|
this.handleQueryQuoteDetailBomAlternative();
|
|
} else {
|
|
this.$message.warning(data.msg);
|
|
}
|
|
}).catch((error) => {
|
|
this.$message.error(error);
|
|
})
|
|
},
|
|
levelRowStyle({row}) {
|
|
if (row.engChgLevel === this.bomEngChgLevel.engChgLevel) {
|
|
return {'background-color': '#E8F7F6'};
|
|
}
|
|
},
|
|
alternativeRowStyle({row}) {
|
|
if (row.engChgLevel === this.bomEngChgLevel.engChgLevel && row.alternativeNo === this.bomEngChgLevel.alternativeNo) {
|
|
return {'background-color': '#E8F7F6'};
|
|
}
|
|
},
|
|
levelRowClick(row) {
|
|
this.bomEngChgLevel.partNo = row.partNo;
|
|
this.bomEngChgLevel.buNo = row.buNo;
|
|
this.bomEngChgLevel.site = row.site;
|
|
this.bomEngChgLevel.engChgLevel = row.engChgLevel;
|
|
this.bomEngChgLevel.bomType = row.bomType;
|
|
this.handleQueryQuoteDetailBomAlternative();
|
|
},
|
|
handleQueryQuoteDetailBomAlternative() {
|
|
let params = {
|
|
...this.bomEngChgLevel
|
|
}
|
|
queryQuoteDetailBomTreeAlternative(params).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.alternativeList = data.rows;
|
|
} else {
|
|
this.$message.warning(data.msg);
|
|
}
|
|
}).catch((error) => {
|
|
this.$message.error(error);
|
|
})
|
|
},
|
|
handleChangeVersion(row) {
|
|
let node = this.$refs.tree.getCurrentNode();
|
|
let params = {
|
|
partNo: row.partNo,
|
|
bomType: row.bomType,
|
|
buNo: row.buNo,
|
|
site: row.site,
|
|
engChgLevel: row.engChgLevel,
|
|
alternativeNo: row.alternativeNo,
|
|
createBy: this.$store.state.user.name,
|
|
quoteId: this.quoteDetail.quoteId,
|
|
quoteDetailId: this.quoteDetail.id,
|
|
quoteNo: this.quoteDetail.quoteNo,
|
|
quoteDetailItemNo: this.quoteDetail.itemNo,
|
|
versionNo:this.quoteDetail.versionNo,
|
|
|
|
}
|
|
if (node) {
|
|
params.id = node.id
|
|
params.partNo = node.partNo
|
|
params.bomType = node.bomType
|
|
params.buNo = node.buNo
|
|
params.site = node.site
|
|
}
|
|
changeQuoteDetailBomTree(params).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.$message.success(data.msg);
|
|
this.versionVisible = false;
|
|
this.handleQueryQuoteDetailBomTree();
|
|
} else {
|
|
this.$message.warning(data.msg);
|
|
}
|
|
}).catch((error) => {
|
|
this.$message.error(error);
|
|
})
|
|
},
|
|
handleJumpToBom(row){
|
|
if (this.$router.resolve('part-bomManagement').resolved.name === '404') {
|
|
this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',});
|
|
} else {
|
|
this.$emit('close')
|
|
let params = {
|
|
name: "part-bomManagement",
|
|
params: {
|
|
type:'quote',
|
|
partNo:row.partNo,
|
|
bomType:row.bomType,
|
|
engChgLevel:row.engChgLevel,
|
|
alternativeNo:row.alternativeNo,
|
|
}
|
|
}
|
|
this.$router.push(params)
|
|
}
|
|
},
|
|
handleUpdateQuoteDetailBom(row){
|
|
if (row.attritionRate === undefined || row.attritionRate === null || row.attritionRate <= 0) {
|
|
this.$message.warning('报价成本损耗不能为空或小于等于0');
|
|
return;
|
|
}
|
|
let params = {
|
|
id:row.id,
|
|
attritionRate:row.attritionRate,
|
|
}
|
|
updateQuoteDetailBom(params).then(({data})=>{
|
|
if (data && data.code === 0){
|
|
this.$message.success(data.msg);
|
|
this.quoteDetailBomVisible = false;
|
|
this.handleQueryQuoteDetailBom();
|
|
}else{
|
|
this.$message.warning(data.msg);
|
|
}
|
|
}).catch((error)=>{
|
|
this.$message.error(error);
|
|
})
|
|
},
|
|
handleClickUpdate(row,column,cell,event){
|
|
if (column.label === '报价成本损耗'){
|
|
this.quoteDetailBom = {
|
|
...row,
|
|
}
|
|
this.preValue = row.attritionRate;
|
|
this.quoteDetailBomVisible = true;
|
|
}
|
|
},
|
|
handleBlur(row){
|
|
if (row.attritionRate === this.preValue) {
|
|
this.quoteDetailBomVisible = false;
|
|
this.preValue = undefined
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
if (this.quoteDetail && this.quoteDetail.id) {
|
|
this.handleQueryQuoteDetailBomTree();
|
|
}
|
|
},
|
|
watch: {
|
|
'quoteDetail.id'(newVal, oldVal) {
|
|
this.handleQueryQuoteDetailBomTree();
|
|
},
|
|
isAllBom(newVal, oldVal) {
|
|
this.handleQueryQuoteDetailBom();
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<div style="margin-bottom: 10px">
|
|
<el-link style="margin-right: 20px;cursor: pointer" @click="handleCheckedVersion" v-if="quoteDetail.status === '草稿'">切换版本</el-link>
|
|
<el-checkbox v-model="isAllBom">全级BOM结构</el-checkbox>
|
|
</div>
|
|
<el-container>
|
|
<el-aside width="300px" v-loading="queryTreeLoading">
|
|
<el-tree
|
|
:data="treeData"
|
|
:props="props"
|
|
:default-expand-all="true"
|
|
:expand-on-click-node="false"
|
|
node-key="id"
|
|
highlight-current
|
|
@node-click="nodeClick" ref="tree">
|
|
|
|
</el-tree>
|
|
</el-aside>
|
|
<el-main style="padding: 0" class="rq">
|
|
<el-table :data="dataList" v-loading="queryLoading" border
|
|
@cell-dblclick="handleClickUpdate"
|
|
style="width: 100%" :height="420">
|
|
<!-- <el-table-column label="操作" align="center">-->
|
|
<!-- <template slot-scope="scope">-->
|
|
<!-- <a @click="handleClickUpdate(scope.row)">编辑</a>-->
|
|
<!-- </template>-->
|
|
<!-- </el-table-column>-->
|
|
<el-table-column
|
|
v-for="(item,index) in columns" :key="index"
|
|
:sortable="item.columnSortable"
|
|
:prop="item.columnProp"
|
|
:header-align="item.headerAlign"
|
|
:show-overflow-tooltip="item.showOverflowTooltip"
|
|
:align="item.align"
|
|
:fixed="item.fixed===''?false:item.fixed"
|
|
:min-width="item.columnWidth"
|
|
:label="item.columnLabel">
|
|
<template slot-scope="scope">
|
|
<template v-if="item.columnProp === 'partNo'">
|
|
<el-link @click="handleJumpToBom(scope.row)">{{ scope.row[item.columnProp] }}</el-link>
|
|
</template>
|
|
<template v-else-if="item.columnProp === 'attritionRate' && quoteDetailBomVisible && scope.row.id === quoteDetailBom.id">
|
|
<el-input-number v-model="scope.row.attritionRate" @blur="handleBlur(scope.row)" @change="handleUpdateQuoteDetailBom(scope.row)" style="width: 100%" :controls="false" :min="0"></el-input-number>
|
|
</template>
|
|
<template v-else>
|
|
<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>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-main>
|
|
</el-container>
|
|
|
|
<el-dialog title="BOM版本切换" :visible.sync="versionVisible" append-to-body :close-on-click-modal="false" v-drag
|
|
width="900px">
|
|
<el-table :data="versionList" :row-style="levelRowStyle" @row-click="levelRowClick" ref="versionTable"
|
|
style="width: 100%" border :height="240">
|
|
<el-table-column label="物料编码" prop="partNo" header-align="center" align="center" show-overflow-tooltip
|
|
min-width="140"/>
|
|
<el-table-column label="物料描述" prop="partDesc" header-align="center" align="left" show-overflow-tooltip
|
|
min-width="200"/>
|
|
<el-table-column label="版本" prop="engChgLevel" 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="alternativeList" :row-style="alternativeRowStyle" ref="versionTable"
|
|
style="width: 100%;margin-top: 20px" border :height="240">
|
|
<el-table-column label="物料编码" prop="partNo" header-align="center" align="center" show-overflow-tooltip
|
|
min-width="140"/>
|
|
<el-table-column label="物料描述" prop="partDesc" header-align="center" align="left" show-overflow-tooltip
|
|
min-width="200"/>
|
|
<el-table-column label="版本" prop="engChgLevel" 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="操作" header-align="center" align="center" min-width="100">
|
|
<template slot-scope="scope">
|
|
<a @click="handleChangeVersion(scope.row)">选择</a>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-dialog>
|
|
|
|
|
|
<!-- <el-dialog title="BOM信息" :visible.sync="quoteDetailBomVisible" append-to-body :close-on-click-modal="false" width="450px" v-drag>-->
|
|
|
|
<!-- </el-dialog>-->
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|