Переглянути джерело

重写合同到期人员导出名单

zmw 1 рік тому
батько
коміт
4e09088560

+ 1 - 0
app/common/api/VerifyApi.php

@@ -1036,6 +1036,7 @@ class VerifyApi {
                             ->select()->toArray();
         }
         $un_common_location = Db::table("un_common_location")->column('name', 'code');
+
         foreach ($list as $kkk => &$item) {
             if($params['select_contract'] == '1'){
                 if($item['activeName'] == '离职'){

+ 24 - 0
app/enterprise/controller/TalentBasicChange.php

@@ -358,4 +358,28 @@ class TalentBasicChange extends EnterpriseController {
         return json(["total" => $count, "rows" => $list]);
     }
 
+    public function htEndExport(){
+        $where = [];
+        $where[] = ["ti.delete", "=", 0];
+        $where[] = ["ti.active", "=", 1];
+        $where[] = ["ti.checkState", "=", TalentState::CERTIFICATED];
+        $now = date("Y-m-d",time());
+        $count = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc","ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->count();
+        if($count > 0){
+            $columns = [
+                'id',
+                '姓名',
+                '证件号码',
+                '劳动合同时间'
+            ];
+            $setting = [];
+            $setting["freeze"] = "A2";
+            $setting["filter"] = sprintf("A1:%s1", getExcelColumnByIndex(count($columns) - 1));
+            $datas = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc","ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->limit($offset, $limit)->select()->toArray();
+            export($columns, $datas, "合同到期列表导出", $setting);
+        }else{
+            echo "<script>parent.layer.alert('没有可以导出的数据');window.history.go(-1);</script>";
+        }
+
+    }
 }

+ 4 - 0
app/enterprise/view/talent_basic_change/htindex.html

@@ -33,6 +33,9 @@
                                 <button type="button" class="btn btn-sm btn-primary" onclick="TalentHetongChange.reset()">
                                     <i class="fa fa-trash"></i>&nbsp;重置
                                 </button>
+                                <button type="button" class="btn btn-sm btn-primary" onclick="TalentHetongChange.export()">
+                                    <i class="fa fa-file-excel-o"></i>&nbsp;导出
+                                </button>
                             </div>
                         </div>
                         <table id="TalentHetongChangeTable" class="table-condensed" style="font-size: 10px;table-layout: fixed!important;" data-mobile-responsive="true" data-click-to-select="true">
@@ -48,6 +51,7 @@
         </div>
     </div>
 </div>
+
 <script type="text/javascript">
     document.write('<script src="/static/modular/gate/talentLibrary/talentBasicChange/talentHetongChange.js?v=' + (new Date()).getTime() + '"><\/script>');
     document.write('<script src="/static/modular/common/config.js?v=' + (new Date()).getTime() + '"><\/script>');

+ 0 - 3
app/enterprise/view/talent_library/index.html

@@ -129,9 +129,6 @@
                             <button type="button" class="btn btn-sm btn-primary" onclick="TalentInfo.openTalentInfoDetail()">
                                 <i class="fa fa-book"></i>&nbsp;查看
                             </button>
-                            <button type="button" class="btn btn-sm btn-primary" onclick="TalentInfo.showExportModal()">
-                                <i class="fa fa-file-excel-o"></i>&nbsp;导出合同到期名单
-                            </button>
                         </div>
                         <table id="TalentInfoTable" class="table-condensed" style="font-size: 10px;table-layout: fixed!important;" data-mobile-responsive="true" data-click-to-select="true">
                             <thead>

+ 15 - 7
public/static/modular/gate/talentLibrary/talentBasicChange/talentHetongChange.js

@@ -74,6 +74,19 @@ TalentHetongChange.openAddTalentHetongChange = function (id=0) {
     layer.full(index);
 };
 
+/**
+ * 显示导出模态框
+ */
+TalentInfo.export = function () {
+    var operation = function () {
+
+        var url = "/enterprise/talent_basic_change/htEndExport";
+
+        window.location.href = url;
+    };
+    Feng.confirm("确定要导出数据吗?", operation);
+}
+
 /**
  * 打开查看人才基础信息变更详情
  */
@@ -154,13 +167,8 @@ TalentHetongChange.search = function () {
 };
 
 TalentHetongChange.reset = function () {
-    $("#oldName").val("");
-    $("#oldCardType").val("");
-    $("#oldIdCard").val("");
-    $("#newName").val("");
-    $("#newCardType").val("");
-    $("#newIdCard").val("");
-    $("#checkState").val("");
+    $("#name").val("");
+    $("#idCard").val("");
 }
 
 $(function () {