wupengfei 2 年之前
父节点
当前提交
9d08e961ed

+ 122 - 0
application/car/controller/CarFlow.php

@@ -0,0 +1,122 @@
+<?php
+namespace app\car\controller;
+use app\common\model\User;
+use library\Controller;
+use think\Db;
+/**
+ * 用车流程
+ * Class CarFlow
+ * @package app\car\controller
+ */
+class CarFlow extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'CarFlow';
+
+    /**
+     * 流程列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '管理';
+        $sel_type = input('sel_type');
+        $query = $this->_query($this->table)
+            ->alias('f')
+            ->field('f.*,u.name,u.headimg')
+            ->leftJoin('store_member u','u.id = f.user_id')
+            ->order('sort asc,id desc')
+            ->where('is_deleted',0)
+            ->when($sel_type,function ($query)use ($sel_type){
+                if($sel_type) $query->where('type',$sel_type);
+            })->page(false);
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+        foreach ($data as $k=>&$v){
+
+        }
+    }
+
+    /**
+     * 删除
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+
+
+    /**
+     * 添加
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function add(){
+        $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
+     */
+    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');
+        }
+    }
+
+}

+ 122 - 0
application/car/controller/Flow.php

@@ -0,0 +1,122 @@
+<?php
+namespace app\leave\controller;
+use app\common\model\User;
+use library\Controller;
+use think\Db;
+/**
+ * 请假流程
+ * Class Flow
+ * @package app\leave\controller
+ */
+class Flow extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'LeaveFlow';
+
+    /**
+     * 流程列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '管理';
+        $sel_type = input('sel_type');
+        $query = $this->_query($this->table)
+            ->alias('f')
+            ->field('f.*,u.name,u.headimg')
+            ->leftJoin('store_member u','u.id = f.user_id')
+            ->order('sort asc,id desc')
+            ->where('is_deleted',0)
+            ->when($sel_type,function ($query)use ($sel_type){
+                if($sel_type) $query->where('type',$sel_type);
+            })->page(false);
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+        foreach ($data as $k=>&$v){
+
+        }
+    }
+
+    /**
+     * 删除
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+
+
+    /**
+     * 添加
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function add(){
+        $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
+     */
+    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');
+        }
+    }
+
+}

+ 135 - 0
application/car/controller/LeaveInfo.php

@@ -0,0 +1,135 @@
+<?php
+namespace app\leave\controller;
+use app\common\model\LeaveApprove;
+use library\Controller;
+use think\Db;
+/**
+ * 请假列表
+ * Class LeaveInfo
+ * @package app\leave\controller
+ */
+class LeaveInfo extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'LeaveInfo';
+
+    /**
+     * 类型列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '列表管理';
+        $all_type = \app\common\model\LeaveType::getAllType();
+        $this->all_type = array_column($all_type,null,'id');
+        $sel_where = [];
+        $sel_where[] = ['approve_type','=',1];
+        if($type = input('type')) $sel_where[] = ['a.type','=',$type];
+        if($name = input('name')) $sel_where[] = ['u.name','like','%'.$name.'%'];
+        $query = $this->_query($this->table)
+            ->field('a.*,u.name,u.headimg')
+            ->where($sel_where)
+            ->alias('a')
+            ->leftJoin('store_member u','u.id = a.user_id')
+            ->where('a.is_deleted',0)->page();
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+        foreach ($data as $k=>&$v){
+
+        }
+    }
+
+    /**
+     * 删除
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function remove()
+    {
+        $this->_save($this->table, ['is_deleted' => '1']);
+    }
+
+
+
+    /**
+     *
+     * 编辑
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    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)
+    {
+
+    }
+
+
+    /**
+     *
+     * 审批记录
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function approve()
+    {
+        $id = input('id');
+        $list = $this->_query('LeaveApprove')
+            ->alias('r')
+            ->field('r.*,u.name,u.phone,u.headimg')
+            ->leftJoin('store_member u','u.id = r.approve_user')
+            ->where('r.leave_id',$id)
+            ->order('r.id desc')->page(false);
+        $this->assign('list',$list);
+        $this->fetch();
+    }
+
+
+
+}

+ 47 - 0
application/car/view/car_flow/form.html

@@ -0,0 +1,47 @@
+<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">
+                    <select class="layui-select" name="user_id" >
+                        {foreach $all_user as $user_id=>$user_name}
+                            <option value="{$user_id}" {if isset($vo.user_id) && $vo.user_id == $user_id}selected{/if}>{$user_name}</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>

+ 64 - 0
application/car/view/car_flow/index.html

@@ -0,0 +1,64 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<button data-modal='{:url("add")}' data-title="添加" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='car_flow/index_search'}
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='text-left nowrap' style="width: 60%">类型</th>
+            <th class='text-left nowrap' >审批人/抄送人</th>
+            <th class='text-left nowrap'>审批顺序</th>
+            <th class="text-left nowrap">操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>
+                {eq name ='vo.type' value = '1'}审批人{/eq}
+                {eq name ='vo.type' value = '2'}抄送人{/eq}
+            </td>
+            <td class='text-left nowrap'>{$vo.name|default=''}</td>
+            <td class='text-left nowrap'>{$vo.sort|default=''}</td>
+            <td class='text-left' >
+                <a data-title="编辑" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','remove','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/car/car_flow/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+</script>
+{/block}
+
+
+

+ 30 - 0
application/car/view/car_flow/index_search.html

@@ -0,0 +1,30 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+
+
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">类型</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="sel_type">
+                    <option  value="0">全部</option>
+                    {foreach [1=>'审批人',2=>'抄送人'] as $k=>$v}
+                        {if $Think.get.sel_type eq $k}
+                            <option selected value="{$k}">{$v}</option>
+                        {else}
+                            <option  value="{$k}">{$v}</option>
+                        {/if}
+                    {/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>
+        </div>
+
+    </form>
+    <script>
+        form.render();
+    </script>
+</fieldset>

+ 37 - 0
application/car/view/car_info/approve.html

@@ -0,0 +1,37 @@
+{block name="content"}
+<div class="think-box-shadow">
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+            <tr>
+                <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>
+            </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>{$vo.name}</td>
+            <td class='text-left nowrap'>
+                {eq name ='vo.status' value='0'}待审批{/eq}
+                {eq name ='vo.status' value='1'}审批中{/eq}
+                {eq name ='vo.status' value='2'}审批通过{/eq}
+                {eq name ='vo.status' value='3'}审批拒绝{/eq}
+            </td>
+            <td class='text-left nowrap'>{$vo.approve_time|default='--'}</td>
+            <td class='text-left nowrap'>{$vo.remark|default='--'}</td>
+            <td class='text-left nowrap'>{$vo.time|default='--'}</td>
+
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+
+{/block}
+
+
+

+ 18 - 0
application/car/view/car_info/form.html

@@ -0,0 +1,18 @@
+<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">
+                    <textarea name="content" rows="10" cols="100">{$vo.reason}</textarea>
+                </div>
+            </div>
+        </div>
+    </form>
+    <script>
+        window.form.render();
+    </script>
+</div>

+ 85 - 0
application/car/view/car_info/index.html

@@ -0,0 +1,85 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<button data-modal='{:url("add")}' data-title="添加" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='leave_info/index_search'}
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='list-table-sort-td'>
+                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
+            </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>
+        </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
+            <td class='text-left nowrap'>
+                <img data-tips-image style="width:60px;height:60px" src="{$vo.headimg|default=''}" class="margin-right-5 text-top">
+                <div class="inline-block">
+                    员工ID:{$vo.user_id|default='--'}<br><br>
+                    员工名称:{$vo.name|default='--'}<br>
+                </div>
+            </td>
+
+            <td class='text-left nowrap'>{$all_type[$vo.type]['title']|default=''}</td>
+            <td class='text-left nowrap'>
+                <div class="inline-block">
+                    开始时间:{$vo.start_date|default='--'}--{$vo.start_time|default='--'}<br><br>
+                    结束时间:{$vo.end_date|default='--'}--{$vo.end_time|default='--'}<br>
+                </div>
+            </td>
+            <td class='text-left nowrap'>
+                {eq name ='vo.status' value='1'}审批中{/eq}
+                {eq name ='vo.status' value='2'}审批通过{/eq}
+                {eq name ='vo.status' value='3'}审批拒绝{/eq}
+                {eq name ='vo.status' value='9'}已取消{/eq}
+            </td>
+            <td class='text-left' >
+                <a data-title="查看事由" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>查看事由</a>
+                <a data-title="查看审批" class="layui-btn layui-btn-sm" data-modal='{:url("approve")}?id={$vo.id}'>审批记录</a>
+                <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','remove','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/leave/leave_info/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+</script>
+{/block}
+
+
+

+ 71 - 0
application/car/view/car_info/index_search.html

@@ -0,0 +1,71 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">员工名称</label>
+            <div class="layui-input-inline">
+                <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入微信昵称" class="layui-input">
+            </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="type">
+                        <option value="0">全部</option>
+                        {foreach $all_type as $v}
+                            {if $Think.get.type > -1 && $Think.get.type eq $v.id}
+                            <option selected value="{$v.id}">{$v.title}</option>
+                            {else}
+                            <option  value="{$v.id}">{$v.title}</option>
+                            {/if}
+                        {/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" id="download"><i class="layui-icon layui-icon-export"></i> 导 出</button>-->
+        </div>
+        <div class="layui-form-item layui-inline" style="margin-left: 5px;">
+            <div  data-title="导出" class='layui-btn layui-btn-sm layui-btn-primary' id="download">导出</div>
+        </div>
+    </form>
+    <script>
+        form.render();
+        laydate.render({range: true, elem: '[name="create_at"]'})
+        layui.use('upload', function(){
+            var upload = layui.upload;
+            //执行实例
+            var uploadInst = upload.render({
+                elem: '#import' //绑定元素
+                ,url: '/user/member/import'
+                ,accept: 'file' //普通文件,
+                ,data:{
+                    subject_id:function(){
+                        return $('#subject').val();
+                    }
+                }
+                ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
+                }
+                ,done: function(res){
+                    if(res.code == 0){
+                        layer.msg(res.info);
+                    }else{
+                        layer.msg('导入成功');
+                        setTimeout(function(){
+                            location.reload();
+                        },2000);
+                    }
+                }
+                ,error: function(){
+                    layer.msg('上传失败');
+                }
+            });
+        });
+        $('#download').click(function () {
+            window.location.href = "{:url('export')}?phone={$Think.get.phone|default=''}&name={$Think.get.name|default=''}&create_at={$Think.get.create_at|default=''}&account_type={$Think.get.create_at|default='0'}" + $(this).parents('form').serialize();
+        });
+    </script>
+</fieldset>