供应商、订单采购加入供应商筛选等
This commit is contained in:
parent
9c71f3fe98
commit
171c87d447
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue