Bläddra i källkod

检测管理有效期字段计算代码更改

CHINAMI-P698360\Administrator 1 år sedan
förälder
incheckning
7c3ddce1ad

+ 12 - 4
src/views/system/jbdScan/js/manualConfirmationJS.js

@@ -627,8 +627,12 @@ export default {
                                 var maxAge
                                 repostCurd('sql', sql).then((res) => {
                                     const { data = [] } = res.variables || {}
-                                    maxAge = data.reduce((max, person) => person.bao_gao_zhou_qi_g > max ? person.bao_gao_zhou_qi_g : max, data[0].bao_gao_zhou_qi_g)
-
+                                    maxAge = data.reduce((max, person) => {
+                                        // 将age从字符串转换为数字
+                                        const  maxNum = parseInt(person.bao_gao_zhou_qi_g)
+                                        // 使用三元表达式比较并更新最大值
+                                        return maxNum > max ? maxNum : max
+                                    }, 0)
                                     const currentDate = new Date()
 
                                     //  创建一个新的日期对象,表示当前日期加上3天
@@ -894,8 +898,12 @@ export default {
                                         var maxAge
                                         repostCurd('sql', sql).then((res) => {
                                             const { data = [] } = res.variables || {}
-                                            maxAge = data.reduce((max, person) => person.bao_gao_zhou_qi_g > max ? person.bao_gao_zhou_qi_g : max, data[0].bao_gao_zhou_qi_g)
-
+                                            maxAge = data.reduce((max, person) => {
+                                                // 将age从字符串转换为数字
+                                                const  maxNum = parseInt(person.bao_gao_zhou_qi_g)
+                                                // 使用三元表达式比较并更新最大值
+                                                return maxNum > max ? maxNum : max
+                                            }, 0)
                                             const currentDate = new Date()
 
                                             //  创建一个新的日期对象,表示当前日期加上3天

+ 12 - 4
src/views/system/jbdScan/js/sampleConfirmationJS.js

@@ -569,8 +569,12 @@ export default {
                                 var maxAge
                                 repostCurd('sql', sql).then((res) => {
                                     const { data = [] } = res.variables || {}
-                                    maxAge = data.reduce((max, person) => person.bao_gao_zhou_qi_g > max ? person.bao_gao_zhou_qi_g : max, data[0].bao_gao_zhou_qi_g)
-
+                                    maxAge = data.reduce((max, person) => {
+                                        // 将age从字符串转换为数字
+                                        const  maxNum = parseInt(person.bao_gao_zhou_qi_g)
+                                        // 使用三元表达式比较并更新最大值
+                                        return maxNum > max ? maxNum : max
+                                    }, 0)
                                     const currentDate = new Date()
 
                                     //  创建一个新的日期对象,表示当前日期加上3天
@@ -836,8 +840,12 @@ export default {
                                         var maxAge
                                         repostCurd('sql', sql).then((res) => {
                                             const { data = [] } = res.variables || {}
-                                            maxAge = data.reduce((max, person) => person.bao_gao_zhou_qi_g > max ? person.bao_gao_zhou_qi_g : max, data[0].bao_gao_zhou_qi_g)
-
+                                            maxAge = data.reduce((max, person) => {
+                                                // 将age从字符串转换为数字
+                                                const  maxNum = parseInt(person.bao_gao_zhou_qi_g)
+                                                // 使用三元表达式比较并更新最大值
+                                                return maxNum > max ? maxNum : max
+                                            }, 0)
                                             const currentDate = new Date()
 
                                             //  创建一个新的日期对象,表示当前日期加上3天