This commit is contained in:
xd 2024-03-06 16:50:41 +08:00
commit 05512e19f5
5 changed files with 186 additions and 64 deletions

View File

@ -5,13 +5,12 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.quote.domain.CalculateRBParamDto;
import com.ruoyi.quote.domain.MaterialDto;
import com.ruoyi.quote.service.QuoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -44,4 +43,15 @@ public class QuoteController extends BaseController {
System.out.println("打通接口");
return getDataTable(materialDtos);
}
@PostMapping("/redBPrice")
public void queryRedBookPriceByParam(@RequestBody List<CalculateRBParamDto> params) {
System.out.println(params.get(0).getModel());
System.out.println(params.get(0).getSpecification());
System.out.println(params.get(0).getVoltLevel());
}
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.quote.domain;
/**
* @title CalculateRBParamDto
* @description 用于接受前端传过来的型号规格参数
* @author JIAL
* @updateTime 2024/3/6 15:18
*/
public class CalculateRBParamDto {
private String model;
private String specification;
private String voltLevel;
public String getVoltLevel() {
return voltLevel;
}
public void setVoltLevel(String voltLevel) {
this.voltLevel = voltLevel;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getSpecification() {
return specification;
}
public void setSpecification(String specification) {
this.specification = specification;
}
// 省略构造函数getter和setter
}

View File

@ -19,18 +19,60 @@ public class MaterialDto extends BaseEntity {
private String measureUnit; //单位
private String matCostPrice; //材料成本价格
private double matCostPrice = 0; //材料成本价格
private String redBookPrice; //红本价格
private double redBookPrice = 0; //红本价格
private String redBookCost; //红本成本
private double redBookCost = 0; //红本成本
private String rbFacPrice; //红本厂价
public double getMatCostPrice() {
return matCostPrice;
}
public void setMatCostPrice(double matCostPrice) {
this.matCostPrice = matCostPrice;
}
public double getRedBookPrice() {
return redBookPrice;
}
public void setRedBookPrice(double redBookPrice) {
this.redBookPrice = redBookPrice;
}
public double getRedBookCost() {
return redBookCost;
}
public void setRedBookCost(double redBookCost) {
this.redBookCost = redBookCost;
}
public double getRbFacPrice() {
return rbFacPrice;
}
public void setRbFacPrice(double rbFacPrice) {
this.rbFacPrice = rbFacPrice;
}
private double rbFacPrice = 0; //红本厂价
private String manuCost; //制造成本
private String wdFSurcharge; //盘具点数
private Integer number = 1;
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getUid() {
return uid;
}
@ -87,37 +129,7 @@ public class MaterialDto extends BaseEntity {
this.measureUnit = measureUnit;
}
public String getMatCostPrice() {
return matCostPrice;
}
public void setMatCostPrice(String matCostPrice) {
this.matCostPrice = matCostPrice;
}
public String getRedBookPrice() {
return redBookPrice;
}
public void setRedBookPrice(String redBookPrice) {
this.redBookPrice = redBookPrice;
}
public String getRedBookCost() {
return redBookCost;
}
public void setRedBookCost(String redBookCost) {
this.redBookCost = redBookCost;
}
public String getRbFacPrice() {
return rbFacPrice;
}
public void setRbFacPrice(String rbFacPrice) {
this.rbFacPrice = rbFacPrice;
}
public String getManuCost() {
return manuCost;

View File

@ -7,3 +7,11 @@ export function queryMaterialListByParam(query) {
params: query
})
}
export function queryRedBookPriceByParam (query) {
return request({
url: '/quote/redBPrice',
method: 'post',
data: query
})
}

View File

@ -274,6 +274,7 @@
<!-- 添加物料和计算数据的按钮div -->
<div class="button-box">
<el-button type="text" @click="addMaterial">添加物料</el-button>
<el-button type="text" @click="calculateRedBookPrice">计算红本价格</el-button>
<el-button type="text" >计算数据</el-button>
</div>
<!-- 物料表格控件 -->
@ -350,8 +351,8 @@
width="180"
prop="number"
label="数量">
<template slot-scope="scope">
<el-input v-model="scope.row.number" @blur="validateNumber(scope.row)">
<template v-slot="scope">
<el-input v-model="scope.row.number">
</el-input>
</template>
</el-table-column>
@ -426,18 +427,18 @@
<div slot="title" style="margin: 0px">
<el-form>
<el-form-item >
<el-input style="width: 180px; margin-right: 20px" v-model="queryParams.precMaterialName" placeholder="开头物料名称精确查询">
<el-input style="width: 180px; margin-right: 20px" v-model="materialQueryParams.precMaterialName" placeholder="开头物料名称精确查询">
</el-input>
<el-input style="width: 180px; margin-right: 20px" v-model="queryParams.vagueMaterialName" placeholder="物料名称模糊查询">
<el-input style="width: 180px; margin-right: 20px" v-model="materialQueryParams.vagueMaterialName" placeholder="物料名称模糊查询">
</el-input>
<el-input style="width: 180px; margin-right: 20px" v-model="queryParams.vagueModel" placeholder="规格模糊查询">
<el-input style="width: 180px; margin-right: 20px" v-model="materialQueryParams.vagueModel" placeholder="规格模糊查询">
</el-input>
<el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button>
</el-form-item>
</el-form>
</div>
<div style="display: flex; flex-direction: row;">
<div style="width: 758px">
<div style="width: 700px">
<el-table
:data="materialDialogData"
@selection-change="handleSelectionChange"
@ -455,7 +456,7 @@
<el-table-column
label="序号"
type="index"
width="50">
width="55">
</el-table-column>
<el-table-column
width="120"
@ -468,7 +469,7 @@
label="型号">
</el-table-column>
<el-table-column
width="120"
width="125"
prop="specification"
label="规格">
</el-table-column>
@ -478,7 +479,7 @@
label="电压">
</el-table-column>
<el-table-column
width="100"
width="102"
prop="measureUnit"
label="单位">
</el-table-column>
@ -486,8 +487,8 @@
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
:page.sync="materialQueryParams.pageNum"
:limit.sync="materialQueryParams.pageSize"
@pagination="searchMaterial"
/>
</div>
@ -505,8 +506,8 @@
<div style="text-align: center; padding-top: 20px">
<el-button-group>
<el-button type="primary" size="small" style="margin-right: 80px" >确认</el-button>
<el-button type="warning" size="small" >取消</el-button>
<el-button type="primary" size="small" style="margin-right: 80px" @click="addMaterialToTable">确认</el-button>
<el-button type="warning" size="small" @click="closeMaterialDialog">取消</el-button>
</el-button-group>
</div>
</el-dialog>
@ -514,7 +515,7 @@
</template>
<script>
import {queryMaterialListByParam } from "@/api/quote/quote";
import {queryMaterialListByParam, queryRedBookPriceByParam } from "@/api/quote/quote";
const commonRule = [
{ required: true, message: '不能为空值可填0', trigger: 'blur' },
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/, message: '格式有误,只能为数字格式', trigger: 'blur' }
@ -589,7 +590,7 @@ export default {
],
dialogMaterialVisible: false,
queryParams: {
materialQueryParams: {
pageNum: 1,
pageSize: 10,
precMaterialName: '',
@ -660,7 +661,7 @@ export default {
},
/**--------查询物料---------**/
searchMaterial() {
queryMaterialListByParam(this.queryParams).then(response => {
queryMaterialListByParam(this.materialQueryParams).then(response => {
this.materialDialogData = response.rows;
this.total = response.total;
this.loading = false;
@ -670,6 +671,7 @@ export default {
selection.forEach(item => {
//
if (!this.selectedMaterialItems.some(selectedItem => selectedItem.uid === item.uid)) {
console.log(item)
this.selectedMaterialItems.push(item);
}
});
@ -677,7 +679,7 @@ export default {
},
removeSelectedItem(selectedItem) {
//
const isSelected = this.$refs.materialTable.selection.includes(selectedItem);
const isSelected = this.$refs.materialDialogData.selection.includes(selectedItem);
//
const index = this.selectedMaterialItems.findIndex(item => item.uid === selectedItem.uid);
@ -687,25 +689,36 @@ export default {
// el-table
if (isSelected) {
this.$refs.materialTable.toggleRowSelection(selectedItem, false);
this.$refs.materialDialogData.toggleRowSelection(selectedItem, false);
}
},
/**-------------dialog确认按钮将物料添加进表格-----------------**/
addMaterialToTable() {
//
this.materialData = this.materialData.concat(this.selectedMaterialItems);
console.log(this.materialData)
//
this.selectedMaterialItems = [];
this.$refs.materialTable.clearSelection();
this.$refs.materialDialogData.clearSelection();
this.dialogMaterialVisible = false;
},
closeMaterialDialog() {
this.dialogMaterialVisible = false;
},
/**----------------计算红本价格--------------------**/
calculateRedBookPrice() {
const param = this.materialData.map(item => ({
model: item.model,
specification: item.specification,
voltLevel: item.voltLevel
}));
queryRedBookPriceByParam(param).then(response => {
});
}
},
}
</script>
@ -749,13 +762,52 @@ export default {
}
.changed-field {
background-color: #ffe6e6; /* 更改后的背景颜色 */
background-color: #add8e6; /* 更改后的背景颜色 */
}
.materialDialogTable .el-dialog__header{
padding: 20px 20px 0px !important;
::v-deep .materialDialogTable .el-dialog__header {
padding-bottom: 0px;
}
.materialDialogTable .el-dialog__body{
padding: 0px 20px !important;
::v-deep .materialDialogTable .el-dialog__body {
padding-top: 0px;
}
.selected-item {
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 5px;
padding: 5px;
margin-bottom: 5px;
display: flex;
justify-content: space-between;
}
.remove-btn {
padding: 0px;
color: red;
}
.table-box {
width: 98%;
margin: auto;
}
::v-deep .el-input__inner {
height: 30px;
/*font-family: Roboto, serif;*/
font-size: 12px;
line-height: 14px;
}
::v-deep .el-input-group {
margin-top: 3px;
}
::v-deep .total-box input {
background: #f0f0f0 !important;
font-weight: bold !important;
color: black !important;
}
</style>