Browse Source

70岁附件不满70周岁不显示

sugangqiang 2 năm trước cách đây
mục cha
commit
c6385ff783

+ 11 - 4
public/static/modular/gate/talentBase/talentInfo_info.js

@@ -618,10 +618,17 @@ TalentInfoInfoDlg.initFile = function () {
                 if (data["rows"][k].option) {
                     //指定了选项
                     if (rel == "birthday") {
-                        let birthday = parseInt($("#" + rel).val().substring(0, 4));
-                        let currentYear = parseInt(new Date().getFullYear());
-                        let age = currentYear - (isNaN(birthday) ? 0 : birthday);
-                        if (isNaN(birthday) || (!isNaN(birthday) && age < data["rows"][k].option))
+                        let age = 0;
+                        if ($("#" + rel).val()) {
+                            let birthDate = new Date($("#" + rel).val());//生日日期
+                            let birthYear = birthDate.getFullYear();
+                            let birthMonth = birthDate.getMonth() + 1;
+                            let currentDate = new Date();//当前日期
+                            let currentYear = currentDate.getFullYear();
+                            let currentMonth = currentDate.getMonth() + 1;
+                            age = (currentYear * 12 + currentMonth - birthYear * 12 - birthMonth) / 12;
+                        }
+                        if (age < data["rows"][k].option)
                             data["rows"][k].hidden = true;
                     } else {
                         let selectVal = $("#" + rel).val();

+ 11 - 4
public/static/modular/gate/talentInfo/new_talentInfo_info.js

@@ -309,10 +309,17 @@ TalentInfoInfoDlg.initFileTable = function () {
                 if (data["rows"][k].option) {
                     //指定了选项
                     if (rel == "birthday") {
-                        let birthday = parseInt($("#" + rel).val().substring(0, 4));
-                        let currentYear = parseInt(new Date().getFullYear());
-                        let age = currentYear - (isNaN(birthday) ? 0 : birthday);
-                        if (isNaN(birthday) || (!isNaN(birthday) && age < data["rows"][k].option))
+                        let age = 0;
+                        if ($("#" + rel).val()) {
+                            let birthDate = new Date($("#" + rel).val());//生日日期
+                            let birthYear = birthDate.getFullYear();
+                            let birthMonth = birthDate.getMonth() + 1;
+                            let currentDate = new Date();//当前日期
+                            let currentYear = currentDate.getFullYear();
+                            let currentMonth = currentDate.getMonth() + 1;
+                            age = (currentYear * 12 + currentMonth - birthYear * 12 - birthMonth) / 12;
+                        }
+                        if (age < data["rows"][k].option)
                             data["rows"][k].hidden = true;
                     } else {
                         let selectVal = $("#" + rel).data("value").toString();

+ 11 - 4
public/static/modular/gate/talentInfo/talentInfo_info.js

@@ -304,10 +304,17 @@ TalentInfoInfoDlg.initFileTable = function () {
                 if (data["rows"][k].option) {
                     //指定了选项
                     if (rel == "birthday") {
-                        let birthday = parseInt($("#" + rel).val().substring(0, 4));
-                        let currentYear = parseInt(new Date().getFullYear());
-                        let age = currentYear - (isNaN(birthday) ? 0 : birthday);
-                        if (isNaN(birthday) || (!isNaN(birthday) && age < data["rows"][k].option))
+                        let age = 0;
+                        if ($("#" + rel).val()) {
+                            let birthDate = new Date($("#" + rel).val());//生日日期
+                            let birthYear = birthDate.getFullYear();
+                            let birthMonth = birthDate.getMonth() + 1;
+                            let currentDate = new Date();//当前日期
+                            let currentYear = currentDate.getFullYear();
+                            let currentMonth = currentDate.getMonth() + 1;
+                            age = (currentYear * 12 + currentMonth - birthYear * 12 - birthMonth) / 12;
+                        }
+                        if (age < data["rows"][k].option)
                             data["rows"][k].hidden = true;
                     } else {
                         let selectVal = $("#" + rel).data("value").toString();

+ 11 - 4
public/static/modular/gate/talentInfo/talentInfo_select.js

@@ -72,10 +72,17 @@ TalentInfoInfoDlg.initFileTable = function () {
                 if (data["rows"][k].option) {
                     //指定了选项
                     if (rel == "birthday") {
-                        let birthday = parseInt($("#" + rel).val().substring(0, 4));
-                        let currentYear = parseInt(new Date().getFullYear());
-                        let age = currentYear - (isNaN(birthday) ? 0 : birthday);
-                        if (isNaN(birthday) || (!isNaN(birthday) && age < data["rows"][k].option))
+                        let age = 0;
+                        if ($("#" + rel).val()) {
+                            let birthDate = new Date($("#" + rel).val());//生日日期
+                            let birthYear = birthDate.getFullYear();
+                            let birthMonth = birthDate.getMonth() + 1;
+                            let currentDate = new Date();//当前日期
+                            let currentYear = currentDate.getFullYear();
+                            let currentMonth = currentDate.getMonth() + 1;
+                            age = (currentYear * 12 + currentMonth - birthYear * 12 - birthMonth) / 12;
+                        }
+                        if (age < data["rows"][k].option)
                             data["rows"][k].hidden = true;
                     } else {
                         let selectVal = $("#" + rel).data("value").toString();

+ 11 - 4
public/static/modular/talentIdentify/talentInfo/talentInfo_common_check.js

@@ -77,10 +77,17 @@ TalentInfoInfoDlg.initFileTable = function () {
                 if (data["rows"][k].option) {
                     //指定了选项
                     if (rel == "birthday") {
-                        let birthday = parseInt($("#" + rel).val().substring(0, 4));
-                        let currentYear = parseInt(new Date().getFullYear());
-                        let age = currentYear - (isNaN(birthday) ? 0 : birthday);
-                        if (isNaN(birthday) || (!isNaN(birthday) && age < data["rows"][k].option))
+                        let age = 0;
+                        if ($("#" + rel).val()) {
+                            let birthDate = new Date($("#" + rel).val());//生日日期
+                            let birthYear = birthDate.getFullYear();
+                            let birthMonth = birthDate.getMonth() + 1;
+                            let currentDate = new Date();//当前日期
+                            let currentYear = currentDate.getFullYear();
+                            let currentMonth = currentDate.getMonth() + 1;
+                            age = (currentYear * 12 + currentMonth - birthYear * 12 - birthMonth) / 12;
+                        }
+                        if (age < data["rows"][k].option)
                             data["rows"][k].hidden = true;
                     } else {
                         let selectVal = $("#" + rel).data("value").toString();