供应商、订单采购加入供应商筛选等

This commit is contained in:
jjLv 2025-10-14 18:08:20 +08:00
parent 9c71f3fe98
commit 171c87d447
5 changed files with 686 additions and 620 deletions

View File

@ -42,6 +42,7 @@
"clipboard": "2.0.8",
"core-js": "3.25.3",
"crypto-js": "^4.2.0",
"decimal.js": "^10.6.0",
"echarts": "5.4.0",
"element-ui": "2.15.8",
"file-saver": "2.0.5",

View File

@ -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();
}
};

View File

@ -144,7 +144,7 @@
</el-table-column>
<el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<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>
</el-table-column>
<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 { getPurchaseOrderInfoApi,addPurchaseOrderApi,editPurchaseOrderApi } from "@/api/foodManage/purchaseManage";
import { purchasePlanPageApi,getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage";
import PrecisionHandler from '../../../../utils/PrecisionHandler'
export default {
name: "orderEdit",
computed: {
PrecisionHandler() {
return PrecisionHandler
}
},
dicts: [],
data() {
return {
@ -315,6 +321,9 @@ export default {
contractType:undefined,
areaId:undefined,
canteenId:undefined,
supplierId: undefined,
warehouseId:undefined,
},
//
baseRules: {
@ -581,16 +590,19 @@ export default {
},
//
addMaterial(){
if(this.baseInfo.areaId!=undefined){
this.openDialog=true
this.resetQuery()
setTimeout(()=>{
this.$refs.multipleTable1.clearSelection()
},300)
}else{
this.$modal.msgError("请先选择区域");
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.resetQuery()
setTimeout(()=>{
this.$refs.multipleTable1.clearSelection()
},300)
},
/** 搜索按钮操作 */
handleQuery() {
@ -616,6 +628,7 @@ export default {
"materialName": this.queryParams.materialName,
"materialCode": this.queryParams.materialCode,
"materialTypeIds": this.queryParams.materialTypeIds,
"supplierId": this.baseInfo.supplierId,
}
getMaterialListApi(param).then(response => {
this.tableListData = response.rows;
@ -741,7 +754,6 @@ export default {
obj.totalPrice = (Number(obj.singlePrice)*Number(obj.orderNum))
param.orderAmount = param.orderAmount+obj.totalPrice;
param.totalNum = param.totalNum+Number(obj.orderNum)
param.orderGoodsDetailList.push(obj)
}
})
}

View File

@ -487,55 +487,56 @@ export default {
this.getList();
});
},
//
checkDisabled(item,row){
//
let flag = false;
if(row.alternativeSuppliers&&row.alternativeSuppliers.length>0){
let index = row.alternativeSuppliers.findIndex(v=>v.supplierId==item.supplierId)
if(index==-1){
if(item.status==1){
flag=false
}else{
flag=true
}
}else{
flag=true
}
//
checkDisabled(item,row){
//
let flag = false;
if(row.alternativeSuppliers&&row.alternativeSuppliers.length>0){
let index = row.alternativeSuppliers.findIndex(v=>v.supplierId==item.supplierId)
if(index==-1){
if(item.status==1){
flag=false
}else{
if(item.status==1){
flag=false
}else{
flag=true
}
flag=true
}
return flag;
},
//
checkDisabled2(item,row){
//
let flag = false;
if(row.supplierId&&row.supplierId!=""){
if(item.supplierId==row.supplierId){
if(item.status==1){
flag=false
}else{
flag=true
}
}else{
flag=true
}
}else{
flag=true
}
}else{
if(item.status==1){
flag=false
}else{
flag=true
}
}
return flag;
},
//
checkDisabled2(item,row){
//
let flag = false;
if(row.supplierId&&row.supplierId!=""){
if(item.supplierId==row.supplierId){
if(item.status==1){
flag=false
}else{
if(item.status==1){
flag=false
}else{
flag=true
}
flag=true
}
return flag;
},
}else{
flag=true
}
}else{
if(item.status==1){
flag=false
}else{
flag=true
}
}
return flag;
},
//
//
handleSelectionChange(selection) {
this.batchRows = selection
},

View File

@ -664,7 +664,8 @@ export default {
areaId: undefined,
linkman: undefined,
status: undefined,
categoryIdList: []
categoryIdList: [],
type:"list"
},
treeTypeOptions:[],//
treeOptions:[],//
@ -836,7 +837,8 @@ export default {
"areaIdList": [this.queryParams.areaId],
"linkman": this.queryParams.linkman,
"status": this.queryParams.status,
"isPaging":2
"isPaging":2,
"type":"list"
}
supplierPageApi(param).then(response => {
this.tableListData = response.rows;