byzhenyu hai 1 ano
pai
achega
e2ed067d13

+ 114 - 0
application/approve/controller/ApproveFlow.php

@@ -0,0 +1,114 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\approve\controller;
+
+use app\common\constant\CommonConstant;
+use app\common\constant\EvectionConstant;
+use app\common\constant\LeaveConstant;
+use app\common\constant\MaintainConstant;
+use library\Controller;
+
+/**
+ * 审批流程设置
+ */
+class ApproveFlow extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'ApproveFlow';
+
+    /**
+     * 列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function index()
+    {
+        $module = input('module');
+        $get_item_list = [];
+        switch ($module){
+            case CommonConstant::MODULE_5:
+                $get_item_list = EvectionConstant::get_type_list();
+                break;
+            case CommonConstant::MODULE_6:
+                $get_item_list = LeaveConstant::get_time_list();
+                break;
+            case CommonConstant::MODULE_8:
+                $get_item_list = MaintainConstant::get_type_list();
+                break;
+        }
+        $this->get_item_list = $get_item_list;
+        $this->get_type_list = CommonConstant::get_type_list();
+        $this->get_module_list = CommonConstant::get_module_list();
+        $this->title = $this->get_module_list[$module].'审批流程';
+        $query = $this->_query($this->table)
+            ->where('module',$module);
+        $query->page(false);
+    }
+
+    /**
+     * 列表数据处理
+     * @param array $data
+     * @throws \Exception
+     */
+    protected function _index_page_filter(&$data)
+    {
+        foreach ($data as &$value) {
+        }
+    }
+
+    /**
+     * 编辑
+     * @auth true
+     */
+    public function edit()
+    {
+        $this->title = '编辑';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _form_filter(&$data)
+    {
+        if($this->request->isGet()) {
+//            $this->all_user = User::where('is_deleted',0)->column('name','id');
+        }
+    }
+
+    /**
+     * 列表
+     */
+    public function flow()
+    {
+        $this->title = '审批流';
+        $list = CommonConstant::get_module_list();
+        return $this->fetch('', compact("list"));
+    }
+}

+ 27 - 0
application/approve/view/approve_flow/flow.html

@@ -0,0 +1,27 @@
+{extend name='admin@main'}
+
+{block name="content"}
+<div class="think-box-shadow">
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='text-left nowrap'>名称</th>
+            <th class="text-center" style="width: 20%">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left'>{$vo|default='--'}</td>
+            <td class='text-center nowrap'>
+                <a class="layui-btn layui-btn-xs" data-href="/admin.html#{:url('index')}?module={$key}">编 辑</a>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没 有 记 录 哦!</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}

+ 35 - 0
application/approve/view/approve_flow/form.html

@@ -0,0 +1,35 @@
+<style>
+
+</style>
+<div class="think-box-shadow">
+    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+        <div class="layui-card-body">
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">审批类型</label>
+                <div class="layui-input-block">
+                    <select class="layui-select" name="type" >
+                        {foreach [1=>'审批人',2=>'抄送人'] as $tk=>$tv}
+                         <option value="{$tk}" {if isset($vo.type) && $vo.type == $tk}selected{/if}>{$tv}</option>
+                        {/foreach}
+                    </select>
+                </div>
+            </div>
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">审批顺序</label>
+                <div class="layui-input-block">
+                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入审批序号" class="layui-input">
+                </div>
+            </div>
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+            <div class="layui-form-item text-center">
+                <button class="layui-btn" type='submit'>保 存</button>
+                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定取消编辑吗?" data-close>取消编辑</button>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+    </script>
+</div>

+ 40 - 0
application/approve/view/approve_flow/index.html

@@ -0,0 +1,40 @@
+{extend name='admin@main'}
+
+{block name="button"}
+
+<button class="layui-btn layui-btn-sm layui-btn-primary" type='button' data-href="/admin.html#{:url('flow')}">返回</button>
+
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='approve_flow/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='text-left nowrap'>审批流类型</th>
+            <th class='text-left nowrap'>审批流项</th>
+            <th class="text-center" style="width: 20%">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>
+                {eq name='vo.flow_type' value='0'}--{else}{$get_type_list[$vo.flow_type]}{/eq}
+            </td>
+            <td class='text-left nowrap'>
+                {eq name='vo.flow_item' value='0'}--{else}{$get_item_list[$vo.flow_item]}{/eq}
+            </td>
+            <td class='text-center nowrap'>
+                <a data-dbclick class="layui-btn layui-btn-xs" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没 有 记 录 哦!</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}

+ 1 - 0
application/approve/view/approve_flow/index_search.html

@@ -0,0 +1 @@
+

+ 28 - 12
application/common/constant/CommonConstant.php

@@ -120,18 +120,6 @@ class CommonConstant
         ];
     }
 
-    // 用户状态:0=已禁用,1=正常
-    const STATUS_FROZEN = '0';
-    const STATUS_NORMAL = '1';
-
-    public static function get_status_list()
-    {
-        return [
-            self::STATUS_FROZEN => '已禁用',
-            self::STATUS_NORMAL => '正常',
-        ];
-    }
-
     // 审批流类型:1=审批人,2=抄送人
     const TYPE_1 = '1';
     const TYPE_2 = '2';
@@ -161,6 +149,34 @@ class CommonConstant
         ];
     }
 
+    // 用户状态:0=已禁用,1=正常
+    const STATUS_FROZEN = '0';
+    const STATUS_NORMAL = '1';
+
+    public static function get_status_list()
+    {
+        return [
+            self::STATUS_FROZEN => '已禁用',
+            self::STATUS_NORMAL => '正常',
+        ];
+    }
+
+    // 用户签名状态:1=未操作,2=待审核,3=审核通过,4=审核驳回
+    const SIGNATURE_STATUS_1 = '1';
+    const SIGNATURE_STATUS_2 = '2';
+    const SIGNATURE_STATUS_3 = '3';
+    const SIGNATURE_STATUS_4 = '4';
+
+    public static function get_signature_status_list()
+    {
+        return [
+            self::SIGNATURE_STATUS_1 => '未操作',
+            self::SIGNATURE_STATUS_2 => '待审核',
+            self::SIGNATURE_STATUS_3 => '审核通过',
+            self::SIGNATURE_STATUS_4 => '审核驳回',
+        ];
+    }
+
     // 方式:create=申请,update=重新发起,edit=审批人修改
     const create = 'create';
     const update = 'update';

+ 2 - 4
application/user/controller/Department.php

@@ -31,7 +31,7 @@ class Department extends Controller
     protected $table = 'Department';
 
     /**
-     * 部门列表
+     * 列表
      * @auth true
      * @menu true
      * @throws \think\Exception
@@ -45,9 +45,7 @@ class Department extends Controller
         $query = $this->_query($this->table)
             ->where('is_deleted',CommonConstant::IS_DELETED_0)
             ->field('dept_id as id,name,parent_id as pid');
-        $result = $query->page(false,false);
-        $list = $result['list'];
-        return $this->fetch('', compact("list"));
+        $query->page(false);
     }
 
     /**

+ 39 - 7
application/user/controller/Member.php

@@ -16,10 +16,11 @@
 namespace app\user\controller;
 
 use app\common\constant\CommonConstant;
+use app\common\model\Department;
 use library\Controller;
 
 /**
- * 用户
+ * 员工
  */
 class Member extends Controller
 {
@@ -30,7 +31,7 @@ class Member extends Controller
     protected $table = 'StoreMember';
 
     /**
-     * 用户列表
+     * 列表
      * @auth true
      * @menu true
      * @throws \think\Exception
@@ -41,13 +42,18 @@ class Member extends Controller
     public function index()
     {
         $status = input('status');
+        $signature_status = input('signature_status');
         $this->get_status_list = CommonConstant::get_status_list();
-        $this->title = '用户列表';
+        $this->get_signature_status_list = CommonConstant::get_signature_status_list();
+        $this->title = '员工列表';
         $query = $this->_query($this->table)
             ->where('is_deleted', CommonConstant::IS_DELETED_0)
             ->when(array_key_exists($status, $this->get_status_list), function ($query) use ($status) {
                 $query->where('status', $status);
             })
+            ->when(array_key_exists($signature_status, $this->get_signature_status_list), function ($query) use ($signature_status) {
+                $query->where('signature_status', $signature_status);
+            })
             ->like('name,mobile');
         $query->page();
     }
@@ -59,7 +65,16 @@ class Member extends Controller
      */
     protected function _index_page_filter(&$data)
     {
+        $department_list = Department::column('dept_id,name');
         foreach ($data as &$value) {
+            $department_ids = explode(',',$value['department']);
+            $department = '';
+            foreach ($department_ids as $val){
+                if(array_key_exists($val,$department_list)){
+                    $department .= $department_list[$val].',';
+                }
+            }
+            $value['department_text'] = $department;
         }
     }
 
@@ -69,7 +84,7 @@ class Member extends Controller
     }
 
     /**
-     * 编辑用户
+     * 编辑
      * @auth true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -79,12 +94,12 @@ class Member extends Controller
      */
     public function edit()
     {
-        $this->title = '编辑用户';
+        $this->title = '编辑';
         $this->_form($this->table, 'form');
     }
 
     /**
-     * 启用用户
+     * 启用
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
@@ -96,14 +111,31 @@ class Member extends Controller
     }
 
     /**
-     * 禁用用户
+     * 禁用
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
     public function forbid()
     {
+        $this->applyCsrfToken();
         $this->_save($this->table, ['status' => CommonConstant::STATUS_FROZEN]);
     }
 
+    /**
+     * 审核签名
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function signature_status()
+    {
+        $signature_status = input('signature_status');
+        if(!array_key_exists($signature_status,CommonConstant::get_signature_status_list())){
+            $this->controller->error('审核状态参数错误');
+        }
+        $this->applyCsrfToken();
+        $this->_save($this->table, ['signature_status' => $signature_status]);
+    }
+
 }

+ 0 - 2
application/user/view/department/index_search.html

@@ -1,2 +0,0 @@
-<fieldset>
-</fieldset>

+ 12 - 2
application/user/view/member/index.html

@@ -7,7 +7,7 @@
 {/if}
 
 {if auth("forbid")}
-<button class="layui-btn layui-btn-xs layui-btn-primary" data-confirm="确定要批量禁用吗?" data-action="{:url('forbid')}" data-csrf="{:systoken('forbid')}" data-rule="id#{key}">批量禁用</button>
+<button class="layui-btn layui-btn-sm layui-btn-primary" data-confirm="确定要批量禁用吗?" data-action="{:url('forbid')}" data-csrf="{:systoken('forbid')}" data-rule="id#{key}">批量禁用</button>
 {/if}
 
 {/block}
@@ -30,7 +30,9 @@
             <th class='text-left nowrap'>昵称</th>
             <th class='text-left nowrap'>手机号码</th>
             <th class='text-left nowrap'>职位</th>
-            <th class='text-left nowrap'>用户状态</th>
+            <th class='text-left nowrap'>所属部门</th>
+            <th class='text-left nowrap'>状态</th>
+            <th class='text-left nowrap'>签名状态</th>
 <!--            <th class='text-left nowrap' style="width: 20%">所属部门</th>-->
             <th class="text-center" style="width: 20%">操作</th>
         </tr>
@@ -54,9 +56,13 @@
             <td class='text-left'>{$vo.nickname|default='--'}</td>
             <td class='text-left'>{$vo.mobile|default='--'}</td>
             <td class='text-left'>{$vo.title|default='--'}</td>
+            <td class='text-left'>{$vo.department_text|default='--'}</td>
             <td class='text-left'>
                 {eq name='vo.status' value='0'}<strong class="color-red">已禁用</strong>{else}<strong class="color-green">正常</strong>{/eq}
             </td>
+            <td class='text-left'>
+                <strong>{$get_signature_status_list[$vo.signature_status]}</strong>
+            </td>
 <!--            <td class='text-left'>{$vo.department|default='&#45;&#45;'}</td>-->
             <td class='text-center nowrap'>
                 {if $vo.status eq 1 and auth("forbid")}
@@ -64,6 +70,10 @@
                 {elseif auth("resume")}
                 <a class="layui-btn layui-btn-xs layui-bg-blue" data-confirm="确定要启用该账号吗?" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('resume')}">启 用</a>
                 {/if}
+                {if $vo.signature_status eq 2}
+                <a class="layui-btn layui-btn-xs layui-bg-blue" data-confirm="确定要审核通过吗?" data-action="{:url('signature_status')}" data-value="id#{$vo.id};signature_status#3" data-csrf="{:systoken('signature_status')}">审核通过</a>
+                <a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要审核驳回吗?" data-action="{:url('signature_status')}" data-value="id#{$vo.id};signature_status#4" data-csrf="{:systoken('signature_status')}">审核驳回</a>
+                {/if}
             </td>
         </tr>
         {/foreach}

+ 16 - 1
application/user/view/member/index_search.html

@@ -15,7 +15,7 @@
             </div>
         </div>
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">用户状态</label>
+            <label class="layui-form-label">状态</label>
             <div class="layui-input-inline">
                 <select class="layui-select" name="status">
                     <option value="">请选择</option>
@@ -30,6 +30,21 @@
             </div>
         </div>
         <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">签名状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="signature_status">
+                    <option value="">请选择</option>
+                    {foreach $get_signature_status_list as $k=>$v}
+                    {eq name='Think.get.signature_status' value='$k.""'}
+                    <option selected value="{$k}">{$v}</option>
+                    {else}
+                    <option value="{$k}">{$v}</option>
+                    {/eq}
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
             <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
             <button type="button" data-export-list class="layui-btn layui-btn-primary layui-hide"><i class="layui-icon layui-icon-export"></i> 导 出
             </button>