Kaynağa Gözat

更新高教复审判定

zmw 7 ay önce
ebeveyn
işleme
b81024940f

+ 30 - 1
app/admin/controller/TalentAllowance.php

@@ -214,10 +214,39 @@ class TalentAllowance extends AdminController {
                     $typeName = "系统判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($old["allowanceType"])) . ");享受月份:" . $old["recommendMonths"] . ";\n";
                     $newObj["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $newObj["recommendAllowanceMsg"] . ";";
                 } else if ($obj["source"] == 2) {
+                    $detailIds = array_column($obj["details"], "id");
+                    $where = [];
+                    $where[] = ["id", "in", $detailIds];
+                    $detailList = \app\common\model\TalentAllowancecontractDetail::where($where)->select()->toArray();
                     $newObj['allowanceType'] = $obj["resAllowanceType"];
                     $newObj["recommendAllowanceType"] = $obj["resAllowanceType"];
-                    $typeName = "人工判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($newObj["recommendAllowanceType"])) . ");\n";
+                    $set = [];
+                    if ($obj["resAllowanceType"] == 1) {
+
+                        $monthsMap = [];
+                        for ($i = 0; $i < count($obj["details"]); $i++) {
+                            $monthsMap[$obj["details"][$i]["id"]] = $obj["details"][$i]["months"];
+                        }
+                        foreach ($detailList as &$detail) {
+                            $months = $monthsMap[$detail["id"]];
+                            if (\StrUtil::isNotEmpAndNull($months)) {
+                                $detail["months"] = $months;
+                                $set = array_merge($set, explode(",", $months));
+                            }
+                        }unset($detail);
+                        $set = array_filter($set);
+                        usort($set, function ($a, $b) {
+                            return (int) $a - (int) $b;
+                        });
+                        $newObj["recommendMonths"] = implode(",", $set);
+                        $typeName = "人工判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($newObj["recommendAllowanceType"])) . ");享受月份:" . $newObj["recommendMonths"] . ";\n";
+                    }else{
+                        $typeName = "人工判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($newObj["recommendAllowanceType"])) . ");\n";
+                    }
                     $newObj["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $obj["resAllowanceMsg"] . ";";
+                    $arrangeList = $this->calculateAllowance($newObj, $set, $detailList);
+                    $taaModel = new TalentAllowanceArrange();
+                    $taaModel->saveAll($arrangeList);
                 }
 
                 $newObj["otherEnjoyedMoney"] = $obj["otherEnjoyedMoney"];

+ 26 - 1
public/static/modular/talentAllowance/talentAllowanceInfo_info.js

@@ -864,6 +864,31 @@ TalentAllowanceInfoDlg.checkSubmit = function (index) {
     if (Feng.isNotEmptyStr(companyCodes)) {
         companyCodes = companyCodes.substring(0, companyCodes.length - 1);
     }
+    var details = new Array();
+    $(".detailMonths").each(function () {
+        var id = $(this).find(".detailId").val();
+        var months = $(this).find(".months").val();
+        details.push({"id": id, "months": months});
+    });
+    var source = $("#source").val();
+    var resAllowanceType = $("#resAllowanceType").val();
+    var resAllowanceMsg = $("#resAllowanceMsg").val();
+
+    if (source == 2) {
+        if (Feng.isEmptyStr(resAllowanceType)) {
+            Feng.info("请选择津补贴类型");
+            return;
+        }
+        if (resAllowanceType == 1 && details.length == 0) {
+            Feng.info("请选择工作津贴可享受的月份");
+            return;
+        }
+        if (Feng.isEmptyStr(resAllowanceMsg)) {
+            Feng.info("请填写判定说明");
+            return;
+        }
+    }
+
     var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/check", function (data) {
         if (data.code == 200) {
             layer.close(index);
@@ -874,7 +899,7 @@ TalentAllowanceInfoDlg.checkSubmit = function (index) {
     }, function (data) {
         Feng.error("提交审核失败!" + data.responseJSON.message + "!");
     });
-    ajax.setData({"id": id, "checkState": checkState, "checkMsg": checkMsg, "process": $("#process").val(), "projects": projects, "files": files, "concats": concats, "fields": fields, "companyId": $("#companyId").val(), "toProcess": $("#toProcess").val(), "toDep": companyCodes, otherEnjoyedMoney: otherEnjoyedMoney, otherEnjoyedDescription: otherEnjoyedDescription, source: $("#source").val(), resAllowanceType: $("#resAllowanceType").val(), resAllowanceMsg: $("#resAllowanceMsg").val()});
+    ajax.setData({"id": id, "checkState": checkState, "checkMsg": checkMsg, "process": $("#process").val(), "projects": projects, "files": files, "concats": concats, "fields": fields, "companyId": $("#companyId").val(), "toProcess": $("#toProcess").val(), "toDep": companyCodes, otherEnjoyedMoney: otherEnjoyedMoney, otherEnjoyedDescription: otherEnjoyedDescription, source: source, resAllowanceType: resAllowanceType, resAllowanceMsg: resAllowanceMsg, "details": details});
     ajax.start();
 }