Эх сурвалжийг харах

津补贴企业端审核端导出

sugangqiang 1 жил өмнө
parent
commit
ec93bf96ef

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

@@ -14,6 +14,7 @@ use app\common\model\TalentAllowanceArrange;
 use app\common\state\ProjectState;
 use app\common\state\AllowanceStateEnum;
 use app\common\state\AllowanceProjectEnum;
+use app\common\state\AllowanceTypeEnum;
 use app\common\model\AmountStandard as AsModel;
 
 /**
@@ -947,23 +948,139 @@ class TalentAllowance extends AdminController {
         $obj["identifyCondition"] = \StrUtil::getRequestDecodeParam($this->request, "identifyCondition");
         $obj["isSupple"] = \StrUtil::getRequestDecodeParam($this->request, "isSupple");
         $obj["checkState"] = \StrUtil::getRequestDecodeParam($this->request, "checkState");
+        $obj["publicState"] = \StrUtil::getRequestDecodeParam($this->request, "publicState");
         $obj["companyName"] = \StrUtil::getRequestDecodeParam($this->request, "companyName");
         $obj["introductionMode"] = \StrUtil::getRequestDecodeParam($this->request, "introductionMode");
         $obj["firstJJStartTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJStartTime");
         $obj["firstJJEndTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJEndTime");
         $obj["process"] = intval(\StrUtil::getRequestDecodeParam($this->request, "process"));
         $obj["type"] = $this->user["type"];
-        $list = [];
+        $where = [];
+        $where[] = ["ta.type", "=", $this->user["type"]];
+        $this->setTalentAllowanceInfoForExport($where, $obj, $obj["process"]);
         switch ($obj["process"]) {
             case 1:
+                $where[] = ["ta.checkState", "in", [1, 5, 10, 13, 15, 20, 25, 30]];
                 break;
             case 2:
+                $where[] = ["ta.firstPassTime", "EXP", Db::raw("is not null")];
                 break;
             case 3:
+                $where[] = ["ta.visitPassTime", "EXP", Db::raw("is not null")];
                 break;
             case 4:
+                if ($obj["publicState"]) {
+                    $where[] = ["publicState", "=", $param["publicState"]];
+                }
+                $where[] = ["ta.checkState", "in", [-1, 30]];
                 break;
         }
+        $projects = [
+            AllowanceProjectEnum::PROJECT_TAX,
+            AllowanceProjectEnum::PROJECT_WAGES,
+            AllowanceProjectEnum::PROJECT_ATTENDANCE,
+            AllowanceProjectEnum::PROJECT_SB_PENSION,
+            AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
+            AllowanceProjectEnum::PROJECT_SB_MEDICA,
+        ];
+        $months = [];
+        for ($m = 1; $m <= 12; $m++) {
+            $months[] = $m . "月";
+        }
+        $columns = [["年度", [1, 2]], ["所属镇街", [1, 2]], ["姓名", [1, 2]], ["性别", [1, 2]], ["证件号码", [1, 2]], ["人才层次", [1, 2]], ["认定条件", [1, 2]], ["认定条件取得时间", [1, 2]], ["认定条件名称", [1, 2]], ["公布入选月份", [1, 2]], ["津补贴类型", [1, 2]], ["兑现月份", [1, 2]], ["兑现金额", [1, 2]], ["金额说明", [1, 2]], ["审核状态", [1, 2]], ["缴纳单位", [1, 2]]];
+        $infoCols = count($columns);
+        for ($i = 0; $i < count($projects); $i++) {
+            $columns[] = [AllowanceProjectEnum::getProjectName($projects[$i]), $months];
+        }
+        $list = \app\common\model\TalentAllowanceProject::alias("pro")
+                        ->field("ta.id,ta.year,ta.enterpriseId as curEnterpriseId,ta.address,ta.name,ta.sex,ta.idCard,ta.talentArrange,ta.identifyCondition,ta.identifyGetTime,ta.identifyConditionName,ta.identifyMonth,ta.allowanceType,ta.months,ta.money,ta.moneyDesc,ta.checkState,ta.publicState,pro.project,pro.months as pre_months,con.enterpriseId,con.startTime,con.endTime,con.entryTime,con.quitTime,con.isQuit")
+                        ->leftJoin("un_talent_allowance_info ta", "ta.id=pro.mainId")
+                        ->leftJoin("un_talent_allowancecontract_detail con", "pro.baseId=con.id")
+                        ->where($where)
+                        ->order("ta.year desc,ta.createTime desc,pro.project asc")
+                        ->select()->toArray();
+        $tmpList = [];
+
+        $levelMap = DictApi::selectByParentCode("talent_arrange");
+        $streetMap = DictApi::selectByParentCode("street");
+        $where = [];
+        $where[] = ["id", "in", array_column($list, "identifyCondition")];
+        $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
+
+        $where = [];
+        $where[] = ["id", "in", array_column($list, "enterpriseId")];
+        $enterpriseMap = \app\common\model\Enterprise::where($where)->column("name", "id");
+        foreach ($list as $item) {
+            //组装数据
+            if (!$tmpList[$item["id"]]) {
+                $tmpList[$item["id"]]["curEnterpriseId"] = $item["curEnterpriseId"];
+                $tmpList[$item["id"]]["info"] = [$item["year"], $streetMap[$item["address"]], $item["name"], $item["sex"] == 1 ? "男" : "女", $item["idCard"], $levelMap[$item["talentArrange"]],
+                    $icmap[$item["identifyCondition"]], $item["identifyGetTime"], $item["identifyConditionName"], $item["identifyMonth"], AllowanceTypeEnum::getTypeName($item["allowanceType"]), $item["months"], $item["money"],
+                    $item["moneyDesc"], $this->getCheckStateName($item["checkState"], $item["publicState"], $item["allowanceType"])];
+            }
+            if (!$tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]) {
+                $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]] = [
+                    "startTime" => $item["startTime"],
+                    "endTime" => $item["endTime"],
+                    "entryTime" => $item["entryTime"],
+                    "isQuit" => $item["isQuit"]
+                ];
+            }
+            $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]["projects"][$item["project"]] = $item["pre_months"];
+        }
+        $rows = [];
+        $colorset = [];
+        foreach ($tmpList as $id => $item) {
+            foreach ($item["enterprise"] as $enterpriseId => $enterprise) {
+                $row = $item["info"];
+                $row[] = $this->user["uid"] == $enterpriseId ? "本单位" : $enterpriseMap[$enterpriseId];
+                for ($i = 0; $i < count($projects); $i++) {
+                    if (strpos($enterprise["projects"][$projects[$i]], "=") === false) {
+                        $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
+                        for ($m = 1; $m <= 12; $m++) {
+                            $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
+                            if (in_array($_month, $months)) {
+                                $row[] = "✔";
+                                $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
+                            } else {
+                                $row[] = "";
+                            }
+                        }
+                    } else {
+                        $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
+                        $_months = [];
+                        foreach ($months as $month) {
+                            $kv = explode("=", $month);
+                            $_months[$kv[0]] = $kv[1];
+                        }
+                        for ($m = 1; $m <= 12; $m++) {
+                            $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
+                            $days = $_months[$_month];
+                            if ($days && $days > 0) {
+                                $row[] = $days . "天";
+                                $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
+                            } else {
+                                $row[] = "";
+                            }
+                        }
+                    }
+                }
+                $rows[] = $row;
+            }
+        }
+        $cols = $infoCols + count($projects) * 12 - 1;
+        $settings = [
+            "width" => [["A", 8], ["C", 12], ["D", 6], ["E", 20], ["F", 12], ["G", 70], ["H", 12], ["I", 15], ["J", 12], ["K", 12], ["P", 30]],
+            "height" => [18],
+            "freeze" => "D3",
+            "color" => $colorset
+        ];
+        for ($i = 0; $i < count($projects) * 12; $i++) {
+            $settings["width"][] = [getExcelColumnByIndex($infoCols + $i), 6]; //批设置项目的宽度
+        }
+        $settings["background-color"][] = [sprintf("%s2:%s2", getExcelColumnByIndex($infoCols), getExcelColumnByIndex($cols)), "E1F1DE"];
+        export($columns, $rows, "津补贴申报名单", $settings);
+        
     }
 
     private function validateAllowanceType(&$info) {
@@ -1668,6 +1785,141 @@ class TalentAllowance extends AdminController {
         }
         return $where;
     }
+    
+    private function setTalentAllowanceInfoForExport($where, $query, $process) {
+        if (\StrUtil::isNotEmpAndNull($query["year"])) {
+            $where[] = ["ta.year", "=", $query["year"]];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["enterpriseName"])) {
+            $where[] = ["ta.enterpriseName", "like", "%" . $query["enterpriseName"] . "%"];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["name"])) {
+            $where[] = ["ta.name", "like", "%" . $query["name"] . "%"];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["talentType"])) {
+            $where[] = ["ta.talentType", "=", $query["talentType"]];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["talentArrange"])) {
+            $where[] = ["ta.talentArrange", "=", $query["talentArrange"]];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["identifyCondition"])) {
+            $where[] = ["ta.identifyCondition", "=", $query["identifyCondition"]];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["address"])) {
+            $where[] = ["ta.address", "=", $query["address"]];
+        }
+        if ($query["recommendAllowanceType"]) {
+            $where[] = ["ta.recommendAllowanceType", "=", $query["recommendAllowanceType"]];
+        }
+        if ($query["publicState"]) {
+            $where[] = ["ta.publicState", "=", $query["publicState"]];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["introductionMode"])) {
+            $where[] = ["ta.introductionMode", "=", $query["introductionMode"]];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["firstJJStartTime"])) {
+            $where[] = ["ta.firstInJJTime", ">=", $query["firstJJStartTime"]];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["firstJJEndTime"])) {
+            $where[] = ["ta.firstInJJTime", "<=", $query["firstJJEndTime"]];
+        }
+        if ($process == 4) {
+            if ($query["isSupple"]) {
+                $where[] = ["ta.isSupple", "=", $query["isSupple"]];
+            }
+            if ($query["isPublicCheck"]) {
+                $where[] = ["ta.isPublicCheck", "=", $query["isPublicCheck"]];
+            }
+        }
+        if ($query["checkState"]) {
+            if ($query["checkState"] == -1) {
+                $where[] = ["ta.checkState", "=", $query["checkState"]];
+            } else {
+                if ($process == 1) {
+                    switch ($query["checkState"]) {
+                        case 0:     //保存未提交
+                            $where[] = ["ta.checkState", "=", 1];
+                            break;
+                        case 1:
+                            $where[] = ["ta.checkState", "=", 5];
+                            break;
+                        case 2:     //驳回
+                            $where[] = ["ta.checkState", "=", 10];
+                            break;
+                        case 3:     //通过
+                            $where[] = ["ta.checkState", "in", [15, 20, 30, 25]];
+                            break;
+                        case 4:     //重新提交
+                            $where[] = ["ta.checkState", "=", 5];
+                            $where[] = ["ta.highProcess", ">=", $process];
+                            break;
+                        case 5:     //上级驳回
+                            $where[] = ["ta.checkState", "=", 13];
+                            break;
+                    }
+                }
+                if ($process == 2) {
+                    switch ($query["checkState"]) {
+                        case 1:
+                            $where[] = ["ta.checkState", "=", 15];
+                            break;
+                        case 2:     //驳回
+                            $where[] = ["ta.checkState", "in", [1, 5, 10]];
+                            $where[] = ["ta.highProcess", ">=", $process];
+                            break;
+                        case 3:     //通过                            
+                            $where[] = ["ta.checkState", "in", [20, 30]];
+                            break;
+                        case 9:   //重新提交                            
+                            $where[] = ["ta.checkState", "=", 15];
+                            $where[] = ["ta.highProcess", ">=", $process];
+                            break;
+                        case 4:     //上级驳回                            
+                            $where[] = ["ta.checkState", "=", 25];
+                            break;
+                        case -1:
+                            $where[] = ["ta.checkState", "=", -1];
+                            break;
+                    }
+                }
+                if ($process == 3) {
+                    switch ($query["checkState"]) {
+                        case -1:
+                            $where[] = ["ta.checkState", "=", -1];
+                            break;
+                        case 1:
+                            $where[] = ["ta.checkState", "=", 20];
+                            break;
+                        case 2:     //驳回 
+                            $where[] = ["ta.checkState", "in", [1, 5, 10, 15, 25]];
+                            $where[] = ["ta.highProcess", ">=", $process];
+                            break;
+                        case 3:     //通过 
+                            $where[] = ["ta.checkState", "=", 30];
+                            break;
+                        case 9:     //重新提交 
+                            $where[] = ["ta.checkState", "=", 20];
+                            $where[] = ["ta.highProcess", ">=", $process];
+                            break;
+                        case 4:     //上级驳回 
+                            $where[] = ["ta.checkState", "=", 35];
+                            break;
+                    }
+                }
+                if ($process == 4) {
+                    switch ($query["checkState"]) {
+                        case -1:
+                            $where[] = ["ta.checkState", "=", -1];
+                            break;
+                        case 3:     //通过 
+                            $where[] = ["ta.checkState", "=", 30];
+                            break;
+                    }
+                }
+            }
+        }
+        return $where;
+    }
 
     private function translateToChinese(&$obj) {
         if (\StrUtil::isNotEmpAndNull($obj["address"])) {
@@ -1720,5 +1972,42 @@ class TalentAllowance extends AdminController {
         }unset($info);
         return $list;
     }
+    
+    private function getCheckStateName($checkState, $publicState, $allowanceType) {
+        switch ($checkState) {
+            case 1:
+                return "待提交";
+            case 5:
+            case 13:
+            case 15:
+            case 20:
+            case 25:
+            case 35:
+                return "审核中";
+            case 10:
+                return "已驳回";
+            case - 1:
+                if ($publicState >= 3) {
+                    return "审核不通过";
+                } else {
+                    return "审核中";
+                }
+                break;
+            case 30:
+                if ($publicState == 1) {
+                    return "待核查征信";
+                } else if ($publicState == 2) {
+                    return "待公示";
+                } else if ($publicState == 3) {
+                    return "公示中";
+                } else if ($publicState == 4) {
+                    return $allowanceType != 3 ? "待兑现" : "不予兑现";
+                } else if ($publicState == 5) {
+                    return "已兑现";
+                }
+            default:
+                return "未知状态";
+        }
+    }
 
 }

+ 4 - 4
app/admin/view/talent_allowance/index.html

@@ -301,12 +301,12 @@
                                 <i class="fa fa-edit"></i>&nbsp;修改驳回字段
                             </button>
                             {/if}
-                            <!--{if condition="chkCommission('/admin/talentAllowance/firstExport','/talentAllowance/firstExport')"}
+                            {if condition="chkCommission('/admin/talentAllowance/firstExport','/talentAllowance/firstExport')"}
                             <button type="button" class="btn btn-sm btn-primary " onclick="TalentAllowanceInfo.exportBasicInfo()" id="">
                                 <i class="fa fa-file-excel-o"></i>&nbsp;导出基础信息
                             </button>
                             {/if}
-                            {if condition="chkCommission('/admin/talentAllowance/firstExportProjectData','/talentAllowance/firstExportProjectData')"}
+                            <!--{if condition="chkCommission('/admin/talentAllowance/firstExportProjectData','/talentAllowance/firstExportProjectData')"}
                             <button type="button" class="btn btn-sm btn-primary " onclick="TalentAllowanceInfo.showDataModal(4)" id="">
                                 <i class="fa fa-file-excel-o"></i>&nbsp;导出项目核查结果
                             </button>
@@ -365,12 +365,12 @@
                                 <i class="fa fa-reply"></i>&nbsp;撤销审核
                             </button>
                             {/if}
-                            <!--{if condition="chkCommission('/admin/talentAllowance/reviewExport','/talentAllowance/reviewExport')"}
+                            {if condition="chkCommission('/admin/talentAllowance/reviewExport','/talentAllowance/reviewExport')"}
                             <button type="button" class="btn btn-sm btn-primary " onclick="TalentAllowanceInfo.exportBasicInfo()" id="">
                                 <i class="fa fa-file-excel-o"></i>&nbsp;导出基础信息
                             </button>
                             {/if}
-                            {if condition="chkCommission('/admin/talentAllowance/reviewExportProjectData','/talentAllowance/reviewExportProjectData')"}
+                            <!--{if condition="chkCommission('/admin/talentAllowance/reviewExportProjectData','/talentAllowance/reviewExportProjectData')"}
                             <button type="button" class="btn btn-sm btn-primary " onclick="TalentAllowanceInfo.showDataModal(8)" id="">
                                 <i class="fa fa-file-excel-o"></i>&nbsp;导出项目核查结果
                             </button>

+ 6 - 6
app/common.php

@@ -121,7 +121,7 @@ function export($columns, $rows, $filename = "jjrcw", $settings = [], $sheetname
 
                 $colCount += $columns[$i][1][0];
             } else {
-                $rowStartLine = $rowStartLine > 2 ? $rowStartLine : 2;
+                $rowStartLine = $rowStartLine > 3 ? $rowStartLine : 3;
                 $child_titles = $columns[$i][1];
                 $child_count = count($child_titles);
                 $objPHPExcel->mergeCells(sprintf("%s:%s", getExcelColumnByIndex($colCount) . $titleStartLine, getExcelColumnByIndex($colCount + $child_count - 1) . $titleStartLine));
@@ -154,7 +154,7 @@ function export($columns, $rows, $filename = "jjrcw", $settings = [], $sheetname
     $objPHPExcel->getDefaultColumnDimension()->setWidth(16); //默认列宽
     $objPHPExcel->getDefaultRowDimension()->setRowHeight(30); //默认列高
     //样式设置
-    $defaultSetting = getCommonExcelSetting($colCount, $rowCount);
+    $defaultSetting = getCommonExcelSetting($colCount, $rowStartLine + $rowCount - 1);
     foreach ($formatString as $fs) {
         $columnName = getExcelColumnByIndex($fs);
         $defaultSetting["format"][] = ["string", sprintf("%s%d:%s%d", $columnName, 2, $columnName, count($rows) + 1)];
@@ -184,7 +184,7 @@ function export($columns, $rows, $filename = "jjrcw", $settings = [], $sheetname
                     if (is_array($cfg[$i])) {
                         $objPHPExcel->getRowDimension($cfg[$i][0])->setRowHeight($cfg[$i][1]);
                     } else if (is_numeric($cfg[$i])) {
-                        for ($n = 1; $n <= ($colCount + $rowCount); $n++) {
+                        for ($n = 1; $n <= ($rowStartLine + $rowCount - 1); $n++) {
                             $objPHPExcel->getRowDimension($n)->setRowHeight($cfg[$i]);
                         }
                     }
@@ -326,9 +326,9 @@ function getCommonExcelSetting($columns, $rows) {
     return $settings = [
         "background-color" => [[sprintf("A1:%s1", getExcelColumnByIndex($columns - 1)), "0066CC"]],
         "color" => [[sprintf("A1:%s1", getExcelColumnByIndex($columns - 1)), "FFFFFF"]],
-        "border" => sprintf("A1:%s%d", getExcelColumnByIndex($columns - 1), $rows + 1),
-        "wrap" => [sprintf("A2:%s%d", getExcelColumnByIndex($columns - 1), $rows + 1)],
-        "align" => [[sprintf("A1:%s%d", getExcelColumnByIndex($columns - 1), $rows + 1), "hCenter"], [sprintf("A1:%s%d", getExcelColumnByIndex($columns - 1), $rows + 1), "vCenter"]]
+        "border" => sprintf("A1:%s%d", getExcelColumnByIndex($columns - 1), $rows),
+        "wrap" => [sprintf("A2:%s%d", getExcelColumnByIndex($columns - 1), $rows)],
+        "align" => [[sprintf("A1:%s%d", getExcelColumnByIndex($columns - 1), $rows), "hCenter"], [sprintf("A1:%s%d", getExcelColumnByIndex($columns - 1), $rows), "vCenter"]]
     ];
 }
 

+ 110 - 10
app/enterprise/controller/TalentAllowance.php

@@ -22,6 +22,7 @@ use think\facade\Db;
 use app\common\api\Response;
 use app\common\api\UploadApi;
 use app\enterprise\model\TalentTypeChange;
+use app\common\state\AllowanceTypeEnum;
 
 /**
  * Description of TalentAllowance
@@ -635,7 +636,7 @@ class TalentAllowance extends EnterpriseController {
         $where[] = ["project", "=", AllowanceProjectEnum::PROJECT_ATTENDANCE];
         $where[] = ["mainId", "=", $data["id"]];
         $attendanceList = \app\common\model\TalentAllowanceProject::where($where)->select()->toArray();
-        if ($old["allowanceType"] == \app\common\state\AllowanceTypeEnum::JBT_JT) {
+        if ($old["allowanceType"] == AllowanceTypeEnum::JBT_JT) {
             //因为天数保存格式为 月份=天数 如 01=31,02=20,03=15,月份保存格式为01,02,03,所以可以从有没有=号判断是否有进行考勤的修改保存操作
             foreach ($attendanceList as $a) {
                 //$a["months"]有值但是没有包含=号则一般可认为是类型修改为交通补贴而未修改考勤,此时的months字段数据是错误的,修改为空。
@@ -894,31 +895,130 @@ class TalentAllowance extends EnterpriseController {
             $columns[] = [AllowanceProjectEnum::getProjectName($projects[$i]), $months];
         }
         $list = \app\common\model\TalentAllowanceProject::alias("pro")
-                        ->field("ta.id,ta.year,ta.enterpriseId as curEnterpriseId,ta.address,ta.name,ta.sex,ta.idCard,ta.talentArrange,ta.identifyCondition,ta.identifyConditionName,ta.identifyMonth,ta.allowanceType,ta.months,ta.money,ta.moneyDesc,ta.checkState,pro.months as pre_months,con.enterpriseId,con.startTime,con.endTime,con.entryTime,con.quitTime,con.isQuit")
+                        ->field("ta.id,ta.year,ta.enterpriseId as curEnterpriseId,ta.address,ta.name,ta.sex,ta.idCard,ta.talentArrange,ta.identifyCondition,ta.identifyGetTime,ta.identifyConditionName,ta.identifyMonth,ta.allowanceType,ta.months,ta.money,ta.moneyDesc,ta.checkState,ta.publicState,pro.project,pro.months as pre_months,con.enterpriseId,con.startTime,con.endTime,con.entryTime,con.quitTime,con.isQuit")
                         ->leftJoin("un_talent_allowance_info ta", "ta.id=pro.mainId")
                         ->leftJoin("un_talent_allowancecontract_detail con", "pro.baseId=con.id")
                         ->where($where)
                         ->order("ta.year desc,ta.createTime desc,pro.project asc")
                         ->select()->toArray();
         $tmpList = [];
+
+        $levelMap = DictApi::selectByParentCode("talent_arrange");
+        $streetMap = DictApi::selectByParentCode("street");
+        $where = [];
+        $where[] = ["id", "in", array_column($list, "identifyCondition")];
+        $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
+
+        $where = [];
+        $where[] = ["id", "in", array_column($list, "enterpriseId")];
+        $enterpriseMap = \app\common\model\Enterprise::where($where)->column("name", "id");
         foreach ($list as $item) {
-            
+            //组装数据
+            if (!$tmpList[$item["id"]]) {
+                $tmpList[$item["id"]]["curEnterpriseId"] = $item["curEnterpriseId"];
+                $tmpList[$item["id"]]["info"] = [$item["year"], $streetMap[$item["address"]], $item["name"], $item["sex"] == 1 ? "男" : "女", $item["idCard"], $levelMap[$item["talentArrange"]],
+                    $icmap[$item["identifyCondition"]], $item["identifyGetTime"], $item["identifyConditionName"], $item["identifyMonth"], AllowanceTypeEnum::getTypeName($item["allowanceType"]), $item["months"], $item["money"],
+                    $item["moneyDesc"], $this->getCheckStateName($item["checkState"], $item["publicState"], $item["allowanceType"])];
+            }
+            if (!$tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]) {
+                $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]] = [
+                    "startTime" => $item["startTime"],
+                    "endTime" => $item["endTime"],
+                    "entryTime" => $item["entryTime"],
+                    "isQuit" => $item["isQuit"]
+                ];
+            }
+            $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]["projects"][$item["project"]] = $item["pre_months"];
+        }
+        $rows = [];
+        $colorset = [];
+        foreach ($tmpList as $id => $item) {
+            foreach ($item["enterprise"] as $enterpriseId => $enterprise) {
+                $row = $item["info"];
+                $row[] = $this->user["uid"] == $enterpriseId ? "本单位" : $enterpriseMap[$enterpriseId];
+                for ($i = 0; $i < count($projects); $i++) {
+                    if (strpos($enterprise["projects"][$projects[$i]], "=") === false) {
+                        $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
+                        for ($m = 1; $m <= 12; $m++) {
+                            $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
+                            if (in_array($_month, $months)) {
+                                $row[] = "✔";
+                                $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
+                            } else {
+                                $row[] = "";
+                            }
+                        }
+                    } else {
+                        $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
+                        $_months = [];
+                        foreach ($months as $month) {
+                            $kv = explode("=", $month);
+                            $_months[$kv[0]] = $kv[1];
+                        }
+                        for ($m = 1; $m <= 12; $m++) {
+                            $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
+                            $days = $_months[$_month];
+                            if ($days && $days > 0) {
+                                $row[] = $days . "天";
+                                $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
+                            } else {
+                                $row[] = "";
+                            }
+                        }
+                    }
+                }
+                $rows[] = $row;
+            }
         }
         $cols = $infoCols + count($projects) * 12 - 1;
         $settings = [
-            "background-color" => [[sprintf("A1:%s1", getExcelColumnByIndex($cols)), "0066CC"]],
-            "color" => [[sprintf("A1:%s1", getExcelColumnByIndex($cols)), "FFFFFF"]],
-            "border" => sprintf("A1:%s%d", getExcelColumnByIndex($cols), 2),
-            "wrap" => [sprintf("A2:%s%d", getExcelColumnByIndex($cols), 2)],
-            "align" => [[sprintf("A1:%s%d", getExcelColumnByIndex($cols), 2), "hCenter"], [sprintf("A1:%s%d", getExcelColumnByIndex($cols - 1), 2), "vCenter"]],
+            "width" => [["A", 8], ["C", 12], ["D", 6], ["E", 20], ["F", 12], ["G", 70], ["H", 12], ["I", 15], ["J", 12], ["K", 12], ["P", 30]],
             "height" => [18],
-            "freeze" => "D1"
+            "freeze" => "D3",
+            "color" => $colorset
         ];
         for ($i = 0; $i < count($projects) * 12; $i++) {
             $settings["width"][] = [getExcelColumnByIndex($infoCols + $i), 6]; //批设置项目的宽度
         }
         $settings["background-color"][] = [sprintf("%s2:%s2", getExcelColumnByIndex($infoCols), getExcelColumnByIndex($cols)), "E1F1DE"];
-        export($columns, [], "津补贴申报名单", $settings);
+        export($columns, $rows, "津补贴申报名单", $settings);
+    }
+
+    private function getCheckStateName($checkState, $publicState, $allowanceType) {
+        switch ($checkState) {
+            case 1:
+                return "待提交";
+            case 5:
+            case 13:
+            case 15:
+            case 20:
+            case 25:
+            case 35:
+                return "审核中";
+            case 10:
+                return "已驳回";
+            case - 1:
+                if ($publicState >= 3) {
+                    return "审核不通过";
+                } else {
+                    return "审核中";
+                }
+                break;
+            case 30:
+                if ($publicState == 1) {
+                    return "待核查征信";
+                } else if ($publicState == 2) {
+                    return "待公示";
+                } else if ($publicState == 3) {
+                    return "公示中";
+                } else if ($publicState == 4) {
+                    return $allowanceType != 3 ? "待兑现" : "不予兑现";
+                } else if ($publicState == 5) {
+                    return "已兑现";
+                }
+            default:
+                return "未知状态";
+        }
     }
 
 }

+ 5 - 1
public/static/modular/gate/talentAllowance/ic/talentAllowanceInfoIC.js

@@ -74,7 +74,11 @@ TalentAllowanceInfo.initColumn = function () {
                         }
                         break;
                     case 30:
-                        if (row.publicState == 3) {
+                        if (row.publicState == 1) {
+                            html = "<span class='label label-primary'>待核查征信</span>"
+                        } else if (row.publicState == 2) {
+                            html = "<span class='label label-primary'>待公示</span>"
+                        } else if (row.publicState == 3) {
                             html = "<span class='label label-primary'>公示中</span>"
                         } else if (row.publicState == 4) {
                             html = row.allowanceType != 3 ? "<span class='label label-success'>待兑现</span>" : "<span class='label label-danger'>不予兑现</span>";