فهرست منبع

优化质检工单样品数量校验逻辑并修复数值比较问题

yusheng 5 ماه پیش
والد
کامیت
e02a79e106
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      src/views/inspectionWork/mixins/detailMixins.js

+ 4 - 4
src/views/inspectionWork/mixins/detailMixins.js

@@ -947,7 +947,7 @@ export default {
     //样品数操作
     isSampleQuantity(item, index) {
       // this.resetData(item, index, ['qualifiedQuantity', 'noQualifiedQuantity']);
-      if (item.sampleQuantity > this.getSampleQuantityCount) {
+      if (Number(item.sampleQuantity) > this.getSampleQuantityCount) {
         this.$message.error('样品数量不能大于当前质检剩余样品数');
         this.$set(
           this.tableData[index],
@@ -964,8 +964,8 @@ export default {
     },
     //合格/不合格数操作
     isQualifiedQuantity(item, index, key) {
-      console.log(item, 'item[key]');
-      if (item[key] > item.sampleQuantity) {
+
+      if (Number(item[key]) >Number(item.sampleQuantity)) {
         this.$message.error(
           (key == 'qualifiedQuantity' ? '合格' : '不合格') +
             '数量不能大于样品数'
@@ -996,7 +996,7 @@ export default {
               Number(item.retainedSampleUnqualified)
       };
 
-      if (+item[key] > item[keyObj.key]) {
+      if (Number(item[key]) >Number(item[keyObj.key])) {
         this.$message.error(
           title + keyObj.title + '不能大于样品' + keyObj.title
         );