7 changed files with 1611 additions and 10 deletions
-
13src/api/quote/quoteDetail.js
-
7src/api/quote/quoteDetailTool.js
-
56src/views/modules/quote/detail/primary/quoteDetailBom.vue
-
323src/views/modules/quote/detail/primary/quoteDetailCost.vue
-
363src/views/modules/quote/detail/primary/quoteDetailTool.vue
-
759src/views/modules/quote/detail/quoteDetail.vue
-
100src/views/modules/quote/index.vue
@ -0,0 +1,13 @@ |
|||||
|
import {createAPI} from "../../utils/httpRequest"; |
||||
|
|
||||
|
export const queryQuoteDetail = (data) => createAPI(`/quote/detail`,'post',data) |
||||
|
|
||||
|
export const queryQuoteDetailByPage = (data) => createAPI(`/quote/detail/${data.no}/${data.size}`,'post',data) |
||||
|
|
||||
|
export const saveQuoteDetail = (data) => createAPI(`/quote/detail/save`,'post',data) |
||||
|
|
||||
|
export const updateQuoteDetail = (data) => createAPI(`/quote/detail/update`,'post',data) |
||||
|
|
||||
|
export const deleteQuoteDetail = (data) => createAPI(`/quote/detail/remove/${data.id}`,'post',data) |
||||
|
|
||||
|
export const queryQuoteDetailAllCost = (data) => createAPI(`/quote/detail/cost`,'post',data) |
||||
@ -0,0 +1,7 @@ |
|||||
|
import {createAPI} from "../../utils/httpRequest"; |
||||
|
|
||||
|
export const queryToolList = (data) => createAPI('/quote/detail/tool/list', 'post', data) |
||||
|
export const queryQuoteDetailTool = (data) =>createAPI(`/quote/detail/tool`,'post',data) |
||||
|
export const removeQuoteDetailTool = (data) => createAPI(`quote/detail/tool/remove/${data.id}`,'post',data) |
||||
|
export const saveQuoteDetailTool = (data) => createAPI(`quote/detail/tool/save`,'post',data) |
||||
|
export const updateQuoteDetailTool = (data) => createAPI(`quote/detail/tool/update`,'post',data) |
||||
@ -0,0 +1,56 @@ |
|||||
|
<script> |
||||
|
export default { |
||||
|
name: "quoteDetailBom", |
||||
|
props:{ |
||||
|
quoteDetail:{ |
||||
|
type:Object, |
||||
|
required:true |
||||
|
}, |
||||
|
}, |
||||
|
model:{ |
||||
|
prop: "quoteDetail", |
||||
|
event: "update" |
||||
|
}, |
||||
|
data(){ |
||||
|
return{ |
||||
|
isAllBom:false, |
||||
|
} |
||||
|
}, |
||||
|
methods:{ |
||||
|
handleQueryQuoteDetailBom(){ |
||||
|
console.log(this.quoteDetail.id) |
||||
|
}, |
||||
|
}, |
||||
|
created() { |
||||
|
if (this.quoteDetail && this.quoteDetail.id){ |
||||
|
this.handleQueryQuoteDetailBom(); |
||||
|
} |
||||
|
}, |
||||
|
watch:{ |
||||
|
'quoteDetail.id'(newVal,oldVal){ |
||||
|
this.handleQueryQuoteDetailBom(); |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<template> |
||||
|
<div> |
||||
|
<div style="margin-bottom: 10px"> |
||||
|
<el-link style="margin-right: 20px">切换版本</el-link> |
||||
|
<el-checkbox v-model="isAllBom">全级BOM结构</el-checkbox> |
||||
|
</div> |
||||
|
<el-container> |
||||
|
<el-aside width="300px"> |
||||
|
|
||||
|
</el-aside> |
||||
|
<el-main style="padding: 0"> |
||||
|
|
||||
|
</el-main> |
||||
|
</el-container> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,323 @@ |
|||||
|
<script> |
||||
|
import {queryQuoteDetailAllCost} from "../../../../../api/quote/quoteDetail"; |
||||
|
|
||||
|
export default { |
||||
|
name: "quoteDetailCost", |
||||
|
props: { |
||||
|
quoteDetail: { |
||||
|
type: Object, |
||||
|
required: true |
||||
|
}, |
||||
|
}, |
||||
|
model: { |
||||
|
prop: "quoteDetail", |
||||
|
event: "update", |
||||
|
}, |
||||
|
data(){ |
||||
|
return { |
||||
|
rules:{ |
||||
|
adjustPartCost: [ |
||||
|
{ required: true, message: "请输入材料成本", trigger: ["blur","change"] } |
||||
|
], |
||||
|
adjustMachineCost: [ |
||||
|
{ required: true, message: "请输入机器成本", trigger: ["blur","change"] } |
||||
|
], |
||||
|
adjustFabricateCost: [ |
||||
|
{ required: true, message: "请输入制造费用成本", trigger: ["blur","change"] } |
||||
|
], |
||||
|
adjustLabourCost: [ |
||||
|
{ required: true, message: "请输入人工成本", trigger: ["blur","change"] } |
||||
|
], |
||||
|
adjustToolCost: [ |
||||
|
{ required: true, message: "请输入工具成本", trigger: ["blur","change"] } |
||||
|
], |
||||
|
manageCost: [ |
||||
|
{ required: true, message: "请输入管理成本", trigger: ["blur","change"] } |
||||
|
], |
||||
|
otherCost: [ |
||||
|
{ required: true, message: "请输入其他成本", trigger: ["blur","change"] } |
||||
|
], |
||||
|
profitRate: [ |
||||
|
{ required: true, message: "请输入利润率", trigger: ["blur","change"] } |
||||
|
], |
||||
|
taxRate: [ |
||||
|
{ required: true, message: "请输入税率", trigger: ["blur","change"] } |
||||
|
], |
||||
|
}, |
||||
|
} |
||||
|
}, |
||||
|
methods:{ |
||||
|
computeTotalCost(){ |
||||
|
this.quoteDetail.totalCost = |
||||
|
this.quoteDetail.adjustPartCost + |
||||
|
this.quoteDetail.adjustMachineCost + |
||||
|
this.quoteDetail.adjustFabricateCost + |
||||
|
this.quoteDetail.adjustLabourCost + |
||||
|
this.quoteDetail.adjustToolCost + |
||||
|
this.quoteDetail.manageCost + |
||||
|
this.quoteDetail.otherCost; |
||||
|
this.computeProfitAmount(); |
||||
|
}, |
||||
|
computeProfitAmount(){ |
||||
|
this.quoteDetail.profitAmount = |
||||
|
this.quoteDetail.totalCost * (this.quoteDetail.profitRate / 100); |
||||
|
this.computeTaxCost(); |
||||
|
}, |
||||
|
computeTaxCost(){ |
||||
|
this.quoteDetail.totalPrice = |
||||
|
this.quoteDetail.totalCost + this.quoteDetail.profitAmount; |
||||
|
this.quoteDetail.unitPrice = |
||||
|
this.quoteDetail.totalPrice / this.quoteDetail.qty; |
||||
|
this.quoteDetail.taxTotalPrice = |
||||
|
this.quoteDetail.totalPrice + this.quoteDetail.totalPrice * (this.quoteDetail.taxRate / 100); |
||||
|
this.quoteDetail.taxUnitPrice = |
||||
|
this.quoteDetail.taxTotalPrice / this.quoteDetail.qty; |
||||
|
}, |
||||
|
handleQueryAllCost(){ |
||||
|
let params = { |
||||
|
...this.quoteDetail |
||||
|
} |
||||
|
queryQuoteDetailAllCost(params).then(({data})=>{ |
||||
|
if (data && data.code === 0){ |
||||
|
this.quoteDetail.toolCost = data.row.toolCost; |
||||
|
this.quoteDetail.adjustToolCost = data.row.toolCost; |
||||
|
}else { |
||||
|
this.$message.warning(data.msg); |
||||
|
} |
||||
|
}).catch((error)=>{ |
||||
|
this.$message.error(error); |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
watch:{ |
||||
|
'quoteDetail.adjustPartCost'(newValue, oldValue){ |
||||
|
if (newValue === undefined || newValue === null){ |
||||
|
this.quoteDetail.adjustPartCost = 0; |
||||
|
} |
||||
|
this.computeTotalCost(); |
||||
|
}, |
||||
|
'quoteDetail.adjustMachineCost'(newValue, oldValue){ |
||||
|
if (newValue === undefined || newValue === null){ |
||||
|
this.quoteDetail.adjustMachineCost = 0; |
||||
|
} |
||||
|
this.computeTotalCost(); |
||||
|
}, |
||||
|
'quoteDetail.adjustFabricateCost'(newValue, oldValue){ |
||||
|
if (newValue === undefined || newValue === null){ |
||||
|
this.quoteDetail.adjustFabricateCost = 0; |
||||
|
} |
||||
|
this.computeTotalCost(); |
||||
|
}, |
||||
|
'quoteDetail.adjustLabourCost'(newValue, oldValue){ |
||||
|
if (newValue === undefined || newValue === null){ |
||||
|
this.quoteDetail.adjustLabourCost = 0; |
||||
|
} |
||||
|
this.computeTotalCost(); |
||||
|
}, |
||||
|
'quoteDetail.adjustToolCost'(newValue, oldValue){ |
||||
|
if (newValue === undefined || newValue === null){ |
||||
|
this.quoteDetail.adjustToolCost = 0; |
||||
|
} |
||||
|
this.computeTotalCost(); |
||||
|
}, |
||||
|
'quoteDetail.manageCost'(newValue, oldValue){ |
||||
|
if (newValue === undefined || newValue === null){ |
||||
|
this.quoteDetail.manageCost = 0; |
||||
|
} |
||||
|
this.computeTotalCost(); |
||||
|
}, |
||||
|
'quoteDetail.otherCost'(newValue, oldValue){ |
||||
|
if (newValue === undefined || newValue === null){ |
||||
|
this.quoteDetail.otherCost = 0; |
||||
|
} |
||||
|
this.computeTotalCost(); |
||||
|
}, |
||||
|
'quoteDetail.profitRate'(newValue, oldValue){ |
||||
|
if (newValue === undefined || newValue === null){ |
||||
|
this.quoteDetail.profitRate = 0; |
||||
|
} |
||||
|
this.computeProfitAmount(); |
||||
|
}, |
||||
|
'quoteDetail.taxRate'(newValue, oldValue){ |
||||
|
if (newValue === undefined || newValue === null){ |
||||
|
this.quoteDetail.taxRate = 0; |
||||
|
} |
||||
|
this.computeTaxCost(); |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<template> |
||||
|
<div> |
||||
|
<el-button type="primary" @click="handleQueryAllCost"> 计 算</el-button> |
||||
|
<!--系统自动计算结果--> |
||||
|
<el-form :model="quoteDetail" 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=" 10"> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="材料成本:" prop="partCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%; " :controls="false" |
||||
|
v-model="quoteDetail.partCost" :precision="4" disabled/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="机器成本:" prop="machineCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%; " :controls="false" |
||||
|
v-model="quoteDetail.machineCost" :precision="4" disabled/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="制造费用成本:" prop="fabricateCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%; " :controls="false" |
||||
|
v-model="quoteDetail.fabricateCost" :precision="4" disabled/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="人工成本:" prop="labourCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.labourCost" :precision="4" disabled/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="工具成本:" prop="toolCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.toolCost" :precision="4" 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=" 10"> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="材料成本:" prop="adjustPartCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.adjustPartCost" :step="0" :precision="4" :min="0"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="机器成本:" prop="adjustMachineCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.adjustMachineCost" :step="0" :precision="4" :min="0"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="制造费用成本:" prop="adjustFabricateCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.adjustFabricateCost" :step="0" :precision="4" :min="0"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="人工成本:" prop="adjustLabourCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.adjustLabourCost" :step="0" :precision="4" :min="0"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="工具成本:" prop="adjustToolCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.adjustToolCost" :step="0" :precision="4" :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=" 10"> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="管理成本:" prop="manageCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.manageCost" :step="0" :precision="4" :min="0"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<!-- <el-col :span="4">--> |
||||
|
<!-- <el-form-item label="包装成本:">--> |
||||
|
<!-- <el-input-number style="width: 100%;" :controls="false"--> |
||||
|
<!-- v-model="copyPackCost" :step="0" :precision="4" :min="0" disabled/>--> |
||||
|
<!-- </el-form-item>--> |
||||
|
<!-- </el-col>--> |
||||
|
<!-- <el-col :span="4">--> |
||||
|
<!-- <el-form-item label="运输成本:">--> |
||||
|
<!-- <el-input-number style="width: 100%; " :controls="false"--> |
||||
|
<!-- v-model="copyShippingCost" :step="0" :precision="4" :min="0" disabled/>--> |
||||
|
<!-- </el-form-item>--> |
||||
|
<!-- </el-col>--> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="其他成本:" prop="otherCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%; " :controls="false" |
||||
|
v-model="quoteDetail.otherCost" :step="0" :precision="4" :min="0"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="总成本:" prop="totalCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.totalCost" :step="0" :precision="4" :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=" 10"> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="利润率%:" prop="profitRate" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.profitRate" :step="0" :min="0"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="利润额:" prop="profitAmount" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.profitAmount" :step="0" :precision="4" :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=" 10"> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="未税总额:" prop="totalPrice" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.totalPrice" :step="0" :precision="4" :min="0" disabled/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="未税单价:" prop="unitPrice" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.unitPrice" :step="0" :min="0" :precision="6" disabled/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="税率%:" prop="taxRate" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.taxRate" :step="0" :min="0"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="含税总额:" prop="taxTotalPrice" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.taxTotalPrice" :step="0" :precision="4" :min="0" disabled/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="含税单价:" prop="taxUnitPrice" :show-message="false"> |
||||
|
<el-input-number style="width: 100%;" :controls="false" |
||||
|
v-model="quoteDetail.taxUnitPrice" :step="0" :precision="6" :min="0" disabled/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</fieldset> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,363 @@ |
|||||
|
<script> |
||||
|
import { |
||||
|
queryQuoteDetailTool, |
||||
|
queryToolList, |
||||
|
removeQuoteDetailTool, |
||||
|
saveQuoteDetailTool, updateQuoteDetailTool |
||||
|
} from "../../../../../api/quote/quoteDetailTool"; |
||||
|
|
||||
|
export default { |
||||
|
name: "quoteDetailTool", |
||||
|
props:{ |
||||
|
quoteDetail:{ |
||||
|
type: Object, |
||||
|
required: true |
||||
|
}, |
||||
|
}, |
||||
|
model:{ |
||||
|
prop:"quoteDetail", |
||||
|
event:"update", |
||||
|
}, |
||||
|
data(){ |
||||
|
return{ |
||||
|
queryLoading:false, |
||||
|
dataList:[], |
||||
|
tool:{ |
||||
|
toolNo:"", |
||||
|
toolDesc:"", |
||||
|
toolQty:1, |
||||
|
unitCost:0, |
||||
|
expectedServiceLife:0, |
||||
|
quoteUnitCost:0, |
||||
|
remark:"" |
||||
|
}, |
||||
|
saveTool:{ |
||||
|
|
||||
|
}, |
||||
|
saveVisible:false, |
||||
|
saveLoading:false, |
||||
|
toolVisible:false, |
||||
|
toolRules:{ |
||||
|
toolNo: [ |
||||
|
{ required: true, message: '请输入工具编码', trigger: ['blur','change'] } |
||||
|
], |
||||
|
toolDesc: [ |
||||
|
{ required: true, message: '请输入工具描述', trigger: ['blur','change'] } |
||||
|
], |
||||
|
toolQty: [ |
||||
|
{ required: true, message: '请输入工具数量', trigger: ['blur','change'] } |
||||
|
], |
||||
|
unitCost: [ |
||||
|
{ required: true, message: '请输入单位成本', trigger: ['blur','change'] } |
||||
|
], |
||||
|
expectedServiceLife: [ |
||||
|
{ required: true, message: '请输入预计使用寿命', trigger: ['blur','change'] } |
||||
|
], |
||||
|
quoteUnitCost: [ |
||||
|
{ required: true, message: '请输入单位报价成本', trigger: ['blur','change'] } |
||||
|
] |
||||
|
}, |
||||
|
toolList:[], |
||||
|
queryTool:{ |
||||
|
toolNo: "", |
||||
|
toolDesc: "", |
||||
|
}, |
||||
|
} |
||||
|
}, |
||||
|
methods:{ |
||||
|
handleQueryQuoteDetailTool(){ |
||||
|
let params = { |
||||
|
quoteDetailId: this.quoteDetail.id |
||||
|
} |
||||
|
this.queryLoading = true |
||||
|
queryQuoteDetailTool(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 |
||||
|
}) |
||||
|
}, |
||||
|
handleSave(row){ |
||||
|
if (row){ |
||||
|
this.saveTool = {...row}; |
||||
|
}else { |
||||
|
this.saveTool = {...this.tool}; |
||||
|
} |
||||
|
this.saveVisible = true; |
||||
|
}, |
||||
|
handleRemove(row){ |
||||
|
this.$alert("确定删除该工具吗?", "提示", { |
||||
|
confirmButtonText: "确定", |
||||
|
cancelButtonText: "取消", |
||||
|
type: "warning" |
||||
|
}).then(() => { |
||||
|
let params = { |
||||
|
id: row.id |
||||
|
} |
||||
|
removeQuoteDetailTool(params).then(({data})=>{ |
||||
|
if (data && data.code === 0){ |
||||
|
this.$message.success("删除成功") |
||||
|
this.handleQueryQuoteDetailTool(); |
||||
|
}else { |
||||
|
this.$message.warning(data.msg) |
||||
|
} |
||||
|
}).catch((error)=>{ |
||||
|
this.$message.error(error) |
||||
|
}) |
||||
|
}).catch(() => {}); |
||||
|
}, |
||||
|
computedQuoteUnitCost(){ |
||||
|
let quoteUnitCost = this.saveTool.unitCost * this.saveTool.toolQty; |
||||
|
if (isNaN(quoteUnitCost)){ |
||||
|
this.saveTool.quoteUnitCost = 0; |
||||
|
return |
||||
|
} |
||||
|
this.saveTool.quoteUnitCost = quoteUnitCost/this.saveTool.expectedServiceLife; |
||||
|
}, |
||||
|
handleQueryToolList(flag){ |
||||
|
let params = { |
||||
|
site:this.quoteDetail.site, |
||||
|
toolNo:this.queryTool.toolNo, |
||||
|
toolDesc:this.queryTool.toolDesc, |
||||
|
} |
||||
|
queryToolList(params).then(({data})=>{ |
||||
|
if (data && data.code === 0){ |
||||
|
this.toolList = data.rows; |
||||
|
if (flag){ |
||||
|
if (this.toolList.length === 1){ |
||||
|
this.handleToolDblClick(this.toolList[0]) |
||||
|
} |
||||
|
} |
||||
|
}else { |
||||
|
this.$message.warning(data.msg) |
||||
|
} |
||||
|
}).catch((error)=>{ |
||||
|
this.$message.error(error) |
||||
|
}) |
||||
|
}, |
||||
|
handleToolDblClick(row){ |
||||
|
this.saveTool.toolNo = row.toolNo; |
||||
|
this.saveTool.toolDesc = row.toolDesc; |
||||
|
this.saveTool.unitCost = row.unitCost; |
||||
|
this.toolVisible = false |
||||
|
}, |
||||
|
handleToolNoBlur(){ |
||||
|
this.queryTool.toolNo = this.saveTool.toolNo |
||||
|
this.handleQueryToolList(true) |
||||
|
}, |
||||
|
handleSaveOrUpdate(){ |
||||
|
this.$refs.saveToolForm.validate((valid,obj) => { |
||||
|
if (valid){ |
||||
|
if (this.saveTool.id){ |
||||
|
this.handleUpdateTool(); |
||||
|
}else { |
||||
|
this.handleSaveTool(); |
||||
|
} |
||||
|
}else { |
||||
|
let i = 1; |
||||
|
for (let key in obj) { |
||||
|
this.$message.error(obj[key][0].message); |
||||
|
if (i === 1){ |
||||
|
return |
||||
|
} |
||||
|
i++; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
handleUpdateTool(){ |
||||
|
let params ={ |
||||
|
...this.saveTool, |
||||
|
updateBy:this.$store.state.user.name, |
||||
|
} |
||||
|
this.saveLoading = true |
||||
|
updateQuoteDetailTool(params).then(({data})=>{ |
||||
|
this.saveLoading = false |
||||
|
if (data && data.code === 0){ |
||||
|
this.$message.success(data.msg) |
||||
|
this.handleQueryQuoteDetailTool(); |
||||
|
this.saveVisible = false |
||||
|
}else { |
||||
|
this.$message.warning(data.msg) |
||||
|
} |
||||
|
}).catch((error)=>{ |
||||
|
this.saveLoading = false |
||||
|
this.$message.error(error) |
||||
|
}) |
||||
|
}, |
||||
|
handleSaveTool(){ |
||||
|
let params = { |
||||
|
...this.saveTool, |
||||
|
createBy: this.$store.state.user.name, |
||||
|
quoteDetailId: this.quoteDetail.id, |
||||
|
quoteId: this.quoteDetail.quoteId, |
||||
|
quoteNo:this.quoteDetail.quoteNo, |
||||
|
site: this.quoteDetail.site, |
||||
|
buNo: this.quoteDetail.buNo, |
||||
|
versionNo:this.quoteDetail.versionNo, |
||||
|
quoteDetailItemNo:this.quoteDetail.itemNo, |
||||
|
} |
||||
|
if (isNaN(this.saveTool.quoteUnitCost)){ |
||||
|
params.quoteUnitCost = 0; |
||||
|
} |
||||
|
this.saveLoading = true |
||||
|
saveQuoteDetailTool(params).then(({data})=>{ |
||||
|
this.saveLoading = false |
||||
|
if (data && data.code === 0){ |
||||
|
this.$message.success(data.msg) |
||||
|
this.handleQueryQuoteDetailTool() |
||||
|
this.saveVisible = false |
||||
|
}else { |
||||
|
this.$message.warning(data.msg) |
||||
|
} |
||||
|
}).catch((error)=>{ |
||||
|
this.saveLoading = false |
||||
|
this.$message.error(error) |
||||
|
}) |
||||
|
}, |
||||
|
}, |
||||
|
created() { |
||||
|
if (this.quoteDetail && this.quoteDetail.id){ |
||||
|
this.handleQueryQuoteDetailTool(); |
||||
|
} |
||||
|
}, |
||||
|
watch:{ |
||||
|
'quoteDetail.id'(newVal,oldVal){ |
||||
|
this.handleQueryQuoteDetailTool(); |
||||
|
}, |
||||
|
'saveTool.toolQty'(newVal, oldVal){ |
||||
|
this.computedQuoteUnitCost(); |
||||
|
}, |
||||
|
'saveTool.unitCost'(newVal,oldVal){ |
||||
|
this.computedQuoteUnitCost(); |
||||
|
}, |
||||
|
'saveTool.expectedServiceLife'(newVal,oldVal){ |
||||
|
this.computedQuoteUnitCost(); |
||||
|
}, |
||||
|
'toolVisible'(newVal,oldVal){ |
||||
|
if (newVal){ |
||||
|
this.queryTool={ |
||||
|
toolNo: this.saveTool.toolNo, |
||||
|
toolDesc: "", |
||||
|
} |
||||
|
this.handleQueryToolList(); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<template> |
||||
|
<div> |
||||
|
<el-button type="primary" @click="handleSave(null)">新增</el-button> |
||||
|
<el-table :data="dataList" v-loading="queryLoading" :height="420" border style="width: 100%;margin-top: 5px" > |
||||
|
<el-table-column label="工具编码" align="left" header-align="center" width="120" prop="toolNo"></el-table-column> |
||||
|
<el-table-column label="工具描述" align="left" header-align="center" width="180" prop="toolDesc"></el-table-column> |
||||
|
<el-table-column label="工具数量" align="right" header-align="center" width="100" prop="toolQty"></el-table-column> |
||||
|
<el-table-column label="单位成本" align="right" header-align="center" prop="unitCost"></el-table-column> |
||||
|
<el-table-column label="预计使用寿命" align="right" header-align="center" prop="expectedServiceLife"></el-table-column> |
||||
|
<el-table-column label="单位报价成本" align="right" header-align="center" prop="quoteUnitCost"></el-table-column> |
||||
|
<el-table-column label="备注" align="left" header-align="center" prop="remark"></el-table-column> |
||||
|
<el-table-column label="操作" align="center"> |
||||
|
<template slot-scope="scope"> |
||||
|
<a @click="handleSave(scope.row)">编辑</a> |
||||
|
<a @click="handleRemove(scope.row)">删除</a> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<el-dialog title="工具信息" :visible.sync="saveVisible" v-drag width="600px" append-to-body :close-on-click-modal="false"> |
||||
|
<el-form :model="saveTool" label-position="top" :rules="toolRules" ref="saveToolForm"> |
||||
|
<el-row :gutter="10"> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="工具编码" prop="toolNo" :show-message="false"> |
||||
|
<span slot="label"> |
||||
|
<a @click="toolVisible = true">工具编码</a> |
||||
|
</span> |
||||
|
<el-input v-model="saveTool.toolNo" @blur="handleToolNoBlur"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="16"> |
||||
|
<el-form-item label="工具描述" prop="toolDesc" :show-message="false"> |
||||
|
<el-input v-model="saveTool.toolDesc" disabled></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="工具数量" prop="toolQty" :show-message="false"> |
||||
|
<el-input-number style="width: 100%" :controls="false" :step="0" :precision="0" v-model="saveTool.toolQty"></el-input-number> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="预计使用寿命" prop="expectedServiceLife" :show-message="false"> |
||||
|
<el-input-number style="width: 100%" :controls="false" :step="0" :precision="0" v-model="saveTool.expectedServiceLife"></el-input-number> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row :gutter="10"> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="单位成本" prop="unitCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%" :controls="false" :step="0" :precision="4" v-model="saveTool.unitCost"></el-input-number> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="单位报价成本" prop="quoteUnitCost" :show-message="false"> |
||||
|
<el-input-number style="width: 100%" :controls="false" disabled :step="0" :precision="4" v-model="saveTool.quoteUnitCost"></el-input-number> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="24"> |
||||
|
<el-form-item label="备注" prop="remark" class="auto" :show-message="false"> |
||||
|
<el-input type="textarea" v-model="saveTool.remark" :autosize="{minRows: 3, maxRows: 3}"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<div slot="footer" class="dialog-footer"> |
||||
|
<el-button type="primary" :loading="saveLoading" @click="handleSaveOrUpdate">确 定</el-button> |
||||
|
<el-button @click="saveVisible = false">取 消</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
|
||||
|
<el-dialog title="工具列表" v-drag :visible.sync="toolVisible" width="600px" append-to-body :close-on-click-modal="false"> |
||||
|
<el-form :model="queryTool" label-position="top"> |
||||
|
<el-row :gutter="10"> |
||||
|
<el-col :span="6"> |
||||
|
<el-form-item label="工具编码" prop="toolNo" :show-message="false"> |
||||
|
<el-input v-model="queryTool.toolNo"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="6"> |
||||
|
<el-form-item label="工具描述" prop="toolDesc" :show-message="false"> |
||||
|
<el-input v-model="queryTool.toolDesc"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="6"> |
||||
|
<el-form-item label=" " :show-message="false"> |
||||
|
<el-button type="primary" @click="handleQueryToolList(null)">查询</el-button> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<el-table :data="toolList" :height="300" border style="width: 100%;margin-top: 5px" @row-dblclick="handleToolDblClick"> |
||||
|
<el-table-column label="工具编码" align="left" header-align="center" min-width="120" prop="toolNo"></el-table-column> |
||||
|
<el-table-column label="工具描述" align="left" header-align="center" min-width="180" prop="toolDesc"></el-table-column> |
||||
|
</el-table> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<style scoped> |
||||
|
.el-table /deep/ .cell{ |
||||
|
height: auto; |
||||
|
line-height: 1.5; |
||||
|
} |
||||
|
|
||||
|
.auto /deep/ .el-form-item__content{ |
||||
|
height: auto; |
||||
|
line-height: 1.5; |
||||
|
} |
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue