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

Signed-off-by: sgq <sgq@sugangqiang>

sgq 2 жил өмнө
parent
commit
100ea486b7

+ 28 - 0
app/admin/api/DeptApi.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace app\admin\api;
+
+use app\admin\model\Depart;
+
+/**
+ * Description of RoleApi
+ *
+ * @author sgq
+ */
+class DeptApi {
+
+    public static function getOne($id) {
+        return Depart::findOrEmpty($id);
+    }
+
+    public static function getList($params) {
+        $where = [];
+        if (isset($params["condition"])) {
+            $where[] = [["simplename", "like", "%" . $params["condition"] . "%"]];
+            $where[] = [["fullname", "like", "%" . $params["condition"] . "%"]];
+        }
+        $list = Depart::whereOr($where)->select()->toArray();
+        return $list;
+    }
+
+}

+ 70 - 1
app/admin/api/RoleApi.php

@@ -11,9 +11,78 @@ use app\admin\model\Role;
  */
 class RoleApi {
 
-    public static function getList($where = "") {
+    public static function getOne($id) {
+        $res = Role::findOrEmpty($id);
+        if ($res["pid"] > 0) {
+            $res["pName"] = isNullOrEmpty(Role::where("id", "=", $res["pid"])->findOrEmpty()["name"]);
+        }
+        if ($res["deptid"] > 0) {
+            $res["deptName"] = isNullOrEmpty(DeptApi::getOne($res["deptid"])["simplename"]);
+        }
+        return $res;
+    }
+
+    public static function getList($params) {
+        $where = [];
+        if (isset($params["roleName"])) {
+            $where = [["name", "like", "%" . $name . "%"]];
+        }
         $list = Role::where($where)->select()->toArray();
+        foreach ($list as &$item) {
+            if ($item["pid"] > 0) {
+                $item["pName"] = isNullOrEmpty(Role::where("id", "=", $item["pid"])->findOrEmpty()["name"]);
+            }
+            if ($item["deptid"] > 0) {
+                $item["deptName"] = isNullOrEmpty(DeptApi::getOne($item["deptid"])["simplename"]);
+            }
+        }
         return $list;
     }
 
+    public static function create($params) {
+        if (!isset($params["name"]))
+            return ["msg" => "角色名不能为空"];
+        if (!isset($params["tips"]))
+            return ["msg" => "别名不能为空"];
+        if (!isset($params["pid"]))
+            return ["msg" => "请选择上级名称"];
+        $data["name"] = $params["name"];
+        $data["pid"] = $params["pid"];
+        $data["deptid"] = $params["deptid"];
+        $data["tips"] = $params["tips"];
+        $data["num"] = $params["num"];
+        Role::insert($data);
+        return ["code" => 200, "msg" => "成功"];
+    }
+
+    public static function update($params) {
+        if (!isset($params["id"]))
+            return ["msg" => "没有角色信息"];
+        if (!isset($params["name"]))
+            return ["msg" => "角色名不能为空"];
+        if (!isset($params["tips"]))
+            return ["msg" => "别名不能为空"];
+        if (!isset($params["pid"]))
+            return ["msg" => "请选择上级名称"];
+        $child_ids = Role::where("pid", "=", $params["id"])->column("id");
+        if (in_array($params["pid"], $child_ids))
+            return ["msg" => "不能选择自身下级作为上级"];
+        $data["id"] = $params["id"];
+        $data["name"] = $params["name"];
+        $data["pid"] = $params["pid"];
+        $data["deptid"] = $params["deptid"];
+        $data["tips"] = $params["tips"];
+        $data["num"] = $params["num"];
+        Role::update($data);
+        return ["code" => 200, "msg" => "成功"];
+    }
+
+    public static function delete($id) {
+        //不能删除超级管理员角色
+        if ($id == 1)
+            return ["msg" => "不能删除超级管理员角色"];
+        Role::where(["id" => $id])->delete();
+        return ["code" => 200, "msg" => "成功"];
+    }
+
 }

+ 93 - 0
app/admin/controller/Batch.php

@@ -0,0 +1,93 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\common\AdminController;
+use app\common\api\BatchApi;
+
+/**
+ * Description of Batch
+ *
+ * @author sgq
+ */
+class Batch extends AdminController {
+
+    /**
+     * @@auth {{/batch}}
+     * @return type
+     */
+    public function index() {
+        return view();
+    }
+
+    /**
+     * @@auth {{/batch/list}}
+     * @return type
+     */
+    public function list() {
+        return json(BatchApi::getList($this->request));
+    }
+
+    /**
+     * @@auth {{/batch/add}}
+     * @return type
+     */
+    public function add() {
+        if ($this->request->isPost()) {
+            return json(BatchApi::create($this->request->param()));
+        }
+        return view();
+    }
+
+    /**
+     * @@auth {{/batch/update}}
+     * @return type
+     */
+    public function edit() {
+        if ($this->request->isPost()) {
+            return json(BatchApi::update($this->request->param()));
+        }
+        $batch = BatchApi::getOne($this->request->param("id"));
+        return view("", ["batch" => $batch]);
+    }
+
+    /**
+     * @@auth {{/batch/delete}}
+     * @return type
+     */
+    public function delete() {
+        if ($this->request->isPost()) {
+            return json(BatchApi::delete($this->request->param("batchId")));
+        }
+    }
+
+    /**
+     * @@auth {{/batch/setActive}}
+     * @return type
+     */
+    public function setActive() {
+        if ($this->request->isPost()) {
+            return json(BatchApi::setActive($this->request->param("batchId"), 1));
+        }
+    }
+
+    /**
+     * @@auth {{/batch/setNotActive}}
+     * @return type
+     */
+    public function setNotActive() {
+        if ($this->request->isPost()) {
+            return json(BatchApi::setActive($this->request->param("batchId"), 2));
+        }
+    }
+
+    /**
+     * @@auth {{/batch/detail}}
+     * @return type
+     */
+    public function detail() {
+
+        return view();
+    }
+
+}

+ 35 - 0
app/admin/controller/Dept.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\common\AdminController;
+
+/**
+ * Description of Dept
+ *
+ * @author sgq
+ */
+class Dept extends AdminController {
+
+    /**
+     * 树形
+     * @return type
+     */
+    function treelist() {
+        $list = getTreeList(\app\admin\api\DeptApi::getList([]));
+        $format_list = [];
+        foreach ($list as $item) {
+            $format_list[] = [
+                "checked" => false,
+                "id" => $item["id"],
+                "isOpen" => true,
+                "name" => $item["simplename"],
+                "open" => $item["pid"] == 0 ? true : false,
+                "pId" => $item["pid"]
+            ];
+        }
+        $format_list[] = ["checked" => true, "id" => "0", "isOpen" => true, "name" => "顶级", "open" => true, "pId" => "0"];
+        return $format_list;
+    }
+
+}

+ 13 - 2
app/admin/controller/Dict.php

@@ -45,7 +45,12 @@ class Dict extends AdminController {
      * @return type
      */
     public function edit() {
-        return view();
+        if ($this->request->isPost()) {
+            return json(DictApi::update($this->request->param()));
+        }
+
+        $dict = DictApi::getOne($this->request->param("id"));
+        return view("", ["dict" => $dict]);
     }
 
     /**
@@ -53,7 +58,13 @@ class Dict extends AdminController {
      * @return type
      */
     public function delete() {
-        
+        if ($this->request->isPost()) {
+            return json(DictApi::delete($this->request->param("dictId")));
+        }
+    }
+    
+    public function findChildDictByCode(){
+        return json(DictApi::findChildDictByCode($this->request->param("code")));
     }
 
 }

+ 38 - 0
app/admin/controller/Menu.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\common\AdminController;
+
+/**
+ * Description of Menu
+ *
+ * @author sgq
+ */
+class Menu extends AdminController {
+
+    /**
+     * 树形
+     * @return type
+     */
+    function treelist() {
+        $id = $this->request->param("id");
+        $role = \app\admin\api\RoleApi::getOne($id);
+        $list = getTreeList(\app\common\api\MenuApi::getMenuListByRoleid($role["id"]));
+        var_dump($list);exit();
+        $format_list = [];
+        foreach ($list as $item) {
+            $format_list[] = [
+                "checked" => false,
+                "id" => $item["id"],
+                "isOpen" => true,
+                "name" => $item["simplename"],
+                "open" => $item["pid"] == 0 ? true : false,
+                "pId" => $item["pid"]
+            ];
+        }
+        $format_list[] = ["checked" => true, "id" => "0", "isOpen" => true, "name" => "顶级", "open" => true, "pId" => "0"];
+        return $format_list;
+    }
+
+}

+ 32 - 10
app/admin/controller/Role.php

@@ -25,12 +25,7 @@ class Role extends AdminController {
      * @return type
      */
     public function list() {
-        $name = trim($this->request->param("roleName"));
-        $where = [];
-        if ($name) {
-            $where = [["name", "like", "%" . $name . "%"]];
-        }
-        $list = RoleApi::getList($where);
+        $list = RoleApi::getList($this->request->param());
         return json($list);
     }
 
@@ -39,6 +34,9 @@ class Role extends AdminController {
      * @return type
      */
     public function add() {
+        if ($this->request->isPost()) {
+            return json(RoleApi::create($this->request->param()));
+        }
         return view();
     }
 
@@ -47,7 +45,11 @@ class Role extends AdminController {
      * @return type
      */
     public function edit() {
-        return view();
+        if ($this->request->isPost()) {
+            return json(RoleApi::update($this->request->param()));
+        }
+        $id = $this->request->param("id");
+        return view("", ["role" => RoleApi::getOne($id)]);
     }
 
     /**
@@ -62,7 +64,8 @@ class Role extends AdminController {
      * @return type
      */
     public function assign() {
-        
+        $role = RoleApi::getOne($this->request->param("id"));
+        return view("", ["role" => $role]);
     }
 
     /**
@@ -75,8 +78,27 @@ class Role extends AdminController {
     /**
      * @auth {{/role/remove}}
      */
-    public function remove() {
-        
+    public function delete() {
+        if ($this->request->isPost()) {
+            return json(RoleApi::delete($this->request->param("roleId")));
+        }
+    }
+
+    function treelist() {
+        $list = getTreeList(RoleApi::getList([]));
+        $format_list = [];
+        foreach ($list as $item) {
+            $format_list[] = [
+                "checked" => false,
+                "id" => $item["id"],
+                "isOpen" => true,
+                "name" => $item["name"],
+                "open" => $item["pid"] == 0 ? true : false,
+                "pId" => $item["pid"]
+            ];
+        }
+        $format_list[] = ["checked" => true, "id" => "0", "isOpen" => true, "name" => "顶级", "open" => true, "pId" => "0"];
+        return $format_list;
     }
 
 }

+ 16 - 0
app/admin/model/Depart.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * Description of Depart
+ *
+ * @author sgq
+ */
+class Depart extends Model {
+
+    protected $table = "sys_dept";
+
+}

+ 124 - 0
app/admin/view/Batch/add.html

@@ -0,0 +1,124 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="ibox float-e-margins">
+    <div class="ibox-content">
+        <form id="batchInfoForm">
+            <div class="form-horizontal">
+                <input id="id" name="id" type="hidden" value=""/>
+                <div class="row">
+                    <div class="col-sm-6">
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                申报类别</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="type" name="type" data-bv-field="type"><option value="">---请选择---</option></select>
+                                <i style="display: none;" class="form-control-feedback" data-bv-icon-for="type"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="type" data-bv-result="NOT_VALIDATED">申报类别不能为空</small>
+                            </div>
+                        </div>
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                申报批次</label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="batch" name="batch" type="1" data-bv-field="batch">
+                                <i style="display: none;" class="form-control-feedback" data-bv-icon-for="batch"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="batch" data-bv-result="NOT_VALIDATED">申报批次不能为空</small>
+                                <small style="display: none;" class="help-block" data-bv-validator="regexp" data-bv-for="batch" data-bv-result="NOT_VALIDATED">只能输入数字</small>
+                            </div>
+                        </div>
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                申报截止时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="endTime" id="endTime" data-bv-field="endTime" lay-key="1"><i style="display: none;" class="form-control-feedback" data-bv-icon-for="endTime"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="endTime" data-bv-result="NOT_VALIDATED">申报截止时间不能为空</small></div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                公示开始时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="publicStartTime" id="publicStartTime" lay-key="2">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                平均工资</label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="averageWage" name="averageWage" type="1">
+
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                备注</label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="description" name="description" type="1">
+
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-sm-6">
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                人才类型</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" selectval="1" disabled="disabled" id="source" name="source" data-bv-field="source">
+                                    <option value="">请选择</option>
+                                    <option value="1">晋江市优秀人才</option>
+                                    <option value="2">晋江市集成电路优秀人才</option>
+
+                                </select><i style="display: none;" class="form-control-feedback" data-bv-icon-for="source"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="source" data-bv-result="NOT_VALIDATED">人才类型不能为空</small></div>
+                        </div>
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                申报开始时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="startTime" id="startTime" data-bv-field="startTime" lay-key="3"><i style="display: none;" class="form-control-feedback" data-bv-icon-for="startTime"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="startTime" data-bv-result="NOT_VALIDATED">申报开始时间不能为空</small></div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                提交截止时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="submitEndTime" id="submitEndTime" lay-key="4">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                公示截止时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="publicEndTime" id="publicEndTime" lay-key="5">
+                            </div>
+                        </div>
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                是否有效</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" disabled="disabled" id="active" name="active" data-bv-field="active">
+                                    <option value="2" selected="selected">无效</option>
+                                    <option value="1">有效</option>
+
+                                </select><i style="display: none;" class="form-control-feedback" data-bv-icon-for="active"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="active" data-bv-result="NOT_VALIDATED">有效状态不能为空</small></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="BatchInfoDlg.addSubmit()" id="ensure">
+                            <i class="fa fa-check"></i>&nbsp;提交
+                        </button>
+                        <button type="button" class="btn btn-sm btn-danger " onclick="BatchInfoDlg.close()" id="cancel">
+                            <i class="fa fa-eraser"></i>&nbsp;取消
+                        </button>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/system/batch/batch_info.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 124 - 0
app/admin/view/Batch/edit.html

@@ -0,0 +1,124 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="ibox float-e-margins">
+    <div class="ibox-content">
+        <form id="batchInfoForm" autocomplete="off">
+            <div class="form-horizontal">
+                <input id="id" name="id" type="hidden" value="{$batch.id}"/>
+                <div class="row">
+                    <div class="col-sm-6">
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                申报类别</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="type" name="type" selectVal="{$batch.type}" data-bv-field="type"><option value="">---请选择---</option></select>
+                                <i style="display: none;" class="form-control-feedback" data-bv-icon-for="type"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="type" data-bv-result="NOT_VALIDATED">申报类别不能为空</small>
+                            </div>
+                        </div>
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                申报批次</label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="batch" name="batch" value="{$batch.batch}" type="1" data-bv-field="batch">
+                                <i style="display: none;" class="form-control-feedback" data-bv-icon-for="batch"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="batch" data-bv-result="NOT_VALIDATED">申报批次不能为空</small>
+                                <small style="display: none;" class="help-block" data-bv-validator="regexp" data-bv-for="batch" data-bv-result="NOT_VALIDATED">只能输入数字</small>
+                            </div>
+                        </div>
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                申报截止时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="endTime" value="{$batch.endTime}" id="endTime" data-bv-field="endTime" lay-key="1"><i style="display: none;" class="form-control-feedback" data-bv-icon-for="endTime"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="endTime" data-bv-result="NOT_VALIDATED">申报截止时间不能为空</small></div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                公示开始时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="publicStartTime" value="{$batch.publicStartTime}" id="publicStartTime" lay-key="2">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                平均工资</label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="averageWage" name="averageWage" value="{$batch.averageWage}" type="1">
+
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                备注</label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="description" name="description" value="{$batch.description}" type="1">
+
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-sm-6">
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                人才类型</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" selectval="1" disabled="disabled" selectVal="{$batch.source}" id="source" name="source" data-bv-field="source">
+                                    <option value="">请选择</option>
+                                    <option value="1">晋江市优秀人才</option>
+                                    <option value="2">晋江市集成电路优秀人才</option>
+
+                                </select><i style="display: none;" class="form-control-feedback" data-bv-icon-for="source"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="source" data-bv-result="NOT_VALIDATED">人才类型不能为空</small></div>
+                        </div>
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                申报开始时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="startTime" value="{$batch.startTime}" id="startTime" data-bv-field="startTime" lay-key="3"><i style="display: none;" class="form-control-feedback" data-bv-icon-for="startTime"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="startTime" data-bv-result="NOT_VALIDATED">申报开始时间不能为空</small></div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                提交截止时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="submitEndTime" value="{$batch.submitEndTime}" id="submitEndTime" lay-key="4">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                公示截止时间</label>
+                            <div class="col-sm-9">
+                                <input type="text" time="time" format="datetime" class="form-control" name="publicEndTime" id="publicEndTime" value="{$batch.publicEndTime}" lay-key="5">
+                            </div>
+                        </div>
+                        <div class="form-group has-feedback">
+                            <label class="col-sm-3 control-label">
+                                是否有效</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" disabled="disabled" id="active" name="active" selectVal="{$batch.active}" data-bv-field="active">
+                                    <option value="2" selected="selected">无效</option>
+                                    <option value="1">有效</option>
+
+                                </select><i style="display: none;" class="form-control-feedback" data-bv-icon-for="active"></i>
+                                <small style="display: none;" class="help-block" data-bv-validator="notEmpty" data-bv-for="active" data-bv-result="NOT_VALIDATED">有效状态不能为空</small></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="BatchInfoDlg.editSubmit()" id="ensure">
+                            <i class="fa fa-check"></i>&nbsp;提交
+                        </button>
+                        <button type="button" class="btn btn-sm btn-danger " onclick="BatchInfoDlg.close()" id="cancel">
+                            <i class="fa fa-eraser"></i>&nbsp;取消
+                        </button>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/system/batch/batch_info.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 90 - 0
app/admin/view/Batch/index.html

@@ -0,0 +1,90 @@
+{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">
+                            <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></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="Batch.search()" id="">
+                                    <i class="fa fa-search"></i>&nbsp;搜索
+                                </button>
+                                <button type="button" class="btn btn-sm btn-primary " onclick="Batch.reset()" id="">
+                                    <i class="fa fa-trash"></i>&nbsp;重置
+                                </button>
+                            </div>
+                        </div>
+                        <div class="hidden-xs" id="BatchTableToolbar" role="group">
+                            {if condition="chkCommission('/admin/batch/add','/batch/add')"} 
+                            <button type="button" class="btn btn-sm btn-primary " onclick="Batch.openAddBatch()" id="">
+                                <i class="fa fa-plus"></i>&nbsp;添加
+                            </button>
+                            {/if}  
+                            {if condition="chkCommission('/admin/batch/edit','/batch/update')"}   
+                            <button type="button" class="btn btn-sm btn-primary " onclick="Batch.openBatchDetail()" id="">
+                                <i class="fa fa-edit"></i>&nbsp;修改
+                            </button>
+                            {/if}  
+                            {if condition="chkCommission('/admin/batch/delete','/batch/delete')"}   
+                            <button type="button" class="btn btn-sm btn-primary " onclick="Batch.delete()" id="">
+                                <i class="fa fa-remove"></i>&nbsp;删除
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/batch/setActive','/batch/setActive')"}   
+                            <button type="button" class="btn btn-sm btn-danger " onclick="Batch.setActive()" id="">
+                                <i class="fa fa-toggle-off"></i>&nbsp;设置生效
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/batch/setNotActive','/batch/setNotActive')"}   
+                            <button type="button" class="btn btn-sm btn-danger " onclick="Batch.setNotActive()" id="">
+                                <i class="fa fa-toggle-off"></i>&nbsp;设置失效
+                            </button>
+                            {/if}
+                        </div>
+                        <table id="BatchTable" 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>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/system/batch/batch.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 1 - 1
app/admin/view/dict/edit.html

@@ -8,7 +8,7 @@
 
             <div class="row">
                 <div class="col-sm-12" id="itemsArea">
-                    <input type="hidden" id="itemSize" value="{$childs|count}" />
+                    <input type="hidden" id="itemSize" value="{$dict.children|count}" />
                     <div class="form-group">
 
                         <label class="col-sm-2 control-label">类型编码</label>

+ 2 - 2
app/admin/view/role/assign.html

@@ -39,8 +39,8 @@
             }
         };
 
-        var ztree = new $ZTree("zTree", "/admin/menu/menuTreeListByRoleId/"
-            + "${roleId}");
+        var ztree = new $ZTree("zTree", "/admin/menu/treelist/id/"
+            + "{$role.id}");
         ztree.setSettings(setting);
         ztree.init();
     }

+ 2 - 2
app/admin/view/role/edit.html

@@ -16,14 +16,14 @@
                         <label class="col-sm-3 control-label">上级名称</label>
                         <div class="col-sm-9">
                             <input class="form-control" id="pName" name="pName" value="{$role.pName}" type="text" style="background-color: #ffffff !important;" onclick="RolInfoDlg.showPNameSelectTree(); return false;" readonly="">
-                            <input id="pid" type="hidden"/>
+                            <input id="pid" value="{$role.pid}" type="hidden"/>
                         </div>
                     </div>
                     <div class="form-group">
                         <label class="col-sm-3 control-label">部门名称</label>
                         <div class="col-sm-9">
                             <input class="form-control" id="deptName" name="deptName" value="{$role.deptName}" type="text" style="background-color: #ffffff !important;" onclick="RolInfoDlg.showDeptSelectTree(); return false;" readonly="">
-                            <input id="deptid" type="hidden"/>
+                            <input id="deptid" value="{$role.deptid}" type="hidden"/>
                         </div>
                     </div>
                 </div>

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

@@ -27,22 +27,22 @@
                         <div class="hidden-xs" id="roleTableToolbar" role="group">
                             <if condition="chkCommission('/admin/role/add','/role/add')">                                
                                 <button type="button" class="btn btn-sm btn-primary " onclick="Role.openAddRole()">
-                                    <i class="fa fa-search"></i>添加
+                                    <i class="fa fa-plus"></i>添加
                                 </button>
                             </if>
                             <if condition="chkCommission('/admin/role/edit','/role/edit')"> 
                                 <button type="button" class="btn btn-sm btn-primary " onclick="Role.openChangeRole()">
-                                    <i class="fa fa-search"></i>修改
+                                    <i class="fa fa-edit"></i>修改
                                 </button>  
                             </if>
                             <if condition="chkCommission('/admin/role/remove','/role/remove')">   
                                 <button type="button" class="btn btn-sm btn-primary " onclick="Role.delRole()">
-                                    <i class="fa fa-search"></i>删除
+                                    <i class="fa fa-delete"></i>删除
                                 </button>
                             </if>
                             <if condition="chkCommission('/admin/role/setAuthority','/role/setAuthority')">   
                                 <button type="button" class="btn btn-sm btn-primary " onclick="Role.assign()">
-                                    <i class="fa fa-search"></i>权限配置
+                                    <i class="fa fa-user-secret"></i>权限配置
                                 </button>
                             </if>
                         </div>

+ 30 - 0
app/common.php

@@ -36,3 +36,33 @@ function simple_hash($algo = 'md5', $password = '', $salt = '', $hash_iterations
 function chkCommission($url, $old_url) {
     return app\common\api\MenuApi::chkPermission($url, $old_url);
 }
+
+/**
+ * 随机字符ID
+ * @return type
+ */
+function getStringId() {
+    $day = random_int(10, 30);
+    $time = strtotime("-4 years -6 months -" . $day . " days");
+    $randnum = random_int(100000000, 999999999);
+    $randnum = str_shuffle($randnum);
+    return $time . $randnum;
+}
+
+function isNullOrEmpty($obj) {
+    if (!$obj || $obj == "" || !isset($obj))
+        return "";
+    return $obj;
+}
+
+function getTreeList($array, $id_field = "id", $pid_field = "pid", $value = "0") {
+    static $result = [];
+    foreach ($array as $key => $item) {
+        if ($value == $item[$pid_field]) {
+            $result[] = $item;
+            unset($array[$key]);
+            getTreeList($array, $id_field, $pid_field, $item[$id_field]);
+        }
+    }
+    return $result;
+}

+ 146 - 0
app/common/api/BatchApi.php

@@ -0,0 +1,146 @@
+<?php
+
+namespace app\common\api;
+
+use app\common\model\Batch;
+
+/**
+ * Description of BatchApi
+ *
+ * @author sgq
+ */
+class BatchApi {
+
+    public static function getOne($id) {
+        return Batch::findOrEmpty($id)->toArray();
+    }
+
+    public static function getList($request) {
+        $order = trim($request->param("order")) ?: "desc";
+        $offset = trim($request->param("offset")) ?: 0;
+        $limit = trim($request->param("limit")) ?: 10;
+        $type = trim($request->param("type"));
+        $active = trim($request->param("active"));
+        $where = [];
+        if ($type) {
+            $where[] = ["type", "=", $type];
+        }
+        if ($active) {
+            $where[] = ["active", "=", $active];
+        }
+        $count = Batch::where($where)->count();
+        $list = Batch::where($where)->limit($offset, $limit)->order("createTime " . $order)->select()->toArray();
+        $projects = DictApi::selectByParentCode("un_project"); //申报类型
+        foreach ($list as $key => $item) {
+            $list[$key]["type"] = $projects[$item["type"]];
+        }
+        return ["total" => $count, "rows" => $list];
+    }
+
+    public static function create($params) {
+        if (!$params["type"])
+            return ["msg" => "申报类别不能为空"];
+        if (!$params["batch"])
+            return ["msg" => "批次不能为空"];
+        $where[] = ["type", "=", $params["type"]];
+        $where[] = ["batch", "=", $params["batch"]];
+        $count = Batch::where($where)->count();
+        if ($count > 0) {
+            return ["msg" => "该申报类别的批次重复"];
+        }
+        if (!strtotime($params["startTime"]) && $params["startTime"]) {
+            return ["msg" => "申报开始时间错误"];
+        }
+        if (!strtotime($params["endTime"]) && $params["endTime"]) {
+            return ["msg" => "申报截止时间错误"];
+        }
+        if (!strtotime($params["submitEndTime"]) && $params["submitEndTime"]) {
+            return ["msg" => "提交截止时间错误"];
+        }
+        if (!strtotime($params["publicStartTime"]) && $params["publicStartTime"]) {
+            return ["msg" => "公示开始时间错误"];
+        }
+        if (!strtotime($params["publicEndTime"]) && $params["publicEndTime"]) {
+            return ["msg" => "公示截止时间错误"];
+        }
+
+        $id = getStringId();
+        $data["id"] = $id;
+        $data["type"] = $params["type"];
+        $data["source"] = $params["source"];
+        $data["batch"] = $params["batch"];
+        $data["active"] = $params["active"] ?: 2;
+        $data["description"] = $params["description"];
+        $data["type"] = $params["type"];
+        $data["startTime"] = $params["startTime"];
+        $data["endTime"] = $params["endTime"];
+        $data["submitEndTime"] = $params["submitEndTime"];
+        $data["publicStartTime"] = $params["publicStartTime"];
+        $data["publicEndTime"] = $params["publicEndTime"];
+        $data["averageWage"] = $params["averageWage"];
+        $data["createTime"] = date("Y-m-d H:i:s");
+        $data["createUser"] = session("user")["uid"];
+        Batch::insert($data);
+        return ["code" => 200, "msg" => "成功"];
+    }
+
+    public static function update($params) {
+        if (!$params["type"])
+            return ["msg" => "申报类别不能为空"];
+        if (!$params["batch"])
+            return ["msg" => "批次不能为空"];
+        $where[] = ["type", "=", $params["type"]];
+        $where[] = ["batch", "=", $params["batch"]];
+        $where[] = ["id", "<>", $params["id"]];
+        $count = Batch::where($where)->count();
+        if ($count > 0) {
+            return ["msg" => "该申报类别的批次重复"];
+        }
+        if (!strtotime($params["startTime"]) && $params["startTime"]) {
+            return ["msg" => "申报开始时间错误"];
+        }
+        if (!strtotime($params["endTime"]) && $params["endTime"]) {
+            return ["msg" => "申报截止时间错误"];
+        }
+        if (!strtotime($params["submitEndTime"]) && $params["submitEndTime"]) {
+            return ["msg" => "提交截止时间错误"];
+        }
+        if (!strtotime($params["publicStartTime"]) && $params["publicStartTime"]) {
+            return ["msg" => "公示开始时间错误"];
+        }
+        if (!strtotime($params["publicEndTime"]) && $params["publicEndTime"]) {
+            return ["msg" => "公示截止时间错误"];
+        }
+
+        $data["id"] = $params["id"];
+        $data["type"] = $params["type"];
+        $data["source"] = $params["source"];
+        $data["batch"] = $params["batch"];
+        $data["active"] = $params["active"] ?: 2;
+        $data["description"] = $params["description"];
+        $data["type"] = $params["type"];
+        $data["startTime"] = $params["startTime"];
+        $data["endTime"] = $params["endTime"];
+        $data["submitEndTime"] = $params["submitEndTime"];
+        $data["publicStartTime"] = $params["publicStartTime"];
+        $data["publicEndTime"] = $params["publicEndTime"];
+        $data["averageWage"] = $params["averageWage"];
+        $data["updateTime"] = date("Y-m-d H:i:s");
+        $data["updateUser"] = session("user")["uid"];
+        \think\facade\Db::table("sys_batch")->update($data);
+        return ["code" => 200, "msg" => "成功"];
+    }
+
+    public static function delete($id) {
+        Batch::where(["id" => $id])->delete();
+        return ["code" => 200, "msg" => "成功"];
+    }
+
+    public static function setActive($id, $active) {
+        $data["id"] = $id;
+        $data["active"] = $active ?: 2;
+        Batch::update($data);
+        return ["code" => 200, "msg" => "成功"];
+    }
+
+}

+ 40 - 1
app/common/api/DictApi.php

@@ -21,7 +21,7 @@ class DictApi {
         if (self::isExistByCode($data["code"]))
             return ["msg" => sprintf("编码[%s]已经存在", $data["code"])];
         $items = array_filter(explode(";", $values));
-        $id = Dict::table('sys_dict')->insertGetId($data);
+        $id = Dict::insertGetId($data);
         $childs = [];
         for ($i = 0; $i < count($items); $i++) {
             $fields = array_filter(explode(":", $items[$i]));
@@ -31,6 +31,34 @@ class DictApi {
         return ["code" => 200, "msg" => "成功"];
     }
 
+    public static function update($params) {
+        $data["id"] = $params["dictId"];
+        $data["code"] = $params["dictCode"];
+        $data["name"] = $params["dictName"];
+        $data["tips"] = $params["dictTips"];
+        $data["pid"] = 0;
+        $values = $params["dictValues"];
+        if (self::isExistByCode($data["code"], $params["dictId"]))
+            return ["msg" => sprintf("编码[%s]已经存在", $data["code"])];
+        $items = array_filter(explode(";", $values));
+        $id = Dict::table('sys_dict')->save($data);
+        //删除原来的子项
+        Dict::where(["pid" => $params["dictId"]])->delete();
+        $childs = [];
+        for ($i = 0; $i < count($items); $i++) {
+            $fields = array_filter(explode(":", $items[$i]));
+            $childs[] = ["pid" => $params["dictId"], "code" => $fields[0], "name" => $fields[1], "num" => $fields[2]];
+        }
+        Dict::insertAll($childs);
+        return ["code" => 200, "msg" => "成功"];
+    }
+
+    public static function delete($id) {
+        Dict::where(["id" => $id])->delete();
+        Dict::where(["pid" => $id])->delete();
+        return ["code" => 200, "msg" => "成功"];
+    }
+
     public static function isExistByCode($code, $id = 0) {
         $where = [];
         if ($id > 0) {
@@ -94,4 +122,15 @@ class DictApi {
         return $tmp;
     }
 
+    /**
+     * 
+     * @param type $code
+     * @return type
+     */
+    public static function findChildDictByCode($code) {
+        $parent = Dict::where("code", $code)->findOrEmpty()->toArray();
+        $dictList = Dict::where("pid", $parent["id"])->select()->toArray();
+        return $dictList;
+    }
+
 }

+ 2 - 2
app/common/api/MenuApi.php

@@ -63,8 +63,8 @@ class MenuApi {
         $menus = [];
         $menus[] = ["type" => [1, 2, 3], "code" => "qyzx", "pcode" => "0", "name" => "企业用户中心", "url" => "", "icon" => "fa-user"];
         $menus[] = ["type" => [1, 2], "code" => "yhfk", "pcode" => "0", "name" => "用户反馈", "url" => "", "icon" => "fa-bug"];
-        $menus[] = ["type" => [1, 2], "code" => "rcrd", "pcode" => "0", "name" => "人才认定", "url" => "", "icon" => "fa-thumbs-o-up"];
-        $menus[] = ["type" => [1, 2], "code" => "rcrdsb", "pcode" => "rcrd", "name" => "人才认定申报", "url" => "", "icon" => "fa-thumbs-up"];
+        $menus[] = ["type" => [1, 2], "code" => "rcrd", "pcode" => "0", "name" => "人才认定", "url" => "#", "icon" => "fa-thumbs-o-up"];
+        $menus[] = ["type" => [1, 2], "code" => "rcrdsb", "pcode" => "rcrd", "name" => "人才认定申报", "url" => "/enterprise/talent", "icon" => "fa-thumbs-up"];
         $menus[] = ["type" => [1, 2], "code" => "yxrck", "pcode" => "rcrd", "name" => "优秀人才库", "url" => "", "icon" => "fa-thumbs-up"];
         $menus[] = ["type" => [1, 2], "code" => "lzsb", "pcode" => "rcrd", "name" => "离职申报", "url" => "", "icon" => "fa-thumbs-up"];
         $menus[] = ["type" => [1, 2], "code" => "gzdwbg", "pcode" => "rcrd", "name" => "工作单位变更", "url" => "", "icon" => "fa-thumbs-up"];

+ 3 - 3
app/common/api/UserApi.php

@@ -28,15 +28,15 @@ class UserApi {
         switch ($usertype) {
             case 2:
                 //企业
-                $user = Enterprise::where(['username' => $username])->find();
+                $user = Enterprise::where(['username' => $username])->findOrEmpty();
                 break;
             case 3:
                 //个人
-                $user = Person::where('username', $username)->find();
+                $user = Person::where('username', $username)->findOrEmpty();
                 break;
             default:
                 //管理员
-                $user = User::where(['account' => $username])->find();
+                $user = User::where(['account' => $username])->findOrEmpty();
                 break;
         }
         $this->info = $user;

+ 16 - 0
app/common/model/Batch.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+/**
+ * Description of Batch
+ *
+ * @author sgq
+ */
+class Batch extends Model {
+
+    protected $table = "sys_batch";
+
+}

+ 53 - 51
public/static/modular/system/batch/batch.js

@@ -2,45 +2,47 @@
  * 批次管理管理初始化
  */
 var Batch = {
-    id: "BatchTable",	//表格id
-    seItem: null,		//选中的条目
+    id: "BatchTable", //表格id
+    seItem: null, //选中的条目
     table: null,
     layerIndex: -1
 };
-
+Feng.ctxPath = "/admin";
 /**
  * 初始化表格的列
  */
 Batch.initColumn = function () {
     return [
         {field: 'selectItem', radio: true},
-            {title: '申报类别', field: 'type', visible: true, align: 'center', valign: 'middle'},
-            {title: '人才类型', field: 'source', visible: true, align: 'center', valign: 'middle',
-                formatter: function (value, row, index) {
-                    if(value == 1) {
-                        return "晋江市优秀人才";
-                    }if(value == 2) {
-                        return "晋江市集成电路优秀人才";
-                    }
+        {title: '申报类别', field: 'type', visible: true, align: 'center', valign: 'middle'},
+        {title: '人才类型', field: 'source', visible: true, align: 'center', valign: 'middle',
+            formatter: function (value, row, index) {
+                if (value == 1) {
+                    return "晋江市优秀人才";
+                }
+                if (value == 2) {
+                    return "晋江市集成电路优秀人才";
+                }
+            }
+        },
+        {title: '申报批次', field: 'batch', visible: true, align: 'center', valign: 'middle'},
+        {title: '申报开始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle'},
+        {title: '申报截止时间', field: 'endTime', visible: true, align: 'center', valign: 'middle'},
+        {title: '提交截止时间', field: 'submitEndTime', visible: true, align: 'center', valign: 'middle'},
+        {title: '公示开始时间', field: 'publicStartTime', visible: true, align: 'center', valign: 'middle'},
+        {title: '公示截止时间', field: 'publicEndTime', visible: true, align: 'center', valign: 'middle'},
+        {title: '平均工资', field: 'averageWage', visible: true, align: 'center', valign: 'middle'},
+        {title: '是否有效', field: 'active', visible: true, align: 'center', valign: 'middle',
+            formatter: function (value, row, index) {
+                if (value == 1) {
+                    return "<span style='color: green'>是</span>";
                 }
-            },
-            {title: '申报批次', field: 'batch', visible: true, align: 'center', valign: 'middle'},
-            {title: '申报开始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle'},
-            {title: '申报截止时间', field: 'endTime', visible: true, align: 'center', valign: 'middle'},
-            {title: '提交截止时间', field: 'submitEndTime', visible: true, align: 'center', valign: 'middle'},
-            {title: '公示开始时间', field: 'publicStartTime', visible: true, align: 'center', valign: 'middle'},
-            {title: '公示截止时间', field: 'publicEndTime', visible: true, align: 'center', valign: 'middle'},
-            {title: '平均工资', field: 'averageWage', visible: true, align: 'center', valign: 'middle'},
-            {title: '是否有效', field: 'active', visible: true, align: 'center', valign: 'middle',
-                formatter: function (value, row, index) {
-                    if(value == 1) {
-                        return "<span style='color: green'>是</span>";
-                    }if(value == 2) {
-                        return "<span style='color: red'>否</span>";
-                    }
+                if (value == 2) {
+                    return "<span style='color: red'>否</span>";
                 }
-            },
-            {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'}
+            }
+        },
+        {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'}
 
     ];
 };
@@ -50,10 +52,10 @@ Batch.initColumn = function () {
  */
 Batch.check = function () {
     var selected = $('#' + this.id).bootstrapTable('getSelections');
-    if(selected.length == 0){
+    if (selected.length == 0) {
         Feng.info("请先选中表格中的某一记录!");
         return false;
-    }else{
+    } else {
         Batch.seItem = selected[0];
         return true;
     }
@@ -69,7 +71,7 @@ Batch.openAddBatch = function () {
         area: ['800px', '420px'], //宽高
         fix: false, //不固定
         maxmin: true,
-        content: Feng.ctxPath + '/batch/batch_add'
+        content: Feng.ctxPath + '/batch/add'
     });
     Batch.layerIndex = index;
 };
@@ -85,7 +87,7 @@ Batch.openBatchDetail = function () {
             area: ['800px', '420px'], //宽高
             fix: false, //不固定
             maxmin: true,
-            content: Feng.ctxPath + '/batch/batch_update/' + Batch.seItem.id
+            content: Feng.ctxPath + '/batch/edit/id/' + Batch.seItem.id
         });
         Batch.layerIndex = index;
     }
@@ -96,14 +98,14 @@ Batch.openBatchDetail = function () {
  */
 Batch.delete = function () {
     if (this.check()) {
-        var operation = function(){
+        var operation = function () {
             var ajax = new $ax(Feng.ctxPath + "/batch/delete", function (data) {
                 Feng.success("删除成功!");
                 Batch.table.refresh();
             }, function (data) {
                 Feng.error("删除失败!" + data.responseJSON.message + "!");
             });
-            ajax.set("batchId",Batch.seItem.id);
+            ajax.set("batchId", Batch.seItem.id);
             ajax.start();
         };
         Feng.confirm("是否刪除该批次?", operation);
@@ -114,7 +116,7 @@ Batch.delete = function () {
  * 查询表单提交参数对象
  * @returns {{}}
  */
-Batch.formParams = function() {
+Batch.formParams = function () {
     var queryData = {};
     queryData['type'] = $("#type").val();
     queryData['source'] = $("#source").val();
@@ -133,7 +135,7 @@ Batch.search = function () {
 /**
  * 重置
  */
-Batch.reset = function (){
+Batch.reset = function () {
     $("#type").val("");
     $("#active").val("");
     $("#source").val("");
@@ -142,48 +144,48 @@ Batch.reset = function (){
 /**
  * 设置生效
  */
-Batch.setActive = function (){
+Batch.setActive = function () {
     if (this.check()) {
-        if(Batch.seItem.active==1){
+        if (Batch.seItem.active == 1) {
             Feng.error("该批次已生效,无需再次操作");
-            return ;
+            return;
         }
-        var operation = function(){
-            var ajax = new $ax(Feng.ctxPath + "/batch/setupActive", function (data) {
-                if(data.code=="200"){
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/batch/setActive", function (data) {
+                if (data.code == "200") {
                     Feng.success(data.msg);
                     Batch.table.refresh();
-                }else{
+                } else {
                     Feng.error(data.msg);
                 }
             }, function (data) {
                 Feng.error("设置生效失败!" + data.responseJSON.message + "!");
             });
-            ajax.set("batchId",Batch.seItem.id);
+            ajax.set("batchId", Batch.seItem.id);
             ajax.start();
         };
         Feng.confirm("一旦设置生效,该类别其他批次将无效,确认生效吗?", operation);
     }
 }
 
-Batch.setNotActive = function(){
+Batch.setNotActive = function () {
     if (this.check()) {
-        if(Batch.seItem.active==2){
+        if (Batch.seItem.active == 2) {
             Feng.error("该批次未生效,无需再次操作");
-            return ;
+            return;
         }
-        var operation = function(){
+        var operation = function () {
             var ajax = new $ax(Feng.ctxPath + "/batch/setNotActive", function (data) {
-                if(data.code=="200"){
+                if (data.code == "200") {
                     Feng.success(data.msg);
                     Batch.table.refresh();
-                }else{
+                } else {
                     Feng.error(data.msg);
                 }
             }, function (data) {
                 Feng.error("设置失效失败!" + data.responseJSON.message + "!");
             });
-            ajax.set("batchId",Batch.seItem.id);
+            ajax.set("batchId", Batch.seItem.id);
             ajax.start();
         };
         Feng.confirm("确认设置失效吗?", operation);

+ 37 - 35
public/static/modular/system/batch/batch_info.js

@@ -1,8 +1,9 @@
 /**
  * 初始化批次管理详情对话框
  */
+Feng.ctxPath = "/admin";
 var BatchInfoDlg = {
-    batchInfoData : {},
+    batchInfoData: {},
     validateFields: {
         type: {
             validators: {
@@ -23,9 +24,9 @@ var BatchInfoDlg = {
                 notEmpty: {
                     message: '申报批次不能为空'
                 },
-                regexp :{
+                regexp: {
                     regexp: /^\d+$/,
-                    message:"只能输入数字"
+                    message: "只能输入数字"
                 }
             }
         },
@@ -56,7 +57,7 @@ var BatchInfoDlg = {
 /**
  * 清除数据
  */
-BatchInfoDlg.clearData = function() {
+BatchInfoDlg.clearData = function () {
     this.batchInfoData = {};
 }
 
@@ -66,7 +67,7 @@ BatchInfoDlg.clearData = function() {
  * @param key 数据的名称
  * @param val 数据的具体值
  */
-BatchInfoDlg.set = function(key, val) {
+BatchInfoDlg.set = function (key, val) {
     this.batchInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
     return this;
 }
@@ -77,34 +78,34 @@ BatchInfoDlg.set = function(key, val) {
  * @param key 数据的名称
  * @param val 数据的具体值
  */
-BatchInfoDlg.get = function(key) {
+BatchInfoDlg.get = function (key) {
     return $("#" + key).val();
 }
 
 /**
  * 关闭此对话框
  */
-BatchInfoDlg.close = function() {
+BatchInfoDlg.close = function () {
     parent.layer.close(window.parent.Batch.layerIndex);
 }
 
 /**
  * 收集数据
  */
-BatchInfoDlg.collectData = function() {
+BatchInfoDlg.collectData = function () {
     this
-    .set('id')
-    .set('type')
-    .set('source')
-    .set('batch')
-    .set('startTime')
-    .set('endTime')
-    .set('submitEndTime')
-    .set('publicStartTime')
-    .set('publicEndTime')
-    .set('averageWage')
-    .set('active')
-    .set('description');
+            .set('id')
+            .set('type')
+            .set('source')
+            .set('batch')
+            .set('startTime')
+            .set('endTime')
+            .set('submitEndTime')
+            .set('publicStartTime')
+            .set('publicEndTime')
+            .set('averageWage')
+            .set('active')
+            .set('description');
 }
 
 /**
@@ -120,22 +121,22 @@ BatchInfoDlg.validate = function () {
 /**
  * 提交添加
  */
-BatchInfoDlg.addSubmit = function() {
+BatchInfoDlg.addSubmit = function () {
     this.clearData();
     this.collectData();
     if (!this.validate()) {
         return;
     }
     //提交信息
-    var ajax = new $ax(Feng.ctxPath + "/batch/add", function(data){
-        if(data.code=="200"){
+    var ajax = new $ax(Feng.ctxPath + "/batch/add", function (data) {
+        if (data.code == "200") {
             Feng.success(data.msg);
             window.parent.Batch.table.refresh();
             BatchInfoDlg.close();
-        }else{
+        } else {
             Feng.error(data.msg);
         }
-    },function(data){
+    }, function (data) {
         Feng.error("添加失败!" + data.responseJSON.message + "!");
     });
     ajax.set(this.batchInfoData);
@@ -145,29 +146,29 @@ BatchInfoDlg.addSubmit = function() {
 /**
  * 提交修改
  */
-BatchInfoDlg.editSubmit = function() {
+BatchInfoDlg.editSubmit = function () {
     this.clearData();
     this.collectData();
     if (!this.validate()) {
         return;
     }
     //提交信息
-    var ajax = new $ax(Feng.ctxPath + "/batch/update", function(data){
-        if(data.code=="200"){
+    var ajax = new $ax(Feng.ctxPath + "/batch/edit", function (data) {
+        if (data.code == "200") {
             Feng.success(data.msg);
             window.parent.Batch.table.refresh();
             BatchInfoDlg.close();
-        }else{
+        } else {
             Feng.error(data.msg);
         }
-    },function(data){
+    }, function (data) {
         Feng.error("修改失败!" + data.responseJSON.message + "!");
     });
     ajax.set(this.batchInfoData);
     ajax.start();
 }
 
-$(function() {
+$(function () {
     Feng.initValidator("batchInfoForm", BatchInfoDlg.validateFields);
     //下拉框数据动态加载
     Feng.addAjaxSelect({
@@ -178,15 +179,16 @@ $(function() {
         "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_project"
     });
     //批量加载时间控件
-    $("input[time='time']").each(function(){
+    $("input[time='time']").each(function () {
         laydate.render({
-             elem: "#"+$(this).attr("id")
-            ,type: $(this).attr("format")
-            ,trigger: 'click'
+            elem: "#" + $(this).attr("id")
+            , type: $(this).attr("format")
+            , trigger: 'click'
         });
     });
     //下拉框数据回显
     $("select").each(function () {
+        console.log($(this).attr("selectVal"))
         $(this).val($(this).attr("selectVal"));
     });
 });

+ 7 - 3
public/static/modular/system/dict/dict_info.js

@@ -107,9 +107,13 @@ DictInfoDlg.addSubmit = function () {
 DictInfoDlg.editSubmit = function () {
     this.collectData();
     var ajax = new $ax(Feng.ctxPath + "/dict/edit", function (data) {
-        Feng.success("修改成功!");
-        window.parent.Dict.table.refresh();
-        DictInfoDlg.close();
+        if (data.code == 200) {
+            Feng.success("修改成功!");
+            window.parent.Dict.table.refresh();
+            DictInfoDlg.close();
+        } else {
+            Feng.error(data.msg);
+        }
     }, function (data) {
         Feng.error("修改失败!" + data.responseJSON.message + "!");
     });

+ 3 - 3
public/static/modular/system/role/role.js

@@ -63,7 +63,7 @@ Role.openChangeRole = function () {
             area: ['800px', '450px'], //宽高
             fix: false, //不固定
             maxmin: true,
-            content: '/admin/role/edit/' + this.seItem.id
+            content: '/admin/role/edit/id/' + this.seItem.id
         });
         this.layerIndex = index;
     }
@@ -76,7 +76,7 @@ Role.delRole = function () {
     if (this.check()) {
 
         var operation = function(){
-            var ajax = new $ax("/admin/role/remove", function () {
+            var ajax = new $ax("/admin/role/delete", function () {
                 Feng.success("删除成功!");
                 Role.table.refresh();
             }, function (data) {
@@ -101,7 +101,7 @@ Role.assign = function () {
             area: ['300px', '450px'], //宽高
             fix: false, //不固定
             maxmin: true,
-            content: '/admin/role/assign/' + this.seItem.id
+            content: '/admin/role/assign/id/' + this.seItem.id
         });
         this.layerIndex = index;
     }

+ 3 - 3
public/static/modular/system/role/role_info.js

@@ -172,7 +172,7 @@ RolInfoDlg.editSubmit = function () {
         window.parent.Role.table.refresh();
         RolInfoDlg.close();
     }, function (data) {
-        Feng.error("修改失败!" + data.responseJSON.message + "!");
+        Feng.error("修改失败!" + data.msg + "!");
     });
     ajax.set(this.roleInfoData);
     ajax.start();
@@ -181,13 +181,13 @@ RolInfoDlg.editSubmit = function () {
 $(function () {
     Feng.initValidator("roleInfoForm", RolInfoDlg.validateFields);
 
-    var deptTree = new $ZTree("deptTree", "/admin/dept/tree");
+    var deptTree = new $ZTree("deptTree", "/admin/dept/treelist");
     deptTree.bindOnClick(RolInfoDlg.onClickDept);
     deptTree.bindOnDblClick(RolInfoDlg.onDblClickDept)
     deptTree.init();
     RolInfoDlg.deptZtree = deptTree;
 
-    var pNameTree = new $ZTree("pNameTree", "/admin/role/roleTreeList");
+    var pNameTree = new $ZTree("pNameTree", "/admin/role/treelist");
     pNameTree.bindOnClick(RolInfoDlg.onClickPName);
     pNameTree.init();
     RolInfoDlg.pNameZtree = pNameTree;

+ 2 - 0
vendor/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore