6 changed files with 315 additions and 10 deletions
-
10src/api/quote/quoteDetailOther.js
-
10src/api/quote/quoteDetailTest.js
-
2src/views/modules/quote/detail/primary/quoteDetailOtherCost.vue
-
284src/views/modules/quote/detail/primary/quoteDetailTest.vue
-
8src/views/modules/quote/detail/primary/quoteDetailTool.vue
-
11src/views/modules/quote/detail/quoteDetail.vue
@ -0,0 +1,10 @@ |
|||
import {createAPI} from "../../utils/httpRequest"; |
|||
|
|||
export const queryQuoteDetailOther = (data) => createAPI(`/quote/detail/other/list`,'post',data) |
|||
|
|||
export const saveQuoteDetailOther = (data) => createAPI(`/quote/detail/other/save`,'post',data) |
|||
|
|||
export const removeQuoteDetailOther = (data) => createAPI(`/quote/detail/other/remove`,'post',data) |
|||
|
|||
export const updateQuoteDetailOther = (data) => createAPI(`/quote/detail/other/update`,'post',data) |
|||
|
|||
@ -0,0 +1,10 @@ |
|||
import {createAPI} from "../../utils/httpRequest"; |
|||
|
|||
export const queryQuoteDetailTest = (data) => createAPI(`/quote/detail/test/list`,'post',data) |
|||
|
|||
export const saveQuoteDetailTest = (data) => createAPI(`/quote/detail/test/save`,'post',data) |
|||
|
|||
export const removeQuoteDetailTest = (data) => createAPI(`/quote/detail/test/remove`,'post',data) |
|||
|
|||
export const updateQuoteDetailTest = (data) => createAPI(`/quote/detail/test/update`,'post',data) |
|||
|
|||
@ -0,0 +1,284 @@ |
|||
<script> |
|||
import { |
|||
queryQuoteDetailTest, |
|||
removeQuoteDetailTest, saveQuoteDetailTest, |
|||
updateQuoteDetailTest |
|||
} from "../../../../../api/quote/quoteDetailTest"; |
|||
|
|||
export default { |
|||
name: "quoteDetailTest", |
|||
props:{ |
|||
quoteDetail:{ |
|||
type: Object, |
|||
required: true |
|||
}, |
|||
}, |
|||
model:{ |
|||
prop:"quoteDetail", |
|||
event:"update", |
|||
}, |
|||
data(){ |
|||
return{ |
|||
queryLoading:false, |
|||
dataList:[], |
|||
test:{ |
|||
itemNo:'', |
|||
testDesc:'', |
|||
testQty:1, |
|||
unitCost:0, |
|||
markup:0, |
|||
quoteTestCost:0, |
|||
remark:'', |
|||
createdBy:'', |
|||
createdDate:'', |
|||
updatedBy:'', |
|||
updatedDate:'', |
|||
}, |
|||
saveTest:{ |
|||
|
|||
}, |
|||
saveVisible:false, |
|||
saveLoading:false, |
|||
testRules:{ |
|||
testDesc: [ |
|||
{ required: true, message: '请输入测试项', trigger: ['blur','change'] } |
|||
], |
|||
testQty: [ |
|||
{ required: true, message: '请输入分摊数量', trigger: ['blur','change'] } |
|||
], |
|||
unitCost: [ |
|||
{ required: true, message: '请输入测试费金额', trigger: ['blur','change'] } |
|||
], |
|||
markup: [ |
|||
{ required: true, message: '请输入Mark up%', trigger: ['blur','change'] } |
|||
], |
|||
quoteTestCost: [ |
|||
{ required: true, message: '请输入单片分摊成本', trigger: ['blur','change'] } |
|||
] |
|||
}, |
|||
} |
|||
}, |
|||
methods:{ |
|||
handleQueryQuoteDetailTest(){ |
|||
let params = { |
|||
quoteDetailId: this.quoteDetail.id |
|||
} |
|||
this.dataList = []; |
|||
this.queryLoading = true |
|||
queryQuoteDetailTest(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.saveTest = { |
|||
...row |
|||
}; |
|||
}else { |
|||
this.saveTest = {...this.test}; |
|||
} |
|||
this.saveVisible = true; |
|||
}, |
|||
handleRemove(row){ |
|||
this.$alert("确定删除该工具吗?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}).then(() => { |
|||
let params = { |
|||
id: row.id |
|||
} |
|||
removeQuoteDetailTest(params).then(({data})=>{ |
|||
if (data && data.code === 0){ |
|||
this.$message.success("删除成功") |
|||
this.handleQueryQuoteDetailTest(); |
|||
}else { |
|||
this.$message.warning(data.msg) |
|||
} |
|||
}).catch((error)=>{ |
|||
this.$message.error(error) |
|||
}) |
|||
}).catch(() => {}); |
|||
}, |
|||
handleSaveOrUpdate(){ |
|||
this.$refs.saveTestForm.validate((valid,obj) => { |
|||
if (valid){ |
|||
if (this.saveTest.id){ |
|||
this.handleUpdateTest(); |
|||
}else { |
|||
this.handleSaveTest(); |
|||
} |
|||
}else { |
|||
let i = 1; |
|||
for (let key in obj) { |
|||
this.$message.error(obj[key][0].message); |
|||
if (i === 1){ |
|||
return |
|||
} |
|||
i++; |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
handleUpdateTest(){ |
|||
let params ={ |
|||
...this.saveTest, |
|||
updateBy:this.$store.state.user.name, |
|||
} |
|||
this.saveLoading = true |
|||
updateQuoteDetailTest(params).then(({data})=>{ |
|||
this.saveLoading = false |
|||
if (data && data.code === 0){ |
|||
this.$message.success(data.msg) |
|||
this.handleQueryQuoteDetailTest(); |
|||
this.saveVisible = false |
|||
}else { |
|||
this.$message.warning(data.msg) |
|||
} |
|||
}).catch((error)=>{ |
|||
this.saveLoading = false |
|||
this.$message.error(error) |
|||
}) |
|||
}, |
|||
handleSaveTest(){ |
|||
let params = { |
|||
...this.saveTest, |
|||
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.saveTest.quoteTestCost)){ |
|||
params.quoteUnitCost = 0; |
|||
} |
|||
this.saveLoading = true |
|||
saveQuoteDetailTest(params).then(({data})=>{ |
|||
this.saveLoading = false |
|||
if (data && data.code === 0){ |
|||
this.$message.success(data.msg) |
|||
this.handleQueryQuoteDetailTest() |
|||
this.saveVisible = false |
|||
}else { |
|||
this.$message.warning(data.msg) |
|||
} |
|||
}).catch((error)=>{ |
|||
this.saveLoading = false |
|||
this.$message.error(error) |
|||
}) |
|||
}, |
|||
computedQuoteTestCost(){ |
|||
if (this.saveTest.itemNo === 0){ |
|||
return; |
|||
} |
|||
// 单片分摊成本=测试费/(1-mark up)/分摊数量 |
|||
if ((1-this.saveTest.markup/100) === 0){ |
|||
this.saveTest.quoteTestCost = 0; |
|||
return; |
|||
} |
|||
this.saveTest.quoteTestCost = this.saveTest.unitCost / (1-this.saveTest.markup/100) / this.saveTest.testQty; |
|||
} |
|||
}, |
|||
created() { |
|||
if (this.quoteDetail && this.quoteDetail.id){ |
|||
this.handleQueryQuoteDetailTest(); |
|||
} |
|||
}, |
|||
watch:{ |
|||
'quoteDetail.id'(newVal,oldVal){ |
|||
this.handleQueryQuoteDetailTest(); |
|||
}, |
|||
'saveTest.testQty'(newVal, oldVal){ |
|||
console.log(1) |
|||
this.computedQuoteTestCost(); |
|||
}, |
|||
'saveTest.unitCost'(newVal,oldVal){ |
|||
console.log(2) |
|||
this.computedQuoteTestCost(); |
|||
}, |
|||
'saveTest.markup'(newVal,oldVal){ |
|||
console.log(3) |
|||
this.computedQuoteTestCost(); |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
|
|||
<el-button type="primary" @click="handleSave(null)" :disabled="quoteDetail.status === '下达'">新增</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="180" prop="testDesc"></el-table-column> |
|||
<el-table-column label="测试费金额" align="right" header-align="center" prop="unitCost"></el-table-column> |
|||
<el-table-column label="Mark up%" align="right" header-align="center" prop="markup"></el-table-column> |
|||
<el-table-column label="需要分摊数量" align="right" header-align="center" width="120" prop="testQty"></el-table-column> |
|||
<el-table-column label="单片分摊成本" align="right" header-align="center" prop="quoteTestCost"></el-table-column> |
|||
<el-table-column label="备注" align="left" header-align="center" prop="remark"></el-table-column> |
|||
<el-table-column label="操作" align="center" v-if="quoteDetail.status === '草稿'"> |
|||
<template slot-scope="scope" > |
|||
<a @click="handleSave(scope.row)">编辑</a> |
|||
<a v-if="scope.row.itemNo !== 0" @click="handleRemove(scope.row)">删除</a> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<el-dialog title="测试信息" :visible.sync="saveVisible" v-drag width="450px" append-to-body :close-on-click-modal="false"> |
|||
<el-form :model="saveTest" label-position="top" :rules="testRules" ref="saveTestForm"> |
|||
<el-row :gutter="10"> |
|||
<el-col :span="24"> |
|||
<el-form-item label="测试项" prop="testDesc" :show-message="false"> |
|||
<el-input v-model="saveTest.testDesc" :disabled="saveTest.itemNo === 0"></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="分摊数量" prop="testQty" :show-message="false"> |
|||
<el-input-number style="width: 100%" :controls="false" :disabled="saveTest.itemNo === 0" :step="0" :precision="0" v-model="saveTest.testQty"></el-input-number> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="Mark up%" prop="markup" :show-message="false"> |
|||
<el-input-number style="width: 100%" :controls="false" :disabled="saveTest.itemNo === 0" :step="0" :precision="0" v-model="saveTest.markup"></el-input-number> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row :gutter="10"> |
|||
<el-col :span="12"> |
|||
<el-form-item label="测试费金额" prop="unitCost" :show-message="false"> |
|||
<el-input-number style="width: 100%" :controls="false" :disabled="saveTest.itemNo === 0" :step="0" :precision="4" v-model="saveTest.unitCost"></el-input-number> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="单片分摊成本" prop="quoteTestCost" :show-message="false"> |
|||
<el-input-number style="width: 100%" :controls="false" :disabled="saveTest.itemNo !== 0" :step="0" :precision="4" v-model="saveTest.quoteTestCost"></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="saveTest.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> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue