wupengfei vor 2 Jahren
Ursprung
Commit
14588c5a26

+ 7 - 12
application/car/controller/LeaveInfo.php → application/car/controller/CarInfo.php

@@ -1,20 +1,19 @@
 <?php
-namespace app\leave\controller;
-use app\common\model\LeaveApprove;
+namespace app\car\controller;
 use library\Controller;
 use think\Db;
 /**
- * 请假列表
- * Class LeaveInfo
- * @package app\leave\controller
+ * 用车列表
+ * Class CarInfo
+ * @package app\car\controller
  */
-class LeaveInfo extends Controller
+class CarInfo extends Controller
 {
     /**
      * 绑定数据表
      * @var string
      */
-    protected $table = 'LeaveInfo';
+    protected $table = 'CarInfo';
 
     /**
      * 类型列表
@@ -29,11 +28,7 @@ class LeaveInfo extends Controller
     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')
@@ -120,7 +115,7 @@ class LeaveInfo extends Controller
     public function approve()
     {
         $id = input('id');
-        $list = $this->_query('LeaveApprove')
+        $list = $this->_query('CarApprove')
             ->alias('r')
             ->field('r.*,u.name,u.phone,u.headimg')
             ->leftJoin('store_member u','u.id = r.approve_user')

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

@@ -1,122 +0,0 @@
-<?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');
-        }
-    }
-
-}

+ 16 - 0
application/common/model/CarApprove.php

@@ -0,0 +1,16 @@
+<?php
+namespace app\common\model;
+use think\Model;
+// 用车审批记录
+class CarApprove extends Model
+{
+        public  function carInfo()
+        {
+            return $this->belongsTo('CarInfo','id','level_id')
+                ->alias('l')
+                ->field('l.id,l.create_at,l.leave_id,l.start_time,approve_num,l.end_time,u.name user_name,headimg')
+                ->leftJoin('StoreMember u','u.id = l.approve_user')
+                ->order('id asc');
+        }
+
+}

+ 19 - 0
application/common/model/CarFlow.php

@@ -0,0 +1,19 @@
+<?php
+namespace app\common\model;
+use think\Model;
+// 用车审批流程设置
+class CarFlow extends Model
+{
+    // 获取审批人
+    public static function getApproveUser(){
+        return static::where('type',1)->order('sort asc ,id asc')->select()->toArray();
+    }
+
+    // 获取抄送人
+    public static function getCopyTo()
+    {
+        return static::where('type',2)->order('sort asc ,id asc')->select()->toArray();
+    }
+
+
+}

+ 17 - 0
application/common/model/CarInfo.php

@@ -0,0 +1,17 @@
+<?php
+namespace app\common\model;
+use think\Model;
+// 用车记录
+class CarInfo extends Model
+{
+    public function approveList()
+    {
+        return $this->hasMany('CarApprove','car_id','id')
+            ->where('approve_type',1)
+            ->field('l.id,l.status,l.approve_time,l.approve_user,l.leave_id,l.remark,l.time,u.name user_name,headimg')
+            ->alias('l')
+            ->leftJoin('StoreMember u','u.id = l.approve_user')
+            ->order('id asc');
+    }
+
+}