cqp 2 meses atrás
pai
commit
6fec8fc286
2 arquivos alterados com 27 adições e 1 exclusões
  1. 17 1
      app/Model/Employee.php
  2. 10 0
      app/Service/EmployeeService.php

+ 17 - 1
app/Model/Employee.php

@@ -11,7 +11,7 @@ class Employee extends DataScopeBaseModel
     const CREATED_AT = 'crt_time';
     const UPDATED_AT = 'upd_time';
     protected $dateFormat = 'U';
-    public static $field = ['number','mobile','title','id','is_admin', 'account', 'crt_time', 'state', 'education', 'major', 'id_card','p_title','sex'];
+    public static $field = ['number','mobile','title','id','is_admin', 'account', 'crt_time', 'state', 'education', 'major', 'id_card','p_title','sex', 'entrust_type', 'man_type'];
     const SPECIAL_ADMIN = 1;
     const USE = 1;
     const NOT_USE = 2;
@@ -57,4 +57,20 @@ class Employee extends DataScopeBaseModel
         self::TYPE_TWO => '离职',
         self::TYPE_THREE => '休假',
     ];
+
+    const MAN_TYPE_ONE = 1;
+    const MAN_TYPE_TWO = 2;
+    const Man_Type = [
+        self::MAN_TYPE_ONE => '研究人员',
+        self::MAN_TYPE_TWO => '技术人员',
+    ];
+
+    const WT_TYPE_ZERO = 0;
+    const WT_TYPE_ONE = 1;
+    const WT_TYPE_TWO = 2;
+    const WT_Type = [
+        self::WT_TYPE_ZERO => '无',
+        self::WT_TYPE_ONE => '境内委托',
+        self::WT_TYPE_TWO => '境外委托',
+    ];
 }

+ 10 - 0
app/Service/EmployeeService.php

@@ -71,6 +71,8 @@ class EmployeeService extends Service
             $model->p_title = $data['p_title'] ?? "";
             $model->state = $data['state'] ?? 0;
             $model->is_admin = $data['is_admin'] ?? 0;
+            $model->entrust_type = $data['entrust_type'] ?? 0;
+            $model->man_type = $data['man_type'] ?? 0;
             if($model->is_admin && $data['password'] !== '******') {
                 $model->password = Hash::make($data['password']);
                 $model->p_version = $model->p_version + 1;
@@ -153,6 +155,8 @@ class EmployeeService extends Service
             $model->crt_id = $user['id'];
             $model->is_admin = $data['is_admin'] ?? 0;
             $model->account = $data['account'] ?? "";
+            $model->entrust_type = $data['entrust_type'] ?? 0;
+            $model->man_type = $data['man_type'] ?? 0;
             if($model->is_admin) $model->password = Hash::make($data['password']);
             $model->top_depart_id = $data['top_depart_id'];
             $model->save();
@@ -307,6 +311,8 @@ class EmployeeService extends Service
             $item['is_admin_title'] = Employee::IS_ADMIN_TITLE[$item['is_admin']] ?? "";
             $item['state_title'] = Employee::State_Type[$item['state']] ?? "";
             $item['sex_title'] = Employee::SEX_TYPE[$item['sex']] ?? "";
+            $item['man_type_title'] = Employee::Man_Type[$item['man_type']] ?? "";
+            $item['entrust_type_title'] = Employee::WT_Type[$item['entrust_type']] ?? "";
             $item['education_title'] = Employee::Education[$item['education']] ?? "";
             $item['crt_time']       = !empty($item['crt_time']) ? date("Y-m-d", $item['crt_time']) : "";
             if (isset($ergs['search_for_month_work'])) {
@@ -564,6 +570,10 @@ class EmployeeService extends Service
             if(mb_strlen($data['password']) < 6) return [false, '密码长度不得小于6位长度'];
             if(empty($data['role'])) return [false, '角色不能为空'];
         }
+        if(empty($data['man_type'])) return [false,'人员类别不能为空'];
+        if(! isset(Employee::Man_Type[$data['man_type']])) return [false,'人员类别不存在'];
+//        if(empty($data['entrust_type'])) return [false,'委托方式不能为空'];
+//        if(! isset(Employee::WT_Type[$data['entrust_type']])) return [false,'委托方式不存在'];
         $data['top_depart_id'] = $user['top_depart_id'];
 
         if(! empty($data['work_range'])){