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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,6 +5,7 @@ import { ref, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
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 mixin = useCounterMixin();
const dataStore = useDataStore()
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const rows = ref<DisciplineDetail[]>([]);
@ -138,7 +140,7 @@ function onHistory(id: string) {
function getData() {
showLoader();
http
.get(config.API.dataUserDiscipline)
.get(config.API.dataUserDisciplineByType(dataStore.officerLink))
.then((res) => {
const data = res.data.result;
rows.value = data;
@ -155,7 +157,7 @@ function getData() {
function getHistory() {
showLoader();
http
.get(config.API.dataUserDisciplineHistory(idByRow.value))
.get(config.API.dataUserDisciplineHistoryByType(dataStore.officerLink,idByRow.value))
.then((res) => {
const data = res.data.result;
rowsHistory.value = data;

View file

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

View file

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

View file

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

View file

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

View file

@ -5,6 +5,8 @@ import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
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";
const $q = useQuasar();
const dataPerson = useDataStore()
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
@ -193,7 +196,7 @@ function onHistory(id: string) {
function getData() {
showLoader();
http
.get(config.API.dataUserCertificate("certificate"))
.get(config.API.dataUserCertificateByType(dataPerson.officerLink,"certificate"))
.then((res) => {
const data = res.data.result;
rows.value = data;
@ -210,7 +213,7 @@ function getData() {
function getHistory() {
showLoader();
http
.get(config.API.dataUserCertificateHistory("certificate", idByRow.value))
.get(config.API.dataUserCertificateHistoryByType(dataPerson.officerLink,"certificate", idByRow.value))
.then((res) => {
const data = res.data.result;
rowsHistory.value = data;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,15 +1,30 @@
import { ref, computed } from "vue";
import { ref, computed, reactive } from "vue";
import { defineStore } from "pinia";
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
export const useDataStore = defineStore("data", () => {
const storeRegistry = useRegistryInFormationStore();
// ref() คือการประกาศ state เหมือน vuex
const formData = reactive<any>({
prefix: "",
firstName: "",
lastName: "",
position: "",
posExecutiveName: "",
posTypeName: "",
posLevelName: "",
posNo: "",
});
const count = ref<number>(0);
const loader = ref<boolean>(false);
const isProbation = ref<boolean>(false)
const isProbation = ref<boolean>(false);
const profileImg = ref<string>("");
const expandedReport2 = ref<string[]>([]);
const selectedReport2 = ref<string>("");
const officerType = ref<string>("tets");
const officerType = ref<string>("");
const officerLink = ref<string>("");
const expandedRegister = ref<string[]>([]);
const selectedRegister = ref<string>("");
// computed() คือการประกาศ getters เหมือน vuex
@ -54,6 +69,36 @@ export const useDataStore = defineStore("data", () => {
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 {
count,
doubleCount,
@ -69,7 +114,12 @@ export const useDataStore = defineStore("data", () => {
selectedRegister,
changeTreeRegister,
isProbation,
officerType
officerType,
convertEmType,
getData,
profileImg,
formData,
officerLink
};
});

View file

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