wupengfei 2 jaren geleden
bovenliggende
commit
6879e0ffec

+ 97 - 0
application/leave/controller/LeaveInfo.php

@@ -0,0 +1,97 @@
+<?php
+namespace app\leave\controller;
+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 = '列表管理';
+        $query = $this->_query($this->table)->where('is_deleted',0)->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->_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)
+    {
+
+    }
+
+}

+ 31 - 0
application/leave/view/leave_info/form.html

@@ -0,0 +1,31 @@
+<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">
+                    <input name="title" maxlength="20"  value='{$vo.title|default=""}' placeholder="请输入类型名称" class="layui-input">
+                </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>

+ 67 - 0
application/leave/view/leave_info/index.html

@@ -0,0 +1,67 @@
+{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">
+    <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.user_name|default=''}</td>
+            <td class='text-left nowrap'>{$vo.type|default=''}</td>
+            <td class='text-left nowrap'>{$vo.reason|default=''}</td>
+            <td class='text-left' >
+                <a data-title="编辑" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
+                <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_type/"+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}
+
+
+

+ 69 - 0
application/leave/view/leave_info/index_search.html

@@ -0,0 +1,69 @@
+<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">
+                <input name="phone" value="{$Think.get.phone|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">
+                <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>
+        <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>