供应商、订单采购加入供应商筛选等
This commit is contained in:
parent
9c71f3fe98
commit
171c87d447
|
|
@ -42,6 +42,7 @@
|
||||||
"clipboard": "2.0.8",
|
"clipboard": "2.0.8",
|
||||||
"core-js": "3.25.3",
|
"core-js": "3.25.3",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
|
"decimal.js": "^10.6.0",
|
||||||
"echarts": "5.4.0",
|
"echarts": "5.4.0",
|
||||||
"element-ui": "2.15.8",
|
"element-ui": "2.15.8",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
// 优化后的工具文件 utils/PrecisionHandler.js
|
||||||
|
import Decimal from 'decimal.js';
|
||||||
|
|
||||||
|
// 关键:设置足够高的精度并禁止自动转换为数字
|
||||||
|
Decimal.set({
|
||||||
|
precision: 30,
|
||||||
|
toExpNeg: -999, // 避免小数字自动转为科学计数法
|
||||||
|
toExpPos: 999 // 避免大数字自动转为科学计数法
|
||||||
|
});
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// 确保输入是字符串类型以保留完整精度
|
||||||
|
toDecimal(num) {
|
||||||
|
// 如果是数字先转为字符串,避免精度丢失
|
||||||
|
if (typeof num === 'number') {
|
||||||
|
num = num.toString();
|
||||||
|
}
|
||||||
|
return new Decimal(num);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 加法
|
||||||
|
add(num1, num2) {
|
||||||
|
return this.toDecimal(num1).plus(this.toDecimal(num2));
|
||||||
|
},
|
||||||
|
|
||||||
|
// 减法
|
||||||
|
subtract(num1, num2) {
|
||||||
|
return this.toDecimal(num1).minus(this.toDecimal(num2));
|
||||||
|
},
|
||||||
|
|
||||||
|
// 乘法
|
||||||
|
multiply(num1, num2) {
|
||||||
|
return this.toDecimal(num1).times(this.toDecimal(num2));
|
||||||
|
},
|
||||||
|
|
||||||
|
// 除法
|
||||||
|
divide(num1, num2) {
|
||||||
|
return this.toDecimal(num1).dividedBy(this.toDecimal(num2));
|
||||||
|
},
|
||||||
|
|
||||||
|
// 四舍五入保留指定小数位(返回字符串,避免转换丢失)
|
||||||
|
round(num, decimalPlaces = 2) {
|
||||||
|
return this.toDecimal(num).toFixed(decimalPlaces);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 转换为数字(仅在确定不会丢失精度时使用)
|
||||||
|
toNumber(decimal) {
|
||||||
|
return decimal.toNumber();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -144,7 +144,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
|
<el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.singlePrice>=0">{{ scope.row.orderNum*scope.row.singlePrice }}</span>
|
<span v-if="scope.row.singlePrice>=0">{{ PrecisionHandler.multiply(scope.row.orderNum,scope.row.singlePrice) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true">
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true">
|
||||||
|
|
@ -300,8 +300,14 @@ import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/ap
|
||||||
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi,drpWareHousePageApi,purchaseContractPageApi } from "@/api/foodManage/purchaseManage";
|
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi,drpWareHousePageApi,purchaseContractPageApi } from "@/api/foodManage/purchaseManage";
|
||||||
import { getPurchaseOrderInfoApi,addPurchaseOrderApi,editPurchaseOrderApi } from "@/api/foodManage/purchaseManage";
|
import { getPurchaseOrderInfoApi,addPurchaseOrderApi,editPurchaseOrderApi } from "@/api/foodManage/purchaseManage";
|
||||||
import { purchasePlanPageApi,getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage";
|
import { purchasePlanPageApi,getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage";
|
||||||
|
import PrecisionHandler from '../../../../utils/PrecisionHandler'
|
||||||
export default {
|
export default {
|
||||||
name: "orderEdit",
|
name: "orderEdit",
|
||||||
|
computed: {
|
||||||
|
PrecisionHandler() {
|
||||||
|
return PrecisionHandler
|
||||||
|
}
|
||||||
|
},
|
||||||
dicts: [],
|
dicts: [],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -315,6 +321,9 @@ export default {
|
||||||
contractType:undefined,
|
contractType:undefined,
|
||||||
areaId:undefined,
|
areaId:undefined,
|
||||||
canteenId:undefined,
|
canteenId:undefined,
|
||||||
|
supplierId: undefined,
|
||||||
|
warehouseId:undefined,
|
||||||
|
|
||||||
},
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
baseRules: {
|
baseRules: {
|
||||||
|
|
@ -581,16 +590,19 @@ export default {
|
||||||
},
|
},
|
||||||
//添加货品
|
//添加货品
|
||||||
addMaterial(){
|
addMaterial(){
|
||||||
if(this.baseInfo.areaId!=undefined){
|
if(this.baseInfo.areaId==undefined || this.baseInfo.areaId =="" ) {
|
||||||
|
this.$modal.msgError("请先选择区域");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(this.baseInfo.supplierId==undefined || this.baseInfo.supplierId =="" ) {
|
||||||
|
this.$modal.msgError("请先选择供应商");
|
||||||
|
return
|
||||||
|
}
|
||||||
this.openDialog=true
|
this.openDialog=true
|
||||||
this.resetQuery()
|
this.resetQuery()
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.$refs.multipleTable1.clearSelection()
|
this.$refs.multipleTable1.clearSelection()
|
||||||
},300)
|
},300)
|
||||||
}else{
|
|
||||||
this.$modal.msgError("请先选择区域");
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
|
|
@ -616,6 +628,7 @@ export default {
|
||||||
"materialName": this.queryParams.materialName,
|
"materialName": this.queryParams.materialName,
|
||||||
"materialCode": this.queryParams.materialCode,
|
"materialCode": this.queryParams.materialCode,
|
||||||
"materialTypeIds": this.queryParams.materialTypeIds,
|
"materialTypeIds": this.queryParams.materialTypeIds,
|
||||||
|
"supplierId": this.baseInfo.supplierId,
|
||||||
}
|
}
|
||||||
getMaterialListApi(param).then(response => {
|
getMaterialListApi(param).then(response => {
|
||||||
this.tableListData = response.rows;
|
this.tableListData = response.rows;
|
||||||
|
|
@ -741,7 +754,6 @@ export default {
|
||||||
obj.totalPrice = (Number(obj.singlePrice)*Number(obj.orderNum))
|
obj.totalPrice = (Number(obj.singlePrice)*Number(obj.orderNum))
|
||||||
param.orderAmount = param.orderAmount+obj.totalPrice;
|
param.orderAmount = param.orderAmount+obj.totalPrice;
|
||||||
param.totalNum = param.totalNum+Number(obj.orderNum)
|
param.totalNum = param.totalNum+Number(obj.orderNum)
|
||||||
param.orderGoodsDetailList.push(obj)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -535,6 +535,7 @@ export default {
|
||||||
return flag;
|
return flag;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.batchRows = selection
|
this.batchRows = selection
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,8 @@ export default {
|
||||||
areaId: undefined,
|
areaId: undefined,
|
||||||
linkman: undefined,
|
linkman: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
categoryIdList: []
|
categoryIdList: [],
|
||||||
|
type:"list"
|
||||||
},
|
},
|
||||||
treeTypeOptions:[],//类别树
|
treeTypeOptions:[],//类别树
|
||||||
treeOptions:[],//区域树
|
treeOptions:[],//区域树
|
||||||
|
|
@ -836,7 +837,8 @@ export default {
|
||||||
"areaIdList": [this.queryParams.areaId],
|
"areaIdList": [this.queryParams.areaId],
|
||||||
"linkman": this.queryParams.linkman,
|
"linkman": this.queryParams.linkman,
|
||||||
"status": this.queryParams.status,
|
"status": this.queryParams.status,
|
||||||
"isPaging":2
|
"isPaging":2,
|
||||||
|
"type":"list"
|
||||||
}
|
}
|
||||||
supplierPageApi(param).then(response => {
|
supplierPageApi(param).then(response => {
|
||||||
this.tableListData = response.rows;
|
this.tableListData = response.rows;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue