wupengfei 2 年之前
父节点
当前提交
c8047cf451

+ 141 - 0
application/synth/controller/Offer.php

@@ -0,0 +1,141 @@
+<?php
+namespace app\synth\controller;
+use app\common\model\LeaveApprove;
+use library\Controller;
+use think\Db;
+/**
+ * 请假列表
+ * Class Evection
+ * @package app\synth\controller
+ */
+class Offer extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'EvectionInfo';
+
+    /**
+     * 列表
+     * @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 = '列表管理';
+        $this->all_type =[1=>'市内出差',2=>'市外出差'];
+        $this->status_arr = [0=>'全部','1'=>'审批中',2=>'审批通过',3=>'审批拒绝',9=>'已取消'];
+        $sel_where = [];
+        $time = explode(' - ',input('create_at'));
+        if(input('create_at')){
+            $sel_where[] = ['a.create_at','between time',$time];
+        }
+        if($type = input('type')) $sel_where[] = ['a.type','=',$type];
+        if($status = input('status')) $sel_where[] = ['a.status','=',$status];
+        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('EvectionApprove')
+            ->alias('r')
+            ->field('r.*,u.name,u.phone,u.headimg')
+            ->leftJoin('store_member u','u.id = r.approve_user')
+            ->where('r.eve_id',$id)
+            ->order('r.id desc')->page(false);
+        $this->assign('list',$list);
+        $this->fetch();
+    }
+
+
+
+}

+ 39 - 0
application/synth/view/offer/approve.html

@@ -0,0 +1,39 @@
+{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>
+                <th class='text-left nowrap'>审批时长</th>
+            </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>{$vo.approve_type == 1 ?'审批':'抄送'}</td>
+            <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_desc|default='--'}</td>
+
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+
+{/block}
+
+
+

+ 18 - 0
application/synth/view/offer/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/synth/view/offer/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='evection/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'>{$vo.type == 1 ? '市内出差':'市外出差'}</td>
+            <td class='text-left nowrap'>
+                <div class="inline-block">
+                    开始时间:{$vo.start_time|default='--'}<br><br>
+                    结束时间:{$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 = "/synth/evection/"+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}
+
+
+

+ 59 - 0
application/synth/view/offer/index_search.html

@@ -0,0 +1,59 @@
+<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 $k=>$v}
+                        {if $Think.get.type > -1 && $Think.get.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">
+            <label class="layui-form-label">审批状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="status">
+                    {foreach $status_arr as $k=>$v}
+                    {if $Think.get.status && $Think.get.status 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">
+            <label class="layui-form-label">申请时间</label>
+            <div class="layui-input-inline">
+                <input name="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择申请时间" class="layui-input">
+            </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>
+    </form>
+    <script>
+        form.render();
+        laydate.render({range: true, elem: '[name="create_at"]'})
+    </script>
+</fieldset>