浏览代码

修改人才类型附件上传方式

sugangqiang 2 年之前
父节点
当前提交
b6bd5f6479

+ 1 - 1
app/admin/view/talent/talentInfo_base_check.html

@@ -189,7 +189,7 @@
                                                 <td>
                                                     <div class="rowGroup">
                                                         <label class=" control-label spacing td-label"><span style="color: red">*</span>人才类型</label>
-                                                        <input type="text" class="form-control" id="talent_type" name="talent_type" value="{$info.talentTypeName}" />
+                                                        <input type="text" class="form-control" id="talent_type" name="talent_type" value="{$info.talentTypeName}" data-value="{$info.talent_type}"/>
                                                     </div>
                                                 </td>
                                                 <td>

+ 1 - 1
app/admin/view/talent/talentInfo_common_check.html

@@ -167,7 +167,7 @@
                                             <tr>
                                                 <td>
                                                     <label class=" control-label spacing td-label"><span style="color: red">*</span>人才类型</label>
-                                                    <select class="form-control" id="talent_type" name="talent_type" >
+                                                    <select class="form-control" id="talent_type" name="talent_type" data-value="{$info.talent_type}">
                                                         <option value="" selected="true">{$info.talentTypeName}</option>
                                                     </select>
                                                 </td>

+ 1 - 1
app/common/controller/Api.php

@@ -185,7 +185,7 @@ class Api extends BaseController {
         if (in_array($checkState, [-1, 0, 1, 2])) {
             $where[] = ["step", "=", 1]; //只查找人才第一步所需文件
         } else {
-            $where[] = ["isConditionFile", "=", 0]; //排除人才条件上传文件
+            $where[] = ["isConditionFile", "<>", 1]; //排除人才条件上传文件
         }
         $where[] = ["project", "=", $project];
         $where[] = ["type", "=", $type];

+ 57 - 3
app/enterprise/controller/Base.php

@@ -124,7 +124,7 @@ class Base extends EnterpriseController {
                   echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
                   exit;
                   } */
-                $no_empty[] = "pre_contract_rangetime";
+                $no_empty[] = "pre_import_type";
             }
             $return = [];
             foreach ($no_empty as $key) {
@@ -144,7 +144,22 @@ class Base extends EnterpriseController {
             $where[] = ["must", "=", 1];
             $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
 
-            $ft_ids = array_column($filetypes, "id");
+
+            $ft_ids = [];
+            $deletes = [];
+            foreach ($filetypes as $ft) {
+                if ($ft["option"]) {
+                    $selectVal = $param[$ft["rel"]];
+                    $conditions = array_filter(explode(",", $ft["option"]));
+                    if (!in_array($selectVal, $conditions)) {
+                        $deletes[] = $ft["id"];
+                        continue;
+                    }
+                }
+                $ft_ids[] = $ft["id"];
+            }
+
+            //$ft_ids = array_column($filetypes, "id");
             $whr = [];
             $upload_type_counts = 0;
             if ($files) {
@@ -193,8 +208,34 @@ class Base extends EnterpriseController {
                 $data["checkState"] = TalentState::FST_SAVE;
                 $id = TalentModel::insertGetId($data);
                 TalentLogApi::write(1, $id, TalentState::FST_SAVE, "添加人才认定申报", 1);
+                $whr = [];
+                $whr[] = ["fileId", "in", $files];
+                $upd_checklog["mainId"] = $id;
+                Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
             }
             if ($id) {
+                if ($deletes) {
+                    //删除多余的附件,一般是选择人才类型留下来的
+                    $whr = [];
+                    $whr[] = ["typeId", "in", $deletes];
+                    $whr[] = ["id", "in", $files];
+                    $_wait_del_files = Db::table("new_talent_file")->where($whr)->select()->toArray();
+                    $_logfileIds[] = [];
+                    foreach ($_wait_del_files as $_del_file) {
+                        $_logfileIds[] = $_del_file["id"];
+                        @unlink("storage/" . $_del_file["url"]);
+                    }
+                    Db::table("new_talent_file")->where($whr)->delete();
+                    if ($_logfileIds) {
+                        $whr = [];
+                        $whr[] = ["fileId", "in", $_logfileIds];
+                        $_upd_checklog["description"] = "人才申报过程1中取消且已经彻底删除的附件";
+                        $_upd_checklog["updateUser"] = sprintf("%s(%s)", $this->user["account"], $this->user["companyName"] ?: $this->user["rolename"]);
+                        $_upd_checklog["updateTime"] = date("Y-m-d H:i:s");
+                        Db::table("new_talent_checklog")->where($whr)->save($_upd_checklog);
+                    }
+                }
+
                 $whr = [];
                 $whr[] = ["id", "in", $files];
                 Db::table("new_talent_file")->where($whr)->save(["mainId" => $id]);
@@ -236,7 +277,20 @@ class Base extends EnterpriseController {
             $where[] = ["must", "=", 1];
             $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
 
-            $ft_ids = array_column($filetypes, "id");
+            $ft_ids = [];
+            foreach ($filetypes as $ft) {
+                if ($ft["option"]) {
+                    $selectVal = $info[$ft["rel"]];
+                    $conditions = array_filter(explode(",", $ft["option"]));
+                    if (!in_array($selectVal, $conditions)) {
+                        $deletes[] = $ft["id"];
+                        continue;
+                    }
+                }
+                $ft_ids[] = $ft["id"];
+            }
+
+            //$ft_ids = array_column($filetypes, "id");
             $whr = [];
             $upload_type_counts = 0;
             if ($ft_ids) {

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

@@ -141,7 +141,7 @@ class Talent extends EnterpriseController {
 
             if ($upload_type_counts != count($ft_ids)) {
                 $test = count($ft_ids);
-                $res = ["msg" => "{$upload_type_counts}-{$test}请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"];
+                $res = ["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"];
                 echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
                 exit;
             }

+ 2 - 2
app/enterprise/view/base/first.html

@@ -261,8 +261,8 @@
                                                 </td>
                                                 <td >
                                                     <div class="rowGroup">
-                                                        <input type="radio" name="pre_import_type" value="1" /><span style="color: red">*</span>意向合同&nbsp;&nbsp;&nbsp;&nbsp;
-                                                        <input type="radio" name="pre_import_type" value="2"/><span style="color: red">*</span>创业企业名称预核准
+                                                        <input type="radio" name="pre_import_type" value="1" {eq name="row.pre_import_type" value="1"}checked{/eq}/><span style="color: red">*</span>意向合同&nbsp;&nbsp;&nbsp;&nbsp;
+                                                        <input type="radio" name="pre_import_type" value="2" {eq name="row.pre_import_type" value="2"}checked{/eq}/><span style="color: red">*</span>创业企业名称预核准
                                                     </div>
                                                 </td>
                                             </tr>

+ 1 - 1
app/enterprise/view/talent/second.html

@@ -188,7 +188,7 @@
                                         <td>
                                             <div class="rowGroup">
                                                 <label class=" control-label spacing td-label"><span style="color: red">*</span>人才类型</label>
-                                                <select class="form-control" readonly disabled id="talent_type">
+                                                <select class="form-control" readonly disabled id="talent_type" data-value="{$row.talent_type}">
                                                     <option value="" selected="true">{$row.talentTypeName}</option>
                                                 </select>
                                             </div>

+ 1 - 1
app/enterprise/view/talent/view.html

@@ -133,7 +133,7 @@
                                                     </div>
                                                     <div class="rowGroup col-sm-3">
                                                         <label class=" control-label spacing"><span style="color: red">*</span>人才类型</label>
-                                                        <select class="form-control" id="talent_type" name="talent_type" >
+                                                        <select class="form-control" id="talent_type" name="talent_type" data-value="{$row.talent_type}">
                                                             <option value="" selected="true">{$row.talentTypeName}</option>
                                                         </select>
                                                     </div>

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

@@ -431,8 +431,8 @@ TalentInfoInfoDlg.talentTypeChange = function () {
         let option = $("[data-rel=talent_type]").eq(i);
         let options = option.data("option").split(",");
         if (options.indexOf(talent_type) > -1) {
-            option.css("display", "block");
-            option.next("tr.detail-view").css("display", "block");
+            option.css("display", "table-row");
+            option.next("tr.detail-view").css("display", "table-row");
         } else {
             option.css("display", "none");
             option.next("tr.detail-view").css("display", "none");
@@ -810,9 +810,9 @@ TalentInfoInfoDlg.callBack = function (data) {
         } else {
             var html = '<li data-id="' + data.id + '">\n\
 <div><input type="hidden" name="uploadFiles[]" value="' + data.id + '"></div>\n\
-<div style="width: 80%;">' + data.orignName + '</div>\n\
+<div style="width: 70%;">' + data.orignName + '</div>\n\
 <div style="width: 10%;">' + imgStr + '</div>\n\
-<div style="width: 10%;">\n\
+<div style="width: 20%;">\n\
 <button type="button" onclick="TalentInfoInfoDlg.checkFile(this,' + data.typeId + ',' + data.id + ',' + tableIndex + ',' + trIndex + ')" style="margin-right: 10px" class="btn btn-xs btn-info"><i class="fa fa-paste"></i>修改</button>\n\
 <button type="button" onclick="TalentInfoInfoDlg.deleteFile(' + data.id + ')" class="btn btn-xs btn-danger"><i class="fa fa-times"></i>删除</button>\n\
 </div></li></ul>';

+ 15 - 2
public/static/modular/gate/talentInfo/talentInfo_info.js

@@ -277,17 +277,24 @@ TalentInfoInfoDlg.initFileTable = function () {
         }
         for (var k in data["rows"]) {
             var rel = data["rows"][k].rel;
-            console.log(rel)
             if ($("#" + rel).length > 0) {
                 if(rel == 'card_number' || rel == 'name' || rel == 'talent_type' || rel == 'talent_edu' || rel=='fst_work_time'){
                     var tableIndex = $("#" + rel).parents(".table").find("table.fileTable").index(".fileTable");
                 }else{
                     var tableIndex = $("#" + rel).parents(".row").next(".row").find("table.fileTable").index(".fileTable");
                 }
-
                 data["rows"][k].tableIndex = tableIndex;
                 data["rows"][k].trIndex = datas[tableIndex].length;
                 datas[tableIndex].push(data["rows"][k]);
+                if (data["rows"][k].option) {
+                    //指定了选项
+                    let selectVal = $("#" + rel).data("value").toString();
+                    let options = data["rows"][k].option.split(",");
+                    console.log(selectVal,options)
+                    if (options.indexOf(selectVal) == -1) {
+                        data["rows"][k].hidden = true;
+                    }
+                }
             } else {
                 if (data["rows"][k].isConditionFile) {
                     var tableIndex = $("#talent_condition").parents(".row").next(".row").find("table.fileTable").index(".fileTable");
@@ -339,7 +346,13 @@ TalentInfoInfoDlg.initFileTable = function () {
                                     </li>';
                         }
                         html = html + '</ul>';
+                        that.find("tr[data-index='" + k + "']").attr("data-rel", data[k]["rel"]);
+                        that.find("tr[data-index='" + k + "']").attr("data-option", data[k]["option"]);
                         that.find("tr[data-index='" + k + "']").after('<tr class="detail-view"><td colspan="5">' + html + '</td></tr>');
+                        if (typeof data[k].hidden != "undefined") {
+                            that.find("tr[data-index='" + k + "']").css("display", "none");
+                            that.find("tr[data-index='" + k + "']").next("tr.detail-view").css("display", "none");
+                        }
                     }
                     $("td.uitd_showTip").bind("mouseover", function () {
                         var htm = $(this).html();

+ 15 - 0
public/static/modular/gate/talentInfo/talentInfo_select.js

@@ -56,6 +56,15 @@ TalentInfoInfoDlg.initFileTable = function () {
                 data["rows"][k].tableIndex = tableIndex;
                 data["rows"][k].trIndex = datas[tableIndex].length;
                 datas[tableIndex].push(data["rows"][k]);
+                if (data["rows"][k].option) {
+                    //指定了选项
+                    let selectVal = $("#" + rel).data("value").toString();
+                    let options = data["rows"][k].option.split(",");
+                    console.log(selectVal,options)
+                    if (options.indexOf(selectVal) == -1) {
+                        data["rows"][k].hidden = true;
+                    }
+                }
             } else {
                 if (data["rows"][k].isConditionFile) {
                     var tableIndex = $("#talent_condition").parents(".row").next(".row").find("table.fileTable").index(".fileTable");
@@ -103,7 +112,13 @@ TalentInfoInfoDlg.initFileTable = function () {
                                     </li>';
                         }
                         html = html + '</ul>';
+                        that.find("tr[data-index='" + k + "']").attr("data-rel", data[k]["rel"]);
+                        that.find("tr[data-index='" + k + "']").attr("data-option", data[k]["option"]);
                         that.find("tr[data-index='" + k + "']").after('<tr class="detail-view"><td colspan="5">' + html + '</td></tr>');
+                        if (typeof data[k].hidden != "undefined") {
+                            that.find("tr[data-index='" + k + "']").css("display", "none");
+                            that.find("tr[data-index='" + k + "']").next("tr.detail-view").css("display", "none");
+                        }
                     }
                     $("td.uitd_showTip").bind("mouseover", function () {
                         var htm = $(this).html();

+ 14 - 0
public/static/modular/talentIdentify/talentInfo/talentInfo_common_check.js

@@ -64,6 +64,14 @@ TalentInfoInfoDlg.initFileTable = function () {
                 data["rows"][k].tableIndex = tableIndex;
                 data["rows"][k].trIndex = datas[tableIndex].length;
                 datas[tableIndex].push(data["rows"][k]);
+                if (data["rows"][k].option) {
+                    //指定了选项
+                    let selectVal = $("#" + rel).data("value").toString();
+                    let options = data["rows"][k].option.split(",");
+                    if (options.indexOf(selectVal) == -1) {
+                        data["rows"][k].hidden = true;
+                    }
+                }
             } else {
                 if (data["rows"][k].isConditionFile) {
                     var tableIndex = $("#talent_condition").parents(".row").next(".row").find("table.fileTable").index(".fileTable");
@@ -111,7 +119,13 @@ TalentInfoInfoDlg.initFileTable = function () {
                                     </li>';
                         }
                         html = html + '</ul>';
+                        that.find("tr[data-index='" + k + "']").attr("data-rel", data[k]["rel"]);
+                        that.find("tr[data-index='" + k + "']").attr("data-option", data[k]["option"]);
                         that.find("tr[data-index='" + k + "']").after('<tr class="detail-view"><td colspan="5">' + html + '</td></tr>');
+                        if (typeof data[k].hidden != "undefined") {
+                            that.find("tr[data-index='" + k + "']").css("display", "none");
+                            that.find("tr[data-index='" + k + "']").next("tr.detail-view").css("display", "none");
+                        }
                     }
                     $("td.uitd_showTip").bind("mouseover", function () {
                         var htm = $(this).html();