cqp 2 месяцев назад
Родитель
Сommit
60749f518e
2 измененных файлов с 22 добавлено и 1 удалено
  1. 10 0
      app/Service/ImportService.php
  2. 12 1
      config/excel/employee.php

+ 10 - 0
app/Service/ImportService.php

@@ -297,6 +297,7 @@ class ImportService extends Service
         $sexIdx = array_search('sex', $keys);
         $eductionIdx = array_search('education', $keys);
         $stateIdx = array_search('state', $keys);
+        $manIdx = array_search('man_type', $keys);
         $depIdx = array_search('depart_code', $keys);
 
         $code_map = $this->getEmployeeList($array, $user, $codeIdx);
@@ -310,6 +311,7 @@ class ImportService extends Service
         $sex_map = array_flip(Employee::SEX_TYPE);
         $e_map = array_flip(Employee::Education);
         $state_map = array_flip(Employee::State_Type);
+        $man_map = array_flip(Employee::Man_Type);
 
         // 获取所有标记为 is_main 的列索引,用于一致性对比
         $mainColIndices = [];
@@ -370,6 +372,14 @@ class ImportService extends Service
                 $array[$rowIndex][$stateIdx] = $state_map[$state_text];
             }
 
+            //人员类别
+            $man_text = trim($rowValue[$manIdx] ?? '');
+            if (!isset($man_map[$man_text])) {
+                $errors[] = "第{$displayLine}行:人员类别[{$man_text}]无效";
+            } else {
+                $array[$rowIndex][$manIdx] = $man_map[$man_text];
+            }
+
             // 4. 解析部门 (分行模式)
             if ($depIdx !== false && !empty($rowValue[$depIdx])) {
                 $mNum = trim($rowValue[$depIdx]);

+ 12 - 1
config/excel/employee.php

@@ -90,6 +90,17 @@ return [
             'default' => "",
             'comments' => "必填"
         ],
+        [
+            'key' =>'man_type',
+            'export' =>'man_type_title',
+            'value' => '人员类别',
+            'required' => true,
+            'is_main' => true,
+            'unique' => false,
+            'enums' => array_values(\App\Model\Employee::Man_Type),
+            'default' => 0,
+            'comments' => "必填"
+        ],
         [
             'key' =>'state',
             'export' =>'state_title',
@@ -98,7 +109,7 @@ return [
             'is_main' => true,
             'unique' => false,
             'enums' => array_values(\App\Model\Employee::State_Type),
-            'default' => "",
+            'default' => 0,
             'comments' => '必填'
         ],
         [