From 66eb2bebcaef9fd17764e01250cb93c55fdc058e Mon Sep 17 00:00:00 2001 From: Kittapath Date: Thu, 6 Jun 2024 13:23:23 +0700 Subject: [PATCH] set file build --- .github/workflows/release.yaml | 86 +++ entrypoint.sh | 2 +- src/api/index.ts | 111 ++- .../components/DialogAddPosition.vue | 235 ++++++ .../components/DialogFormPosition.vue | 727 ++++++++++++++++++ .../components/DialogHistoryPos.vue | 168 ++++ .../components/DialogMovePos.vue | 349 +++++++++ .../components/DialogPositionDetail.vue | 76 ++ .../components/DialogSelectPerson.vue | 693 +++++++++++++++++ .../components/DialogSortPosition.vue | 158 ++++ .../components/DialogSuccession.vue | 411 ++++++++++ .../components/TreeMain.vue | 168 ++++ .../components/TreeTable.vue | 705 +++++++++++++++++ .../components/TreeView.vue | 318 ++++++++ .../interface/index/Main.ts | 147 ++++ .../interface/index/organizational.ts | 107 +++ .../interface/request/Main.ts | 14 + .../interface/request/organizational.ts | 21 + .../interface/response/organizational.ts | 203 +++++ src/modules/16_positionEmployee/router.ts | 14 + .../store/organizational.ts | 137 ++++ .../16_positionEmployee/views/main.vue | 60 ++ 22 files changed, 4849 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/release.yaml create mode 100644 src/modules/16_positionEmployee/components/DialogAddPosition.vue create mode 100644 src/modules/16_positionEmployee/components/DialogFormPosition.vue create mode 100644 src/modules/16_positionEmployee/components/DialogHistoryPos.vue create mode 100644 src/modules/16_positionEmployee/components/DialogMovePos.vue create mode 100644 src/modules/16_positionEmployee/components/DialogPositionDetail.vue create mode 100644 src/modules/16_positionEmployee/components/DialogSelectPerson.vue create mode 100644 src/modules/16_positionEmployee/components/DialogSortPosition.vue create mode 100644 src/modules/16_positionEmployee/components/DialogSuccession.vue create mode 100644 src/modules/16_positionEmployee/components/TreeMain.vue create mode 100644 src/modules/16_positionEmployee/components/TreeTable.vue create mode 100644 src/modules/16_positionEmployee/components/TreeView.vue create mode 100644 src/modules/16_positionEmployee/interface/index/Main.ts create mode 100644 src/modules/16_positionEmployee/interface/index/organizational.ts create mode 100644 src/modules/16_positionEmployee/interface/request/Main.ts create mode 100644 src/modules/16_positionEmployee/interface/request/organizational.ts create mode 100644 src/modules/16_positionEmployee/interface/response/organizational.ts create mode 100644 src/modules/16_positionEmployee/router.ts create mode 100644 src/modules/16_positionEmployee/store/organizational.ts create mode 100644 src/modules/16_positionEmployee/views/main.vue diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..d91fae54 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,86 @@ +name: release-test +run-name: release-test ${{ github.actor }} +on: + push: + tags: + - "version-[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: +env: + REGISTRY: docker.frappet.com + IMAGE_NAME: ehr/bma-ehr-admin + DEPLOY_HOST: 49.0.91.80 + COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-admin + +jobs: + # act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd + release-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # skip Set up QEMU because it fail on act and container + # Gen Version try to get version from tag or inut + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + - name: Gen Version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + else + IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} + fi + if [[ $IMAGE_VER == '' ]]; then + IMAGE_VER='test-vBeta' + fi + echo '::set-output name=image_ver::'$IMAGE_VER + - name: Test Version + run: | + echo $GITHUB_REF + echo ${{ steps.gen_ver.outputs.image_ver }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login in to registry + uses: docker/login-action@v2 + with: + registry: ${{env.REGISTRY}} + username: ${{secrets.DOCKER_USER}} + password: ${{secrets.DOCKER_PASS}} + - name: Build and load local docker image + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64 + push: true + tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest + + - name: Reload docker compose + uses: appleboy/ssh-action@v0.1.8 + with: + host: ${{env.DEPLOY_HOST}} + username: frappet + password: ${{ secrets.SSH_PASSWORD }} + port: 10102 + script: | + cd "${{env.COMPOSE_PATH}}" + docker compose pull + docker compose up -d + echo "${{ steps.gen_ver.outputs.image_ver }}"> success + - uses: snow-actions/line-notify@v1.1.0 + if: success() + with: + access_token: ${{ secrets.TOKEN_LINE }} + message: | + -Success✅✅✅ + Image: ${{env.IMAGE_NAME}} + Version: ${{ steps.gen_ver.outputs.IMAGE_VER }} + By: ${{secrets.DOCKER_USER}} + - uses: snow-actions/line-notify@v1.1.0 + if: failure() + with: + access_token: ${{ secrets.TOKEN_LINE }} + message: | + -Failure❌❌❌ + Image: ${{env.IMAGE_NAME}} + Version: ${{ steps.gen_ver.outputs.IMAGE_VER }} + By: ${{secrets.DOCKER_USER}} diff --git a/entrypoint.sh b/entrypoint.sh index 2a468c6b..57b20dee 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,7 +4,7 @@ ROOT_DIR=/app # Replace env vars in JavaScript files echo "Replacing env constants in JS" -for file in $ROOT_DIR/assets/app.*.js* $ROOT_DIR/js/app.*.js* $ROOT_DIR/index.html $ROOT_DIR/precache-manifest*.js $ROOT_DIR/assets/index*.js* $ROOT_DIR/assets/*.js*; +for file in $ROOT_DIR/assets/app.*.js* $ROOT_DIR/index.html $ROOT_DIR/assets/index*.js* $ROOT_DIR/assets/*.js*; do echo "Processing $file ..."; diff --git a/src/api/index.ts b/src/api/index.ts index c0280387..478cc27a 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,70 +1,61 @@ /**config api */ -import { ref } from "vue"; +import { ref } from "vue" -const env = ref(process.env.NODE_ENV || "development"); -export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL; -export const apiUrlConfigReport = import.meta.env.VITE_API_REPORT_URL; +const env = ref(process.env.NODE_ENV || "development") +// export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL; +// export const apiUrlConfigReport = import.meta.env.VITE_API_REPORT_URL; // if (process.env.VUE_APP_TEST) { // env = "test"; // } const config = ref({ - development: { - API_URI: "https://bma-ehr.frappet.synology.me/api/v1", - API_URI_ORG_SERVICE: "https://bma-ehr.frappet.synology.me/api/v1", //ใช้ชั่วคราว - API_URI_ORG_EMPLOYEE_SERVICE: "https://bma-ehr.frappet.synology.me/api/v1", //ใช้ชั่วคราว - API_URI_PROFILE_SERVICE: "https://bma-ehr.frappet.synology.me/api/v1", //ใช้ชั่วคราว - API_REPORT_URI: "https://bma-ehr.frappet.synology.me/api/v1", - MEET_URI: "meet.frappet.com", - API_REPORT2_URI: "https://bma-ehr.frappet.synology.me/api/v2", - API_REPORT_TEMPLATE_URI: - "https://report-server.frappet.synology.me/api/v1/report-template", - }, - test: { - API_URI: "http://localhost:5010/api/v1", - API_CANDIDATE_URI: "https://localhost:7007/api/v1", - API_REPORT_URI: "https://localhost:7007/api/v1", - MEET_URI: "meet.frappet.com", - }, - production: { - // API_URI: "https://localhost:5010", - API_URI: `${window.location.protocol}//${window.location.host}/api/v1`, - API_URI_ORG_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`, //ใช้ชั่วคราว - API_URI_ORG_EMPLOYEE_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`, //ใช้ชั่วคราว - API_URI_PROFILE_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`, - API_REPORT_URI: `${window.location.protocol}//${window.location.host}/api/v1`, - MEET_URI: "meet.frappet.com", - API_REPORT2_URI: `${window.location.protocol}//${window.location.host}/api/v2`, - API_REPORT_TEMPLATE_URI: apiUrlConfigReport, - }, -}); + development: { + API_URI: "https://bma-ehr.frappet.synology.me/api/v1", + API_URI_ORG_SERVICE: "https://bma-ehr.frappet.synology.me/api/v1", //ใช้ชั่วคราว + API_URI_ORG_EMPLOYEE_SERVICE: "https://bma-ehr.frappet.synology.me/api/v1", //ใช้ชั่วคราว + API_URI_PROFILE_SERVICE: "https://bma-ehr.frappet.synology.me/api/v1", //ใช้ชั่วคราว + API_REPORT_URI: "https://bma-ehr.frappet.synology.me/api/v1", + MEET_URI: "meet.frappet.com", + API_REPORT2_URI: "https://bma-ehr.frappet.synology.me/api/v2", + API_REPORT_TEMPLATE_URI: "https://report-server.frappet.synology.me/api/v1/report-template", + }, + test: { + API_URI: "http://localhost:5010/api/v1", + API_CANDIDATE_URI: "https://localhost:7007/api/v1", + API_REPORT_URI: "https://localhost:7007/api/v1", + MEET_URI: "meet.frappet.com", + }, + production: { + // API_URI: "https://localhost:5010", + API_URI: `${window.location.protocol}//${window.location.host}/api/v1`, + API_URI_ORG_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`, //ใช้ชั่วคราว + API_URI_ORG_EMPLOYEE_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`, //ใช้ชั่วคราว + API_URI_PROFILE_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`, + API_REPORT_URI: `${window.location.protocol}//${window.location.host}/api/v1`, + MEET_URI: "meet.frappet.com", + API_REPORT2_URI: `${window.location.protocol}//${window.location.host}/api/v2`, + // API_REPORT_TEMPLATE_URI: apiUrlConfigReport, + }, +}) -const API_URI = ref(config.value[env.value].API_URI); -const API_REPORT_URI = ref(config.value[env.value].API_REPORT_URI); -const API_URI_ORG_SERVICE = ref( - config.value[env.value].API_URI_ORG_SERVICE -); -const API_URI_ORG_EMPLOYEE_SERVICE = ref( - config.value[env.value].API_URI_ORG_EMPLOYEE_SERVICE -); -const MEET_URI = ref(config.value[env.value].MEET_URI); -const API_URI_PROFILE_SERVICE = ref( - config.value[env.value].API_URI_PROFILE_SERVICE -); -const API_REPORT2_URI = ref(config.value[env.value].API_REPORT2_URI); -const API_REPORT_TEMPLATE_URI = ref( - config.value[env.value].API_REPORT_TEMPLATE_URI -); +const API_URI = ref(config.value[env.value].API_URI) +const API_REPORT_URI = ref(config.value[env.value].API_REPORT_URI) +const API_URI_ORG_SERVICE = ref(config.value[env.value].API_URI_ORG_SERVICE) +const API_URI_ORG_EMPLOYEE_SERVICE = ref(config.value[env.value].API_URI_ORG_EMPLOYEE_SERVICE) +const MEET_URI = ref(config.value[env.value].MEET_URI) +const API_URI_PROFILE_SERVICE = ref(config.value[env.value].API_URI_PROFILE_SERVICE) +const API_REPORT2_URI = ref(config.value[env.value].API_REPORT2_URI) +const API_REPORT_TEMPLATE_URI = ref(config.value[env.value].API_REPORT_TEMPLATE_URI) export default { - env: env.value, - config: config.value, - API_URI: API_URI.value, - API_REPORT_URI: API_REPORT_URI.value, - API_URI_ORG_SERVICE: API_URI_ORG_SERVICE.value, - API_URI_ORG_EMPLOYEE_SERVICE: API_URI_ORG_EMPLOYEE_SERVICE.value, - API_URI_PROFILE_SERVICE: API_URI_PROFILE_SERVICE.value, - MEET_URI: MEET_URI.value, - API_REPORT2_URI: API_REPORT2_URI.value, - API_REPORT_TEMPLATE_URI: API_REPORT_TEMPLATE_URI.value, -}; + env: env.value, + config: config.value, + API_URI: API_URI.value, + API_REPORT_URI: API_REPORT_URI.value, + API_URI_ORG_SERVICE: API_URI_ORG_SERVICE.value, + API_URI_ORG_EMPLOYEE_SERVICE: API_URI_ORG_EMPLOYEE_SERVICE.value, + API_URI_PROFILE_SERVICE: API_URI_PROFILE_SERVICE.value, + MEET_URI: MEET_URI.value, + API_REPORT2_URI: API_REPORT2_URI.value, + API_REPORT_TEMPLATE_URI: API_REPORT_TEMPLATE_URI.value, +} diff --git a/src/modules/16_positionEmployee/components/DialogAddPosition.vue b/src/modules/16_positionEmployee/components/DialogAddPosition.vue new file mode 100644 index 00000000..7bee3f75 --- /dev/null +++ b/src/modules/16_positionEmployee/components/DialogAddPosition.vue @@ -0,0 +1,235 @@ + + + diff --git a/src/modules/16_positionEmployee/components/DialogFormPosition.vue b/src/modules/16_positionEmployee/components/DialogFormPosition.vue new file mode 100644 index 00000000..29b766e0 --- /dev/null +++ b/src/modules/16_positionEmployee/components/DialogFormPosition.vue @@ -0,0 +1,727 @@ + + + + + diff --git a/src/modules/16_positionEmployee/components/DialogHistoryPos.vue b/src/modules/16_positionEmployee/components/DialogHistoryPos.vue new file mode 100644 index 00000000..1e047116 --- /dev/null +++ b/src/modules/16_positionEmployee/components/DialogHistoryPos.vue @@ -0,0 +1,168 @@ + + + + diff --git a/src/modules/16_positionEmployee/components/DialogMovePos.vue b/src/modules/16_positionEmployee/components/DialogMovePos.vue new file mode 100644 index 00000000..dff18423 --- /dev/null +++ b/src/modules/16_positionEmployee/components/DialogMovePos.vue @@ -0,0 +1,349 @@ + + + + diff --git a/src/modules/16_positionEmployee/components/DialogPositionDetail.vue b/src/modules/16_positionEmployee/components/DialogPositionDetail.vue new file mode 100644 index 00000000..1c2b1a59 --- /dev/null +++ b/src/modules/16_positionEmployee/components/DialogPositionDetail.vue @@ -0,0 +1,76 @@ + + diff --git a/src/modules/16_positionEmployee/components/DialogSelectPerson.vue b/src/modules/16_positionEmployee/components/DialogSelectPerson.vue new file mode 100644 index 00000000..59095264 --- /dev/null +++ b/src/modules/16_positionEmployee/components/DialogSelectPerson.vue @@ -0,0 +1,693 @@ + + + + + diff --git a/src/modules/16_positionEmployee/components/DialogSortPosition.vue b/src/modules/16_positionEmployee/components/DialogSortPosition.vue new file mode 100644 index 00000000..6f796c65 --- /dev/null +++ b/src/modules/16_positionEmployee/components/DialogSortPosition.vue @@ -0,0 +1,158 @@ + + diff --git a/src/modules/16_positionEmployee/components/DialogSuccession.vue b/src/modules/16_positionEmployee/components/DialogSuccession.vue new file mode 100644 index 00000000..3334c340 --- /dev/null +++ b/src/modules/16_positionEmployee/components/DialogSuccession.vue @@ -0,0 +1,411 @@ + + + + + diff --git a/src/modules/16_positionEmployee/components/TreeMain.vue b/src/modules/16_positionEmployee/components/TreeMain.vue new file mode 100644 index 00000000..b72ff449 --- /dev/null +++ b/src/modules/16_positionEmployee/components/TreeMain.vue @@ -0,0 +1,168 @@ + + + + + diff --git a/src/modules/16_positionEmployee/components/TreeTable.vue b/src/modules/16_positionEmployee/components/TreeTable.vue new file mode 100644 index 00000000..e022d9b4 --- /dev/null +++ b/src/modules/16_positionEmployee/components/TreeTable.vue @@ -0,0 +1,705 @@ + + + + + diff --git a/src/modules/16_positionEmployee/components/TreeView.vue b/src/modules/16_positionEmployee/components/TreeView.vue new file mode 100644 index 00000000..659a8ab4 --- /dev/null +++ b/src/modules/16_positionEmployee/components/TreeView.vue @@ -0,0 +1,318 @@ + + + + + diff --git a/src/modules/16_positionEmployee/interface/index/Main.ts b/src/modules/16_positionEmployee/interface/index/Main.ts new file mode 100644 index 00000000..95adf29d --- /dev/null +++ b/src/modules/16_positionEmployee/interface/index/Main.ts @@ -0,0 +1,147 @@ +interface Pagination { + rowsPerPage: number; +} + +interface DataOption { + id: string; + name: string; +} + +interface ListMenu { + label: string; + icon: string; + type: string; + color: string; +} + +interface FormDataAgency { + orgName: string; + orgShortName: string; + orgCode: string; + orgPhoneEx: string; + orgPhoneIn: string; + orgFax: string; + orgLevel: string; + orgLevelSub: string; +} + +interface FormDataPosition { + shortName: string; + prefixNo: string; + positionNo: string; + suffixNo: string; + reason: string; +} + +interface FormDataNewStructure { + orgRevisionId: string; + orgRevisionName: string; + typeDraft: string; +} + +interface FormAgencyRef { + orgName: object | null; + orgShortName: object | null; + orgCode: object | null; + // orgPhoneEx: object | null; + // orgPhoneIn: object | null; + // orgFax: object | null; + orgLevel: object | null; + [key: string]: any; +} + +interface FormPositionRef { + prefixNo: object | null; + positionNo: object | null; + [key: string]: any; +} + +interface FormDateTimeRef { + dateTime: object | null; + [key: string]: any; +} + +interface FormNewStructureRef { + orgRevisionName: object | null; + orgRevisionId: object | null; + type: object | null; + [key: string]: any; +} + +interface HistoryType { + orgRevisionId: string; + orgRevisionName: string; + orgRevisionIsCurrent: boolean; + orgRevisionIsDraft: boolean; + orgRevisionCreatedAt: Date | string; +} +interface HistoryPostType { + id: string; + name: string; + lastUpdatedAt: Date; + orgRevisionName: string; +} + +interface FormPositionSelect { + positionId: string; + positionName: string; + positionField: string; + positionType: string; + positionLevel: string; + positionExecutive: string; + positionExecutiveField: string; + positionArea: string; +} + +interface FormPositionSelectRef { + positionName: object | null; + positionField: object | null; + positionType: object | null; + positionLevel: object | null; + positionExecutive: object | null; + positionExecutiveField: object | null; + positionArea: object | null; + [key: string]: any; +} + +interface RowDetailPositions { + id: string; + positionId: string; + positionName: string; + positionField: string; + positionType: string; + positionLevel: string; + positionExecutive: string; + positionExecutiveField: string; + positionArea: string; + posTypeId: string; + posLevelId: string; + posExecutiveId: string; + isSpecial: boolean; +} + +interface NewPagination { + descending: boolean; + page: number; + rowsPerPage: number; + sortBy: string; +} + +export type { + Pagination, + DataOption, + FormDataAgency, + FormDataPosition, + FormAgencyRef, + FormPositionRef, + FormDateTimeRef, + FormDataNewStructure, + FormNewStructureRef, + HistoryType, + ListMenu, + FormPositionSelect, + RowDetailPositions, + HistoryPostType, + FormPositionSelectRef, + NewPagination, +}; diff --git a/src/modules/16_positionEmployee/interface/index/organizational.ts b/src/modules/16_positionEmployee/interface/index/organizational.ts new file mode 100644 index 00000000..f6f21bd6 --- /dev/null +++ b/src/modules/16_positionEmployee/interface/index/organizational.ts @@ -0,0 +1,107 @@ +interface DataPosition { + id: string; + orgRootId: string; + orgChild1Id: string | null; + orgChild2Id: string | null; + orgChild3Id: string | null; + orgChild4Id: string | null; + posMasterNoPrefix: string; + posMasterNo: string; + posMasterNoSuffix: string; + orgShortname: string; + positions: Position[]; + positionName: string; + positionField: string; + posTypeId: string; + posTypeName: string; + posLevelId: string; + posLevelName: string; + posExecutiveId: string; + posExecutiveName: string; + positionExecutiveField: string; + positionArea: string; + positionIsSelected: string | boolean; +} + +interface Position { + id: string; + positionName: string; + positionField: string; + posTypeId: string; + posTypeName: string; + posLevelId: string; + posLevelName: string; + posExecutiveId: string; + posExecutiveName: string; + positionExecutiveField: string; + positionArea: string; + positionIsSelected: boolean; +} + +interface FormDetailPosition { + positionNo: string; + positionType: string; + positionPathSide: string; + positionLine: string; + positionSide: string; + positionLevel: string; + positionExecutive: string; + positionExecutiveSide: string; + status: string; +} + +interface DataTree { + orgTreeId: string; + orgRootId?: string; + orgLevel: number; + orgName: string; + orgTreeName: string; + orgTreeShortName: string; + orgTreeCode: string; + orgCode: string; + orgTreeRank: string; + orgTreeOrder: number; + orgRootCode?: string; + orgTreePhoneEx: string; + orgTreePhoneIn: string; + orgTreeFax: string; + orgRevisionId: string; + orgRootName: string; + totalPosition: number; + totalPositionCurrentUse: number; + totalPositionCurrentVacant: number; + totalPositionNextUse: number; + totalPositionNextVacant: number; + totalRootPosition: number; + totalRootPositionCurrentUse: number; + totalRootPositionCurrentVacant: number; + totalRootPositionNextUse: number; + totalRootPositionNextVacant: number; + + children?: DataTree[]; +} + +interface SeaechResult { + id: string; + citizenId: string; + name: string; + posTypeName: string; + posLevelName: string; +} +interface FormPositionFilter { + positionNo: string; + positionType: string; + positionLevel: string; + personal: string; + position: string; + status: string; +} + +export type { + DataPosition, + Position, + FormDetailPosition, + DataTree, + SeaechResult, + FormPositionFilter, +}; diff --git a/src/modules/16_positionEmployee/interface/request/Main.ts b/src/modules/16_positionEmployee/interface/request/Main.ts new file mode 100644 index 00000000..b5eb23bd --- /dev/null +++ b/src/modules/16_positionEmployee/interface/request/Main.ts @@ -0,0 +1,14 @@ +interface DataSumCalendarObject { + id: number; + monthFull: String; + count: number; + color: String; +} + +interface DataListsObject { + id: number; + count: number; + name: string; +} + +export type { DataSumCalendarObject, DataListsObject }; diff --git a/src/modules/16_positionEmployee/interface/request/organizational.ts b/src/modules/16_positionEmployee/interface/request/organizational.ts new file mode 100644 index 00000000..074095c3 --- /dev/null +++ b/src/modules/16_positionEmployee/interface/request/organizational.ts @@ -0,0 +1,21 @@ +interface FilterMaster { + id: string; //*Id node + type: number; //*ประเภทnode + isAll: boolean; //*(true->ทั้งหมด, false->ในระดับตัวเอง) + page: number; //*หน้า + pageSize: number; //*จำนวนแถวต่อหน้า + keyword: string; //ข้อความที่ต้องการค้นหา + revisionId?: string +} +interface MovePos { + id: string; + type: number; + positionMaster: string[]; +} + +interface Inherit { + draftPositionId: string; + publishPositionId: string; +} + +export type { FilterMaster, MovePos, Inherit }; diff --git a/src/modules/16_positionEmployee/interface/response/organizational.ts b/src/modules/16_positionEmployee/interface/response/organizational.ts new file mode 100644 index 00000000..d674b577 --- /dev/null +++ b/src/modules/16_positionEmployee/interface/response/organizational.ts @@ -0,0 +1,203 @@ +interface DataActive { + activeId: string; + activeName: string; + draftId: string; + draftName: string; + isPublic: boolean; + orgPublishDate: Date | null; +} + +interface SumPosition { + totalPosition: number; + totalPositionCurrentUse: number; + totalPositionCurrentVacant: number; + totalPositionNextUse: number; + totalPositionNextVacant: number; + totalRootPosition: number; + totalRootPositionCurrentUse: number; + totalRootPositionCurrentVacant: number; + totalRootPositionNextUse: number; + totalRootPositionNextVacant: number; +} + +interface OrgTree { + orgTreeId: string; + orgRootId: string; + orgLevel: number; + orgTreeName: string; + orgTreeShortName: string; + orgTreeCode: string; + orgCode: string; + orgTreeRank: string; + orgTreeOrder: number | null; + orgRootCode: string; + orgTreePhoneEx: string; + orgTreePhoneIn: string; + orgTreeFax: string; + orgRevisionId: string; + children: OrgTree[]; +} + +interface OrgRevision { + orgRevisionCreatedAt: string | null; + orgRevisionId: string; + orgRevisionIsCurrent: boolean; + orgRevisionIsDraft: boolean; + orgRevisionName: string; +} + +interface OptionType { + id: string; + posTypeName: string; +} + +interface OptionLevel { + id: string; + posLevelName: string; +} + +interface OptionExecutive { + id: string; + posExecutiveName: string; +} + +interface DataPosition { + id: string; + posExecutiveId: string; + posExecutiveName: string; + posLevelId: string; + posLevelName: string; + posTypeId: string; + posTypeName: string; + positionArea: string; + positionExecutiveField: string; + positionField: string; + positionIsSelected: boolean; + positionName: string; +} + +interface Position { + id: string; // id ตำแหน่ง + positionName: string; // ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง) + positionField: string; // สายงาน + posTypeId: string; // ประเภทตำแหน่ง + posTypeName: string; // ประเภทตำแหน่ง + posLevelId: string; // ระดับตำแหน่ง + posLevelName: string; // ระดับตำแหน่ง + posExecutiveId: string; // ตำแหน่งทางการบริหาร + posExecutiveName: string; // ตำแหน่งทางการบริหาร + positionExecutiveField: string; // ด้านทางการบริหาร + positionArea: string; // ด้าน/สาขา + positionIsSelected: boolean; // เป็นตำแหน่งที่ถูกเลือกในรอบนั้น ๆ หรือไม่? +} + +interface PosMaster { + id: string; // id อัตรากำลัง posmaster + orgShortname: string; // อักษรย่อตำแหน่ง + posMasterNoPrefix: string; // Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ) + posMasterNo: number | string; // เลขที่ตำแหน่ง เป็นตัวเลข + posMasterNoSuffix: string | null; // Suffix หลังเลขที่ตำแหน่ง เช่น ช. + positionName: string; // ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง) + positionField: string; // สายงาน + posTypeId: string; // ประเภทตำแหน่ง + posTypeName: string; // ประเภทตำแหน่ง + posLevelId: string; // ระดับตำแหน่ง + posLevelName: string; // ระดับตำแหน่ง + posExecutiveId: string; // ตำแหน่งทางการบริหาร + posExecutiveName: string; // ตำแหน่งทางการบริหาร + positionExecutiveField: string; // ด้านทางการบริหาร + positionArea: string; // ด้าน/สาขา + positionIsSelected: boolean; // เป็นตำแหน่งที่ถูกเลือกในรอบนั้น ๆ หรือไม่? + fullNameCurrentHolder: string | null; + fullNameNextHolder: string | null; + positions: Position[]; // ตำแหน่ง + isSit: boolean; + profilePosition: string; + profilePostype: string; + profilePoslevel: string; +} +interface Position2 { + id: string; // id ตำแหน่ง + positionName: string; // ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง) + positionField: string; // สายงาน + posTypeId: string; // ประเภทตำแหน่ง + posTypeName: string; // ประเภทตำแหน่ง + posLevelId: string; // ระดับตำแหน่ง + posLevelName: string; // ระดับตำแหน่ง + posExecutiveId: string; // ตำแหน่งทางการบริหาร + posExecutiveName: string; // ตำแหน่งทางการบริหาร + positionExecutiveField: string; // ด้านทางการบริหาร + positionArea: string; // ด้าน/สาขา + positionIsSelected: string; // เป็นตำแหน่งที่ถูกเลือกในรอบนั้น ๆ หรือไม่? +} + +interface PosMaster2 { + id: string; // id อัตรากำลัง posmaster + orgShortname: string; // อักษรย่อตำแหน่ง + posMasterNoPrefix: string; // Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ) + posMasterNo: number | string; // เลขที่ตำแหน่ง เป็นตัวเลข + posMasterNoSuffix: string | null; // Suffix หลังเลขที่ตำแหน่ง เช่น ช. + positionName: string; // ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง) + positionField: string; // สายงาน + posTypeId: string; // ประเภทตำแหน่ง + posTypeName: string; // ประเภทตำแหน่ง + posLevelId: string; // ระดับตำแหน่ง + posLevelName: string; // ระดับตำแหน่ง + posExecutiveId: string; // ตำแหน่งทางการบริหาร + posExecutiveName: string; // ตำแหน่งทางการบริหาร + positionExecutiveField: string; // ด้านทางการบริหาร + positionArea: string; // ด้าน/สาขา + positionIsSelected: string; // เป็นตำแหน่งที่ถูกเลือกในรอบนั้น ๆ หรือไม่? + positions: Position[]; // ตำแหน่ง +} + +interface HistoryPos { + id: string; //id node + orgShotName: string; //ชื่อย่อส่วนราชการ + lastUpdatedAt: Date; //วันที่แก้ไข + posMasterNoPrefix: string; //Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ) + posMasterNo: number; //เลขที่ตำแหน่ง เป็นตัวเลข + posMasterNoSuffix: string; //Suffix หลังเลขที่ตำแหน่ง เช่น ช. +} + +interface SelectPerson { + citizenId: string; + firstName: string; + id: string; + lastName: string; + posLevel: string; + posType: string; + position: string; + prefix: string; +} + +interface PosLevels { + id: string; + posLevelAuthority: null; + posLevelName: string; + posLevelRank: number; +} +interface TypePos { + id: string; + PosLevels: PosLevels[]; + posTypeName: string; + posTypeRank: number; +} + +export type { + DataActive, + OrgTree, + OrgRevision, + OptionType, + OptionLevel, + OptionExecutive, + DataPosition, + PosMaster, + PosMaster2, + Position, + Position2, + SumPosition, + HistoryPos, + SelectPerson, + TypePos, +}; diff --git a/src/modules/16_positionEmployee/router.ts b/src/modules/16_positionEmployee/router.ts new file mode 100644 index 00000000..9865b0d1 --- /dev/null +++ b/src/modules/16_positionEmployee/router.ts @@ -0,0 +1,14 @@ +const mainPage = () => import("@/modules/16_positionEmployee/views/main.vue"); + +export default [ + { + path: "/position-employee", + name: "positionEmployee", + component: mainPage, + meta: { + Auth: true, + Key: [1], + Role: "positionEmployee", + }, + }, +]; diff --git a/src/modules/16_positionEmployee/store/organizational.ts b/src/modules/16_positionEmployee/store/organizational.ts new file mode 100644 index 00000000..3db85426 --- /dev/null +++ b/src/modules/16_positionEmployee/store/organizational.ts @@ -0,0 +1,137 @@ +import { defineStore } from "pinia"; +import { reactive, ref } from "vue"; + +/** importType*/ +import type { + DataActive, + SumPosition, + PosMaster, +} from "@/modules/16_positionEmployee/interface/response/organizational"; + +export const usePositionEmp = defineStore("positionEmpStore", () => { + const typeOrganizational = ref("current"); + const statusView = ref("list"); + + const dataActive = ref(); + const activeId = ref(); + const draftId = ref(); + const historyId = ref(); + const treeId = ref(); + const level = ref(); + const isPublic = ref(false); + const orgPublishDate = ref(null); + const sumPosition = reactive({ + total: 0, + use: 0, + vacant: 0, + totalRoot: 0, + useRoot: 0, + vacantRoot: 0, + }); + + function getSumPosition(data: SumPosition) { + sumPosition.total = data.totalPosition; + sumPosition.totalRoot = data.totalRootPosition ? data.totalRootPosition : 0; + + if (typeOrganizational.value == "draft") { + sumPosition.use = data.totalPositionNextUse; + sumPosition.useRoot = data.totalRootPositionNextUse + ? data.totalRootPositionNextUse + : 0; + + sumPosition.vacant = data.totalPositionNextVacant; + sumPosition.vacantRoot = data.totalRootPositionNextVacant + ? data.totalRootPositionNextVacant + : 0; + } else { + sumPosition.use = data.totalPositionCurrentUse; + sumPosition.useRoot = data.totalRootPositionCurrentUse + ? data.totalRootPositionCurrentUse + : 0; + + sumPosition.vacant = data.totalPositionCurrentVacant; + sumPosition.vacantRoot = data.totalRootPositionCurrentVacant + ? data.totalRootPositionCurrentVacant + : 0; + } + } + + function fetchDataActive(data: DataActive) { + activeId.value = data.activeId; + draftId.value = data.draftId; + dataActive.value = data; + isPublic.value = data.isPublic; + orgPublishDate.value = data.orgPublishDate; + } + + function fetchPosMaster(data: PosMaster[]) { + const newPosMaster = data.map((e: PosMaster) => ({ + ...e, + positionIsSelected: e.fullNameCurrentHolder + ? e.fullNameCurrentHolder + : "ว่าง", + posMasterNo: + e.orgShortname + + (e.posMasterNoPrefix ? e.posMasterNoPrefix : "") + + (e.posMasterNo ? e.posMasterNo : "") + + (e.posMasterNoSuffix ? e.posMasterNoSuffix : ""), + positionName: e.isSit ? e.profilePosition : e.positionName, + posTypeName: e.isSit ? e.profilePostype : e.posTypeName, + posLevelName: e.isSit ? e.profilePoslevel : e.posLevelName, + posExecutiveName: e.posExecutiveName, + isSit: e.isSit, + })); + + return newPosMaster; + } + + function checkLevel(type: number) { + switch (type) { + case 0: + return "Root"; + case 1: + return "Child1"; + case 2: + return "Child2"; + case 3: + return "Child3"; + default: + return "Child4"; + } + } + + function convertType(type: string) { + switch (type) { + case "DEPARTMENT": + return "ระดับสำนัก"; + case "OFFICE": + return "ระดับกอง/สำนักงาน/ส่วนราชการ/โรงพยาบาล/เทียบเท่ากอง"; + case "DIVISION": + return "ระดับส่วน/กลุ่มภารกิจ"; + case "SECTION": + return "ระดับฝ่าย/กลุ่มงาน"; + default: + return "-"; + } + } + + return { + typeOrganizational, + statusView, + + // + fetchDataActive, + checkLevel, + convertType, + draftId, + activeId, + historyId, + treeId, + level, + isPublic, + orgPublishDate, + fetchPosMaster, + sumPosition, + getSumPosition, + }; +}); diff --git a/src/modules/16_positionEmployee/views/main.vue b/src/modules/16_positionEmployee/views/main.vue new file mode 100644 index 00000000..cc797634 --- /dev/null +++ b/src/modules/16_positionEmployee/views/main.vue @@ -0,0 +1,60 @@ + + + + +