This commit is contained in:
setthawutttty 2024-11-06 16:47:02 +07:00
parent 8390a8ab01
commit 8c989e84b2
23 changed files with 201 additions and 149 deletions

View file

@ -12,24 +12,41 @@ export default {
proFileType: `${profileOrg}/type`, proFileType: `${profileOrg}/type`,
dataUserInformation: `${profileOrg}/user`, dataUserInformation: `${profileOrg}/user`,
dataUserInformationByType: (type: string) => `${org}/profile${type}/user`,
dataUserChangeName: `${profileOrg}/changeName/user`, dataUserChangeName: `${profileOrg}/changeName/user`,
dataUserChangeNameByType: (type: string) =>
`${org}/profile${type}/changeName/user`,
dataUserAddress: `${profileOrg}/address/user`, dataUserAddress: `${profileOrg}/address/user`,
dataUserAddressByType: (type: string) => `${org}/profile${type}/address/user`,
dataUserFamily: (type: string) => `${profileOrg}/family/${type}/user`, dataUserFamily: (type: string) => `${profileOrg}/family/${type}/user`,
dataUserFamilyByType: (emtype: string, type: string) =>
`${org}/profile${emtype}/family/${type}/user`,
dataUserEducations: `${profileOrg}/educations/user`, dataUserEducations: `${profileOrg}/educations/user`,
dataUserEducationsByType: (type: string) =>
`${org}/profile${type}/educations/user`,
dataUserAbility: `${profileOrg}/ability/user`, dataUserAbility: `${profileOrg}/ability/user`,
dataUserAbilityByType: (type: string) => `${org}/profile${type}/ability/user`,
dataUserGovernment: `${profileOrg}/government/user`, dataUserGovernment: `${profileOrg}/government/user`,
dataUserGovernmentByType: (type: string) => `${org}/profile${type}/government/user`,
dataUserDiscipline: `${profileOrg}/discipline/user`, dataUserDiscipline: `${profileOrg}/discipline/user`,
dataUserDisciplineByType: (type: string) => `${org}/profile${type}/discipline/user`,
dataUserLeave: `${profileOrg}/leave/user`, dataUserLeave: `${profileOrg}/leave/user`,
dataUserLeaveByType: (type: string) => `${org}/profile${type}/leave/user`,
dataUserDuty: `${profileOrg}/duty/user`, dataUserDuty: `${profileOrg}/duty/user`,
dataUserDutyByType: (type: string) => `${org}/profile${type}/duty/user`,
dataUserSalary: `${profileOrg}/salary/user`, dataUserSalary: `${profileOrg}/salary/user`,
dataUserSalaryByType: (type: string) => `${org}/profile${type}/salary/user`,
dataUserHonor: `${profileOrg}/honor/user`, dataUserHonor: `${profileOrg}/honor/user`,
dataUserNopaid: `${profileOrg}/nopaid/user`, dataUserNopaid: `${profileOrg}/nopaid/user`,
dataUserNopaidByType: (type: string) => `${org}/profile${type}/nopaid/user`,
dataUserCertificate: (type: string) => `${profileOrg}/${type}/user`, dataUserCertificate: (type: string) => `${profileOrg}/${type}/user`,
dataUserCertificateByType: (emType:string,type: string) => `${org}/profile${emType}/${type}/user`,
dataUserOther: `${profileOrg}/other/user`, dataUserOther: `${profileOrg}/other/user`,
dataUserOtherByType: (type: string) => `${org}/profile${type}/other/user`,
profileReportId: (profileId: string) => `${report}kk1/${profileId}`, profileReportId: (profileId: string) => `${report}kk1/${profileId}`,
profileKp7ShortId: (profileId: string) => `${report}kp7-short/${profileId}`, profileKp7ShortId: (profileId: string) => `${report}kp7-short/${profileId}`,
@ -38,30 +55,43 @@ export default {
dataUserInformatioHistory: (type: string) => dataUserInformatioHistory: (type: string) =>
`${profileOrg}${type}/history/user`, `${profileOrg}${type}/history/user`,
dataUserChangeNameHistory: `${profileOrg}/changeName/history`, dataUserChangeNameHistory: `${profileOrg}/changeName/history`,
dataUserChangeNameHistoryByType: (type: string) =>
`${org}/profile${type}/changeName/history`,
dataUserHistory: (type: string) => dataUserHistory: (type: string) =>
`${profileOrg}${type}/address/history/user`, `${profileOrg}${type}/address/history/user`,
dataUserFamilyHistory: (type: string, emType: string, id: string) => dataUserFamilyHistory: (type: string, emType: string, id: string) =>
`${profileOrg}${emType}/family/${type}/history/${id}`, `${profileOrg}${emType}/family/${type}/history/${id}`,
dataUserEducationsHistory: (id: string) => dataUserEducationsHistory: (id: string) =>
`${profileOrg}/educations/history/${id}`, `${profileOrg}/educations/history/${id}`,
dataUserEducationsHistoryByType: (type: string, id: string) =>
`${org}/profile${type}/educations/history/${id}`,
dataUserAbilityHistory: (id: string) => `${profileOrg}/ability/history/${id}`, dataUserAbilityHistory: (id: string) => `${profileOrg}/ability/history/${id}`,
dataUserAbilityHistoryByType: (type: string, id: string) =>
`${org}/profile${type}/ability/history/${id}`,
dataUserGovernmentHistory: (type: string) => dataUserGovernmentHistory: (type: string) =>
`${profileOrg}${type}/government/history/user`, `${profileOrg}${type}/government/history/user`,
dataUserDisciplineHistory: (id: string) => dataUserDisciplineHistory: (id: string) =>
`${profileOrg}/discipline/history/${id}`, `${profileOrg}/discipline/history/${id}`,
dataUserDisciplineHistoryByType: (emType:string,id: string) => `${org}/profile${emType}/discipline/history/${id}`,
dataUserLeaveHistory: (id: string) => `${profileOrg}/leave/history/${id}`, dataUserLeaveHistory: (id: string) => `${profileOrg}/leave/history/${id}`,
dataUserLeaveHistoryByType: (emType:string,id: string) => `${org}/profile${emType}/leave/history/${id}`,
dataUserDutyHistory: (id: string) => `${profileOrg}/duty/history/${id}`, dataUserDutyHistory: (id: string) => `${profileOrg}/duty/history/${id}`,
dataUserDutyHistoryByType: (emType:string,id: string) => `${org}/profile${emType}/duty/history/${id}`,
dataUserSalaryHistory: (id: string) => `${profileOrg}/salary/history/${id}`, dataUserSalaryHistory: (id: string) => `${profileOrg}/salary/history/${id}`,
dataUserSalaryHistoryByType: (emType:string,id: string) => `${org}/profile${emType}/salary/history/${id}`,
dataUserSalaryNopaidHistory: (id: string) => dataUserSalaryNopaidHistory: (id: string) =>
`${profileOrg}/nopaid/history/${id}`, `${profileOrg}/nopaid/history/${id}`,
dataUserSalaryNopaidHistoryByType: (emType:string,id: string) => `${org}/profile${emType}/nopaid/history/${id}`,
dataUserCertificateHistory: (type: string, id: string) => dataUserCertificateHistory: (type: string, id: string) =>
`${profileOrg}/${type}/history/${id}`, `${profileOrg}/${type}/history/${id}`,
dataUserCertificateHistoryByType: (emType:string,type:string,id: string) => `${org}/profile${emType}/${type}/history/${id}`,
dataUserHonorHistory: (type: string, emType: string, id: string) => dataUserHonorHistory: (type: string, emType: string, id: string) =>
`${profileOrg}${emType}/${type}/history/${id}`, `${profileOrg}${emType}/${type}/history/${id}`,
dataUserOtherHistory: (id: string) => `${profileOrg}/other/history/${id}`, dataUserOtherHistory: (id: string) => `${profileOrg}/other/history/${id}`,
dataUserOtherHistoryByType: (emType:string,id: string) => `${org}/profile${emType}/other/history/${id}`,
orgCheckAvatar: (id: string) => `${profileOrg}/avatar/profileId/${id}`, orgCheckAvatar: (id: string) => `${profileOrg}/avatar/profileId/${id}`,
orgSearchCommander: () => `${profileOrg}/search/commander`, orgSearchCommander: () => `${profileOrg}/search/commander`,
@ -84,9 +114,10 @@ export default {
requestEdit: `${profileOrg}/edit/`, requestEdit: `${profileOrg}/edit/`,
requestsEdit: `${profileOrg}/edit`, requestsEdit: `${profileOrg}/edit`,
developmentUser: `${profileOrg}/development/user`, developmentUser: `${profileOrg}/development/user`,
developmentUserByType: (type: string) => `${org}/profile${type}/development/user`,
upDateNumber:`${profileOrg}/updatePhoneNumber/user`, upDateNumber: `${profileOrg}/updatePhoneNumber/user`,
updateEmail:`${profileOrg}/updateEmail/user`, updateEmail: `${profileOrg}/updateEmail/user`,
/** /**
* workflow * workflow
*/ */

View file

@ -1,7 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import { useQuasar, type QTableColumn, type QTableProps } from "quasar"; import { useQuasar, type QTableColumn, type QTableProps } from "quasar";
import { ref, reactive, onMounted } from "vue"; import { ref, reactive, onMounted, computed } from "vue";
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry"; import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -11,6 +12,8 @@ import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const store = useRegistryInFormationStore(); const store = useRegistryInFormationStore();
const dataStore = useDataStore();
const officerLink = computed(() => dataStore.officerLink);
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const {
showLoader, showLoader,
@ -43,7 +46,7 @@ const formDataInformation = reactive<any>({
email: "", email: "",
}); });
const emailVerify = ref<string|null>(null); const emailVerify = ref<string | null>(null);
const visibleColumnsHistory = ref<string[]>([ const visibleColumnsHistory = ref<string[]>([
"citizenId", "citizenId",
"prefix", "prefix",
@ -240,7 +243,7 @@ function onHistory() {
async function getData() { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.dataUserInformation) .get(config.API.dataUserInformationByType(dataStore.officerLink))
.then(async (res) => { .then(async (res) => {
const data = await res.data.result; const data = await res.data.result;
formDataInformation.citizenId = data.citizenId; formDataInformation.citizenId = data.citizenId;
@ -256,7 +259,7 @@ async function getData() {
formDataInformation.religion = data.religion; formDataInformation.religion = data.religion;
formDataInformation.bloodGroup = data.bloodGroup; formDataInformation.bloodGroup = data.bloodGroup;
formDataInformation.phone = data.phone; formDataInformation.phone = data.phone;
formDataInformation.email = data.email.split("@")[0]; formDataInformation.email = data.email ? data.email.split("@")[0] : "";
emailVerify.value = data.statusEmail; emailVerify.value = data.statusEmail;
hideLoader(); hideLoader();
@ -272,7 +275,7 @@ async function getData() {
/** get history */ /** get history */
function getHistory() { function getHistory() {
const url = const url =
store.typeProfile == "OFFICER" dataStore.officerType == "OFFICER"
? config.API.dataUserInformatioHistory("") ? config.API.dataUserInformatioHistory("")
: config.API.dataUserInformatioHistory("-employee"); : config.API.dataUserInformatioHistory("-employee");
showLoader(); showLoader();

View file

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import { useQuasar, type QTableProps } from "quasar"; import { useQuasar, type QTableProps } from "quasar";
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
@ -11,6 +12,7 @@ import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const dataStore = useDataStore();
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const rows = ref<ChangNameRows[]>([]); const rows = ref<ChangNameRows[]>([]);
@ -162,7 +164,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserChangeName) .get(config.API.dataUserChangeNameByType(dataStore.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -181,7 +183,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserChangeNameHistory + `/${idByrow.value}`) .get(config.API.dataUserChangeNameHistoryByType(dataStore.officerLink) + `/${idByrow.value}`)
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,6 +5,7 @@ import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry"; import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
import type { import type {
@ -18,6 +19,7 @@ import type {
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const store = useRegistryInFormationStore(); const store = useRegistryInFormationStore();
const dataStore = useDataStore();
const rowsHistory = ref<any[]>([]); const rowsHistory = ref<any[]>([]);
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
@ -227,7 +229,7 @@ function onHistory() {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserAddress) .get(config.API.dataUserAddressByType(dataStore.officerLink))
.then((res) => { .then((res) => {
const data: Address = res.data.result; const data: Address = res.data.result;
fetchDistrict(data.registrationProvinceId, "1"); fetchDistrict(data.registrationProvinceId, "1");
@ -260,7 +262,7 @@ function getData() {
/** get history */ /** get history */
function getHistory() { function getHistory() {
const url = const url =
store.typeProfile == "OFFICER" dataStore.officerType == "OFFICER"
? config.API.dataUserHistory("") ? config.API.dataUserHistory("")
: config.API.dataUserHistory("-employee"); : config.API.dataUserHistory("-employee");
showLoader(); showLoader();

View file

@ -5,6 +5,7 @@ import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry"; import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
import { useDataStore } from "@/stores/data";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { FormChildren } from "@/modules/10_registry/interface/index/Family"; import type { FormChildren } from "@/modules/10_registry/interface/index/Family";
@ -17,6 +18,7 @@ const { showLoader, hideLoader, messageError } = mixin;
const idFamily = ref<string>(""); const idFamily = ref<string>("");
const store = useRegistryInFormationStore(); const store = useRegistryInFormationStore();
const dataStore = useDataStore();
const rowsHistory = ref<any[]>([]); const rowsHistory = ref<any[]>([]);
const typeForm = ref<string>(""); const typeForm = ref<string>("");
@ -147,7 +149,7 @@ function onHistory(type: string, id: string) {
function getData(type: string) { function getData(type: string) {
showLoader(); showLoader();
http http
.get(config.API.dataUserFamily(type)) .get(config.API.dataUserFamilyByType(dataStore.officerLink,type))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
if (data) { if (data) {
@ -199,7 +201,7 @@ function getData(type: string) {
/** get history */ /** get history */
function getHistory() { function getHistory() {
const url = const url =
store.typeProfile == "OFFICER" dataStore.officerType == "OFFICER"
? config.API.dataUserFamilyHistory(typeForm.value, "", idFamily.value) ? config.API.dataUserFamilyHistory(typeForm.value, "", idFamily.value)
: config.API.dataUserFamilyHistory( : config.API.dataUserFamilyHistory(
typeForm.value, typeForm.value,

View file

@ -2,7 +2,7 @@
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar"; import { useQuasar, type QTableProps } from "quasar";
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { useDataStore } from "@/stores/data";
//history dialog //history dialog
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -14,6 +14,7 @@ import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const dataStore = useDataStore();
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const rows = ref<EducationProfile[]>([]); const rows = ref<EducationProfile[]>([]);
@ -442,7 +443,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserEducations) .get(config.API.dataUserEducationsByType(dataStore.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -461,7 +462,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserEducationsHistory(idByRow.value)) .get(config.API.dataUserEducationsHistoryByType(dataStore.officerLink,idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,6 +5,7 @@ import { ref, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import type { AbilityRows } from "@/modules/10_registry/interface/index/Main"; import type { AbilityRows } from "@/modules/10_registry/interface/index/Main";
//history dialog //history dialog
@ -17,6 +18,7 @@ const filter = ref<string>("");
const $q = useQuasar(); const $q = useQuasar();
const mode = ref<boolean>($q.screen.gt.xs); const mode = ref<boolean>($q.screen.gt.xs);
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const dataStore = useDataStore();
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const modalHistory = ref<boolean>(false); const modalHistory = ref<boolean>(false);
@ -163,7 +165,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserAbility) .get(config.API.dataUserAbilityByType(dataStore.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -182,7 +184,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserAbilityHistory(idByRow.value)) .get(config.API.dataUserAbilityHistoryByType(dataStore.officerLink,idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -6,6 +6,7 @@ import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data"; import { useDataStore } from "@/stores/data";
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry"; import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
import type { import type {
@ -17,8 +18,8 @@ import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const daraPerson = useDataStore() const dataPerson = useDataStore()
const checkType = ref<boolean>(daraPerson.officerType == 'OFFICER' ? true:false) const checkType = ref<boolean>(dataPerson.officerType == 'OFFICER' ? true:false)
const store = useRegistryInFormationStore(); const store = useRegistryInFormationStore();
const { showLoader, hideLoader, messageError, date2Thai, dateToISO } = mixin; const { showLoader, hideLoader, messageError, date2Thai, dateToISO } = mixin;
@ -284,7 +285,7 @@ function onHistory() {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserGovernment) .get(config.API.dataUserGovernmentByType(dataPerson.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
formData.org = data.org; formData.org = data.org;
@ -317,7 +318,7 @@ function getData() {
/** get history */ /** get history */
function getHistory() { function getHistory() {
const url = const url =
checkType dataPerson.officerType == 'OFFICER'
? config.API.dataUserGovernmentHistory("") ? config.API.dataUserGovernmentHistory("")
: config.API.dataUserGovernmentHistory("-employee"); : config.API.dataUserGovernmentHistory("-employee");
showLoader(); showLoader();

View file

@ -5,6 +5,7 @@ import { ref, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import type { DisciplineDetail } from "@/modules/10_registry/interface/index/Main"; import type { DisciplineDetail } from "@/modules/10_registry/interface/index/Main";
@ -12,6 +13,7 @@ import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const dataStore = useDataStore()
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const rows = ref<DisciplineDetail[]>([]); const rows = ref<DisciplineDetail[]>([]);
@ -138,7 +140,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserDiscipline) .get(config.API.dataUserDisciplineByType(dataStore.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -155,7 +157,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserDisciplineHistory(idByRow.value)) .get(config.API.dataUserDisciplineHistoryByType(dataStore.officerLink,idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,12 +5,14 @@ import { ref, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import type { LeaveFormType } from "@/modules/10_registry/interface/index/Main"; import type { LeaveFormType } from "@/modules/10_registry/interface/index/Main";
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const dataStore = useDataStore()
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const idByRow = ref<string>(""); const idByRow = ref<string>("");
@ -214,7 +216,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserLeave) .get(config.API.dataUserLeaveByType(dataStore.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data.map((item: any) => ({ rows.value = data.map((item: any) => ({
@ -241,7 +243,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserLeaveHistory(idByRow.value)) .get(config.API.dataUserLeaveHistoryByType(dataStore.officerLink,idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data.map((item: any) => ({ rowsHistory.value = data.map((item: any) => ({

View file

@ -5,11 +5,13 @@ import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import type { DutyFormType } from "@/modules/10_registry/interface/index/Main"; import type { DutyFormType } from "@/modules/10_registry/interface/index/Main";
//history dialog //history dialog
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const dataStore = useDataStore()
const idByRow = ref<string>(""); const idByRow = ref<string>("");
const rows = ref<DutyFormType[]>([]); const rows = ref<DutyFormType[]>([]);
const filter = ref<string>(""); const filter = ref<string>("");
@ -216,7 +218,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserDuty) .get(config.API.dataUserDutyByType(dataStore.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -233,7 +235,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserDutyHistory(idByRow.value)) .get(config.API.dataUserDutyHistoryByType(dataStore.officerLink,idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -6,13 +6,14 @@ import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data"; import { useDataStore } from "@/stores/data";
import type { SalaryFormType } from "@/modules/10_registry/interface/index/Main"; import type { SalaryFormType } from "@/modules/10_registry/interface/index/Main";
//history dialog //history dialog
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const daraPerson = useDataStore(); const dataPerson = useDataStore();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
@ -22,7 +23,7 @@ const filter = ref<string>("");
const rowsHistory = ref<SalaryFormType[]>([]); const rowsHistory = ref<SalaryFormType[]>([]);
const mode = ref<boolean>($q.screen.gt.xs); const mode = ref<boolean>($q.screen.gt.xs);
const checkType = ref<boolean>( const checkType = ref<boolean>(
daraPerson.officerType == "OFFICER" ? true : false dataPerson.officerType == "OFFICER" ? true : false
); );
const modalHistory = ref<boolean>(false); const modalHistory = ref<boolean>(false);
/** ตัวแปรข้อมูล */ /** ตัวแปรข้อมูล */
@ -357,7 +358,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserSalary) .get(config.API.dataUserSalaryByType(dataPerson.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -374,7 +375,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserSalaryHistory(idByRow.value)) .get(config.API.dataUserSalaryHistoryByType(dataPerson.officerLink,idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,11 +5,13 @@ import { ref, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useDataStore } from "@/stores/data"
import type { NopaidFormType } from "@/modules/10_registry/interface/index/Main"; import type { NopaidFormType } from "@/modules/10_registry/interface/index/Main";
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const dataPerson = useDataStore()
const idByRow = ref<string>(""); const idByRow = ref<string>("");
const rows = ref<NopaidFormType[]>([]); const rows = ref<NopaidFormType[]>([]);
const filter = ref<string>(""); const filter = ref<string>("");
@ -193,7 +195,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserNopaid) .get(config.API.dataUserNopaidByType(dataPerson.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -210,7 +212,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserSalaryNopaidHistory(idByRow.value)) .get(config.API.dataUserSalaryNopaidHistoryByType(dataPerson.officerLink,idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,6 +5,8 @@ import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import type { CertificateDetail } from "@/modules/10_registry/interface/index/Main"; import type { CertificateDetail } from "@/modules/10_registry/interface/index/Main";
@ -12,6 +14,7 @@ import type { CertificateDetail } from "@/modules/10_registry/interface/index/Ma
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const dataPerson = useDataStore()
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
@ -193,7 +196,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificate("certificate")) .get(config.API.dataUserCertificateByType(dataPerson.officerLink,"certificate"))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -210,7 +213,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificateHistory("certificate", idByRow.value)) .get(config.API.dataUserCertificateHistoryByType(dataPerson.officerLink,"certificate", idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,12 +5,14 @@ import { ref, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import type { TrainingFormType } from "@/modules/10_registry/interface/index/Main"; import type { TrainingFormType } from "@/modules/10_registry/interface/index/Main";
//history dialog //history dialog
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const dataPerson = useDataStore()
const idByRow = ref<string>(""); const idByRow = ref<string>("");
const rows = ref<TrainingFormType[]>([]); const rows = ref<TrainingFormType[]>([]);
const filter = ref<string>(""); const filter = ref<string>("");
@ -320,7 +322,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificate("training")) .get(config.API.dataUserCertificateByType(dataPerson.officerLink,"training"))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -337,7 +339,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificateHistory("training", idByRow.value)) .get(config.API.dataUserCertificateHistoryByType(dataPerson.officerLink,"training", idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,12 +5,15 @@ import { ref, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import type { InsigniaFormType } from "@/modules/10_registry/interface/index/Main"; import type { InsigniaFormType } from "@/modules/10_registry/interface/index/Main";
//history dialog //history dialog
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const dataPerson = useDataStore()
const idByRow = ref<string>(""); const idByRow = ref<string>("");
const rows = ref<InsigniaFormType[]>([]); const rows = ref<InsigniaFormType[]>([]);
const filter = ref<string>(""); const filter = ref<string>("");
@ -397,7 +400,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificate("insignia")) .get(config.API.dataUserCertificateByType(dataPerson.officerLink,"insignia"))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -414,7 +417,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificateHistory("insignia", idByRow.value)) .get(config.API.dataUserCertificateHistoryByType(dataPerson.officerLink,"insignia", idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,6 +5,7 @@ import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry"; import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
import type { HonorFormData } from "@/modules/10_registry/interface/index/Main"; import type { HonorFormData } from "@/modules/10_registry/interface/index/Main";
@ -12,6 +13,7 @@ import type { HonorFormData } from "@/modules/10_registry/interface/index/Main";
//history dialog //history dialog
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const dataPerson = useDataStore()
const idByRow = ref<string>(""); const idByRow = ref<string>("");
const store = useRegistryInFormationStore(); const store = useRegistryInFormationStore();
const rows = ref<HonorFormData[]>([]); const rows = ref<HonorFormData[]>([]);
@ -194,7 +196,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificate("honor")) .get(config.API.dataUserCertificateByType(dataPerson.officerLink,"honor"))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -210,7 +212,7 @@ function getData() {
/** get history */ /** get history */
function getHistory() { function getHistory() {
const url = const url =
store.typeProfile == "OFFICER" dataPerson.officerType == "OFFICER"
? config.API.dataUserHonorHistory("honor", "", idByRow.value) ? config.API.dataUserHonorHistory("honor", "", idByRow.value)
: config.API.dataUserHonorHistory("honor", "-employee", idByRow.value); : config.API.dataUserHonorHistory("honor", "-employee", idByRow.value);
showLoader(); showLoader();

View file

@ -5,12 +5,14 @@ import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import type { AssessmentsFormType } from "@/modules/10_registry/interface/index/Main"; import type { AssessmentsFormType } from "@/modules/10_registry/interface/index/Main";
//history dialog //history dialog
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const dataPerson = useDataStore()
const idByRow = ref<string>(""); const idByRow = ref<string>("");
const rows = ref<AssessmentsFormType[]>([]); const rows = ref<AssessmentsFormType[]>([]);
const filter = ref<string>(""); const filter = ref<string>("");
@ -255,7 +257,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificate("assessments")) .get(config.API.dataUserCertificateByType(dataPerson.officerLink,"assessments"))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -272,7 +274,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificateHistory("assessments", idByRow.value)) .get(config.API.dataUserCertificateHistoryByType(dataPerson.officerLink,"assessments", idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,12 +5,14 @@ import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useDataStore } from "@/stores/data";
//history dialog //history dialog
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
import DialogDevelop from "@/modules/10_registry/Dialog/DialogDevelopmant.vue"; import DialogDevelop from "@/modules/10_registry/Dialog/DialogDevelopmant.vue";
const dataPerson = useDataStore()
const idByRow = ref<string>(""); const idByRow = ref<string>("");
const rows = ref<any[]>([]); const rows = ref<any[]>([]);
const filter = ref<string>(""); const filter = ref<string>("");
@ -116,7 +118,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.developmentUser) .get(config.API.developmentUserByType(dataPerson.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -133,7 +135,7 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserCertificateHistory("assessments", idByRow.value)) .get(config.API.dataUserCertificateHistoryByType(dataPerson.officerLink,"assessments", idByRow.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;

View file

@ -5,6 +5,7 @@ import { ref, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import type { OtherFormType } from "@/modules/10_registry/interface/index/Main"; import type { OtherFormType } from "@/modules/10_registry/interface/index/Main";
@ -13,6 +14,7 @@ import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const dataPerson = useDataStore();
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const idByRow = ref<string>(""); const idByRow = ref<string>("");
@ -111,7 +113,7 @@ function onHistory(id: string) {
function getData() { function getData() {
showLoader(); showLoader();
http http
.get(config.API.dataUserOther) .get(config.API.dataUserOtherByType(dataPerson.officerLink))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
@ -126,7 +128,12 @@ function getData() {
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
.get(config.API.dataUserOtherHistory(idByRow.value)) .get(
config.API.dataUserOtherHistoryByType(
dataPerson.officerLink,
idByRow.value
)
)
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;
@ -181,7 +188,6 @@ onMounted(() => {
outlined outlined
emit-value emit-value
map-options map-options
options-dense options-dense
option-value="name" option-value="name"
style="min-width: 140px" style="min-width: 140px"

View file

@ -25,19 +25,9 @@ const $q = useQuasar();
const dataStore = useDataStore(); const dataStore = useDataStore();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { messageError, dialogConfirm, showLoader, hideLoader } = mixin; const { messageError, dialogConfirm, showLoader, hideLoader } = mixin;
const profileImg = ref<string>("");
const router = useRouter(); const router = useRouter();
const tab = ref<string>("information"); const tab = ref<string>("information");
const formData = reactive<any>({
prefix: "",
firstName: "",
lastName: "",
position: "",
posExecutiveName: "",
posTypeName: "",
posLevelName: "",
posNo: "",
});
const sizeImg = ref<string>(""); const sizeImg = ref<string>("");
function onResize(size: any) { function onResize(size: any) {
const width = size.width > 100 ? 100 : size.width; const width = size.width > 100 ? 100 : size.width;
@ -48,65 +38,6 @@ function onMobile(type: string) {
router.push(`/registry/${type}`); router.push(`/registry/${type}`);
} }
function getMain() {
showLoader();
http
.get(config.API.profilePosition())
.then(async (res) => {
const data = res.data.result;
formData.prefix = data.prefix;
formData.firstName = data.firstName;
formData.lastName = data.lastName;
formData.position = data.position;
formData.posTypeName = data.posTypeName;
formData.posExecutiveName = data.posExecutiveName;
formData.posLevelName = data.posLevelName;
formData.posNo = data.rootShortName
? `${data.rootShortName}${data.posMaster}`
: "";
store.profileId = data.profileId;
if (data.avatarName) {
await getImg(data.profileId, data.avatarName);
} else {
profileImg.value = avatar;
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function getImg(id: string, pathName: string) {
showLoader();
await http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName))
.then((res) => {
profileImg.value = res.data.downloadUrl;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
function getType() {
http
.get(config.API.proFileType)
.then((res) => {
store.typeProfile = res.data.result;
})
.catch((e) => {
messageError($q, e);
});
}
async function onClickDownloadKp7(type: string) { async function onClickDownloadKp7(type: string) {
showLoader(); showLoader();
const url = const url =
@ -182,11 +113,6 @@ function redirectToPagePetition() {
router.push(`/registry/request-edit`); router.push(`/registry/request-edit`);
} }
onMounted(async () => {
store.typeProfile = "OFFICER";
await getType();
await getMain();
});
</script> </script>
<template> <template>
@ -220,27 +146,29 @@ onMounted(async () => {
<div class="relative-position" style="height: 120px"> <div class="relative-position" style="height: 120px">
<div class="absolute-center"> <div class="absolute-center">
<q-avatar size="120px" class="bg-grey-2"> <q-avatar size="120px" class="bg-grey-2">
<q-img :src="profileImg" /> <q-img :src="dataStore.profileImg" />
</q-avatar> </q-avatar>
</div> </div>
</div> </div>
<div class="column text-center q-mt-md q-mb-sm"> <div class="column text-center q-mt-md q-mb-sm">
<span class="text-teal text-weight-medium">{{ <span class="text-teal text-weight-medium">{{
formData.firstName dataStore.formData.firstName
? `${formData.prefix}${formData.firstName} ${formData.lastName}` ? `${dataStore.formData.prefix}${dataStore.formData.firstName} ${dataStore.formData.lastName}`
: "-" : "-"
}}</span> }}</span>
<span class="text-grey text-weight-medium">{{ <span class="text-grey text-weight-medium">{{
dataStore.officerType == "OFFICER" dataStore.officerType == "OFFICER"
? `ข้าราชการกรุงเทพมหานครสามัญ` ? `ข้าราชการกรุงเทพมหานครสามัญ`
: "ลูกจ้างประจำกรุงเทพมหานคร" : dataStore.officerType == "PERM"
? "ลูกจ้างประจำกรุงเทพมหานคร"
: "ลูกจ้างชั่วคราว"
}}</span> }}</span>
<span class="text-grey text-weight-medium">{{ <span class="text-grey text-weight-medium">{{
formData.position ? `${formData.position}` : "-" dataStore.formData.position ? `${dataStore.formData.position}` : "-"
}}</span> }}</span>
<div class="text-grey">{{ formData.posNo }}</div> <div class="text-grey">{{ dataStore.formData.posNo }}</div>
</div> </div>
</q-card-section> </q-card-section>
@ -248,24 +176,24 @@ onMounted(async () => {
<!-- <q-separator /> <!-- <q-separator />
<q-item> <q-item>
<q-item-section class="text-grey-6">{{ <q-item-section class="text-grey-6">{{
store.typeProfile == "OFFICER" ? "ตำแหน่งในสายงาน" : "ตำแหน่ง" dataStore.officerType == "OFFICER" ? "ตำแหน่งในสายงาน" : "ตำแหน่ง"
}}</q-item-section> }}</q-item-section>
<q-item-section>{{ formData.posExecutiveName }}</q-item-section> <q-item-section>{{ formData.posExecutiveName }}</q-item-section>
</q-item> --> </q-item> -->
<q-item> <q-item>
<q-item-section class="text-grey-6">{{ <q-item-section class="text-grey-6">{{
store.typeProfile == "OFFICER" ? "ตำแหน่งประเภท" : "กลุ่มงาน" dataStore.officerType == "OFFICER" ? "ตำแหน่งประเภท" : "กลุ่มงาน"
}}</q-item-section> }}</q-item-section>
<q-item-section>{{ <q-item-section>{{
formData.posTypeName ? formData.posTypeName : "-" dataStore.formData.posTypeName ? dataStore.formData.posTypeName : "-"
}}</q-item-section> }}</q-item-section>
</q-item> </q-item>
<q-item> <q-item>
<q-item-section class="text-grey-6">{{ <q-item-section class="text-grey-6">{{
store.typeProfile == "OFFICER" ? "ระดับ" : "ระดับชั้นงาน" dataStore.officerType == "OFFICER" ? "ระดับ" : "ระดับชั้นงาน"
}}</q-item-section> }}</q-item-section>
<q-item-section>{{ <q-item-section>{{
formData.posLevelName ? formData.posLevelName : "-" dataStore.formData.posLevelName ? dataStore.formData.posLevelName : "-"
}}</q-item-section> }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@ -346,15 +274,15 @@ onMounted(async () => {
<div class="text-center q-mt-md"> <div class="text-center q-mt-md">
<q-avatar :size="sizeImg"> <q-avatar :size="sizeImg">
<img <img
:src="profileImg" :src="dataStore.profileImg"
style="border-radius: 50%; object-fit: cover" style="border-radius: 50%; object-fit: cover"
/> />
</q-avatar> </q-avatar>
</div> </div>
<div class="column text-center q-mt-md q-mb-lg"> <div class="column text-center q-mt-md q-mb-lg">
<span class="text-teal text-weight-medium">{{ <span class="text-teal text-weight-medium">{{
formData.firstName dataStore.formData.firstName
? `${formData.prefix}${formData.firstName} ${formData.lastName}` ? `${dataStore.formData.prefix}${dataStore.formData.firstName} ${dataStore.formData.lastName}`
: "-" : "-"
}}</span> }}</span>
<span class="text-grey text-weight-medium">{{ <span class="text-grey text-weight-medium">{{
@ -363,9 +291,9 @@ onMounted(async () => {
: "ลูกจ้างประจำกรุงเทพมหานคร" : "ลูกจ้างประจำกรุงเทพมหานคร"
}}</span> }}</span>
<span class="text-grey text-weight-medium">{{ <span class="text-grey text-weight-medium">{{
formData.position ? `${formData.position}` : "-" dataStore.formData.position ? `${dataStore.formData.position}` : "-"
}}</span> }}</span>
<div class="text-grey">{{ formData.posNo }}</div> <div class="text-grey">{{ dataStore.formData.posNo }}</div>
</div> </div>
<div class="row justify-center q-gutter-x-lg"> <div class="row justify-center q-gutter-x-lg">
<q-btn <q-btn

View file

@ -1,15 +1,30 @@
import { ref, computed } from "vue"; import { ref, computed, reactive } from "vue";
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
export const useDataStore = defineStore("data", () => { export const useDataStore = defineStore("data", () => {
const storeRegistry = useRegistryInFormationStore();
// ref() คือการประกาศ state เหมือน vuex // ref() คือการประกาศ state เหมือน vuex
const formData = reactive<any>({
prefix: "",
firstName: "",
lastName: "",
position: "",
posExecutiveName: "",
posTypeName: "",
posLevelName: "",
posNo: "",
});
const count = ref<number>(0); const count = ref<number>(0);
const loader = ref<boolean>(false); const loader = ref<boolean>(false);
const isProbation = ref<boolean>(false) const isProbation = ref<boolean>(false);
const profileImg = ref<string>("");
const expandedReport2 = ref<string[]>([]); const expandedReport2 = ref<string[]>([]);
const selectedReport2 = ref<string>(""); const selectedReport2 = ref<string>("");
const officerType = ref<string>("tets"); const officerType = ref<string>("");
const officerLink = ref<string>("");
const expandedRegister = ref<string[]>([]); const expandedRegister = ref<string[]>([]);
const selectedRegister = ref<string>(""); const selectedRegister = ref<string>("");
// computed() คือการประกาศ getters เหมือน vuex // computed() คือการประกาศ getters เหมือน vuex
@ -54,6 +69,36 @@ export const useDataStore = defineStore("data", () => {
selectedRegister.value = s; selectedRegister.value = s;
}; };
async function convertEmType(val: string) {
switch (val) {
case "OFFICER":
return "";
case "PERM":
case "TEMP":
return "-employee";
default:
return "";
}
}
async function getData(dataPerson: any) {
const data = await dataPerson;
isProbation.value = data.isProbation;
officerType.value = data.type;
officerLink.value = await convertEmType(data.type)
formData.prefix = data.prefix;
formData.firstName = data.firstName;
formData.lastName = data.lastName;
formData.position = data.position;
formData.posTypeName = data.posTypeName;
formData.posExecutiveName = data.posExecutiveName;
formData.posLevelName = data.posLevelName;
formData.posNo = data.rootShortName
? `${data.rootShortName}${data.posMaster}`
: "";
storeRegistry.profileId = data.profileId;
}
return { return {
count, count,
doubleCount, doubleCount,
@ -69,7 +114,12 @@ export const useDataStore = defineStore("data", () => {
selectedRegister, selectedRegister,
changeTreeRegister, changeTreeRegister,
isProbation, isProbation,
officerType officerType,
convertEmType,
getData,
profileImg,
formData,
officerLink
}; };
}); });

View file

@ -47,16 +47,16 @@ onMounted(async () => {
}); });
async function checkUser() { async function checkUser() {
http await http
.get(config.API.profilePosition()) .get(config.API.profilePosition())
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = await res.data.result;
dataStore.isProbation = data.isProbation; await dataStore.getData(data);
dataStore.officerType = data.type;
if (data.avatarName) { if (data.avatarName) {
await getImg(data.profileId, data.avatarName); await getImg(data.profileId, data.avatarName);
} else { } else {
profileImg.value = avatar; profileImg.value = avatar;
dataStore.profileImg = avatar;
} }
}) })
.catch((err) => { .catch((err) => {
@ -84,6 +84,7 @@ function getImg(id: string, pathName: string) {
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName)) .get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName))
.then((res) => { .then((res) => {
profileImg.value = res.data.downloadUrl; profileImg.value = res.data.downloadUrl;
dataStore.profileImg = res.data.downloadUrl;
}) })
.catch((e) => { .catch((e) => {
// messageError($q, e); // messageError($q, e);