Browse Source

Merge remote-tracking branch 'origin/master'

sandm 2 years ago
parent
commit
1032ffb6d1

+ 2 - 1
app/admin/controller/FileType.php

@@ -17,7 +17,8 @@ class FileType extends AdminController {
      * @return type
      */
     function index() {
-        return view();
+        $declare_types = \app\common\api\DictApi::findChildDictByCode("declare_type");
+        return view("", ["declare_types" => $declare_types]);
     }
 
     /**

+ 84 - 3
app/admin/controller/IntegralMgr.php

@@ -4,6 +4,7 @@ namespace app\admin\controller;
 
 use app\admin\common\AdminController;
 use app\common\api\IntegralProjectApi;
+use app\common\api\IntegralItemApi;
 
 /**
  * Description of IntegralMgr
@@ -84,19 +85,99 @@ class IntegralMgr extends AdminController {
     }
 
     public function itemList() {
-        return json([]);
+        return json(IntegralItemApi::getList($this->request->param()));
     }
 
     public function addItem() {
+        if ($this->request->isPost()) {
+            $params = $this->request->param();
+            return $this->doItemSave($params);
+        }
         return view("save_item");
     }
 
     public function editItem() {
-        return view("save_item");
+        $params = $this->request->param();
+        if ($this->request->isPost()) {
+            return $this->doItemSave($params);
+        }
+        $row = IntegralItemApi::getOne($params["id"]);
+        return view("save_item", ["row" => $row]);
+    }
+
+    private function doItemSave($params) {
+        if (!$params["projectId"]) {
+            return json(["msg" => "请选择积分项目"]);
+        }
+        if (!$params["name"]) {
+            return json(["msg" => "请输入标准名称"]);
+        }
+        if (!$params["plan"]) {
+            return json(["msg" => "请选择积分方案"]);
+        }
+        if (!$params["unit"]) {
+            return json(["msg" => "请输入计量单位"]);
+        }
+        if (!$params["fstNeedAmount"]) {
+            return json(["msg" => "请输入首次达成量"]);
+        }
+        if (!$params["fstGainPoints"]) {
+            return json(["msg" => "请输入首次获得积分"]);
+        }
+        if ($params["plan"] == 2) {
+            if (!$params["stepNeedAmount"]) {
+                return json(["msg" => "请输入每新增量"]);
+            }
+            if (!$params["stepGainPoints"]) {
+                return json(["msg" => "请输入每新增获得积分"]);
+            }
+            if (!$params["maxGainPoints"]) {
+                return json(["msg" => "请输入积分上限"]);
+            }
+            if (!$params["yearly"]) {
+                return json(["msg" => "请选择累计积分方案"]);
+            }
+        }
+        if (IntegralItemApi::chkExist($params["name"], $params["projectId"], $params["id"]))
+            return json(["msg" => "名称已经被使用"]);
+        $resultStr = $params["id"] ? "编辑" : "添加";
+        if (IntegralItemApi::edit($params))
+            return json(["code" => 200, "msg" => "{$resultStr}积分标准成功"]);
+        return json(["msg" => "{$resultStr}积分标准失败"]);
     }
 
     public function deleteItem() {
-        
+        if ($this->request->isPost()) {
+            $id = $this->request->param("id");
+            if (IntegralItemApi::delete($id))
+                return json(["code" => 200, "msg" => "删除积分标准成功"]);
+            return json(["msg" => "删除积分标准失败"]);
+        }
+    }
+
+    public function getProjectsByType() {
+        $type = $this->request->param("type") ?: 0;
+        $where[] = ["type", "=", $type];
+        $where[] = ["active", "=", 1];
+        $list = IntegralProjectApi::getAll($where);
+        return json($list);
+    }
+
+    public function getFilesByType() {
+        $type = $this->request->param("type") ?: 0;
+        $where[] = ["type", "=", $type];
+        $where[] = ["project", "=", 20];
+        $where[] = ["active", "=", 1];
+        $list = \app\common\api\FileTypeApi::getAll($where);
+        return json($list);
+    }
+
+    public function getItemsByProject() {
+        $projectId = $this->request->param("projectId") ?: 0;
+        $where[] = ["projectId", "=", $projectId];
+        $where[] = ["active", "=", 1];
+        $list = IntegralItemApi::getAll($where);
+        return json($list);
     }
 
 }

+ 20 - 16
app/admin/view/dict/edit.html

@@ -73,22 +73,26 @@
 </div>
 <script type="text/template" id="itemTemplate">
     <div class="form-group" name="dictItem" id="dictItem">
-    <label class="col-sm-1 control-label">值</label>
-    <div class="col-sm-2">
-    <input class="form-control" type="text" name="itemCode">
-    </div>
-    <label class="col-sm-1 control-label" >名称</label>
-    <div class="col-sm-2">
-    <input class="form-control" type="text" name="itemName">
-    </div>
-    <label class="col-sm-1 control-label" >序号</label>
-    <div class="col-sm-2">
-    <input class="form-control" type="text" name="itemNum">
-    </div>
-    <div class="col-sm-2">
-    <#button btnCss="danger" name="删除" id="cancel" icon="fa-remove" clickFun="DictInfoDlg.deleteItem(event)"/>
-    </div>
-    </div>
+            <label class="col-sm-1 control-label">值</label>
+            <div class="col-sm-2">
+                <input class="form-control" type="text" name="itemCode">
+            </div>
+            <label class="col-sm-1 control-label" >名称</label>
+            <div class="col-sm-2">
+                <input class="form-control" type="text" name="itemName">
+            </div>
+            <label class="col-sm-1 control-label" >序号</label>
+            <div class="col-sm-2">
+                <input class="form-control" type="text" name="itemNum">
+            </div>
+            <div class="col-sm-2">
+
+<button type="button" class="btn btn-sm btn-danger " onclick="DictInfoDlg.deleteItem(event)" id="cancel">
+    <i class="fa fa-remove"></i>&nbsp;删除
+</button>
+
+            </div>
+        </div>
 </script>
 
 <script src="/static/modular/system/dict/dict_info.js"></script>

+ 4 - 4
app/admin/view/file_type/add.html

@@ -13,13 +13,13 @@
                                     申报优秀人才类别
                                 </button>
                             </div>
-                            <select class="form-control" id="type" name="type" selectVal="{$info.type}">
+                            <select class="form-control" id="type" name="type" selectVal="{$info.type}" onchange="UnCommonFiletypeInfoDlg.typeChange();">
                                 <option value="">---请选择---</option>
                                 <option value="1">晋江市现代产业体系人才</option>
                                 <option value="2">集成电路优秀人才</option>
                             </select>
                         </div>
-                        <div class="input-group input-group-sm">
+                        <div class="input-group input-group-sm project1" style="display:none;">
                             <div class="input-group-btn">
                                 <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
                                     申报阶段
@@ -67,14 +67,14 @@
                                     申报项目
                                 </button>
                             </div>
-                            <select class="form-control" id="project" name="project" selectVal="{$info.project}" onchange="UnCommonFiletypeInfoDlg.typeChange(this)">
+                            <select class="form-control" id="project" name="project" selectVal="{$info.project}" onchange="UnCommonFiletypeInfoDlg.projectChange()">
                                 <option value="">---请选择---</option>
                                 {volist name="declare_types" id="item"}
                                 <option value="{$item.code}">{$item.name}</option>
                                 {/volist}
                             </select>
                         </div>
-                        <div class="input-group input-group-sm">
+                        <div class="input-group input-group-sm project1" style="display:none;">
                             <div class="input-group-btn">
                                 <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
                                     是否为认定条件

+ 4 - 4
app/admin/view/file_type/edit.html

@@ -13,13 +13,13 @@
                                     申报优秀人才类别
                                 </button>
                             </div>
-                            <select class="form-control" id="type" name="type" selectVal="{$info.type}">
+                            <select class="form-control" id="type" name="type" selectVal="{$info.type}" onchange="UnCommonFiletypeInfoDlg.typeChange();">
                                 <option value="">---请选择---</option>
                                 <option value="1">晋江市现代产业体系人才</option>
                                 <option value="2">集成电路优秀人才</option>
                             </select>
                         </div>
-                        <div class="input-group input-group-sm">
+                        <div class="input-group input-group-sm project1" style="display:none;">
                             <div class="input-group-btn">
                                 <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
                                     申报阶段
@@ -73,14 +73,14 @@
                                     申报项目
                                 </button>
                             </div>
-                            <select class="form-control" id="project" name="project" selectVal="{$info.project}" onchange="UnCommonFiletypeInfoDlg.typeChange(this)">
+                            <select class="form-control" id="project" name="project" selectVal="{$info.project}" onchange="UnCommonFiletypeInfoDlg.projectChange()">
                                 <option value="">---请选择---</option>
                                 {volist name="declare_types" id="item"}
                                 <option value="{$item.code}">{$item.name}</option>
                                 {/volist}
                             </select>
                         </div>
-                        <div class="input-group input-group-sm">
+                        <div class="input-group input-group-sm project1" style="display:none;">
                             <div class="input-group-btn">
                                 <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
                                     是否为认定条件

+ 112 - 16
app/admin/view/integral_mgr/items.html

@@ -1,16 +1,112 @@
-<!DOCTYPE html>
-<!--
-To change this license header, choose License Headers in Project Properties.
-To change this template file, choose Tools | Templates
-and open the template in the editor.
--->
-<html>
-    <head>
-        <title>TODO supply a title</title>
-        <meta charset="UTF-8">
-        <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    </head>
-    <body>
-        <div>TODO write content</div>
-    </body>
-</html>
+{extend name="layout/content"}
+{block name="content"}
+<div class="row">
+    <div class="col-sm-12">
+        <div class="ibox float-e-margins">
+            <div class="ibox-title">
+                <h5>积分标准管理</h5>
+            </div>
+            <div class="ibox-content">
+                <div class="row row-lg">
+                    <div class="col-sm-12">
+                        <div class="row">
+                            <input type="hidden" id="userType" value="${user.type}">
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
+                                            人才类别
+                                        </button>
+                                    </div>
+                                    <select class="form-control" id="type">
+                                        <option value=""></option>
+                                        <option value="1">晋江市现代产业体系人才</option>
+                                        <option value="2">集成电路优秀人才</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">项目名称
+                                        </button>
+                                    </div>
+                                    <input type="text" class="form-control" id="name" placeholder="">
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
+                                            项目类别
+                                        </button>
+                                    </div>
+                                    <select class="form-control" id="projectType">
+                                        <option value=""></option>
+                                        <option value="1">基础分</option>
+                                        <option value="2">贡献分</option>
+                                        <option value="3">资历分</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
+                                            启用状态
+                                        </button>
+                                    </div>
+                                    <select class="form-control" id="active">
+                                        <option value=""></option>
+                                        <option value="1">启用</option>
+                                        <option value="2">停用</option>
+
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <button type="button" class="btn btn-sm btn-primary " onclick="IntegralMgr.search()">
+                                    <i class="fa fa-search"></i>&nbsp;搜索
+                                </button>
+                                <button type="button" class="btn btn-sm btn-primary " onclick="IntegralMgr.reset()">
+                                    <i class="fa fa-trash"></i>&nbsp;重置
+                                </button>
+
+                            </div>
+                        </div>
+                        <div class="hidden-xs" id="IntegralMgrTableToolbar" role="group">
+                            {if condition="chkCommission('/admin/integral_mgr/add','')"}
+                                <button type="button" class="btn btn-sm btn-primary " onclick="IntegralMgr.openAddIntegralProject()">
+                                    <i class="fa fa-plus"></i>&nbsp;添加
+                                </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/integral_mgr/edit','')"}
+                                <button type="button" class="btn btn-sm btn-primary " onclick="IntegralMgr.openEditIntegralProject()">
+                                    <i class="fa fa-edit"></i>&nbsp;修改
+                                </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/integral_mgr/delete','')"}
+                                <button type="button" class="btn btn-sm btn-primary " onclick="IntegralMgr.delete()">
+                                    <i class="fa fa-remove"></i>&nbsp;删除
+                                </button>
+                            {/if}
+                        </div>
+                        <table id="IntegralMgrTable" class="table-condensed" style="font-size: 10px;table-layout: fixed!important;" data-mobile-responsive="true" data-click-to-select="true">
+                            <thead>
+                                <tr>
+                                    <th data-field="selectItem" data-checkbox="true"></th>
+                                </tr>
+                            </thead>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<iframe id="hiddenIframe" name="hiddenIframe" style="display: none;"></iframe>
+
+<script type="text/javascript">
+    document.write('<script src="/static/modular/talentIdentify/integralMgr/IntegralItemMgr.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 104 - 35
app/admin/view/integral_mgr/save_item.html

@@ -1,57 +1,126 @@
 {extend name="layout/content"}
 {block name="content"}
+<style type="text/css">
+    .spacing {
+        margin-bottom: 10px;
+        padding-right:4px;
+        padding-left: 4px;
+    }
+    .rowGroup{height:50px;}
+    .table td{border:1px solid #ddd;}
+</style>
 <div class="ibox float-e-margins">
     <div class="ibox-content">
-        <form id="enterpriseTypeInfoForm">
-            <div class="form-horizontal">
-                <div class="row">
-                    <div class="col-sm-6">
-                        <div class="form-group">
-                            <label class="col-sm-3 control-label"><span style="color: red">*</span>审核单位</label>
-                            <div class="col-sm-9">
-                                <select class="form-control" id="companyId" name="companyId" data-placeholder="请选择审核单位">
+        <div class="form-horizontal">
+            <div class="row">
+                <form id="integraMgrInfoForm">
+                    <div class="col-sm-12 ">
+                        <input id="id" name="id" type="hidden" value="{$row.id}"/>
+                        <div class="rowGroup">
+                            <label class="col-sm-2 control-label spacing">人才类别</label>
+                            <div class="col-sm-4 spacing">
+                                <select class="form-control" id="type" name="type" selectVal="{$row.type}" onchange="IntegralItemMgrInfo.onTypeChange();">
+                                    <option value="">请选择</option>
+                                    <option value="1">晋江市现代产业体系人才</option>
+                                    <option value="2">集成电路优秀人才</option>
+                                </select>
+                            </div>
+                            <label class="col-sm-2 control-label spacing">所属积分项目</label>
+                            <div class="col-sm-4 spacing">
+                                <select class="form-control" id="projectId" name="projectId" selectVal="{$row.projectId}">
                                 </select>
                             </div>
                         </div>
-                        <div class="form-group">
-                            <label class="col-sm-3 control-label spacing">例外设置</label>
-                            <div class="col-sm-9 spacing">
-                                <input class="form-control" id="uniCode" name="uniCode" placeholder="填写统一信用代码,多个用,分隔">
+                        <div class="rowGroup">
+                            <label class="col-sm-2 control-label spacing">标准名称</label>
+                            <div class="col-sm-4 spacing">
+                                <input class="form-control" id="name" name="name" value="{$row.name}">
+                            </div>
+                            <label class="col-sm-2 control-label spacing">启用状态</label>
+                            <div class="col-sm-4 spacing">
+                                <select class="form-control" id="active" name="active" selectVal="{$row.active}">
+                                    <option value="">请选择</option>
+                                    <option value="1">启用</option>
+                                    <option value="2">停用</option>
+                                </select>
                             </div>
                         </div>
-                    </div>
-                    <div class="col-sm-6">
-                        <div class="form-group">
-                            <label class="col-sm-3 control-label spacing">单位标签</label>
-                            <div class="col-sm-9 spacing">
-                                <select class="form-control" id="enterpriseTag" name="enterpriseTag">
+                        <div class="rowGroup">
+                            <label class="col-sm-2 control-label spacing">积分方案</label>
+                            <div class="col-sm-4 spacing">
+                                <select class="form-control" id="plan" name="plan" selectVal="{$row.plan}" onchange="IntegralItemMgrInfo.onIntegralPlanChange();">
+                                    <option value="">请选择</option>
+                                    <option value="1">仅首次可获积分</option>
+                                    <option value="2">新增可获积分</option>
                                 </select>
                             </div>
+                            <label class="col-sm-2 control-label spacing">计量单位</label>
+                            <div class="col-sm-4 spacing">
+                                <input class="form-control" id="unit" name="unit" value="{$row.unit}">
+                            </div>
                         </div>
-                        <div class="form-group">
-                            <label class="col-sm-3 control-label spacing">备注</label>
-                            <div class="col-sm-9 spacing">
-                                <input class="form-control" id="description" name="description">
+                        <div class="rowGroup">
+                            <label class="col-sm-2 control-label spacing">首次达成量</label>
+                            <div class="col-sm-4 spacing">
+                                <input class="form-control" id="fstNeedAmount" name="fstNeedAmount" value="{$row.fstNeedAmount}">
+                            </div>
+                            <label class="col-sm-2 control-label spacing">首次获得积分</label>
+                            <div class="col-sm-4 spacing">
+                                <input class="form-control" id="fstGainPoints" name="fstGainPoints" value="{$row.fstGainPoints}">
+                            </div>
+                        </div>
+                        <div class="rowGroup planb" style="display:none;">
+                            <label class="col-sm-2 control-label spacing">每新增量</label>
+                            <div class="col-sm-4 spacing">
+                                <input class="form-control" id="stepNeedAmount" name="stepNeedAmount" value="{$row.stepNeedAmount}">
+                            </div>
+                            <label class="col-sm-2 control-label spacing">每新增获得积分</label>
+                            <div class="col-sm-4 spacing">
+                                <input class="form-control" id="stepGainPoints" name="stepGainPoints" value="{$row.stepGainPoints}">
+                            </div>
+                        </div>
+                        <div class="rowGroup planb" style="display:none;">
+                            <label class="col-sm-2 control-label spacing">积分上限</label>
+                            <div class="col-sm-4 spacing">
+                                <input class="form-control" id="maxGainPoints" name="maxGainPoints" value="{$row.maxGainPoints}">
+                            </div>
+                            <label class="col-sm-2 control-label spacing">累计积分方案</label>
+                            <div class="col-sm-4 spacing">
+                                <select class="form-control" id="yearly" name="yearly" selectVal="{$row.yearly}" onchange="IntegralItemMgrInfo.onAccumulationPlanChange();">
+                                    <option value="">请选择</option>
+                                    <option value="1">每年度重置积分上限</option>
+                                    <option value="2">达上限即止</option>
+                                </select>
+                            </div>
+                        </div>
+                        <div class="rowGroup">
+                            <label class="col-sm-2 control-label spacing">证明材料</label>
+                            <div class="col-sm-4 spacing">
+                                <select class="form-control" id="fileTypeId" name="fileTypeId" selectVal="{$row.fileTypeId}" multiple>
+                                    <option value="">请选择</option>
+                                    {volist name="fileTypes" id="fileType"}
+                                    <option value="{$fileType.id}">{$fileType.name}</option>
+                                    {/volist}
+                                </select>
                             </div>
                         </div>
                     </div>
-                </div>
-                <div class="row btn-group-m-t">
-                    <div class="col-sm-12" style="text-align: center;">
-                        <button type="button" class="btn btn-sm btn-info " onclick="EnterprisetypePropertiesInfoDlg.addSubmit()" id="ensure">
-                            <i class="fa fa-check"></i>&nbsp;提交
-                        </button>
-                        <button type="button" class="btn btn-sm btn-danger " onclick="EnterprisetypePropertiesInfoDlg.close()" id="cancel">
-                            <i class="fa fa-eraser"></i>&nbsp;取消
-                        </button>
-                    </div>
+                </form>
+            </div>
+            <div class="row btn-group-m-t">
+                <div class="col-sm-12" style="text-align: center;">
+                    <button type="button" class="btn btn-sm btn-info " onclick="IntegralItemMgrInfo.addSubmit()" id="ensure">
+                        <i class="fa fa-check"></i>&nbsp;提交
+                    </button>
+                    <button type="button" class="btn btn-sm btn-danger " onclick="IntegralItemMgrInfo.close()" id="cancel">
+                        <i class="fa fa-eraser"></i>&nbsp;取消
+                    </button>
                 </div>
             </div>
-        </form>
-
+        </div>
     </div>
 </div>
 <script type="text/javascript">
-    document.write('<script src="/static/modular/system/enterprisetypeProperties/enterprisetypeProperties_info.js?v=' + (new Date()).getTime() + '"><\/script>');
+    document.write('<script src="/static/modular/talentIdentify/integralMgr/IntegralItemMgr_info.js?v=' + (new Date()).getTime() + '"><\/script>');
 </script>
 {/block}

+ 6 - 0
app/common/api/FileTypeApi.php

@@ -44,6 +44,12 @@ class FileTypeApi {
         return FileType::findOrEmpty($id)->toArray();
     }
 
+    public static function getAll($where = []) {
+        $where[] = ["delete", "=", 0];
+        $list = FileType::where($where)->select()->toArray();
+        return $list;
+    }
+
     public static function edit($request) {
         $params = $request->param();
         $data["type"] = $params["type"];

+ 21 - 20
app/common/api/IntegralItemApi.php

@@ -7,7 +7,7 @@ use app\common\model\IntegralItem;
 class IntegralItemApi {
 
     public static function getOne($id) {
-        return IntegralItem::findOrEmpty($id);
+        return IntegralItem::alias("i")->leftJoin("new_integral_project p", "p.id=i.projectId")->field("i.*,p.type,if(yearly > 0,yearly,0) as plan")->findOrEmpty($id);
     }
 
     public static function getList($params) {
@@ -15,12 +15,6 @@ class IntegralItemApi {
         $offset = $params["offset"] ?: 0;
         $limit = $params["limit"] ?: 10;
         $where[] = ["delete", "=", 0];
-        if ($params["type"]) {
-            $where[] = ["type", "=", $params["type"]];
-        }
-        if ($params["name"]) {
-            $where[] = ["name", "like", "%{$params["name"]}%"];
-        }
         if ($params["projectType"]) {
             $where[] = ["projectType", "=", $params["projectType"]];
         }
@@ -32,17 +26,31 @@ class IntegralItemApi {
         return ["total" => $count, "rows" => $list];
     }
 
-    public static function getAll() {
+    public static function getAll($where = []) {
         $where[] = ["delete", "=", 0];
         $list = IntegralItem::where($where)->order("updateTime desc,createTime desc")->select()->toArray();
         return $list;
     }
 
     public static function edit($params) {
-        $data["type"] = $params["type"];
+        $data["projectId"] = $params["projectId"];
         $data["name"] = $params["name"];
-        $data["projectType"] = $params["projectType"];
+        $data["unit"] = $params["unit"];
+        $data["fstNeedAmount"] = $params["fstNeedAmount"];
+        $data["fstGainPoints"] = $params["fstGainPoints"];
+        $data["fileTypeId"] = implode(",", $params["fileTypeId"]);
         $data["active"] = $params["active"];
+        if ($params["plan"] == 2) {
+            $data["stepNeedAmount"] = $params["stepNeedAmount"];
+            $data["stepGainPoints"] = $params["stepGainPoints"];
+            $data["maxGainPoints"] = $params["maxGainPoints"];
+            $data["yearly"] = $params["yearly"];
+        } else {
+            $data["stepNeedAmount"] = 0;
+            $data["stepGainPoints"] = 0;
+            $data["maxGainPoints"] = 0;
+            $data["yearly"] = 0;
+        }
         if ($params["id"]) {
             $data["id"] = $params["id"];
             $data["updateTime"] = date("Y-m-d H:i:s");
@@ -60,20 +68,13 @@ class IntegralItemApi {
         $data["delete"] = 1;
         $data["updateUser"] = session("user")["uid"];
         $data["updateTime"] = date("Y-m-d H:i:s");
-        //同时删除子项
-        $upd["delete"] = 1;
-        $upd["updateTime"] = date("Y-m-d H:i:s");
-        $upd["updateTime"] = session("user")["uid"];
-        $where[] = ["projectId", "=", $id];
-        \app\common\model\IntegralItem::where($where)->save($upd);
         return IntegralItem::update($data);
     }
 
-    public static function chkExist($name, $type, $projectType, $id = 0) {
+    public static function chkExist($name, $projectId, $id = 0) {
         $where = [];
-        $where[] = ["type", "=", $params["type"]];
-        $where[] = ["projectType", "=", $params["projectType"]];
-        $where[] = ["name", "=", $params["name"]];
+        $where[] = ["projectId", "=", $projectId];
+        $where[] = ["name", "=", $name];
         $where[] = ["delete", "=", 0];
         if ($id) {
             $where[] = ["id", "<>", $id];

+ 1 - 1
app/common/api/IntegralProjectApi.php

@@ -32,7 +32,7 @@ class IntegralProjectApi {
         return ["total" => $count, "rows" => $list];
     }
 
-    public static function getAll() {
+    public static function getAll($where = []) {
         $where[] = ["delete", "=", 0];
         $list = IntegralProject::where($where)->order("updateTime desc,createTime desc")->select()->toArray();
         return $list;

+ 21 - 2
public/static/modular/filetype/unCommonFiletype/unCommonFiletype_info.js

@@ -149,13 +149,31 @@ UnCommonFiletypeInfoDlg.callBack = function (data) {
     }
 }
 
-UnCommonFiletypeInfoDlg.typeChange = function (ctx) {
-    if ($(ctx).val() == 1) {
+UnCommonFiletypeInfoDlg.typeChange = function () {
+    UnCommonFiletypeInfoDlg.typeAndProjectChange();
+}
+
+UnCommonFiletypeInfoDlg.projectChange = function () {
+    var project = $("#project").val();
+    if(project == 1){
+        $(".project1").css("display","");
+    }else{
+        $(".project1").css("display","none");
+    }
+    UnCommonFiletypeInfoDlg.typeAndProjectChange();
+}
+
+UnCommonFiletypeInfoDlg.typeAndProjectChange = function () {
+    var type = $("#type").val();
+    var project = $("#project").val();
+    if (type == 1 && project == 1) {
         var options = '<option value="">---请选择---</option><option value="1">一、基础资料填报阶段</option><option value="2">二、补充认定材料阶段</option>';
     } else {
         var options = '<option value="">---请选择---</option>';
     }
     $("#step").html(options);
+    var step = $("#step").attr("selectVal");
+    $("#step").val(step);
 }
 
 UnCommonFiletypeInfoDlg.fileChange = function (context) {
@@ -170,6 +188,7 @@ $(function () {
     $("select").each(function () {
         $(this).val($(this).attr("selectVal"));
     });
+    UnCommonFiletypeInfoDlg.projectChange();
 });
 
 

+ 260 - 0
public/static/modular/talentIdentify/integralMgr/IntegralItemMgr_info.js

@@ -0,0 +1,260 @@
+/**
+ * 初始化认定条件管理详情对话框
+ */
+var IntegralItemMgrInfo = {
+    integralMgrInfoData: {},
+    validateFields: {
+        projectId: {
+            validators: {
+                notEmpty: {
+                    message: '请选择所属积分项目'
+                }
+            }
+        },
+        name: {
+            validators: {
+                notEmpty: {
+                    message: '请输入标准名称'
+                }
+            }
+        },
+        active: {
+            validators: {
+                notEmpty: {
+                    message: '请选择启用状态'
+                }
+            }
+        },
+        plan: {
+            validators: {
+                notEmpty: {
+                    message: '请选择积分方案'
+                }
+            }
+        },
+        unit: {
+            validators: {
+                notEmpty: {
+                    message: '请输入计量单位'
+                }
+            }
+        },
+        fstNeedAmount: {
+            validators: {
+                notEmpty: {
+                    message: '请输入首次达成量'
+                }
+            }
+        },
+        fstGainPoints: {
+            validators: {
+                notEmpty: {
+                    message: '请输入首次获得积分'
+                }
+            }
+        },
+        stepNeedAmount: {
+            validators: {
+                notEmpty: {
+                    message: '请输入每新增量'
+                }
+            }
+        },
+        stepGainPoints: {
+            validators: {
+                notEmpty: {
+                    message: '请输入每新增获得积分'
+                }
+            }
+        },
+        maxGainPoints: {
+            validators: {
+                notEmpty: {
+                    message: '请输入积分上限'
+                }
+            }
+        },
+        yearly: {
+            validators: {
+                notEmpty: {
+                    message: '请选择累计积分方案'
+                }
+            }
+        }
+    }
+};
+
+/**
+ * 清除数据
+ */
+IntegralItemMgrInfo.clearData = function () {
+    this.integralMgrInfoData = {};
+}
+
+/**
+ * 设置对话框中的数据
+ *
+ * @param key 数据的名称
+ * @param val 数据的具体值
+ */
+IntegralItemMgrInfo.set = function (key, val) {
+    this.integralMgrInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
+    return this;
+}
+
+/**
+ * 设置对话框中的数据
+ *
+ * @param key 数据的名称
+ * @param val 数据的具体值
+ */
+IntegralItemMgrInfo.get = function (key) {
+    return $("#" + key).val();
+}
+
+/**
+ * 关闭此对话框
+ */
+IntegralItemMgrInfo.close = function () {
+    parent.layer.close(window.parent.IntegralMgr.layerIndex);
+}
+
+/**
+ * 收集数据
+ */
+IntegralItemMgrInfo.collectData = function () {
+    this
+            .set('id')
+            .set('type')
+            .set('projectId')
+            .set('name')
+            .set('plan')
+            .set('unit')
+            .set('fstNeedAmount')
+            .set('fstGainPoints')
+            .set('stepNeedAmount')
+            .set('stepGainPoints')
+            .set('maxGainPoints')
+            .set('yearly')
+            .set('fileTypeId')
+            .set('active');
+}
+
+IntegralItemMgrInfo.onTypeChange = function () {
+    var type = $("#type").val();
+    Feng.addAjaxSelect({
+        "id": "projectId",
+        "displayCode": "id",
+        "displayName": "name",
+        "type": "GET",
+        "url": "/admin/integral_mgr/getProjectsByType/type/" + type
+    });
+    var projectId = $("#projectId").attr("selectVal");
+    $("#projectId").val(projectId);
+    Feng.addAjaxSelect({
+        "id": "fileTypeId",
+        "displayCode": "id",
+        "displayName": "name",
+        "type": "GET",
+        "url": "/admin/integral_mgr/getFilesByType/type/" + type
+    });
+    $("#fileTypeId").trigger('chosen:updated');
+}
+
+//切换积分方案
+IntegralItemMgrInfo.onIntegralPlanChange = function () {
+    var plan = $("#plan").val();
+    switch (plan) {
+        case "1":
+            $(".planb").css("display", "none");
+            $('#integraMgrInfoForm').bootstrapValidator('removeField', "stepNeedAmount");
+            $('#integraMgrInfoForm').bootstrapValidator('removeField', "stepGainPoints");
+            $('#integraMgrInfoForm').bootstrapValidator('removeField', "maxGainPoints");
+            $('#integraMgrInfoForm').bootstrapValidator('removeField', "yearly");
+            break;
+        case "2":
+            $(".planb").css("display", "block");
+            $('#integraMgrInfoForm').bootstrapValidator('addField', "stepNeedAmount", {validators: {notEmpty: {message: '请填写每新增量'}}});
+            $('#integraMgrInfoForm').bootstrapValidator('addField', "stepGainPoints", {validators: {notEmpty: {message: '请填写每新增获得积分'}}});
+            $('#integraMgrInfoForm').bootstrapValidator('addField', "maxGainPoints", {validators: {notEmpty: {message: '请填写积分上限'}}});
+            $('#integraMgrInfoForm').bootstrapValidator('addField', "yearly", {validators: {notEmpty: {message: '请选择累计积分方案'}}});
+            break;
+    }
+}
+
+/**
+ * 提交添加
+ */
+IntegralItemMgrInfo.addSubmit = function () {
+    this.clearData();
+    this.collectData();
+    if (!this.validate()) {
+        return;
+    }
+
+    var ajax = new $ax("/admin/integral_mgr/addItem", function (data) {
+        if (data.code == "200") {
+            Feng.success(data.msg);
+            window.parent.IntegralMgr.table.refresh();
+            IntegralItemMgrInfo.close();
+        } else {
+            Feng.error(data.msg);
+        }
+    }, function (data) {
+        Feng.error("添加失败!" + data.responseJSON.message + "!");
+    });
+    ajax.set(this.integralMgrInfoData);
+    ajax.start();
+}
+
+/**
+ * 提交修改
+ */
+IntegralItemMgrInfo.editSubmit = function () {
+    this.clearData();
+    this.collectData();
+    if (!this.validate()) {
+        return;
+    }
+    var ajax = new $ax(Feng.ctxPath + "/admin/integral_mgr/editItem", function (data) {
+        if (data.code == "200") {
+            Feng.success(data.msg);
+            window.parent.IntegralMgr.table.refresh();
+            IntegralItemMgrInfo.close();
+        } else {
+            Feng.error(data.msg);
+        }
+    }, function (data) {
+        Feng.error("修改失败!" + data.responseJSON.message + "!");
+    });
+    ajax.set(this.integralMgrInfoData);
+    ajax.start();
+}
+
+/**
+ * 验证数据是否为空
+ */
+IntegralItemMgrInfo.validate = function () {
+    $('#integraMgrInfoForm').data("bootstrapValidator").resetForm();
+    $('#integraMgrInfoForm').bootstrapValidator('validate');
+    return $("#integraMgrInfoForm").data('bootstrapValidator').isValid();
+}
+
+$(function () {
+    Feng.initValidator("integraMgrInfoForm", IntegralItemMgrInfo.validateFields);
+    //下拉框数据回显
+    $("select").each(function () {
+        $(this).val($(this).attr("selectVal"));
+    });
+    IntegralItemMgrInfo.onTypeChange();
+    IntegralItemMgrInfo.onIntegralPlanChange();
+    
+    $("#fileTypeId").chosen({
+        no_results_text: "没有找到结果!",
+        width:'100%',
+        search_contains:true,       //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
+        disable_search: false,
+        enable_split_word_search: true,
+        rtl:true
+    });
+});

+ 164 - 0
public/static/modular/talentIdentify/integralMgr/integralItemMgr.js

@@ -0,0 +1,164 @@
+/**
+ * 认定条件管理管理初始化
+ */
+var IntegralItemMgr = {
+    id: "IntegralItemMgrTable", //表格id
+    seItem: null, //选中的条目
+    table: null,
+    layerIndex: -1
+};
+
+/**
+ * 初始化表格的列
+ */
+IntegralItemMgr.initColumn = function () {
+    return [
+        {field: 'selectItem', radio: true},
+        {title: '人才类别', field: 'type', visible: true, align: 'center', valign: 'middle',
+            formatter: function (value, row, index) {
+                if (value == 1) {
+                    return "晋江市现代产业体系人才";
+                }
+                if (value == 2) {
+                    return "集成电路优秀人才";
+                }
+            }
+        },
+        {title: '项目名称', field: 'projectName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip'},
+        {title: '项目类别', field: 'projectType', visible: true, align: 'center', valign: 'middle',
+            formatter: function (value, row, index) {
+                switch (value) {
+                    case 1:
+                        return "基础分";
+                    case 2:
+                        return "贡献分";
+                    case 3:
+                        return "资历分";
+                }
+            }
+        },
+        {title: '标准名称', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip'},
+        {title: '是否启用', field: 'active', visible: true, align: 'center', valign: 'middle',
+            formatter: function (value, row, index) {
+                if (value == 1) {
+                    return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-primary btn-xs\">启用</button>";
+                }
+                if (value == 2) {
+                    return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-warning btn-xs\">停用</button>";
+                }
+            }
+        }
+    ];
+};
+
+/**
+ * 检查是否选中
+ */
+IntegralItemMgr.check = function () {
+    var selected = $('#' + this.id).bootstrapTable('getSelections');
+    if (selected.length == 0) {
+        Feng.info("请先选中表格中的某一记录!");
+        return false;
+    } else {
+        IntegralItemMgr.seItem = selected[0];
+        return true;
+    }
+};
+
+/**
+ * 点击添加积分项目
+ */
+IntegralItemMgr.openAddIntegralProject = function () {
+    var index = layer.open({
+        type: 2,
+        title: '添加积分项目',
+        area: ['1126px', '420px'], //宽高
+        fix: false, //不固定
+        maxmin: true,
+        content: Feng.ctxPath + '/admin/integral_mgr/addItem'
+    });
+    this.layerIndex = index;
+};
+
+/**
+ * 打开编辑积分项目
+ */
+IntegralItemMgr.openEditIntegralProject = function () {
+    if (this.check()) {
+        var index = layer.open({
+            type: 2,
+            title: '编辑积分项目',
+            area: ['1126px', '420px'], //宽高
+            fix: false, //不固定
+            maxmin: true,
+            content: Feng.ctxPath + '/admin/integral_mgr/editItem/id/' + IntegralItemMgr.seItem.id
+        });
+        this.layerIndex = index;
+    }
+};
+
+/**
+ * 删除积分项目
+ */
+IntegralItemMgr.delete = function () {
+    if (this.check()) {
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/admin/integral_mgr/deleteItem/id/", function (data) {
+                Feng.success("删除成功!");
+                IntegralItemMgr.table.refresh();
+            }, function (data) {
+                Feng.error("删除失败!" + data.responseJSON.message + "!");
+            });
+            ajax.set("id", IntegralItemMgr.seItem.id);
+            ajax.start();
+        }
+        Feng.confirm("是否刪除该积分标准?", operation);
+    }
+};
+
+/**
+ * 查询表单提交参数对象
+ * @returns {{}}
+ */
+IntegralItemMgr.formParams = function () {
+    var queryData = {};
+    queryData['type'] = $("#type").val();
+    queryData['name'] = $("#name").val();
+    queryData['projectType'] = $("#projectType").val();
+    queryData['active'] = $("#active").val();
+    return queryData;
+}
+
+
+/**
+ * 查询认定条件管理列表
+ */
+IntegralItemMgr.search = function () {
+    IntegralItemMgr.table.refresh({query: IntegralItemMgr.formParams()});
+};
+
+/**
+ * 重置
+ */
+IntegralItemMgr.reset = function () {
+    $("#type").val("");
+    $("#name").val("");
+    $("#projectType").val("");
+    $("#active").val("");
+}
+
+//回调
+IntegralItemMgr.callBack = function (data) {
+    Feng.info(data.msg);
+    if (data.code == 200) {
+        $("#importModal").modal("hide");
+        IntegralItemMgr.table.refresh();
+    }
+}
+
+$(function () {
+    var defaultColunms = IntegralItemMgr.initColumn();
+    var table = new BSTable(IntegralItemMgr.id, "/admin/integral_mgr/itemList", defaultColunms);
+    table.setPaginationType("server");
+    IntegralItemMgr.table = table.init();
+});