backup: 完成 HR_position_ 表格前綴重命名與欄位對照表整理

變更內容:
- 所有資料表加上 HR_position_ 前綴
- 整理完整欄位顯示名稱與 ID 對照表
- 模組化 JS 檔案 (admin.js, ai.js, csv.js 等)
- 專案結構優化 (docs/, scripts/, tests/ 等)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-09 12:05:20 +08:00
parent a068ef9704
commit a6af297623
82 changed files with 8685 additions and 4933 deletions

347
docs/表單欄位清單.md Normal file
View File

@@ -0,0 +1,347 @@
# 表單欄位完整清單
## 1. 崗位基礎資料模組 - 基礎資料頁籤 (positionForm - tab-position-basic)
| # | 欄位顯示名稱 | HTML元素ID | 資料庫欄位名稱 | 資料類型 | 是否必填 | 預設值 | 備註 |
|---|-----------|---------|------------|------|------|------|------|
| 1 | 事業體 (Business Unit) | businessUnit | businessUnit | select | 否 | 空值 | SBU, MBU, HQBU, ITBU, HRBU, ACCBU |
| 2 | 處級單位 (Division) | division | division | select | 否 | 空值 | 根據事業體變動 |
| 3 | 部級單位 (Department) | department | department | select | 否 | 空值 | 根據處級單位變動 |
| 4 | 課級單位 (Section) | section | section | text | 否 | 選填 | - |
| 5 | 崗位編號 * | positionCode | positionCode | text | **是** | 空值 | 唯一識別碼,可更改 |
| 6 | 生效日期 | effectiveDate | effectiveDate | date | 否 | 2001-01-01 | - |
| 7 | 崗位名稱 * | positionName | positionName | text | **是** | 空值 | - |
| 8 | 崗位級別 | positionLevel | positionLevel | select | 否 | 空值 | L1-L7 (基層至總經理) |
| 9 | 崗位類別 | positionCategory | positionCategory | select | 否 | 空值 | 01, 02, 03, 04有onchange事件 |
| 10 | 崗位類別名稱 | positionCategoryName | positionCategoryName | text | 否 | 自動帶出 | readonly |
| 11 | 崗位性質 | positionNature | positionNature | select | 否 | 空值 | FT(全職), PT(兼職), CT(約聘), IN(實習)有onchange事件 |
| 12 | 崗位性質名稱 | positionNatureName | positionNatureName | text | 否 | 自動帶出 | readonly |
| 13 | 編制人數 | headcount | headcount | number | 否 | 空值 | min=0 |
| 14 | 崗位描述(條列式說明) | positionDesc | positionDesc | textarea | 否 | 空值 | rows=6有範例提示 |
| 15 | 崗位備注(條列式說明) | positionRemark | positionRemark | textarea | 否 | 空值 | rows=6有範例提示 |
---
## 2. 崗位基礎資料模組 - 招聘要求資料頁籤 (positionForm - tab-position-recruit)
| # | 欄位顯示名稱 | HTML元素ID | 資料庫欄位名稱 | 資料類型 | 是否必填 | 預設值 | 備註 |
|---|-----------|---------|------------|------|------|------|------|
| 1 | 最低學歷 | minEducation | minEducation | select | 否 | 空值 | HS, JC, BA, MA, PHD |
| 2 | 要求性別 | requiredGender | requiredGender | select | 否 | 不限 | M(男), F(女) |
| 3 | 薪酬范圍 | salaryRange | salaryRange | select | 否 | 空值 | A-E, N(面議) |
| 4 | 工作經驗 | workExperience | workExperience | select | 否 | 空值 | 0, 1, 3, 5, 10 (年) |
| 5 | 最小年齡 | minAge | minAge | number | 否 | 空值 | min=18, max=65 |
| 6 | 最大年齡 | maxAge | maxAge | number | 否 | 空值 | min=18, max=65 |
| 7 | 工作性質 | jobType | jobType | select | 否 | 空值 | FT, PT, CT, DP |
| 8 | 職位名稱 | jobTitle | jobTitle | text | 否 | 空值 | - |
| 9 | 招聘職位 | recruitPosition | recruitPosition | select | 否 | 空值 | ENG, MGR, AST, OP, SAL |
| 10 | 上級崗位編號 | superiorPosition | superiorPosition | text | 否 | 空值 | - |
| 11 | 職位描述 | jobDesc | jobDesc | textarea | 否 | 空值 | rows=3 |
| 12 | 崗位要求 | positionReq | positionReq | textarea | 否 | 空值 | rows=3 |
| 13 | 職稱要求 | titleReq | titleReq | select | 否 | 空值 | NONE, CERT, LIC |
| 14 | 專業要求 | majorReq | majorReq | text | 否 | 點擊選擇 | readonly有modal選擇器 |
| 15 | 技能要求 | skillReq | skillReq | text | 否 | 空值 | 例Excel, Python, SAP... |
| 16 | 語言要求 | langReq | langReq | text | 否 | 空值 | 例英文中級、日文N2... |
| 17 | 其他要求 | otherReq | otherReq | text | 否 | 空值 | - |
| 18 | 備注說明 | recruitRemark | recruitRemark | textarea | 否 | 空值 | rows=4 |
---
## 3. 職務基礎資料模組 (jobForm - tab-job-basic)
| # | 欄位顯示名稱 | HTML元素ID | 資料庫欄位名稱 | 資料類型 | 是否必填 | 預設值 | 備註 |
|---|-----------|---------|------------|------|------|------|------|
| 1 | 職務類別編號 * | jobCategoryCode | jobCategoryCode | select | **是** | 空值 | MGR, TECH, SALE, ADMIN, RD, PROD有onchange事件 |
| 2 | 職務類別名稱 | jobCategoryName | jobCategoryName | text | 否 | 自動帶出 | readonly |
| 3 | 職務編號 * | jobCode | jobCode | text | **是** | 空值 | 可更改職務編號 |
| 4 | 職務名稱 * | jobName | jobName | text | **是** | 空值 | - |
| 5 | 職務英文 | jobNameEn | jobNameEn | text | 否 | 空值 | - |
| 6 | 生效日期 | jobEffectiveDate | jobEffectiveDate | date | 否 | 空值 | - |
| 7 | 編制人數 | jobHeadcount | jobHeadcount | number | 否 | 空值 | min=0 |
| 8 | 排列順序 | jobSortOrder | jobSortOrder | number | 否 | 空值 | min=0 |
| 9 | 備注說明 | jobRemark | jobRemark | textarea | 否 | 空值 | rows=4 |
| 10 | 職務層級 | jobLevel | jobLevel | text | 否 | 如:*保密* | 敏感信息欄位 |
| 11 | 是否有全勤 | hasAttendanceBonus | hasAttendanceBonus | checkbox | 否 | 否 | toggle-switch 控件 |
| 12 | 是否住房補貼 | hasHousingAllowance | hasHousingAllowance | checkbox | 否 | 否 | toggle-switch 控件 |
---
## 4. 部門職責模組 (deptFunctionForm)
| # | 欄位顯示名稱 | HTML元素ID | 資料庫欄位名稱 | 資料類型 | 是否必填 | 預設值 | 備註 |
|---|-----------|---------|------------|------|------|------|------|
| 1 | 部門職責編號 * | deptFunctionCode | deptFunctionCode | text | **是** | 空值 | 例如: DF-001 |
| 2 | 部門職責名稱 * | deptFunctionName | deptFunctionName | text | **是** | 空值 | 例如: 軟體研發部職責 |
| 3 | 事業體 (Business Unit) * (第1個) | deptFunctionBU | deptFunctionBU | select | **是** | 空值 | SBU, MBU, HQBU, ITBU, HRBU, ACCBU |
| 4 | 事業體 (Business Unit) * (第2個) | deptFunc_businessUnit | businessUnit | select | **是** | 空值 | 聯動選擇 |
| 5 | 處級單位 (Division) * | deptFunc_division | division | select | **是** | 空值 | 聯動選擇 |
| 6 | 部級單位 (Department) * | deptFunc_department | department | select | **是** | 空值 | 聯動選擇 |
| 7 | 課級單位 (Section) | deptFunc_section | section | text | 否 | 選填 | - |
| 8 | 崗位名稱 * | deptFunc_positionTitle | positionTitle | select | **是** | 空值 | 根據部級單位變動 |
| 9 | 崗位級別 | deptFunc_positionLevel | positionLevel | select | 否 | 空值 | E, M, S, D, VP, C |
| 10 | 部門主管職稱 | deptManager | deptManager | text | 否 | 例如: 部門經理 | - |
| 11 | 生效日期 * | deptFunctionEffectiveDate | deptFunctionEffectiveDate | date | **是** | 空值 | - |
| 12 | 部門人數上限 | deptHeadcount | deptHeadcount | number | 否 | 例如: 50 | min=1 |
| 13 | 部門狀態 | deptStatus | deptStatus | select | 否 | active | active, inactive, planning |
| 14 | 部門使命 (Mission) | deptMission | deptMission | textarea | 否 | 空值 | rows=3有範例提示 |
| 15 | 部門願景 (Vision) | deptVision | deptVision | textarea | 否 | 空值 | rows=3有範例提示 |
| 16 | 核心職責 (Core Functions) * | deptCoreFunctions | deptCoreFunctions | textarea | **是** | 空值 | rows=6有範例提示 |
| 17 | 關鍵績效指標 (KPIs) | deptKPIs | deptKPIs | textarea | 否 | 空值 | rows=4有範例提示 |
| 18 | 協作部門 | deptCollaboration | deptCollaboration | textarea | 否 | 空值 | rows=3有範例提示 |
| 19 | 備注 | deptFunctionRemark | deptFunctionRemark | textarea | 否 | 空值 | rows=3 |
---
## 5. 崗位描述模組 (jobDescForm - tab-jobdesc-basic)
### 5.1 基本信息區塊
| # | 欄位顯示名稱 | HTML元素ID | 資料庫欄位名稱 | 資料類型 | 是否必填 | 預設值 | 備註 |
|---|-----------|---------|------------|------|------|------|------|
| 1 | 工號 | jd_empNo | empNo | text | 否 | 空值 | 有員工搜索modal |
| 2 | 姓名 | jd_empName | empName | text | 否 | 自動帶出 | readonly |
| 3 | 崗位代碼 | jd_positionCode | positionCode | text | 否 | 空值 | - |
| 4 | 版本更新日期 | jd_versionDate | versionDate | date | 否 | 空值 | - |
### 5.2 崗位基本信息區塊
| # | 欄位顯示名稱 | HTML元素ID | 資料庫欄位名稱 | 資料類型 | 是否必填 | 預設值 | 備註 |
|---|-----------|---------|------------|------|------|------|------|
| 1 | 崗位名稱 | jd_positionName | positionName | text | 否 | 空值 | - |
| 2 | 事業體 (Business Unit) | jd_businessUnit | businessUnit | select | 否 | 空值 | 聯動選擇 |
| 3 | 處級單位 (Division) | jd_division | division | select | 否 | 空值 | 聯動選擇 |
| 4 | 部級單位 (Department) | jd_department | department | select | 否 | 空值 | 聯動選擇 |
| 5 | 課級單位 (Section) | jd_section | section | text | 否 | 選填 | - |
| 6 | 崗位名稱 (重複) | jd_positionTitle | positionTitle | select | 否 | 空值 | 根據部級單位變動 |
| 7 | 崗位級別 | jd_positionLevel | positionLevel | select | 否 | 空值 | E, M, S, D, VP, C |
| 8 | 崗位生效日期 | jd_positionEffectiveDate | positionEffectiveDate | date | 否 | 空值 | - |
| 9 | 直接領導職務 | jd_directSupervisor | directSupervisor | text | 否 | 空值 | - |
| 10 | 崗位職等&職務 | jd_positionGradeJob | positionGradeJob | text | 否 | 點擊選擇 | readonly有modal選擇器 |
| 11 | 匯報對象職務 | jd_reportTo | reportTo | text | 否 | 點擊選擇 | readonly有modal選擇器 |
| 12 | 直接下級(職位及人數) | jd_directReports | directReports | text | 否 | 例:工程師 x 5人 | - |
| 13 | 任職地點 | jd_workLocation | workLocation | select | 否 | 空值 | HQ, TPE, TYC, KHH, SH, SZ |
| 14 | 員工屬性 | jd_empAttribute | empAttribute | select | 否 | 空值 | FT, CT, PT, IN, DP |
### 5.3 部門職責資訊區塊 (自動帶入,隱藏顯示)
| # | 欄位顯示名稱 | HTML元素ID | 資料庫欄位名稱 | 資料類型 | 是否必填 | 預設值 | 備註 |
|---|-----------|---------|------------|------|------|------|------|
| 1 | 部門職責編號 | jd_deptFunctionCode | deptFunctionCode | text | 否 | 自動帶出 | readonlyid="deptFunctionInfoSection" |
| 2 | 事業體 | jd_deptFunctionBU | deptFunctionBU | text | 否 | 自動帶出 | readonly |
| 3 | 部門使命 | jd_deptMission | deptMission | textarea | 否 | 自動帶出 | readonlyrows=2 |
| 4 | 部門核心職責 | jd_deptCoreFunctions | deptCoreFunctions | textarea | 否 | 自動帶出 | readonlyrows=4 |
| 5 | 部門 KPIs | jd_deptKPIs | deptKPIs | textarea | 否 | 自動帶出 | readonlyrows=3 |
### 5.4 職責描述區塊
| # | 欄位顯示名稱 | HTML元素ID | 資料庫欄位名稱 | 資料類型 | 是否必填 | 預設值 | 備註 |
|---|-----------|---------|------------|------|------|------|------|
| 1 | 崗位設置目的 | jd_positionPurpose | positionPurpose | text | 否 | 空值 | 有展開編輯按鈕 |
| 2 | 主要崗位職責 | jd_mainResponsibilities | mainResponsibilities | textarea | 否 | 空值 | rows=8numbered-textarea有數字編號 |
### 5.5 崗位要求區塊
| # | 欄位顯示名稱 | HTML元素ID | 資料庫欄位名稱 | 資料類型 | 是否必填 | 預設值 | 備註 |
|---|-----------|---------|------------|------|------|------|------|
| 1 | 教育程度 | jd_education | education | text | 否 | 例:大學本科及以上 | - |
| 2 | 基本技能 | jd_basicSkills | basicSkills | textarea | 否 | 空值 | rows=2有展開編輯按鈕 |
| 3 | 專業知識 | jd_professionalKnowledge | professionalKnowledge | textarea | 否 | 空值 | rows=2有展開編輯按鈕 |
| 4 | 工作經驗 | jd_workExperienceReq | workExperienceReq | textarea | 否 | 空值 | rows=2有展開編輯按鈕 |
| 5 | 其他 | jd_otherRequirements | otherRequirements | textarea | 否 | 空值 | rows=3 |
---
## 6. 崗位清單模組 (positionListTable)
### 6.1 表格列(只讀顯示)
| # | 列標題 | 資料鍵值 | 資料類型 | 可排序 | 備註 |
|---|------|--------|------|------|------|
| 1 | 崗位編號 | positionCode | text | 是 | 可點擊排序 |
| 2 | 崗位名稱 | positionName | text | 是 | 可點擊排序 |
| 3 | 崗位類別 | positionCategory | text | 是 | 可點擊排序 |
| 4 | 崗位性質 | positionNature | text | 是 | 可點擊排序 |
| 5 | 編制人數 | headcount | number | 是 | 可點擊排序 |
| 6 | 崗位等級 | positionLevel | text | 是 | 可點擊排序 |
| 7 | 生效日期 | effectiveDate | date | 是 | 可點擊排序 |
| 8 | 操作 | - | button | 否 | 編輯/刪除按鈕 |
---
## 數據結構對應關係
### Position (崗位基礎資料)
```javascript
{
id: string,
basicInfo: {
positionCode: string,
positionName: string,
positionCategory: string,
positionCategoryName: string,
positionNature: string,
positionNatureName: string,
headcount: number,
positionLevel: string,
effectiveDate: date,
positionDesc: string,
positionRemark: string
},
recruitInfo: {
minEducation: string,
requiredGender: string,
salaryRange: string,
workExperience: number,
minAge: number,
maxAge: number,
jobType: string,
recruitPosition: string,
jobTitle: string,
jobDesc: string,
positionReq: string,
titleReq: string,
majorReq: string,
skillReq: string,
langReq: string,
otherReq: string,
superiorPosition: string,
recruitRemark: string
},
createdAt: datetime,
updatedAt: datetime
}
```
### Job (職務基礎資料)
```javascript
{
id: string,
jobCategoryCode: string,
jobCategoryName: string,
jobCode: string,
jobName: string,
jobNameEn: string,
jobEffectiveDate: date,
jobHeadcount: number,
jobSortOrder: number,
jobRemark: string,
jobLevel: string,
hasAttendanceBonus: boolean,
hasHousingAllowance: boolean,
createdAt: datetime,
updatedAt: datetime
}
```
### DeptFunction (部門職責)
```javascript
{
deptFunctionCode: string,
deptFunctionName: string,
deptFunctionBU: string,
businessUnit: string,
division: string,
department: string,
section: string,
positionTitle: string,
positionLevel: string,
deptManager: string,
deptFunctionEffectiveDate: date,
deptHeadcount: number,
deptStatus: string,
deptMission: string,
deptVision: string,
deptCoreFunctions: string,
deptKPIs: string,
deptCollaboration: string,
deptFunctionRemark: string
}
```
### JobDescription (崗位描述)
```javascript
{
basicInfo: {
empNo: string,
empName: string,
positionCode: string,
versionDate: date
},
positionInfo: {
positionName: string,
businessUnit: string,
division: string,
department: string,
section: string,
positionTitle: string,
positionLevel: string,
positionEffectiveDate: date,
directSupervisor: string,
positionGradeJob: string,
reportTo: string,
directReports: string,
workLocation: string,
empAttribute: string,
deptFunctionCode: string,
deptFunctionBU: string,
deptMission: string,
deptCoreFunctions: string,
deptKPIs: string
},
responsibilities: {
positionPurpose: string,
mainResponsibilities: string
},
requirements: {
education: string,
basicSkills: string,
professionalKnowledge: string,
workExperienceReq: string,
otherRequirements: string
}
}
```
---
## 關鍵特性總結
### 聯動選擇Cascading Select
- **事業體 → 處級單位 → 部級單位 → 課級單位**
- 在崗位基礎資料、部門職責、崗位描述中都有此聯動
- 觸發事件onchange="onXXXBusinessUnitChange/onXXXDivisionChange" 等
### 自動帶出欄位 (readonly)
- 崗位類別名稱 (根據崗位類別自動帶出)
- 崗位性質名稱 (根據崗位性質自動帶出)
- 職務類別名稱 (根據職務類別編號自動帶出)
- 員工姓名 (根據工號自動帶出)
- 部門職責相關資訊 (自動帶入到崗位描述)
### Modal/模態框
- 專業要求選擇 (Major Modal - majorModal)
- 員工搜索 (EmpSearchModal)
- 組織搜索 (OrgSearchModal)
- 職等職務選擇 (GradeJobModal)
- 匯報對象選擇 (ReportToModal)
### CSV 操作
- 職務基礎資料支援: 下載範本、匯出、匯入
- 部門職責支援: 匯入、匯出
### 特殊欄位
- **敏感信息欄位**: jobLevel (職務層級) - 標記為 *保密*
- **布林值(Checkbox)**: hasAttendanceBonus, hasHousingAllowance
- **Toggle Switch**: 用於布林值的友善UI
### 表單驗證
- 必填欄位用 `<span class="required">*</span>` 標記
- HTML5 required 屬性用於部分欄位
---
## 變更紀錄
| 日期 | 版本 | 變更內容 |
|------|------|--------|
| 2025-12-05 | v1.0 | 初版完整表單欄位清單 |