11 changed files with 2471 additions and 206 deletions
-
1src/api/base/site.js
-
7src/api/quotation/quoteOfBom.js
-
3src/api/quotation/quoteOfRouting.js
-
14src/views/modules/base/factoryInformation.vue
-
423src/views/modules/quotation/sellForQuotation.vue
-
379src/views/modules/quotation/sellForQuotation/quotationDetail/billOfMateriel.vue
-
341src/views/modules/quotation/sellForQuotation/quotationDetail/costPrice.vue
-
206src/views/modules/quotation/sellForQuotation/quotationDetail/propertyTemplates.vue
-
73src/views/modules/quotation/sellForQuotation/quotationDetail/quoteRouting.vue
-
532src/views/modules/quotation/sellForQuotation/quotationDetail/toolQuotation.vue
-
604src/views/modules/quotation/sellForQuotation/quoteDetail.vue
@ -0,0 +1,7 @@ |
|||
import {createAPI} from "../../utils/httpRequest"; |
|||
|
|||
export const getBomTreeStructure = (data)=>createAPI(`/quote/bom/tree/list`,'get',data); |
|||
export const updateQuoteBomList = (data)=>createAPI(`/quote/bom/update`,'post',data); |
|||
|
|||
export const searchQuoteBomList = (data)=>createAPI(`/quote/bom/list`,'post',data); |
|||
export const searchQuoteBomHeader = (data)=>createAPI(`/quote/bom/header`,'get',data); |
|||
@ -0,0 +1,3 @@ |
|||
import {createAPI} from "../../utils/httpRequest"; |
|||
|
|||
export const getBomTreeStructure = (data)=>createAPI(`/quote/routing/tree/list`,'get',data); |
|||
@ -0,0 +1,379 @@ |
|||
<script> |
|||
import {getBomTreeStructure, searchQuoteBomList, updateQuoteBomList} from '../../../../../api/quotation/quoteOfBom' |
|||
import {Decimal} from "decimal.js"; |
|||
export default { |
|||
name:'billOfMateriel', |
|||
props:{ |
|||
detail:{ |
|||
type:Object, |
|||
request:true, |
|||
}, |
|||
height:{ |
|||
type:Number, |
|||
default:400, |
|||
} |
|||
}, |
|||
data(){ |
|||
return{ |
|||
treeLoading:false, |
|||
bomTreeStructure:[], |
|||
bomProps:{ |
|||
label:'label', |
|||
value:'value', |
|||
children:'list' |
|||
}, |
|||
dataListLoading:false, |
|||
bomDetailList:[], |
|||
selectBom:[], |
|||
copyBom:[], |
|||
columnDetailList:[ |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101009001, |
|||
serialNumber: '101009001Table9LineSequence', |
|||
tableId: "101002001Table9", |
|||
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: 101009001, |
|||
serialNumber: '101009001Table9ComponentPart', |
|||
tableId: "101002001Table9", |
|||
tableName: "报价材料信息", |
|||
columnProp: 'componentPart', |
|||
headerAlign: "center", |
|||
align: "center", |
|||
columnLabel: '物料编码', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 100, |
|||
},{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101009001, |
|||
serialNumber: '101009001Table9ComponentPartDesc', |
|||
tableId: "101002001Table9", |
|||
tableName: "报价材料信息", |
|||
columnProp: 'componentPartDesc', |
|||
headerAlign: "center", |
|||
align: "left", |
|||
columnLabel: '物料名称', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 140, |
|||
},{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101009001, |
|||
serialNumber: '101009001Table9QtyPerAssembly', |
|||
tableId: "101002001Table9", |
|||
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: 101009001, |
|||
serialNumber: '101009001Table9ComponentScrap', |
|||
tableId: "101002001Table9", |
|||
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: 101009001, |
|||
serialNumber: '101009001Table9ShrinkageFactor', |
|||
tableId: "101002001Table9", |
|||
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: 101009001, |
|||
serialNumber: '101009001Table9PrintUnitName', |
|||
tableId: "101002001Table9", |
|||
tableName: "报价材料信息", |
|||
columnProp: 'printUnitName', |
|||
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: 101009001, |
|||
serialNumber: '101009001Table9NoteText', |
|||
tableId: "101002001Table9", |
|||
tableName: "报价材料信息", |
|||
columnProp: 'noteText', |
|||
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: 101009001, |
|||
serialNumber: '101009001Table9UnitCost', |
|||
tableId: "101002001Table9", |
|||
tableName: "报价材料信息", |
|||
columnProp: 'unitCost', |
|||
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: 101009001, |
|||
serialNumber: '101009001Table9QuoteUnitCost', |
|||
tableId: "101002001Table9", |
|||
tableName: "报价材料信息", |
|||
columnProp: 'quoteUnitCost', |
|||
headerAlign: "center", |
|||
align: "right", |
|||
columnLabel: '单位报价成本', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: 'right', |
|||
columnWidth: 90, |
|||
}, |
|||
], |
|||
} |
|||
}, |
|||
methods:{ |
|||
getInventoryPartBom(){ |
|||
// 请求后端 获得树结构菜单 |
|||
let params = { |
|||
site:this.detail.site, |
|||
testPartNo:this.detail.productNo |
|||
} |
|||
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.selectBom[2]}`) |
|||
}) |
|||
}else { |
|||
this.$message.warning(data.msg) |
|||
} |
|||
this.treeLoading = false; |
|||
}).catch((error)=>{ |
|||
this.$message.error(error) |
|||
this.treeLoading = false; |
|||
}) |
|||
}, |
|||
changeSelect(val){ |
|||
if (this.selectBom.length === 0){ |
|||
this.updateQuoteBomList(); |
|||
return |
|||
} |
|||
this.$confirm('此操作将更换材料信息, 是否继续?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
this.updateQuoteBomList(); |
|||
}).catch(() => { |
|||
this.selectBom = JSON.parse(JSON.stringify(this.copyBom)) |
|||
this.$nextTick(()=>{ |
|||
this.$refs.tree.setCurrentKey(`${this.selectBom[0]}-${this.selectBom[1]}-${this.selectBom[2]}`) |
|||
}) |
|||
}); |
|||
}, |
|||
updateQuoteBomList(){ |
|||
let params = { |
|||
site:this.$store.state.user.site, |
|||
testPartNo: this.detail.productNo, |
|||
version:this.selectBom[0], |
|||
bomType:this.selectBom[1], |
|||
alternativeNo:this.selectBom[2], |
|||
quoteDetailId:this.detail.quotationDetailId |
|||
} |
|||
updateQuoteBomList(params).then(({data})=>{ |
|||
if (data && data.code === 0){ |
|||
this.$message.success(data.msg) |
|||
this.searchQuoteBomList(); |
|||
}else { |
|||
this.$message.warning(data.msg) |
|||
} |
|||
}).catch((error)=>{ |
|||
this.$message.error(error) |
|||
}) |
|||
}, |
|||
setSelectBom(val){ |
|||
if (val.length === 0){ |
|||
this.getInventoryPartBom(); |
|||
return |
|||
} |
|||
this.selectBom = JSON.parse(JSON.stringify(val)) |
|||
this.getInventoryPartBom(); |
|||
this.searchQuoteBomList(); |
|||
}, |
|||
searchQuoteBomList(){ |
|||
let params = { |
|||
site:this.$store.state.user.site, |
|||
testPartNo: this.detail.productNo, |
|||
version:this.selectBom[0], |
|||
bomType:this.selectBom[1], |
|||
alternativeNo:this.selectBom[2], |
|||
quoteDetailId:this.detail.quotationDetailId |
|||
} |
|||
this.dataListLoading = true; |
|||
searchQuoteBomList(params).then(({data})=>{ |
|||
if (data && data.code === 0){ |
|||
this.bomDetailList = data.rows |
|||
this.computedQuoteBomCost(); |
|||
}else { |
|||
this.$message.warning(data.msg) |
|||
} |
|||
this.dataListLoading = false; |
|||
}).catch((error)=>{ |
|||
this.dataListLoading = false; |
|||
this.$message.error(error) |
|||
}) |
|||
}, |
|||
computedQuoteBomCost(){ |
|||
for (let i = 0; i < this.bomDetailList.length; i++) { |
|||
let bomDetail = this.bomDetailList[i] |
|||
// 单位成本 |
|||
let unitCost = new Decimal(bomDetail.unitCost); |
|||
// 调机用量 |
|||
let componentScrap = new Decimal(bomDetail.componentScrap) |
|||
// 单位用量 |
|||
let qtyPerAssembly = new Decimal(bomDetail.qtyPerAssembly) |
|||
// 损耗率 |
|||
let shrinkageFactor = new Decimal(bomDetail.shrinkageFactor) |
|||
// 报价数量 |
|||
let num = new Decimal(this.detail.quotationDetailQuantity) |
|||
let needNum = componentScrap.div(num).add(qtyPerAssembly.mul(new Decimal(100).sub(shrinkageFactor)).div(new Decimal(100))) |
|||
bomDetail.quoteUnitCost = new Decimal(needNum.mul(unitCost).toFixed(16,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber() |
|||
} |
|||
}, |
|||
getQuoteBomCost(){ |
|||
this.searchQuoteBomList(); |
|||
return this.bomDetailList.reduce((total, currentValue) => { |
|||
return total + new Decimal(currentValue.quoteUnitCost).toNumber(); |
|||
}, 0) |
|||
}, |
|||
nodeClick(val){ |
|||
if (val.list){ |
|||
this.$nextTick(()=>{ |
|||
this.$refs.tree.setCurrentKey(`${this.selectBom[0]}-${this.selectBom[1]}-${this.selectBom[2]}`) |
|||
}) |
|||
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.copyBom[2] !== this.selectBom[2]){ |
|||
this.changeSelect() |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<el-container> |
|||
<el-aside width="24%" style="padding: 0;" :style="{height: height}" v-loading="treeLoading"> |
|||
<el-tree :data="bomTreeStructure" |
|||
:props="bomProps" |
|||
@node-click="nodeClick" |
|||
node-key="value" style="height: 100%" |
|||
default-expand-all |
|||
:current-node-key="`${selectBom[0]}-${selectBom[1]}-${selectBom[2]}`" |
|||
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"> |
|||
<el-table-column |
|||
v-for="(item,index) in columnDetailList" :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"> |
|||
<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> |
|||
</el-table-column> |
|||
</el-table> |
|||
</el-main> |
|||
</el-container> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
|||
@ -0,0 +1,341 @@ |
|||
<script> |
|||
import {Decimal} from "decimal.js"; |
|||
|
|||
export default { |
|||
name: "costPrice", |
|||
props: { |
|||
detail: { |
|||
type: Object, |
|||
request: true |
|||
}, |
|||
height: { |
|||
type: Number, |
|||
default: 400, |
|||
}, |
|||
}, |
|||
data() { |
|||
return { |
|||
bomCost:0, |
|||
machineCost:0, |
|||
fabricateCost:0, |
|||
labourCost:0, |
|||
toolCost:0, |
|||
packCost:0, |
|||
shippingCost:0, |
|||
rules: { |
|||
detailProfitRate: [{required: true, pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
adjustPartCost: [{required: true, pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
adjustMachineCost: [{required: true,pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
adjustFabricateCost: [{required: true,pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
adjustLabourCost: [{required: true,pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
adjustToolCost: [{required: true,pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
detailManageCost: [{required: true,pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
detailOtherCost: [{required: true,pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
taxRate: [{required: true, message: ' ', trigger: ['change','blur']}], |
|||
}, |
|||
quotationDetailColumns: [ |
|||
{label: "productDesc", value: "产品名称"}, |
|||
{label: "quotationDetailQuantity", value: "报价数量"}, |
|||
{label: "internalInquiryNo", value: "内部询价单号"}, |
|||
{label: "quotationDetailStatus", value: "报价状态"}, |
|||
{label: "itemNo", value: "序号"}, |
|||
{label: "adjustPartCost", value: "调整后的材料成本"}, |
|||
{label: "adjustMachineCost", value: "调整后的机器成本"}, |
|||
{label: "adjustFabricateCost", value: "调整后的制造费用"}, |
|||
{label: "adjustLabourCost", value: "调整后人的工成本"}, |
|||
{label: "adjustToolCost", value: "调整后的工具成本"}, |
|||
{label: "detailManageCost", value: "管理成本"}, |
|||
{label: "detailOtherCost", value: "其他成本"}, |
|||
{label: "detailProfitRate", value: "利润率"}, |
|||
{label: "finalUntaxedPrice", value: "最终去税价格"}, |
|||
], |
|||
} |
|||
}, |
|||
computed: { |
|||
copyDetail: { |
|||
get() { |
|||
return this.detail |
|||
}, |
|||
set(val) { |
|||
|
|||
} |
|||
} |
|||
}, |
|||
methods:{ |
|||
ruleCostForm(){ |
|||
let flag = false; |
|||
this.$refs.costForm.validate((validate,objects)=>{ |
|||
if (!validate){ |
|||
this.rulesValidateLabel(objects, this.quotationDetailColumns); |
|||
} |
|||
flag = validate; |
|||
}) |
|||
return flag; |
|||
}, |
|||
restCostForm(){ |
|||
this.$refs.costForm.resetFields(); |
|||
}, |
|||
getQuotationDetail(){ |
|||
return JSON.parse(JSON.stringify(this.copyDetail)); |
|||
}, |
|||
rulesValidateLabel(objects, labels) { |
|||
for (let filed in objects) { |
|||
console.log(filed) |
|||
for (let i = 0; i < labels.length; i++) { |
|||
let quotationToolColumn = labels[i]; |
|||
if (quotationToolColumn.label === filed) { |
|||
this.$message.warning(quotationToolColumn.value+"为空或填写不正确"); |
|||
return |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
setCost(bomCost,machineCost,fabricateCost,labourCost,toolCost,packCost,shippingCost){ |
|||
this.bomCost = bomCost; |
|||
this.machineCost = machineCost; |
|||
this.fabricateCost = fabricateCost; |
|||
this.labourCost = labourCost; |
|||
this.toolCost = toolCost; |
|||
this.packCost = packCost; |
|||
this.shippingCost = shippingCost; |
|||
}, |
|||
computeCost(){ |
|||
// this.$message.success(`${this.bomCost},${this.machineCost},${this.fabricateCost},${this.labourCost},${this.toolCost},${this.packCost},${this.shippingCost}`) |
|||
//材料成本 |
|||
this.copyDetail.computePartCost = this.bomCost |
|||
this.copyDetail.adjustPartCost = this.bomCost |
|||
// 机器成本 |
|||
this.copyDetail.computeMachineCost = this.machineCost |
|||
this.copyDetail.adjustMachineCost = this.machineCost |
|||
// 制作费用 |
|||
this.copyDetail.computedFabricateCost = this.fabricateCost |
|||
this.copyDetail.adjustFabricateCost = this.fabricateCost |
|||
// 人工费用 |
|||
this.copyDetail.computeLabourCost = this.labourCost |
|||
this.copyDetail.adjustLabourCost = this.labourCost |
|||
// 工具成本 |
|||
this.copyDetail.computeToolCost = this.toolCost |
|||
this.copyDetail.adjustToolCost = this.toolCost |
|||
// 其他成本 |
|||
this.copyDetail.detailOtherCost = new Decimal(this.shippingCost).add(new Decimal(this.packCost)).toSignificantDigits().toNumber() |
|||
// 管理成本 |
|||
this.copyDetail.detailManageCost = 0; |
|||
// 利润率 |
|||
this.copyDetail.detailProfitRate = 0; |
|||
this.computeAllCost(); |
|||
}, |
|||
computeAllCost(){ |
|||
this.computedTotalCost();// 总成本 |
|||
this.computedAmountOfProfitCost();//利润额 |
|||
this.computedUntaxedCost();//未税总额和单价 |
|||
this.computedTaxedCost();//含税总额和单价 |
|||
}, |
|||
// 计算总成本 |
|||
computedTotalCost(){ |
|||
this.copyDetail.detailTotalCost = new Decimal(this.copyDetail.adjustPartCost) |
|||
.add(new Decimal(this.copyDetail.adjustMachineCost)) |
|||
.add(new Decimal(this.copyDetail.adjustFabricateCost)) |
|||
.add(new Decimal(this.copyDetail.adjustLabourCost)) |
|||
.add(new Decimal(this.copyDetail.adjustToolCost)) |
|||
.add(new Decimal(this.copyDetail.detailManageCost)) |
|||
.add(new Decimal(this.copyDetail.detailOtherCost)).toSignificantDigits().toNumber() |
|||
}, |
|||
computedAmountOfProfitCost(){ |
|||
this.copyDetail.detailProfitAmount = new Decimal(this.copyDetail.detailTotalCost) |
|||
.mul( |
|||
this.copyDetail.detailProfitRate===0 |
|||
?new Decimal(this.copyDetail.detailProfitRate) |
|||
:new Decimal(this.copyDetail.detailProfitRate).div(new Decimal(100)) |
|||
).toSignificantDigits().toNumber() |
|||
}, |
|||
computedUntaxedCost(){ |
|||
this.copyDetail.systemComputeAmount = |
|||
new Decimal(this.copyDetail.detailTotalCost) |
|||
.add(new Decimal(this.copyDetail.detailProfitAmount)).toSignificantDigits().toNumber(); |
|||
this.copyDetail.finalUntaxedPrice = |
|||
new Decimal(this.copyDetail.systemComputeAmount) |
|||
.div(new Decimal(this.copyDetail.quotationDetailQuantity)).toSignificantDigits().toNumber(); |
|||
}, |
|||
computedTaxedCost(){ |
|||
this.copyDetail.systemComputePrice = |
|||
new Decimal(this.copyDetail.systemComputeAmount) |
|||
.add(new Decimal(this.copyDetail.systemComputeAmount) |
|||
.mul( |
|||
this.copyDetail.taxRate===0 |
|||
?new Decimal(this.copyDetail.taxRate) |
|||
:new Decimal(this.copyDetail.taxRate).div(new Decimal(100)) |
|||
) |
|||
).toSignificantDigits().toNumber(); |
|||
this.copyDetail.finalTaxedPrice = |
|||
new Decimal(this.copyDetail.systemComputePrice) |
|||
.div(new Decimal(this.copyDetail.quotationDetailQuantity)).toSignificantDigits().toNumber(); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<div> |
|||
<el-button type="primary" @click="computeCost"> 计 算</el-button> |
|||
</div> |
|||
<!--系统自动计算结果--> |
|||
<el-form :model="copyDetail" ref="costForm" :rules="rules" label-position="top" label-width="120px"> |
|||
<fieldset |
|||
style="height:80px;margin-top: 2px;border-color: rgb(255,255,255);"> |
|||
<legend>系统自动计算结果(料工费/工具)</legend> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="4"> |
|||
<el-form-item label="材料成本:" prop="computePartCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.computePartCost" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="机器成本:" prop="computeMachineCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.computeMachineCost" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="制造费用成本:" prop="computeFabricateCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.computeFabricateCost" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="人工成本:" prop="computeLabourCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.computeLabourCost" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="工具成本:" prop="computeToolCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.computeToolCost" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</fieldset> |
|||
<fieldset |
|||
style="height:80px;margin-top: 5px;border-color: rgb(255,255,255);"> |
|||
<legend>调整后成本(料工费/工具)</legend> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="4"> |
|||
<el-form-item label="材料成本:" prop="adjustPartCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" @blur="computeAllCost" |
|||
v-model="copyDetail.adjustPartCost" :min="0"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="机器成本:" prop="adjustMachineCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" @blur="computeAllCost" |
|||
v-model="copyDetail.adjustMachineCost" :min="0"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="制造费用成本:" prop="adjustFabricateCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" @blur="computeAllCost" |
|||
v-model="copyDetail.adjustFabricateCost" :min="0"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="人工成本:" prop="adjustLabourCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" @blur="computeAllCost" |
|||
v-model="copyDetail.adjustLabourCost" :min="0"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="工具成本:" prop="adjustToolCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" @blur="computeAllCost" |
|||
v-model="copyDetail.adjustToolCost" :min="0"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</fieldset> |
|||
<fieldset |
|||
style="height:80px;margin-top: 5px;border-color: rgb(255,255,255)"> |
|||
<legend>其他成本</legend> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="4"> |
|||
<el-form-item label="管理成本:" prop="detailManageCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" @blur="computeAllCost" |
|||
v-model="copyDetail.detailManageCost" :min="0"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="其他成本:" prop="detailOtherCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" @blur="computeAllCost" |
|||
v-model="copyDetail.detailOtherCost" :min="0"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="总成本:" prop="detailTotalCost"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.detailTotalCost" :min="0" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</fieldset> |
|||
<fieldset style="height:80px;margin-top: 5px;border-color: rgb(255,255,255);"> |
|||
<legend>利润</legend> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="4"> |
|||
<el-form-item label="利润率%:" prop="detailProfitRate"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" @blur="computeAllCost" |
|||
v-model="copyDetail.detailProfitRate" :min="0"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="利润额:" prop="detailProfitAmount"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.detailProfitAmount" :min="0" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</fieldset> |
|||
<fieldset style="height:80px;margin-top: 5px;border-color: rgb(255,255,255);"> |
|||
<legend>最终价格</legend> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="4"> |
|||
<el-form-item label="未税总额:" prop="systemComputeAmount"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.systemComputeAmount" :min="0" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="未税单价:" prop="finalUntaxedPrice"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.finalUntaxedPrice" :min="0" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="税率%:" prop="taxRate"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" @blur="computeAllCost" |
|||
v-model="copyDetail.taxRate" :min="0"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="含税总额:" prop="systemComputePrice"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.systemComputePrice" :min="0" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="含税单价:" prop="finalTaxedPrice"> |
|||
<el-input-number style="width: 100%;margin-top: -5px;" :controls="false" |
|||
v-model="copyDetail.finalTaxedPrice" :min="0" disabled/> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</fieldset> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
.el-input-number /deep/ .el-input__inner { |
|||
text-align: right; |
|||
padding-right: 5px !important; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,206 @@ |
|||
<script> |
|||
import {getItemModal} from "../../../../../api/base/properties"; |
|||
import {Decimal} from "decimal.js"; |
|||
|
|||
export default { |
|||
name: "propertyTemplates", |
|||
props:{ |
|||
detail:{ |
|||
type:Object, |
|||
request:true, |
|||
}, |
|||
height:{ |
|||
type:Number, |
|||
default:400, |
|||
} |
|||
}, |
|||
data(){ |
|||
return{ |
|||
propertyTemplatesItemList:[],//属性模板item集合 |
|||
dataListLoading:false, |
|||
columnDetailList: [ |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101002001, |
|||
serialNumber: '101002001Table9PropertiesItemID', |
|||
tableId: "101002001Table9", |
|||
tableName: "物料属性项目表", |
|||
columnProp: 'propertiesItemNo', |
|||
headerAlign: "center", |
|||
align: "left", |
|||
columnLabel: '属性编码', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 90, |
|||
}, |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101002001, |
|||
serialNumber: '101002001Table9PropertiesItemDesc', |
|||
tableId: "101002001Table9", |
|||
tableName: "物料属性项目表", |
|||
columnProp: 'itemDesc', |
|||
headerAlign: "center", |
|||
align: "left", |
|||
columnLabel: '属性名称', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 90, |
|||
}, |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101002001, |
|||
serialNumber: '101002001Table9ValueType', |
|||
tableId: "101002001Table9", |
|||
tableName: "物料属性项目表", |
|||
columnProp: 'valueType', |
|||
headerAlign: "center", |
|||
align: "center", |
|||
columnLabel: '属性类型', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 70, |
|||
}, |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101002001, |
|||
serialNumber: '101002001TableValueChooseFlag', |
|||
tableId: "101002001Table", |
|||
tableName: "common", |
|||
columnProp: 'textValue', |
|||
headerAlign: "center", |
|||
align: "center", |
|||
columnLabel: '文本值', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 70, |
|||
}, |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101002001, |
|||
serialNumber: '101002001TableValueChooseFlag', |
|||
tableId: "101002001Table", |
|||
tableName: "common", |
|||
columnProp: 'numValue', |
|||
headerAlign: "center", |
|||
align: "center", |
|||
columnLabel: '数字值', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 70, |
|||
}, |
|||
], |
|||
} |
|||
}, |
|||
created() { |
|||
// this.getPropertyTemplatesItem(); |
|||
}, |
|||
methods:{ |
|||
getPackInfoCost(){ |
|||
let boxOfBags = this.propertyTemplatesItemList.find((item)=>item.propertiesItemNo.toUpperCase() === 'PACK-BAGS/BOX'); |
|||
let boxCost = this.propertyTemplatesItemList.find((item)=>item.propertiesItemNo.toUpperCase() === 'PACK-BOX-COST'); |
|||
let packOtherCost = this.propertyTemplatesItemList.find((item)=>item.propertiesItemNo.toUpperCase() === 'PACK-OTHER-COST'); |
|||
let numOfBag = this.propertyTemplatesItemList.find((item)=>item.propertiesItemNo.toUpperCase() === 'PACK-PCS/PE-BAG'); |
|||
let bagCost = this.propertyTemplatesItemList.find((item)=>item.propertiesItemNo.toUpperCase() === 'PACK-PE-BAG-COST'); |
|||
if (!boxCost || !boxOfBags || !numOfBag || !bagCost){ |
|||
// this.$message.warning("缺少包装信息") |
|||
return 0; |
|||
} |
|||
if (boxCost.numValue === null || boxCost.numValue === undefined || boxOfBags.numValue === null || boxOfBags.numValue === undefined |
|||
|| numOfBag.numValue === null || numOfBag.numValue === undefined || bagCost.numValue === null || bagCost.numValue === undefined){ |
|||
// this.$message.warning("缺少包装信息") |
|||
return 0; |
|||
} |
|||
let num1 = new Decimal(bagCost.numValue).div(new Decimal(numOfBag.numValue)); |
|||
let num2 = new Decimal(boxCost.numValue).div(new Decimal(boxOfBags.numValue)); |
|||
return num1.add(num2).toSignificantDigits().toNumber() |
|||
}, |
|||
getShippingInfoCost(){ |
|||
let shippingCost = this.propertyTemplatesItemList.find((item)=>item.propertiesItemNo.toUpperCase() === 'SHIPPING-COST'); |
|||
let shippingDeliverQuantity = this.propertyTemplatesItemList.find((item)=>item.propertiesItemNo.toUpperCase() === 'SHIPPING-DELIVER-QUANTITY'); |
|||
let shippingOtherCost = this.propertyTemplatesItemList.find((item)=>item.propertiesItemNo.toUpperCase() === 'SHIPPING-OTHER-COST'); |
|||
if (!shippingCost || !shippingDeliverQuantity){ |
|||
// this.$message.warning("缺少交付/运输信息") |
|||
return 0; |
|||
} |
|||
if (shippingCost.numValue === null || shippingCost.numValue === undefined || shippingDeliverQuantity.numValue === null || shippingDeliverQuantity.numValue === undefined){ |
|||
// this.$message.warning("缺少交付/运输信息") |
|||
return 0; |
|||
} |
|||
return new Decimal(shippingCost.numValue).div(new Decimal(shippingDeliverQuantity.numValue)).toSignificantDigits().toNumber() |
|||
}, |
|||
getPropertyTemplatesItem(){ |
|||
let params = { |
|||
site:this.$store.state.user.site, |
|||
partNo:this.detail.productNo |
|||
} |
|||
this.dataListLoading = true |
|||
getItemModal(params).then(({data})=>{ |
|||
if (data && data.code === 0){ |
|||
this.propertyTemplatesItemList = data.rows; |
|||
}else { |
|||
this.$message.warning(data.msg) |
|||
} |
|||
this.dataListLoading = false |
|||
}).catch((error)=>{ |
|||
this.$message.error(error) |
|||
this.dataListLoading = false |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<div> |
|||
<el-button type="primary" @click="getPropertyTemplatesItem">刷新属性</el-button> |
|||
</div> |
|||
<el-table |
|||
:height="height" |
|||
:data="propertyTemplatesItemList" |
|||
border element-loading-text = "数据正在加载中" |
|||
v-loading="dataListLoading" |
|||
style="width: 100%;margin-top: 5px"> |
|||
<el-table-column |
|||
v-for="(item,index) in columnDetailList" :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"> |
|||
<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> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
|||
@ -0,0 +1,73 @@ |
|||
<script> |
|||
import {getBomTreeStructure} from "../../../../../api/quotation/quoteOfRouting"; |
|||
|
|||
export default { |
|||
name: "quoteRouting", |
|||
props:{ |
|||
detail:{ |
|||
type:Object, |
|||
request:true, |
|||
}, |
|||
height:{ |
|||
type:Number, |
|||
default:400, |
|||
} |
|||
}, |
|||
data(){ |
|||
return{ |
|||
treeLoading:false, |
|||
routingTreeStructure:[], |
|||
routingProps:{ |
|||
label:'label', |
|||
value:'value', |
|||
children:'list' |
|||
}, |
|||
selectRouting:[], |
|||
} |
|||
}, |
|||
methods:{ |
|||
nodeClick(val){ |
|||
|
|||
}, |
|||
getBomTreeStructure(){ |
|||
let params = { |
|||
site:this.detail.site, |
|||
testPartNo:this.detail.productNo |
|||
} |
|||
getBomTreeStructure(params).then(({data})=>{ |
|||
if (data && data.code === 0){ |
|||
this.routingTreeStructure = data.rows |
|||
}else { |
|||
this.$message.warning(data.msg) |
|||
} |
|||
}).catch((error)=>{ |
|||
this.$message.error(error) |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
{{detail}} |
|||
<el-container> |
|||
<el-aside width="24%" style="padding: 0;" :style="{height: height}" v-loading="treeLoading"> |
|||
<el-tree :data="routingTreeStructure" |
|||
:props="routingProps" |
|||
@node-click="nodeClick" |
|||
node-key="value" style="height: 100%" |
|||
default-expand-all |
|||
highlight-current ref="tree" |
|||
></el-tree> |
|||
</el-aside> |
|||
<el-main style="padding: 0"> |
|||
|
|||
</el-main> |
|||
</el-container> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
|||
@ -0,0 +1,532 @@ |
|||
<script> |
|||
import { |
|||
batchDeleteQuotationTool, |
|||
deleteQuotationTool, saveQuotationTool, |
|||
searchQuotationTool |
|||
} from "../../../../../api/quotation/quotationHeader"; |
|||
import {Decimal} from "decimal.js"; |
|||
import {searchTool, searchToolHeader} from "../../../../../api/part/toolHeader"; |
|||
|
|||
export default { |
|||
name:'toolQuotation', |
|||
props:{ |
|||
detail:{ |
|||
type:Object, |
|||
request:true, |
|||
}, |
|||
height:{ |
|||
type:Number, |
|||
default:400, |
|||
} |
|||
}, |
|||
data(){ |
|||
const validateToolNo = (rule, value, callback) => { |
|||
if (this.saveQuotationToolFlag !== true){ |
|||
return; |
|||
} |
|||
if (value === '' || value === null || value === undefined){ |
|||
callback(new Error(' ')) |
|||
return |
|||
} |
|||
if (value === '*'){ |
|||
callback(); |
|||
return; |
|||
} |
|||
this.toolHeader.toolNo = value; |
|||
searchTool(this.toolHeader).then(({data})=>{ |
|||
if (data.code === 200) { |
|||
if (data.data.length === 1){ |
|||
callback() |
|||
return |
|||
} |
|||
} |
|||
this.toolHeader.toolNo = null; |
|||
this.$message.error("工具编码不存在!") |
|||
callback(new Error(' ')) |
|||
}).catch((error)=>{ |
|||
this.toolHeader.toolNo = null; |
|||
callback(new Error(' ')) |
|||
}) |
|||
}; |
|||
return{ |
|||
saveQuotationToolFlag:false, |
|||
quotationToolList:[], |
|||
initQuotationToolLoading:false, |
|||
toolHeaderDialogFlag:false, |
|||
selectionQuotationToolList:[], |
|||
saveQuotationToolLoading:false, |
|||
selectionToolHeaderList:[], |
|||
toolHeaderList:[], |
|||
quotationTool: { |
|||
quotationToolId: undefined, |
|||
site: this.$store.state.user.site, |
|||
toolNo: "", |
|||
toolDescription: "", |
|||
toolQuantity: 1, |
|||
unitCost: 1, |
|||
quotationUnitCost:0, |
|||
expectedServiceLife: 1, |
|||
remark: "", |
|||
}, |
|||
// 工具列表筛选对象 |
|||
toolHeader:{ |
|||
site:this.$store.state.user.site, |
|||
toolNo:undefined,// 编号 |
|||
toolDescription:undefined,// 描述 |
|||
}, |
|||
// 报价工具表单校验 |
|||
quotationToolRules: { |
|||
toolNo: [{required: true, validator:validateToolNo,message:" ", trigger: 'change'}], |
|||
toolDescription: [{required: true, message: ' ', trigger: ['change','blur']}], |
|||
toolQuantity: [{required: true,pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
unitCost: [{required: true,pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
expectedServiceLife: [{required: true,pattern:/^[1-9]\d{0,14}(\.\d{1,16})?$|^0(\.\d{1,16})?$/, message: ' ', trigger: ['change','blur']}], |
|||
}, |
|||
// 工具列表 |
|||
quotationToolColumns: [ |
|||
{label: "toolNo", value: "工具编码",}, |
|||
{label: "toolDescription", value: "工具描述",}, |
|||
{label: "toolQuantity", value: "工具数量",}, |
|||
{label: "unitCost", value: "单位成本",}, |
|||
{label: "itemNo", value: "序号",}, |
|||
{label: "expectedServiceLife", value: "预计使用寿命",}, |
|||
], |
|||
columnList: [ |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101008001, |
|||
serialNumber: '101002001ToolNo', |
|||
tableId: '101002001Table5', |
|||
tableName: '工具信息表', |
|||
columnProp: 'toolNo', |
|||
headerAlign: 'center', |
|||
align: 'center', |
|||
columnLabel: '工具编码', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 120 |
|||
},{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101008001, |
|||
serialNumber: '101002001ToolDescription', |
|||
tableId: '101002001Table5', |
|||
tableName: '工具信息表', |
|||
columnProp: 'toolDescription', |
|||
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: 101008001, |
|||
serialNumber: '101002001ToolQuantity', |
|||
tableId: '101002001Table5', |
|||
tableName: '工具信息表', |
|||
columnProp: 'toolQuantity', |
|||
headerAlign: 'center', |
|||
align: 'right', |
|||
columnLabel: '工具数量', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 100 |
|||
},{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101008001, |
|||
serialNumber: '101002001UnitCost', |
|||
tableId: '101002001Table5', |
|||
tableName: '工具信息表', |
|||
columnProp: 'unitCost', |
|||
headerAlign: 'center', |
|||
align: 'right', |
|||
columnLabel: '单位成本', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 120 |
|||
},{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101008001, |
|||
serialNumber: '101002001ExpectedServiceLife', |
|||
tableId: '101002001Table5', |
|||
tableName: '工具信息表', |
|||
columnProp: 'expectedServiceLife', |
|||
headerAlign: 'center', |
|||
align: 'right', |
|||
columnLabel: '预计使用寿命', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 120 |
|||
},{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101008001, |
|||
serialNumber: '101002001QuotationUnitCost', |
|||
tableId: '101002001Table5', |
|||
tableName: '工具信息表', |
|||
columnProp: 'quotationUnitCost', |
|||
headerAlign: 'center', |
|||
align: 'right', |
|||
columnLabel: '单位报价成本', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 120 |
|||
},{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 101008001, |
|||
serialNumber: '101002001Remark', |
|||
tableId: '101002001Table5', |
|||
tableName: '工具信息表', |
|||
columnProp: 'remark', |
|||
headerAlign: 'center', |
|||
align: 'left', |
|||
columnLabel: '备注', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 120 |
|||
}, |
|||
], |
|||
} |
|||
}, |
|||
created() { |
|||
// this.initQuotationToolData(); |
|||
}, |
|||
methods:{ |
|||
getQuotationToolList(){ |
|||
this.initQuotationToolData(); |
|||
// 计算成本 |
|||
return this.quotationToolList.reduce((total, currentValue) => { |
|||
return total + new Decimal(currentValue.quotationUnitCost).toNumber(); |
|||
}, 0); |
|||
}, |
|||
initQuotationToolData() { |
|||
let params = { |
|||
quotationDetailId: this.detail.quotationDetailId, |
|||
} |
|||
this.initQuotationToolLoading = true; |
|||
searchQuotationTool(params).then(({data}) => { |
|||
this.initQuotationToolLoading = false; |
|||
if (data && data.code === 200) { |
|||
this.quotationToolList = data.data; |
|||
} |
|||
}).catch((error)=>{ |
|||
this.initQuotationToolLoading = false; |
|||
}) |
|||
}, |
|||
handleSelectionChangeQuotationToolTable(selection){ |
|||
this.selectionQuotationToolList = selection; |
|||
}, |
|||
clickEditToolTableBtn(row){ |
|||
this.quotationTool = JSON.parse(JSON.stringify(row)); |
|||
this.saveQuotationToolFlag= true; |
|||
}, |
|||
clickDeleteToolTableBtn(row){ |
|||
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
deleteQuotationTool(row).then(({data})=>{ |
|||
if (data.code === 200){ |
|||
this.initQuotationToolData(); |
|||
this.$message.success(data.msg); |
|||
}else { |
|||
this.$message.error(data.msg); |
|||
} |
|||
}) |
|||
}) |
|||
}, |
|||
deleteSelectionQuotationTool(){ |
|||
if (this.selectionQuotationToolList.length === 0) { |
|||
this.$message.warning("请选择要删除的工具记录") |
|||
return; |
|||
} |
|||
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
batchDeleteQuotationTool(this.selectionQuotationToolList).then(({data})=>{ |
|||
if (data.code === 200){ |
|||
this.initQuotationToolData(); |
|||
this.$message.success(data.msg); |
|||
}else { |
|||
this.$message.error(data.msg); |
|||
} |
|||
}) |
|||
}) |
|||
}, |
|||
// 关闭 报价工具 新增弹框 |
|||
closeQuotationToolDialog() { |
|||
this.$refs['quotationToolForm'].resetFields(); |
|||
this.quotationTool = { |
|||
quotationToolId: undefined, |
|||
site: this.$store.state.user.site, |
|||
toolNo: "", |
|||
toolDescription: "", |
|||
toolQuantity: 1, |
|||
unitCost: 1, |
|||
quotationUnitCost: 0, |
|||
expectedServiceLife: 1, |
|||
remark: "", |
|||
}; |
|||
if (this.selectionToolHeaderList.length > 0){ |
|||
this.$refs.toolHeaderForm.resetFields(); |
|||
} |
|||
this.selectionQuotationToolList = []; |
|||
if (this.$refs.toolHeaderTable) { |
|||
this.$refs.toolHeaderTable.clearSelection(); |
|||
} |
|||
}, |
|||
openQuotationToolDialog(){ |
|||
this.computeToolQuotationUnitCost(this.quotationTool); |
|||
}, |
|||
computeToolQuotationUnitCost(row){ |
|||
//单位报价成本 = 单位成本 * 工具数量 / 预计使用寿命 |
|||
if (!row.expectedServiceLife || row.expectedServiceLife <= 0){ |
|||
this.quotationTool.expectedServiceLife = 1; |
|||
} |
|||
if (!row.toolQuantity || row.toolQuantity <= 0){ |
|||
this.quotationTool.toolQuantity = 1; |
|||
} |
|||
if (!row.unitCost || row.unitCost < 0){ |
|||
this.quotationTool.unitCost = 0; |
|||
} |
|||
if (!row.expectedServiceLife || !row.toolQuantity || !row.unitCost){ |
|||
row.quotationUnitCost = 0; |
|||
return |
|||
} |
|||
row.quotationUnitCost = new Decimal(new Decimal(row.unitCost).mul(new Decimal(row.toolQuantity)).div(new Decimal(row.expectedServiceLife)).toFixed(16,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber(); |
|||
}, |
|||
saveQuotationTool() { |
|||
this.$refs['quotationToolForm'].validate((validate, object) => { |
|||
if (validate) { |
|||
this.saveQuotationToolLoading = true; |
|||
this.quotationTool.quotationDetailId = this.detail.quotationDetailId; |
|||
this.insertQuotationToolData(); |
|||
} else { |
|||
this.rulesValidateLabel(object, this.quotationToolColumns);// 校验提示 |
|||
} |
|||
}) |
|||
}, |
|||
insertQuotationToolData(){ |
|||
saveQuotationTool(this.quotationTool).then(({data}) => { |
|||
this.saveQuotationToolLoading = false; |
|||
if (data.code === 200) { |
|||
this.initQuotationToolData(); |
|||
this.$message.success(data.msg); |
|||
this.saveQuotationToolFlag = false;// 关闭弹框 |
|||
} else { |
|||
this.$message.error(data.msg); |
|||
} |
|||
}).catch((error)=>{ |
|||
this.saveQuotationToolLoading = false; |
|||
}) |
|||
}, |
|||
// 打开 工具信息弹框 |
|||
openToolHeaderDialog(){ |
|||
if (this.selectionToolHeaderList.length > 0) { |
|||
this.$refs.quotationToolForm.resetFields(); |
|||
} |
|||
}, |
|||
initToolHeader(){ |
|||
searchToolHeader(this.toolHeader).then(({data})=>{ |
|||
if (data.code === 200) { |
|||
this.toolHeaderList = data.data; |
|||
this.toolHeaderList = this.toolHeaderList.map(item =>{ |
|||
let utilObj = { |
|||
toolNo:item.toolId, |
|||
toolDescription:item.toolDescription, |
|||
unitCost:item.standardCost, |
|||
} |
|||
return utilObj; |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
handleSelectionChangeToolHeaderTable(selection){ |
|||
this.selectionToolHeaderList = selection; |
|||
}, |
|||
dblclickToolHeader(row){ |
|||
row = JSON.parse(JSON.stringify(row)); |
|||
this.quotationTool.toolNo = row.toolNo; |
|||
this.quotationTool.toolDescription = row.toolDescription; |
|||
this.quotationTool.unitCost = row.unitCost ? row.unitCost : 0; |
|||
this.computeToolQuotationUnitCost(this.quotationTool) |
|||
this.toolHeaderDialogFlag= false; |
|||
}, |
|||
// 校验处理 |
|||
rulesValidateLabel(objects, labels) { |
|||
for (let filed in objects) { |
|||
for (let i = 0; i < labels.length; i++) { |
|||
let quotationToolColumn = labels[i]; |
|||
if (quotationToolColumn.label === filed) { |
|||
this.$message.warning(quotationToolColumn.value+"为空或填写不正确"); |
|||
return |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
}, |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<div> |
|||
<el-button type="primary" @click="saveQuotationToolFlag = true">新 增</el-button> |
|||
<el-button type="primary" @click="deleteSelectionQuotationTool">删 除</el-button> |
|||
</div> |
|||
<el-table style="margin-top: 5px" ref="quotationToolTable" |
|||
v-loading="initQuotationToolLoading" |
|||
element-loading-text = "数据正在加载中" |
|||
@selection-change="handleSelectionChangeQuotationToolTable" |
|||
:data="quotationToolList" :height="height" stripe border> |
|||
<el-table-column |
|||
type="selection" |
|||
align="center" |
|||
width="55"> |
|||
</el-table-column> |
|||
<el-table-column label="操作" width="120" align="center" > |
|||
<template slot-scope="{row,$index}"> |
|||
<el-link style="cursor: pointer" @click="clickEditToolTableBtn(row)">编辑</el-link> |
|||
<el-link style="cursor: pointer" @click="clickDeleteToolTableBtn(row)">删除</el-link> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
v-for="(item,index) in columnList" :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" > |
|||
<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> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<el-dialog title="报价工具" v-drag |
|||
@close="closeQuotationToolDialog" |
|||
@open="openQuotationToolDialog" |
|||
:visible.sync="saveQuotationToolFlag" width="40%" |
|||
top="15vh" append-to-body> |
|||
<el-form :rules="quotationToolRules" ref="quotationToolForm" :model="quotationTool" label-position="top" |
|||
style="height: 260px"> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<el-form-item label="工具编码" prop="toolNo"> |
|||
<span slot="label" @click="toolHeaderDialogFlag = true" style="cursor: pointer"><a>工具编码</a></span> |
|||
<el-input v-model="quotationTool.toolNo" clearable/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12" :offset="2"> |
|||
<el-form-item label="工具描述" prop="toolDescription"> |
|||
<el-input v-model="quotationTool.toolDescription" :disabled="quotationTool.toolNo !== '*'" clearable/> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<el-form-item label="工具数量" prop="toolQuantity"> |
|||
<div class="right"> |
|||
<el-input class="inlineNumber" @input="computeToolQuotationUnitCost(quotationTool)" v-model="quotationTool.toolQuantity" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12" :offset="2"> |
|||
<el-form-item label="预计使用寿命" prop="expectedServiceLife"> |
|||
<div class="right"> |
|||
<el-input class="inlineNumber" @input="computeToolQuotationUnitCost(quotationTool)" v-model="quotationTool.expectedServiceLife" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<el-form-item label="单位成本" prop="unitCost"> |
|||
<div class="right"> |
|||
<el-input class="inlineNumber" @input="computeToolQuotationUnitCost(quotationTool)" v-model="quotationTool.unitCost" :disabled="quotationTool.toolNo !== '*'" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12" :offset="2"> |
|||
<el-form-item label="单位报价成本" prop="unitCost"> |
|||
<div class="right"> |
|||
<el-input class="inlineNumber" v-model="quotationTool.quotationUnitCost" disabled onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-form-item label="备注" prop="remark" style="height: 90px"> |
|||
<el-input v-model="quotationTool.remark" resize="none" type="textarea" :autosize="{minRows: 3, maxRows: 3}" style="width: 93%"/> |
|||
</el-form-item> |
|||
</el-form> |
|||
<span slot="footer" class="dialog-footer" style="margin-top: 5px"> |
|||
<el-button type="primary" :loading="saveQuotationToolLoading" @click="saveQuotationTool">确 定</el-button> |
|||
<el-button @click="saveQuotationToolFlag= false">取 消</el-button> |
|||
</span> |
|||
</el-dialog> |
|||
|
|||
<!--tool列表--> |
|||
<el-dialog v-drag title="工具信息" |
|||
@open="openToolHeaderDialog" |
|||
width="40%" top="15vh" append-to-body |
|||
:visible.sync="toolHeaderDialogFlag"> |
|||
<!--搜索条件--> |
|||
<el-form :model="toolHeader" ref="toolHeaderForm" :inline="true" label-position="top"> |
|||
<el-form-item label="工具编号" prop="toolNo"> |
|||
<el-input v-model="toolHeader.toolNo" clearable/> |
|||
</el-form-item> |
|||
<el-form-item label="工具描述" prop="toolDescription"> |
|||
<el-input v-model="toolHeader.toolDescription" clearable/> |
|||
</el-form-item> |
|||
<el-form-item label=" "> |
|||
<el-button type="primary" @click="initToolHeader">搜 索</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<!--筛选的数据--> |
|||
<el-table :data="toolHeaderList" ref="toolHeaderTable" :style="{marginTop:'10px'}" |
|||
height="300px" stripe border @selection-change="handleSelectionChangeToolHeaderTable" |
|||
@row-dblclick="dblclickToolHeader"> |
|||
<el-table-column label="工具编号" prop="toolNo"/> |
|||
<el-table-column label="工具描述" prop="toolDescription"/> |
|||
</el-table> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
|||
604
src/views/modules/quotation/sellForQuotation/quoteDetail.vue
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue