zhanglinxin 1 年之前
父節點
當前提交
eac6a41882

+ 5 - 24
application/api/controller/Common.php

@@ -2,16 +2,10 @@
 
 namespace app\api\controller;
 
-use app\common\constant\ApplyConstant;
 use app\common\constant\CommonConstant;
-use app\common\constant\ContractConstant;
-use app\common\constant\EvectionConstant;
-use app\common\constant\LeaveConstant;
 use app\common\constant\MaintainConstant;
-use app\common\constant\OfferConstant;
-use app\common\model\ApproveMaintainUser;
 use app\common\model\Goods;
-use app\common\model\GoodsCategory;
+use app\common\service\CommonService;
 use app\common\service\GoodsCategoryService;
 use app\common\service\UserService;
 use hg\apidoc\annotation as Apidoc;
@@ -39,7 +33,7 @@ class Common extends Base
     }
 
     /**
-     * 类型列表
+     * 类型数据
      *
      * @Apidoc\Method("POST")
      * @Apidoc\Returned("module_list", type="array", desc="模块列表")
@@ -55,17 +49,7 @@ class Common extends Base
      */
     public function get_type_list()
     {
-        $module_list = get_one_two_array(CommonConstant::get_module_list(), 'id', 'name');
-        $degree_list = get_one_two_array(OfferConstant::get_degree_list(), 'id', 'name');
-        $pay_type_list = get_one_two_array(ApplyConstant::get_pay_type_list(), 'id', 'name');
-        $time_list = get_one_two_array(LeaveConstant::get_time_list(), 'id', 'name');
-        $data1 = get_one_two_array(ApplyConstant::get_type_list(), 'id', 'name');
-        $data2 = get_one_two_array(OfferConstant::get_type_list(), 'id', 'name');
-        $data5 = get_one_two_array(EvectionConstant::get_type_list(), 'id', 'name');
-        $data6 = get_one_two_array(LeaveConstant::get_type_list(), 'id', 'name');
-        $data8 = get_one_two_array(MaintainConstant::get_type_list(), 'id', 'name');
-        $data9 = get_one_two_array(ContractConstant::get_type_list(), 'id', 'name');
-        $data = compact("module_list", "degree_list", "pay_type_list", "time_list", "data1", "data2", "data5", "data6", "data8", "data9");
+        $data = CommonService::get_type_list();
         $this->success('类型列表', $data);
     }
 
@@ -84,7 +68,7 @@ class Common extends Base
         $offset = $this->off_set;
         $length = $this->page_num;
         $user = $this->user;
-        $list = UserService::get_list($offset, $length, $user);
+        $list = UserService::get_list($offset, $length);
         $this->success('发起人列表', $list);
     }
 
@@ -100,10 +84,7 @@ class Common extends Base
         if (!array_key_exists($type, MaintainConstant::get_type_list())) {
             $this->success('维修人员列表.');
         }
-        $list = ApproveMaintainUser::field('is_deleted',true)
-            ->where('is_deleted',CommonConstant::IS_DELETED_0)
-            ->where('type',$type)
-            ->select();
+        $list = UserService::get_maintain_user($type);
         $this->success('维修人员列表',$list);
     }
 

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

@@ -19,6 +19,7 @@ use app\common\constant\CommonConstant;
 use app\common\constant\EvectionConstant;
 use app\common\constant\LeaveConstant;
 use app\common\constant\MaintainConstant;
+use app\common\service\UserService;
 use library\Controller;
 
 /**
@@ -39,6 +40,7 @@ class ApproveFlow extends Controller
     {
         $this->get_module_list = CommonConstant::get_module_list();
         $this->get_type_list = CommonConstant::get_type_list();
+        $this->get_user_type_list = CommonConstant::get_user_type_list();
     }
 
     /**
@@ -92,6 +94,8 @@ class ApproveFlow extends Controller
     protected function _form_filter(&$data)
     {
         if($this->request->isGet()) {
+            $data['user_data'] = json_decode($data['user_data'],true);
+            $this->user_list = UserService::get_list();
 //            return false;
 //            $this->all_user = User::where('is_deleted',0)->column('name','id');
         }
@@ -107,6 +111,9 @@ class ApproveFlow extends Controller
         return $this->fetch('', compact("list"));
     }
 
+    /**
+     * 根据模块获取审批流项
+     **/
     public function get_item_list($module){
         $get_item_list = [];
         switch ($module){

+ 59 - 15
application/approve/view/approve_flow/form.html

@@ -1,34 +1,78 @@
-<style>
-
-</style>
+{block name="content"}
 <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">
+
+            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+
             <div class="layui-form-item">
-                <label class="layui-form-label label-required">审批类型</label>
+                <label class="layui-form-label">模块</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>
+                    <input name="" placeholder="" value="{$get_module_list[$vo.module]}" class="layui-input layui-bg-gray" disabled>
+                    <p class="help-block"></p>
                 </div>
             </div>
 
             <div class="layui-form-item">
-                <label class="layui-form-label label-required">审批顺序</label>
+                <label class="layui-form-label">审批流类型</label>
                 <div class="layui-input-block">
-                    <input type="number" name="sort"  value='{$vo.sort|default=""}' placeholder="请输入审批序号" class="layui-input">
+                    <input name="" placeholder="" value="{$get_type_list[$vo.flow_type]}" class="layui-input layui-bg-gray" disabled>
+                    <p class="help-block"></p>
                 </div>
             </div>
-            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+
+            {eq name='vo.flow_item' value='0' }
+            {else}
+            <div class="layui-form-item">
+                <label class="layui-form-label">审批流项</label>
+                <div class="layui-input-block">
+                    <input name="" placeholder="" value="{$get_item_list[$vo.flow_item]}" class="layui-input layui-bg-gray" disabled >
+                    <p class="help-block"></p>
+                </div>
+            </div>
+            {/eq}
+
+            <div class="layui-form-item">
+                <label class="layui-form-label">审批层级</label>
+                <div class="layui-input-block">
+                    <div class="layui-input-inline">
+                        <select class="layui-select" name="" id="c-key" >
+                            {foreach $get_user_type_list as $k=>$v}
+                            <option value="{$k}">{$v}</option>
+                            {/foreach}
+                        </select>
+                    </div>
+                    <div class="layui-input-inline">
+                        <select class="layui-select" name="" id="c-value">
+                            <option value="">请选择员工</option>
+                            {foreach $user_list as $k=>$v}
+                            <option value="{$v.userid}">{$v.name}</option>
+                            {/foreach}
+                        </select>
+                    </div>
+                    <button type="button" class="layui-btn layui-btn-primary">添加审批层级</button>
+                </div>
+
+
+<!--                {foreach $vo.user_data as $k=>$v}-->
+<!--                <div class="layui-input-block">-->
+<!--                    <div class="layui-input-inline">-->
+<!--                        <span>第{$k+1}级:</span>-->
+<!--                    </div>-->
+<!--                </div>-->
+<!--                {/foreach}-->
+            </div>
+            <div style="height: 30rem"></div>
             <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>
+                <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>
+</div>
+{/block}
+{block name="style"}{/block}
+{block name='script'}{/block}

+ 13 - 1
application/common/constant/CommonConstant.php

@@ -132,7 +132,19 @@ class CommonConstant
         ];
     }
 
-    // 审核状态:1=待审批,2=审批中,3=审批同意,4=审批驳回,5=审批撤销
+    // 审批流用户类型:1=负责人主管;2=指定一人
+    const USER_TYPE_1 = '1';
+    const USER_TYPE_2 = '2';
+
+    public static function get_user_type_list()
+    {
+        return [
+            self::USER_TYPE_1 => '负责人主管',
+            self::USER_TYPE_2 => '指定一人',
+        ];
+    }
+
+    // 审批状态:1=待审批,2=审批中,3=审批同意,4=审批驳回,5=审批撤销
     const STATUS_1 = 1;
     const STATUS_2 = 2;
     const STATUS_3 = 3;

+ 36 - 0
application/common/service/CommonService.php

@@ -2,7 +2,13 @@
 
 namespace app\common\service;
 
+use app\common\constant\ApplyConstant;
+use app\common\constant\CommonConstant;
+use app\common\constant\ContractConstant;
+use app\common\constant\EvectionConstant;
+use app\common\constant\LeaveConstant;
 use app\common\constant\MaintainConstant;
+use app\common\constant\OfferConstant;
 use think\cache\driver\Redis;
 
 /**
@@ -12,6 +18,36 @@ class CommonService
 {
 
     /**
+     * 类型数据
+     *
+     * @Apidoc\Method("POST")
+     * @Apidoc\Returned("module_list", type="array", desc="模块列表")
+     * @Apidoc\Returned("degree_list", type="array", desc="缓急程度列表")
+     * @Apidoc\Returned("pay_type_list", type="array", desc="采购支付方式列表")
+     * @Apidoc\Returned("time_list", type="array", desc="请假周期列表")
+     * @Apidoc\Returned("data1", type="array", desc="采购类型列表")
+     * @Apidoc\Returned("data2", type="array", desc="呈批类型列表")
+     * @Apidoc\Returned("data5", type="array", desc="出差类型列表")
+     * @Apidoc\Returned("data6", type="array", desc="请假类型列表")
+     * @Apidoc\Returned("data8", type="array", desc="维修类型列表")
+     * @Apidoc\Returned("data9", type="array", desc="合同类型列表")
+     */
+    public static function get_type_list()
+    {
+        $module_list = get_one_two_array(CommonConstant::get_module_list(), 'id', 'name');
+        $degree_list = get_one_two_array(OfferConstant::get_degree_list(), 'id', 'name');
+        $pay_type_list = get_one_two_array(ApplyConstant::get_pay_type_list(), 'id', 'name');
+        $time_list = get_one_two_array(LeaveConstant::get_time_list(), 'id', 'name');
+        $data1 = get_one_two_array(ApplyConstant::get_type_list(), 'id', 'name');
+        $data2 = get_one_two_array(OfferConstant::get_type_list(), 'id', 'name');
+        $data5 = get_one_two_array(EvectionConstant::get_type_list(), 'id', 'name');
+        $data6 = get_one_two_array(LeaveConstant::get_type_list(), 'id', 'name');
+        $data8 = get_one_two_array(MaintainConstant::get_type_list(), 'id', 'name');
+        $data9 = get_one_two_array(ContractConstant::get_type_list(), 'id', 'name');
+        return compact("module_list", "degree_list", "pay_type_list", "time_list", "data1", "data2", "data5", "data6", "data8", "data9");
+    }
+
+    /**
      * 拼接查询字段
      *
      * @param string $field

+ 16 - 2
application/common/service/UserService.php

@@ -3,6 +3,8 @@
 namespace app\common\service;
 
 use app\common\constant\CommonConstant;
+use app\common\constant\MaintainConstant;
+use app\common\model\ApproveMaintainUser;
 use app\common\model\User;
 
 /**
@@ -16,9 +18,8 @@ class UserService
      *
      * @param integer $offset 起始位置
      * @param integer $length 查询数量
-     * @param mixed $user 用户信息
      **/
-    public static function get_list($offset, $length, $user)
+    public static function get_list($offset = 0, $length = 1000)
     {
         $list = User::field('userid,name')
             ->where('status', CommonConstant::IS_WHO_1)
@@ -28,4 +29,17 @@ class UserService
         return $list;
     }
 
+    /**
+     * 维修人员列表
+     *
+     * @param integer $type 类型:1=物业主管,2=信息负责人
+     **/
+    public static function get_maintain_user($type){
+        $list = ApproveMaintainUser::field('is_deleted',true)
+            ->where('is_deleted',CommonConstant::IS_DELETED_0)
+            ->where('type',$type)
+            ->select();
+        return $list;
+    }
+
 }