暂无数据
@@ -173,7 +173,7 @@
-
+
@@ -184,7 +184,7 @@
-
+
@@ -212,7 +212,7 @@
@@ -234,7 +234,7 @@
-
+
@@ -255,7 +255,7 @@
从其他报价单复制
批 量 删 除
- 从其他报价单复制
批 量 删 除
-
+
-
+
@@ -561,7 +564,7 @@
@@ -713,7 +716,7 @@
@@ -784,7 +787,7 @@
@@ -868,40 +871,52 @@
-
+
-
+
-
+
-
+
+
+
+
+
+ 查 询
+ 查 询
- toggleRowSelectionTable(row,'otherQuotationDetailTable')">
-
+
+
+
+
+
+
+
- toggleRowSelectionTable(row,'otherQuotationPartTable')">
- toggleRowSelectionTable(row,'otherQuotationRoutingTable')">
- toggleRowSelectionTable(row,'otherQuotationToolTable')">
@@ -996,12 +1011,14 @@ import {
searchQuotationRoutingByDetailId,
searchQuotationTool,
updateQuotationDetail,
+ quotationDetailList,
} from '@/api/quotation/quotationHeader.js';
import {searchUmInformationList,} from '@/api/part/umInformation.js';
import {searchToolHeader,} from '@/api/part/toolHeader.js';
import {searchWorkCenter,} from '@/api/part/workCenter.js';
import {searchPartList,} from '@/api/part/partInformation.js';
import {getProjectPartList} from '@/api/project/project.js';
+import {Decimal} from "decimal.js";
export default {
props: ['quotationHeader'],
@@ -1051,13 +1068,23 @@ export default {
otherQuotationDetailDialogFlag:false,// 其他报价明细
projectPartDialogFlag:false,// 项目物料
options:0,// 从其他报价明细 复制选项
+ // 新增修改按钮状态
+ insertQuotationDetailLoading : false,//新增报价明细按钮
+ editQuotationDetailLoading:false,//修改报价明细按钮
+ saveQuotationToolLoading:false,//保存工具信息按钮
+ saveQuotationRoutingLoading:false,//保存报价工序信息按钮
+ saveQuotationPartLoading:false,//保存报价材料信息按钮
+ saveBatchLoading:false,//导入按钮状态
+ // 表格查询状态
+ initQuotationDetailLoading:false,//报价明细
+ initQuotationRoutingLoading:false,//报价工艺
+ initQuotationToolLoading:false,// 报价工具
+ initQuotationPartLoading:false,// 报价材料
// =============================================新增报价明细的开关==========================================
//新增 报价详情数据
insertQuotationDetailData: {
flag: false,
},
- // =============================================表格加载状态 ================================================
- partTableFlag:true,
// ==============================================标签页================================================
activeName: "index",//选择的标签页
// ===============================================参数对象==========================================
@@ -1561,9 +1588,11 @@ export default {
// ===============================================新增================================================
// 新增 报价明细
insertQuotationDetailBtn() {
+ this.insertQuotationDetailLoading = true;
this.$refs['insertQuotationDetailForm'].validate((validate, objects) => {
if (validate) {
insertQuotationDetail(this.insertQuotationDetail).then(({data}) => {
+ this.insertQuotationDetailLoading = false;
if (data.code == 200) {
this.quotationLeadIntoDetailFlag = false;
// 保存成功后
@@ -1576,6 +1605,8 @@ export default {
} else {
this.$message.error(data.msg);
}
+ }).catch((error)=>{
+ this.insertQuotationDetailLoading = false;
})
} else {
this.rulesValidateLabel(objects, this.quotationDetailColumns);
@@ -1586,14 +1617,15 @@ export default {
saveQuotationTool() {
this.$refs['quotationToolForm'].validate((validate, object) => {
if (validate) {
- this.$confirm('是否保存工具信息?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
+ // this.$confirm('是否保存工具信息?', '提示', {
+ // confirmButtonText: '确定',
+ // cancelButtonText: '取消',
+ // type: 'warning'
+ // }).then(() => {
+ this.saveQuotationToolLoading = true;
this.quotationTool.quotationDetailId = this.quotationDetailData.quotationDetailId;
this.insertQuotationToolData();
- })
+ // })
} else {
this.rulesValidateLabel(object, this.quotationToolColumns);// 校验提示
}
@@ -1602,6 +1634,7 @@ export default {
// 新增报价工具信息
insertQuotationToolData(){
saveQuotationTool(this.quotationTool).then(({data}) => {
+ this.saveQuotationToolLoading = false;
if (data.code == 200) {
this.initQuotationToolData();
this.$message.success(data.msg);
@@ -1609,17 +1642,22 @@ export default {
} else {
this.$message.error(data.msg);
}
+ }).catch((error)=>{
+ this.saveQuotationToolLoading = false;
})
},
// 批量新增报价工具信息
batchInsertQuotationToolData(batchInsertQuotationToolList){
batchInsertQuotationTool(batchInsertQuotationToolList).then(({data})=>{
+ this.saveBatchLoading = false;
if (data.code == 200){
this.initQuotationToolData();
this.otherQuotationDetailDialogFlag = false;
this.saveQuotationToolFlag = false;
}
this.$message.success(data.msg);
+ }).catch((error)=>{
+ this.saveBatchLoading = false;
})
},
// =======================================================删除===========================================
@@ -1789,7 +1827,9 @@ export default {
if (flag) {
// 校验通过 保存数据
let params = this.quotationDetailData;
+ this.editQuotationDetailLoading = true;
updateQuotationDetail(params).then(({data}) => {
+ this.editQuotationDetailLoading = false;
if (data.code == 200) {
this.quotationDetailFlag = false;
this.initData();
@@ -1797,6 +1837,8 @@ export default {
} else {
this.$message.error(data.msg);
}
+ }).catch((error)=>{
+ this.editQuotationDetailLoading = false;
})
}
},
@@ -1855,7 +1897,9 @@ export default {
},
// 新增报价工艺
insertQuotationRoutingData(){
+ this.saveQuotationRoutingLoading = true;
insertQuotationRouting(this.quotationRouting).then(({data})=>{
+ this.saveQuotationRoutingLoading = false;
if (data.code == 200){
this.initQuotationRoutingData();
this.$message.success(data.msg);
@@ -1863,11 +1907,14 @@ export default {
}else {
this.$message.error(data.msg);
}
+ }).catch((error)=>{
+ this.saveQuotationRoutingLoading = true;
})
},
// 批量新增报价工艺
batchInsertQuotationRoutingData(quotationRoutingList){
batchInsertQuotationRouting(quotationRoutingList).then(({data})=>{
+ this.saveBatchLoading = false;
if (data.code == 200){
this.initQuotationRoutingData();
this.$message.success(data.msg);
@@ -1876,6 +1923,8 @@ export default {
}else {
this.$message.error(data.msg);
}
+ }).catch((error)=>{
+ this.saveBatchLoading = false;
})
},
// 新增 报价材料
@@ -1884,20 +1933,16 @@ export default {
if (!validate){
this.rulesValidateLabel(objects,this.quotationPartColumns);
}else {
- this.$confirm('此操作将保存材料信息, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.quotationPart.quotationDetailId = this.quotationDetailData.quotationDetailId;
- this.insertQuotationPartData();
- })
+ this.saveQuotationPartLoading = true;
+ this.quotationPart.quotationDetailId = this.quotationDetailData.quotationDetailId;
+ this.insertQuotationPartData();
}
})
},
// 批量新增报价材料
batchInsertQuotationPartData(quotationPrtList){
batchInsertQuotationPart(quotationPrtList).then(({data})=>{
+ this.saveBatchLoading = false;
if (data.code == 200){
this.initQuotationPart();
this.$message.success(data.msg);
@@ -1906,11 +1951,14 @@ export default {
}else {
this.$message.error(data.msg);
}
+ }).catch((error)=>{
+ this.saveBatchLoading = false;
})
},
//新增报价材料信息
insertQuotationPartData(){
insertQuotationPart(this.quotationPart).then(({data})=>{
+ this.saveQuotationPartLoading = false;
if (data.code == 200){
this.initQuotationPart();
this.$message.success(data.msg);
@@ -1918,17 +1966,14 @@ export default {
}else {
this.$message.error(data.msg);
}
+ }).catch((error)=>{
+ this.saveQuotationPartLoading = false;
})
},
// 保存勾选的其他报价信息
saveOtherQuotationDetailBtn(){
- this.$confirm('此操作将从其他报价明细添加记录, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.otherQuotationDetailFun();
- })
+ this.saveBatchLoading = true;
+ this.otherQuotationDetailFun();
},
// 处理其他报价信息数据复制
otherQuotationDetailFun(){
@@ -1976,6 +2021,7 @@ export default {
// 批量新增报价明细信息
batchInsertQuotationDetailData(quotationDetailList){
batchInsertQuotationDetail(quotationDetailList).then(({data})=>{
+ this.saveBatchLoading = false;
if (data.code == 200){
this.initData();
this.otherQuotationDetailDialogFlag = false;
@@ -1983,6 +2029,8 @@ export default {
}else {
this.$message.error(data.msg);
}
+ }).catch((error)=>{
+ this.saveBatchLoading = false;
})
},
// 编辑报价工具
@@ -2014,7 +2062,10 @@ export default {
size: this.size,
quotationHeaderId: this.quotation?this.quotation.quotationHeaderId:null,
}
+ this.tableData = [];
+ this.initQuotationDetailLoading = true;
searchQuotationDetailPageByHeaderId(params).then(({data}) => {
+ this.initQuotationDetailLoading = false;
if (data.code == 200) {
this.tableData = data.data.records;
this.total = data.data.total;
@@ -2022,6 +2073,8 @@ export default {
this.tableData = [];
this.total = 0;
}
+ }).catch((error)=>{
+ this.initQuotationDetailLoading = false;
})
},
// 查询项目材料信息
@@ -2077,22 +2130,26 @@ export default {
quotationDetailId: this.quotationDetailData.quotationDetailId,
site:this.$store.state.user.site,
};
+ this.initQuotationRoutingLoading = true;
searchQuotationRoutingByDetailId(params).then(({data})=>{
+ this.initQuotationRoutingLoading = false;
if (data.code == 200) {
this.quotationRoutingFormTable.quotationRoutingList = data.data;
// 计算价格
let list = this.quotationRoutingFormTable.quotationRoutingList;
+ this.quotationDetailData.computeLabourCost = 0;
+ this.quotationDetailData.computeFabricateCost = 0;
+ this.quotationDetailData.computeMachineCost = 0;
for (let i = 0; i < list.length; i++) {
let item = list[i];
// 获取总价格
- this.quotationDetailData.computeLabourCost = 0;
- this.quotationDetailData.computeFabricateCost = 0;
- this.quotationDetailData.computeMachineCost = 0;
- this.quotationDetailData.computeLabourCost += +item.unitLaborCost;
- this.quotationDetailData.computeFabricateCost += +item.unitMachineryCost;
- this.quotationDetailData.computeMachineCost += +item.unitMachineryCost;
+ this.quotationDetailData.computeLabourCost = new Decimal(this.quotationDetailData.computeLabourCost).add(new Decimal(item.unitLaborCost)).toNumber();
+ this.quotationDetailData.computeFabricateCost = new Decimal(this.quotationDetailData.computeFabricateCost).add(new Decimal(item.unitManufacturingCost)).toNumber();
+ this.quotationDetailData.computeMachineCost = new Decimal(this.quotationDetailData.computeMachineCost).add(new Decimal(item.unitMachineryCost)).toNumber();
}
}
+ }).catch((error)=>{
+ this.initQuotationRoutingLoading = false;
});
},
// 报价材料 查询
@@ -2100,12 +2157,15 @@ export default {
let params = {
quotationDetailId: this.quotationDetailData.quotationDetailId,
};
- this.partTableFlag = false;
+ this.initQuotationPartLoading = true;
searchQuotationPart(params).then(({data})=>{
+ this.initQuotationPartLoading = false;
if (data.code == 200){
this.quotationPartFormTable.quotationPartList = data.data;
this.computeQuotationPartCost();// 计算材料
}
+ }).catch((error)=>{
+ this.initQuotationPartLoading = false;
})
},
// 报价工具查询
@@ -2113,11 +2173,15 @@ export default {
let params = {
quotationDetailId: this.quotationDetailData.quotationDetailId,
}
+ this.initQuotationToolLoading = true;
searchQuotationTool(params).then(({data}) => {
+ this.initQuotationToolLoading = false;
if (data.code == 200) {
this.quotationToolFormTable.quotationToolList = data.data;
this.computeQuotationToolCost();// 计算工具价格
}
+ }).catch((error)=>{
+ this.initQuotationToolLoading = false;
})
},
// 查询 加工中心 列表
@@ -2148,12 +2212,10 @@ export default {
initOtherQuotationDetail(){
let params = {
site:this.$store.state.user.site,
- quotationDetailId:this.quotationDetailData.quotationDetailId,
quotationNo:this.otherDetail.quotationNo,
productNo:this.otherDetail.productNo,
productDesc:this.otherDetail.productDesc,
internalInquiryNo:this.otherDetail.internalInquiryNo,
- quotationHeaderId:this.quotation.quotationHeaderId,
};
searchQuotationDetail(params).then(({data})=>{
if (data.code == 200){
@@ -2161,6 +2223,21 @@ export default {
}
})
},
+ // 查询历史询价的报价记录
+ initHistoryInquiryLead(){
+ let params={
+ site:this.$store.state.user.site,
+ quotationNo:this.otherDetail.quotationNo,
+ productNo:this.otherDetail.productNo,
+ productDesc:this.otherDetail.productDesc,
+ internalInquiryNo:this.otherDetail.internalInquiryNo,
+ }
+ quotationDetailList(params).then(({data})=>{
+ if (data.code == 200){
+ this.otherQuotationDetailList = data.data;
+ }
+ })
+ },
// ===============================================页码变动==================================================
// 报价详情size 改变
detailSizeChange(val) {
@@ -2231,6 +2308,12 @@ export default {
this.otherQuotationDetailDialogFlag = true;
this.options = i;
},
+ // 点击历史询价导入
+ clickHistoryInquiryLeadIntoBtn(i){
+ this.initHistoryInquiryLead();
+ this.otherQuotationDetailDialogFlag = true;
+ this.options = i;
+ },
// 点击历史报价明细
clickHistoryQuotationDetailBtn(){
this.initOtherQuotationDetail();
@@ -2379,6 +2462,7 @@ export default {
closeOtherQuotationDetail(){
this.options = 0;
this.otherDetail = {
+ internalInquiryNo:undefined,//内部询价单号
quotationNo:undefined,// 报价单号
productNo:undefined,// 产品编码
productDesc:undefined,// 产品名称
@@ -2387,6 +2471,7 @@ export default {
if (this.$refs.otherQuotationDetailTable){
this.$refs.otherQuotationDetailTable.clearSelection();
}
+ this.otherQuotationDetailList = [];
},
// ===================================================表格多选发生改变事件============================================
// 报价工具表格
@@ -2446,16 +2531,16 @@ export default {
computeQuotationPartCost(){
let amount = this.quotationPartFormTable.quotationPartList.reduce((total,currentValue)=>{
// 用量 调机用量+单位用量+损耗率
- let count = +currentValue.unitDosage + +currentValue.transferAmount ;
- count = count + count * currentValue.attritionRate/100;
- return total + count * currentValue.unitCost;
+ let count = new Decimal(currentValue.unitDosage).add(new Decimal(currentValue.transferAmount));
+ count = count.add(count.mul(new Decimal(currentValue.attritionRate)).div(100));
+ return total + count.mul(new Decimal(currentValue.unitCost)).toNumber();
},0);
- this.quotationDetailData.computePartCost = amount * this.quotationDetailData.quotationDetailQuantity;
+ this.quotationDetailData.computePartCost = new Decimal(amount).mul(new Decimal(this.quotationDetailData.quotationDetailQuantity)).toNumber();
},
// 计算 报价工具总成本
computeQuotationToolCost(){
this.quotationDetailData.computeToolCost = this.quotationToolFormTable.quotationToolList.reduce((total, currentValue) => {
- return total + currentValue.toolQuantity * currentValue.unitCost;
+ return total + new Decimal(currentValue.toolQuantity).mul(new Decimal(currentValue.unitCost)).toNumber();
}, 0);
},
// 计算按钮
@@ -2470,31 +2555,29 @@ export default {
// 最终价格
computeEndAmount(){
// 未税总价/单价
- this.quotationDetailData.systemComputeAmount = +this.quotationDetailData.detailProfitAmount + +this.quotationDetailData.detailTotalCost;
- this.quotationDetailData.finalUntaxedPrice = +this.quotationDetailData.systemComputeAmount / +this.quotationDetailData.quotationDetailQuantity;
- this.quotationDetailData.finalUntaxedPrice = String(this.quotationDetailData.finalUntaxedPrice).replace(/^(.*\..{4}).*$/,"$1");
+ this.quotationDetailData.systemComputeAmount = new Decimal(this.quotationDetailData.detailProfitAmount).add(new Decimal(this.quotationDetailData.detailTotalCost)).toSignificantDigits().toNumber();
+ this.quotationDetailData.finalUntaxedPrice = new Decimal(this.quotationDetailData.systemComputeAmount).div(new Decimal(this.quotationDetailData.quotationDetailQuantity)).toSignificantDigits().toNumber();
// 含税总价/单价
- this.quotationDetailData.systemComputePrice = (1 + +this.quotationDetailData.taxRate / 100) * +this.quotationDetailData.systemComputeAmount;
- this.quotationDetailData.systemComputePrice = String(this.quotationDetailData.systemComputePrice).replace(/^(.*\..{4}).*$/,"$1");
+ this.quotationDetailData.systemComputePrice = new Decimal(1).add(new Decimal(this.quotationDetailData.taxRate).div(new Decimal(100))).mul(new Decimal(this.quotationDetailData.systemComputeAmount)).toSignificantDigits().toNumber();
this.quotationDetailData.finalTaxedPrice = +this.quotationDetailData.systemComputePrice / +this.quotationDetailData.quotationDetailQuantity;
- this.quotationDetailData.finalTaxedPrice = String(this.quotationDetailData.finalTaxedPrice).replace(/^(.*\..{4}).*$/,"$1");
+ this.quotationDetailData.systemComputePrice = new Decimal(new Decimal(this.quotationDetailData.systemComputePrice).toFixed(4,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber();
+ this.quotationDetailData.finalTaxedPrice = new Decimal(new Decimal(this.quotationDetailData.finalTaxedPrice).toFixed(4,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber();
},
// 利润额
computeProfitAmount(){
- this.quotationDetailData.detailProfitAmount = 0;
- this.quotationDetailData.detailProfitAmount = +this.quotationDetailData.detailTotalCost * +this.quotationDetailData.detailProfitRate / 100;
- this.quotationDetailData.detailProfitAmount = String(this.quotationDetailData.detailProfitAmount).replace(/^(.*\..{4}).*$/,"$1");
+ this.quotationDetailData.detailProfitAmount = new Decimal(this.quotationDetailData.detailTotalCost).mul(new Decimal(this.quotationDetailData.detailProfitRate).div(new Decimal(100))).toSignificantDigits().toNumber();
+ this.quotationDetailData.detailProfitAmount = new Decimal(new Decimal(this.quotationDetailData.detailProfitAmount).toFixed(4,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber();
},
// 总金额
computeAmount(){
- this.quotationDetailData.detailTotalCost = 0;
- this.quotationDetailData.detailTotalCost += +this.quotationDetailData.adjustPartCost;
- this.quotationDetailData.detailTotalCost += +this.quotationDetailData.adjustLabourCost;
- this.quotationDetailData.detailTotalCost += +this.quotationDetailData.adjustFabricateCost;
- this.quotationDetailData.detailTotalCost += +this.quotationDetailData.adjustMachineCost;
- this.quotationDetailData.detailTotalCost += +this.quotationDetailData.adjustToolCost;
- this.quotationDetailData.detailTotalCost += +this.quotationDetailData.detailOtherCost;
- this.quotationDetailData.detailTotalCost += +this.quotationDetailData.detailManageCost;
+ this.quotationDetailData.detailTotalCost = new Decimal(0);
+ this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.adjustPartCost));
+ this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.adjustLabourCost));
+ this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.adjustFabricateCost));
+ this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.adjustMachineCost));
+ this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.adjustToolCost));
+ this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.detailOtherCost));
+ this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.detailManageCost)).toSignificantDigits().toNumber();
},
// ====================================================输入框 事件=============================================
changeWorkCenterSelect(val,obj){
@@ -2515,15 +2598,15 @@ export default {
},
// 计算工艺单位成本
changeRoutingCost(){
- this.quotationRouting.unitQuotedCost = 0;
+ this.quotationRouting.unitQuotedCost = new Decimal(0);
if (this.quotationRouting.unitMachineryCost){
- this.quotationRouting.unitQuotedCost += +this.quotationRouting.unitMachineryCost;
+ this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitMachineryCost));
}
if (this.quotationRouting.unitLaborCost){
- this.quotationRouting.unitQuotedCost += +this.quotationRouting.unitLaborCost;
+ this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitLaborCost));
}
if (this.quotationRouting.unitManufacturingCost){
- this.quotationRouting.unitQuotedCost += +this.quotationRouting.unitManufacturingCost;
+ this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitManufacturingCost));
}
},
// ==================================================校验工具类====================================================
diff --git a/src/views/modules/quotation/sellForQuotation.vue b/src/views/modules/quotation/sellForQuotation.vue
index 256f203..f0f6c36 100644
--- a/src/views/modules/quotation/sellForQuotation.vue
+++ b/src/views/modules/quotation/sellForQuotation.vue
@@ -65,14 +65,17 @@
-