瀏覽代碼

电路人才申报中前端验证省市县时,如果县没有列表,可以通过空值排查

sugangqiang 2 年之前
父節點
當前提交
5e2f5bc803

+ 2 - 2
app/enterprise/controller/Talent.php

@@ -307,7 +307,7 @@ class Talent extends EnterpriseController {
         if ($checkState == TalentState::SCND_SAVE || !$id) {
             $field_dict = \app\common\api\DictApi::getTalentFields(4, $info["isImport"]);
 
-            $no_empty = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "county", "talent_type", "experience", "education",
+            $no_empty = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "talent_type", "experience", "education",
                 "talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "bank", "bank_number", "bank_branch_name",
                 "bank_account", "study_abroad", "phone", "email", "import_way", "cur_entry_time", "cur_entry_time", "position", "source"];
 
@@ -462,7 +462,7 @@ class Talent extends EnterpriseController {
         if ($checkState == TalentState::SCND_SAVE) {
             $field_dict = \app\common\api\DictApi::getTalentFields_IC();
 
-            $no_empty = ["name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "county", "nation", "politics", "break_faith",
+            $no_empty = ["name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "nation", "politics", "break_faith",
                 "phone", "email", "highest_degree", "graduate_school", "major", "study_abroad", "position", "cur_entry_time", "labor_contract_rangetime",
                 "talent_arrange", "talent_condition", "identifyConditionName", "identifyGetTime",
                 "bank", "bank_branch_name", "bank_account", "experience", "education"];

+ 14 - 0
public/static/modular/gate/talentInfo/new_talentInfo_info.js

@@ -23,6 +23,20 @@ var TalentInfoInfoDlg = {
         nationality: {validators: {notEmpty: {message: '国籍/地区不能为空'}}},
         province: {validators: {notEmpty: {message: '户籍省份不能为空'}}},
         city: {validators: {notEmpty: {message: '户籍市不能为空'}}},
+        county: {validators: {
+                //notEmpty: {message: '户籍县不能为空'},
+                callback: {
+                    message: "户籍县不能为空",
+                    callback: function (value, validator) {
+                        if ($("#province").val() > 0 && $("#city").val() > 0 && $("#county option").length > 1 && $("county option:selected").length == 0) {
+                            //当省市都有值时,如果县有列表,必选
+                            return false;
+                        }
+                        return true;
+                    }
+                }
+            }
+        },
         nation: {validators: {notEmpty: {message: '民族不能为空'}}},
         politics: {validators: {notEmpty: {message: '政治面貌不能为空'}}},
         experience: {validators: {notEmpty: {message: '工作简历不能为空'}}},

+ 14 - 1
public/static/modular/gate/talentInfo/talentInfo_ic_info.js

@@ -11,7 +11,20 @@ var TalentInfoInfoDlg = {
         nation: {validators: {notEmpty: {message: '民族不能为空'}}},
         province: {validators: {notEmpty: {message: '户籍省份不能为空'}}},
         city: {validators: {notEmpty: {message: '户籍市不能为空'}}},
-        county: {validators: {notEmpty: {message: '户籍县不能为空'}}},
+        county: {validators: {
+                //notEmpty: {message: '户籍县不能为空'},
+                callback: {
+                    message: "户籍县不能为空",
+                    callback: function (value, validator) {
+                        if ($("#province").val() > 0 && $("#city").val() > 0 && $("#county option").length > 1 && $("county option:selected").length == 0) {
+                            //当省市都有值时,如果县有列表,必选
+                            return false;
+                        }
+                        return true;
+                    }
+                }
+            }
+        },
         address: {validators: {notEmpty: {message: '现居地址不能为空'}}},
         highest_degree: {validators: {notEmpty: {message: '最高学历不能为空'}}},
         major: {validators: {notEmpty: {message: '专业不能为空'}}},

+ 14 - 0
public/static/modular/gate/talentInfo/talentInfo_info.js

@@ -24,6 +24,20 @@ var TalentInfoInfoDlg = step == 1 ? {
         nationality: {validators: {notEmpty: {message: '国籍/地区不能为空'}}},
         province: {validators: {notEmpty: {message: '户籍省份不能为空'}}},
         city: {validators: {notEmpty: {message: '户籍市不能为空'}}},
+        county: {validators: {
+                //notEmpty: {message: '户籍县不能为空'},
+                callback: {
+                    message: "户籍县不能为空",
+                    callback: function (value, validator) {
+                        if ($("#province").val() > 0 && $("#city").val() > 0 && $("#county option").length > 1 && $("county option:selected").length == 0) {
+                            //当省市都有值时,如果县有列表,必选
+                            return false;
+                        }
+                        return true;
+                    }
+                }
+            }
+        },
         nation: {validators: {notEmpty: {message: '民族不能为空'}}},
         politics: {validators: {notEmpty: {message: '政治面貌不能为空'}}},
         experience: {validators: {notEmpty: {message: '工作简历不能为空'}}},