完成页面

This commit is contained in:
JIAL 2024-03-14 07:57:32 +08:00
parent 4c986cb5ba
commit 17997282d9
7 changed files with 183 additions and 61 deletions

View File

@ -99,5 +99,18 @@ public class QuoteController extends BaseController {
return success(quoteService.queryRedBookVer());
}
/**
* @title queryRedBookLocalVersion
* @description 获取本地红本版本号
* @author JIAL
* @updateTime 2024/3/13 12:54
* @return: com.ruoyi.common.core.domain.AjaxResult
*/
@DataSource(DataSourceType.QUOT)
@PostMapping("/redBookLocalVer")
public AjaxResult queryRedBookLocalVersion() {
return success(quoteService.queryRedBookLocalVer());
}
}

View File

@ -25,4 +25,6 @@ public interface QuoteMapper {
List<CalculateRBParamDto> queryRedBPriceByParams(@Param("params") List<CalculateRBParamDto> params);
String queryRedBookVer();
String queryRedBookLocalVer();
}

View File

@ -20,4 +20,6 @@ public interface QuoteService {
List<CalculateRBParamDto> queryRedBPriceByParams(List<CalculateRBParamDto> params);
String queryRedBookVer();
String queryRedBookLocalVer();
}

View File

@ -75,4 +75,16 @@ public class QuoteServiceImpl implements QuoteService {
public String queryRedBookVer() {
return quoteMapper.queryRedBookVer();
}
/**
* @title queryRedBookLocalVer
* @description 获取本地红本版本号
* @author JIAL
* @updateTime 2024/3/13 12:37
* @return: java.lang.String
*/
@Override
public String queryRedBookLocalVer() {
return quoteMapper.queryRedBookLocalVer();
}
}

View File

@ -109,4 +109,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE [sta_0] IN ('0', '1');
</select>
<select id="queryRedBookLocalVer" resultType="String">
SELECT MAX([version_uid]) AS redBookLocalVer
FROM [jn_quot].[dbo].[c_rb_version]
</select>
</mapper>

View File

@ -30,3 +30,10 @@ export function queryRedBookVer () {
method: 'post',
})
}
export function queryRedBookLocalVer () {
return request({
url: '/quote/redBookLocalVer',
method: 'post',
})
}

View File

@ -412,11 +412,11 @@
</el-table-column>
<el-table-column
fixed="right"
width="180"
width="150"
label="操作">
<template slot-scope="scope">
<el-button @click="handleviewDetails(scope.row)" style="color: dodgerblue; margin-right: 20px" type="text">查看详情</el-button>
<el-button @click="handleDeleteClick(scope.$index)" style="color: red;" type="text">删除</el-button>
<el-button @click="handleDeleteClick(scope.$index)" style="color: red;" type="text">查看详情</el-button>
</template>
</el-table-column>
</el-table>
@ -511,17 +511,55 @@
</el-button-group>
</div>
</el-dialog>
<el-dialog class="matUsageDetDialogTable" :visible.sync="dialogMatUsageDetVisible" width="725px">
<el-table
:data="matUsageDetDialogData"
ref="matUsageDetDialogData"
height="550px"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
:cell-style="{'text-align': 'center', 'padding': '5px 0px'}"
border>
<el-table-column
label="序号"
type="index"
width="55">
</el-table-column>
<el-table-column
width="260"
prop="materialName"
label="关联用料">
</el-table-column>
<el-table-column
width="120"
prop="costClQty"
label="用量1">
</el-table-column>
<el-table-column
width="125"
prop="costClQty2"
label="用量2">
</el-table-column>
<el-table-column
width="120"
prop="materialPrice"
label="单价">
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import {queryMaterialListByParam, queryRedBCostByParams, queryRedBPriceByParams, queryRedBookVer } from "@/api/quote/quote";
import { getMaterial} from "@/api/material/material";
import {queryMaterialListByParam, queryRedBCostByParams, queryRedBPriceByParams, queryRedBookVer, queryRedBookLocalVer } from "@/api/quote/quote";
import {getMaterial} from "@/api/material/material";
const commonRule = [
{ required: true, message: '不能为空值可填0', trigger: 'blur' },
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/, message: '格式有误,只能为数字格式', trigger: 'blur' }
];
let redBookVer = 0; //
let redBookLocalVer = 0; //
export default {
name: "index-app",
@ -605,6 +643,8 @@ export default {
selectedMaterialItems: [], //
savedSelectedMaterials: [], //
total: 0,
dialogMatUsageDetVisible: false,
matUsageDetDialogData: [],
}
},
computed: {
@ -625,8 +665,12 @@ export default {
/**-------------获取红本版本号---------------**/
getRedBookVersion() {
queryRedBookVer().then(response => {
console.log(response);
redBookVer = response.msg
console.log("redBookVer:" + redBookVer)
});
queryRedBookLocalVer().then(response => {
redBookLocalVer = response.msg
console.log("redBookLocalVer:" + redBookLocalVer)
});
},
/**--------------输入值改变则底色发生变化------------**/
@ -650,6 +694,7 @@ export default {
});
}
}
this.calculatedData();
},
/**-------物料表格的cell样式----------**/
cellStyle({row, column, rowIndex, columnIndex}) {
@ -665,17 +710,42 @@ export default {
handleDeleteClick(index){
this.materialData.splice(index, 1)
},
/**-------------------点击查看物料材料用量详情------------------------**/
handleviewDetails(row) {
this.dialogMatUsageDetVisible = true;
const uid = row.uid;
getMaterial(uid).then(response => {
console.log(response);
this.matUsageDetDialogData = response.data.cmaterialCostList
});
console.log("当前行的UID: " + row.uid);
},
/**--------添加物料打开物料dialog框---------**/
addMaterial(){
this.dialogMaterialVisible = true;
},
/**--------查询物料---------**/
searchMaterial() {
queryMaterialListByParam(this.materialQueryParams).then(response => {
this.materialDialogData = response.rows;
this.total = response.total;
this.loading = false;
});
if(this.materialQueryParams.precMaterialName === '' && this.materialQueryParams.vagueMaterialName === ''
&& this.materialQueryParams.vagueModel === '') {
this.$message({
type: 'warning',
message: "请输入查询条件。"
});
} else {
queryMaterialListByParam(this.materialQueryParams).then(response => {
if (response.rows.length === 0) {
this.$message({
type: 'warning',
message: "查询结果为空,请检查查询条件。"
});
}
this.materialDialogData = response.rows;
this.total = response.total;
this.loading = false;
});
}
},
/**-----------选择物料触发事件----------------**/
handleSelectionChange(selection) {
@ -793,61 +863,70 @@ export default {
},
/**----------------计算数据--------------------**/
calculatedData() {
/**-------------计算财务总成本---------------**/
this.calculateTotal();
/**----------------------进行盘具、数量、人工、水电三个数值的验证---------------**/
this.validationErrors = []; //
this.materialData.forEach((row, index) => {
const quantity = parseFloat(row.number) || 0; // 0
//
if (isNaN(quantity) || quantity < 0) {
this.validationErrors.push(`${index + 1} 行数量不符合要求\n`);
}
});
/**-----------------------验证完成进行运算,验证结果通过才进行计算--------------------------**/
if (this.validationErrors.length === 0) {
//
this.materialData.forEach((row, index) => {
this.validationErrors = []; //
const redBookFacPrice = parseFloat(row.rbFacPrice);
const materialCost = parseFloat(row.matCostPrice);
const wdFSurcharge = parseFloat(row.wdFSurcharge) || 0; // 0
const manuCost = parseFloat(row.manuCost) || 0; // 0
const quantity = parseFloat(row.number) || 0; // 0
const totalFinExpenses = (parseFloat(this.totalForm.totalFinExpenses)) / 100
const num1 = (quantity * redBookFacPrice);
const num2 = ((materialCost + materialCost * (manuCost + wdFSurcharge + totalFinExpenses ) ) * quantity)
//
this.$set(this.materialData, index, {
...row,
varRatio: ((redBookFacPrice - materialCost) / redBookFacPrice * 100).toFixed(2) + '%',
totalFacPrice: (quantity * redBookFacPrice).toFixed(2),
totalCost: ((materialCost + materialCost * (manuCost + wdFSurcharge + totalFinExpenses) ) * quantity
).toFixed(2),
totalVariance : (((num1 - num2) / num1) * 100).toFixed(2) + '%'
});
if(redBookVer !== redBookLocalVer) {
this.$message({
type: 'warning',
message: "调价结果未同步,请联系管理员进行同步再进行价格计算。"
});
} else {
this.$message({
type: 'error',
dangerouslyUseHTMLString: true,
message: this.validationErrors.join('<br>')
/**-------------计算财务总成本---------------**/
this.calculateTotal();
/**----------------------进行盘具、数量、人工、水电三个数值的验证---------------**/
this.validationErrors = []; //
this.materialData.forEach((row, index) => {
const var1 = /^\d*\.?\d+$/.test(row.number);
//
if (!var1) {
this.validationErrors.push(`${index + 1} 行数量不符合要求\n`);
}
});
/**-----------------------验证完成进行运算,验证结果通过才进行计算--------------------------**/
if (this.validationErrors.length === 0) {
//
this.materialData.forEach((row, index) => {
this.validationErrors = []; //
const redBookFacPrice = parseFloat(row.rbFacPrice);
const materialCost = parseFloat(row.matCostPrice);
const wdFSurcharge = parseFloat(row.wdFSurcharge) || 0; // 0
const manuCost = parseFloat(row.manuCost) || 0; // 0
const quantity = parseFloat(row.number) || 0; // 0
const totalFinExpenses = (parseFloat(this.totalForm.totalFinExpenses)) / 100
const num1 = (quantity * redBookFacPrice);
const num2 = ((materialCost + materialCost * (manuCost + wdFSurcharge + totalFinExpenses)) * quantity)
//
this.$set(this.materialData, index, {
...row,
varRatio: ((redBookFacPrice - materialCost) / redBookFacPrice * 100).toFixed(2) + '%',
totalFacPrice: (quantity * redBookFacPrice).toFixed(2),
totalCost: ((materialCost + materialCost * (manuCost + wdFSurcharge + totalFinExpenses)) * quantity
).toFixed(2),
totalVariance: (((num1 - num2) / num1) * 100).toFixed(2) + '%'
});
});
} else {
this.validationErrors.push("页面未进行运算,请改正所有错误再进行运算!!!!!");
this.$message({
type: 'error',
dangerouslyUseHTMLString: true,
message: this.validationErrors.join('<br>')
});
}
//
const totalFactoryAmount = this.materialData.reduce((sum, row) => sum + parseFloat(row.totalFacPrice), 0);
this.totalForm.totalFactoryAmount = totalFactoryAmount.toFixed(2);
//
const totalCost = this.materialData.reduce((sum, row) => sum + parseFloat(row.totalCost), 0);
this.totalForm.totalActualAmount = totalCost.toFixed(2);
const totalDifferenceValue = (((totalFactoryAmount - totalCost) / totalFactoryAmount) * 100)
this.totalForm.totalDifferenceValue = totalDifferenceValue.toFixed(2)
}
//
const totalFactoryAmount = this.materialData.reduce((sum, row) => sum + parseFloat(row.totalFacPrice), 0);
this.totalForm.totalFactoryAmount = totalFactoryAmount.toFixed(2);
//
const totalCost = this.materialData.reduce((sum, row) => sum + parseFloat(row.totalCost), 0);
this.totalForm.totalActualAmount = totalCost.toFixed(2);
const totalDifferenceValue = (((totalFactoryAmount - totalCost) / totalFactoryAmount) * 100)
this.totalForm.totalDifferenceValue = totalDifferenceValue.toFixed(2)
},
},
}
@ -872,6 +951,8 @@ export default {
}
.form-box .el-col {
height: 55px;
}