diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java index df1e61b3..e1ee1af1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java @@ -83,7 +83,7 @@ public class SysMakeorderBom extends BaseEntity /** 损耗率 */ @Excel(name = "损耗率") - private String lossRate; + private Double lossRate; /** 层级 */ @Excel(name = "层级") @@ -250,11 +250,11 @@ public class SysMakeorderBom extends BaseEntity this.useNum = useNum; } - public String getLossRate() { + public Double getLossRate() { return lossRate; } - public void setLossRate(String lossRate) { + public void setLossRate(Double lossRate) { this.lossRate = lossRate; } diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html index 351ba294..983cabff 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html @@ -347,6 +347,13 @@ field: 'lossRate', align: 'center', title: '损耗率', + formatter: function (value, row, index) { + if (value == null || value == ''){ + return "0.00%"; + } + value = parseFloat(value).toFixed(2); + return value + "%"; + } }, { field: 'materialNum', diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html index 04530ef3..d58c89f6 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html @@ -323,6 +323,13 @@ field: 'lossRate', title: '损耗率', align: 'center', + formatter: function (value, row, index) { + if (value == null || value == ''){ + return "0.00%"; + } + value = parseFloat(value).toFixed(2); + return value + "%"; + } }, { field: 'orderNum', diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/detail.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/detail.html index c159622d..528a4582 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/detail.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/detail.html @@ -307,13 +307,13 @@ field: 'lossRate', align: 'center', title: '损耗率', - // formatter: function (value,row,index){ - // if (value == null || value == ''){ - // return '/'; - // }else{ - // return value + "%"; - // } - // } + formatter: function (value, row, index) { + if (value == null || value == ''){ + return "0.00%"; + } + value = parseFloat(value).toFixed(2); + return value + "%"; + } }, { field: 'materialNum', diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/editMakeOrderBom.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/editMakeOrderBom.html index 08a46a6e..5ea3f473 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/editMakeOrderBom.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/editMakeOrderBom.html @@ -209,7 +209,6 @@ editable : { type : 'text', title : '用量', - mode:'inline', validate : function(value) { if (!value) { return '用量不能为空'; @@ -230,43 +229,17 @@ editable : { editor: { defaultValue: '%', - title : '损耗率(%)', - mode:'inline', + title: '损耗率(%)', type: 'text', - // 编辑时同样附带百分比符号 - formatter: function(value) { - return value + '%'; - }, - // 编辑后去除百分比符号 - custom_getter: function(value) { - return value.replace('%', ''); - } }, - validate : function(value) { + validate : function (value) { if (!value) { return '损耗率不能为空'; } - const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 - const match = value.match(regex); // 使用match方法查找所有匹配 - if (!match) { - return '损耗率必须以百分比结尾'; - } - var num = value.replace('%', ''); - if (num < 0 || num > 100) { + if (isNaN(value)) return '损耗率必须是数字'; + if (value < 0 || value > 100) { return '损耗率必须大于等于0小于等于100'; } - }, - }, - formatter: function (value,row,index){ - if (value == null || value == ''){ - return "%"; - } - const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 - const match = value.match(regex); // 使用match方法查找所有匹配 - if (match) { - return value; - }else{ - return value + "%"; } }, }, diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/gcsh.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/gcsh.html index 35094dc8..957efc60 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/gcsh.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/gcsh.html @@ -338,13 +338,13 @@ field: 'lossRate', align: 'center', title: '损耗率', - // formatter: function (value,row,index){ - // if (value == null || value == ''){ - // return '/'; - // }else{ - // return value + "%"; - // } - // } + formatter: function (value, row, index) { + if (value == null || value == ''){ + return "0.00%"; + } + value = parseFloat(value).toFixed(2); + return value + "%"; + } }, { field: 'materialNum',