# ระบบ BMA eHR (eHR กรุงเทพมหานคร) สำหรับ User ## โครงสร้างโฟลเดอร์ ภายใต้ src จะประกอบด้วยโฟลเดอร์ที่จำเป็นดังนี้ 1. **assets** : สำหรับเก็บไฟล์ภาพกราฟิก + css 2. **components** : สำหรับเก็บ Component ส่วนกลางที่สามารถเรียกใช้จากระบบใดก็ได้ 3. **helpers** : สำหรับเก็บ filter, composable ที่เรียกใช้จากระบบใดก็ได้ 4. **modules** : สำหรับเก็บไฟล์โค้ดหลัก ภายในจะแบ่งเป็นโฟลเดอร์ย่อยของระบบต่าง ๆ ทั้ง 17 ระบบ 17 โฟลเดอร์ ภายใต้โฟลเดอร์ย่อยของระบบจะเป็นโครงสร้างแบบเดียวกับ vue template เช่น ภายใต้โฟลเดอร์ 01_metadata (ระบบข้อมูลหลัก) ประกอบด้วยโฟลเดอร์ - **components** : โฟลเดอร์เก็บ Component ที่ใช้เฉพาะระบบข้อมูลหลัก - **views** : โฟลเดอร์เก็บ View/Layout ที่ใช้เฉพาะระบบข้อมูลหลัก ## การกำหนดค่าตัวแปร Environment Variable 1. สร้างไฟล์ .env.local ที่ root ของ Project โดยกำหนดค่าตามนี้ ซึ่งไฟล์นี้จะใช้สำหรับให้ App อ่านค่าตัวแปรเพื่อนำไปใช้ตอน run dev ``` VITE_COMPETITIVE_EXAM_PANEL= "https://bma-dashboard.frappet.synology.me/goto/e15Slas4z?orgId=1" VITE_QUALIFY_DISABLE_EMAM_PANEL= "https://bma-dashboard.frappet.synology.me/goto/r19B_asVz?orgId=1" VITE_QUALIFY_EXAM_PANEL= "https://bma-dashboard.frappet.synology.me/goto/9DWylasVk?orgId=1" ``` 2.สร้างไฟล์ .env.production ที่ root ของ Project โดยกำหนดค่าตามนี้ ซึ่งไฟล์นี้จะใช้สำหรับการ build App เพื่อที่จะได้นำค่าไปใส่ใน javascript แล้วใช้คำสั่งในการ Replace ค่าจาก environment variable ใน yaml file ``` VITE_COMPETITIVE_EXAM_PANEL=VITE_COMPETITIVE_EXAM_PANEL VITE_QUALIFY_DISABLE_EMAM_PANEL=VITE_QUALIFY_DISABLE_EMAM_PANEL VITE_QUALIFY_EXAM_PANEL=VITE_QUALIFY_EXAM_PANEL ``` ## รูปแบบ SFC ที่แนะนำให้ใช้ใน Vue 3 ลำดับการวางโค้ดใน Vue 3 จะย้ายแท็ก script ขึ้นก่อนแท็ก template ส่วนแท็ก style จะอยู่ลำดับล่างสุดเหมือนเดิม - แท็ก script ควรมี setup และ lang="ts" บอกเสมอ - แท็ก style ควรกำหนด lang และ scoped ด้วย ตัวอย่างด้านล่าง ``` ``` ## การอ้างอิง Path Vue Template ได้สร้าง shortcut ไว้ให้แล้วด้วยการใส่เครื่องหมาย '@' นำหน้า ซึ่ง @ แทน src ดังนั้นพาธใด ๆ ก็ต้องจะอยู่ภายใน @ ทั้งหมด เช่น ต้องการเรียก src/components ให้ใส่ว่า "@/components" ถ้าเป็นไปได้ไม่ควรใช้ relative path ## ชื่อภาษาอังกฤษที่ใช้ในระบบต่าง ๆ 1. ระบบข้อมูลหลัก = **metadata** 2. ระบบโครงสร้างหน่วยงานและกรอบอัตรากำลัง = **organizational** 3. ระบบการสรรหา = **recruiting** 4. ระบบทะเบียนประวัติ = **registry** 5. ระบบการบรรจุ แต่งตั้ง ย้าย โอน 6. ระบบการพ้นจากราชการ 7. ระบบงานเครื่องราชอิสริยภรณ์ --- ## Recommended IDE Setup [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). ## Type Support for `.vue` Imports in TS TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: 1. Disable the built-in TypeScript Extension 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. ## Customize configuration See [Vite Configuration Reference](https://vitejs.dev/config/). ## Project Setup ```sh npm install ``` ### Compile and Hot-Reload for Development ```sh npm run dev ``` ### Type-Check, Compile and Minify for Production ```sh npm run build ``` ### Run Unit Tests with [Vitest](https://vitest.dev/) ```sh npm run test:unit ``` ### Run End-to-End Tests with [Cypress](https://www.cypress.io/) ```sh npm run test:e2e:dev ``` This runs the end-to-end tests against the Vite development server. It is much faster than the production build. But it's still recommended to test the production build with `test:e2e` before deploying (e.g. in CI environments): ```sh npm run build npm run test:e2e ``` ### Lint with [ESLint](https://eslint.org/) ```sh npm run lint ```