เพิ่ม interface ให้ any

This commit is contained in:
setthawutttty 2023-09-22 16:10:30 +07:00
parent 7d3c48142c
commit 77ccaec4e3
18 changed files with 259 additions and 73 deletions

View file

@ -5,6 +5,7 @@ import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import CurrencyInput from "@/components/CurruncyInput.vue";
import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive";
import type { appointmentData,ResponseData } from "@/modules/05_placement/interface/response/AppointMent";
import http from "@/plugins/http";
import config from "@/app.config";
@ -14,7 +15,12 @@ const route = useRoute();
const router = useRouter();
const mixin = useCounterMixin();
const appointment = ref<any>([]);
const appointment = ref<appointmentData>({
citizenId:"",
prefixId:"",
firstname:"",
lastname:""
});
const myform = ref<any>();
const edit = ref<boolean>(false);
const profileId = ref<string>("");
@ -52,7 +58,7 @@ const fecthappointmentByid = async () => {
showLoader();
await http
.get(config.API.appointmentByid(paramsId.toString()))
.then((res: any) => {
.then((res: ResponseData) => {
const data = res.data.result;
appointment.value = data;
profileId.value = data.profileId;

View file

@ -3,6 +3,7 @@ import { ref, computed,watchEffect } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { UserData } from "@/modules/05_placement/interface/response/AppointMent";
import http from "@/plugins/http";
@ -12,7 +13,7 @@ const { showLoader, success, messageError, dialogConfirm,hideLoader } = mixin;
const $q = useQuasar();
import DialogHeader from "@/modules/05_placement/components/AppointMent/DialogHeader.vue";
const selected = ref([]);
const selected = ref<UserData[]>([]);
const checkSelected = computed(() => {
if (selected.value.length === 0 || props.type === "") {
return true;
@ -98,7 +99,7 @@ const updateInput = (value: any) => {
emit("update:filterKeyword2", value);
};
const updateInputType = (value: any) => {
const updateInputType = (value: string) => {
emit("update:type", value);
};
//
@ -115,7 +116,7 @@ const clickAddlist = () => {
const createdAppoint = async () => {
let pId: string[] = [];
let Type = props.type as string
selected.value.forEach((e: any) => {
selected.value.forEach((e: UserData) => {
pId.push(e.personalId);
});
let data = {
@ -124,10 +125,10 @@ const createdAppoint = async () => {
showLoader();
await http
.put(config.API.apppointmentReport(Type), data)
.then((res: any) => {
.then((res) => {
success($q, "บันทึกสำเร็จ");
})
.catch((e: any) => {
.catch((e) => {
messageError($q, e);
})
.finally(() => {
@ -145,7 +146,7 @@ watchEffect(() => {
});
</script>
<template>
<q-dialog v-model="props.Modal">
<q-dialog v-model="props.Modal">
<q-card style="width: 1200px; max-width: 80vw">
<DialogHeader title="ส่งไปออกคำสั่ง" :close="clickClose" />
<q-separator />

View file

@ -30,7 +30,7 @@ const router = useRouter();
const rows = ref<listAppointType[]>([]);
const rows2 = ref<listAppointType[]>([]);
const modalTree = ref<boolean>(false);
const personal = ref<any[]>([]);
const personal = ref<resData[]>([]);
const personalId = ref<string>("");
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
@ -235,9 +235,9 @@ const closeModalTree = async () => {
};
//
const nextPage = (row: any) => {
const nextPage = (id: string) => {
router.push({
path: `appoint-promote/detail/${row.personalId}`,
path: `appoint-promote/detail/${id}`,
});
};
@ -286,16 +286,16 @@ onMounted(() => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="no" :props="props" @click="nextPage(props.row)">
<q-td key="no" :props="props" @click="nextPage(props.row.personalId)">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="citizenId" :props="props" @click="nextPage(props.row)">
<q-td key="citizenId" :props="props" @click="nextPage(props.row.personalId)">
{{ props.row.citizenId }}
</q-td>
<q-td key="fullname" :props="props" @click="nextPage(props.row)">
<q-td key="fullname" :props="props" @click="nextPage(props.row.personalId)">
{{ props.row.fullname }}
</q-td>
<q-td key="organizationName" :props="props" @click="nextPage(props.row)">
<q-td key="organizationName" :props="props" @click="nextPage(props.row.personalId)">
<div v-if="props.row.orgName !== null ||
props.row.positionPath !== null
">
@ -316,13 +316,13 @@ onMounted(() => {
</div>
</div>
</q-td>
<q-td key="birthday" :props="props" @click="nextPage(props.row)">
<q-td key="birthday" :props="props" @click="nextPage(props.row.personalId)">
{{ props.row.birthday }}
</q-td>
<q-td key="createdAt" :props="props" @click="nextPage(props.row)">
<q-td key="createdAt" :props="props" @click="nextPage(props.row.personalId)">
{{ props.row.createdAt }}
</q-td>
<q-td key="status" :props="props" @click="nextPage(props.row)">
<q-td key="status" :props="props" @click="nextPage(props.row.personalId)">
{{ props.row.status }}
</q-td>
<q-td auto-width>

View file

@ -6,6 +6,7 @@ import { useCounterMixin } from "@/stores/mixin";
import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive";
import type { ResponseDataDetail } from "@/modules/05_placement/interface/response/Transfer";
import type { OtherdataInterface,resApiData } from "@/modules/05_placement/interface/response/OhterMain";
import type { QForm } from "quasar";
import http from "@/plugins/http";
@ -58,10 +59,14 @@ const myform = ref<any>();
const positionLevelOld = ref<string>("");
const posNo = ref<string>("");
const salary = ref<number>(0);
const organization = ref<string>("");
const date = ref<Date | null>(null);
const reason = ref<string>("");
const Otherdata = ref<any>([]);
const Otherdata = ref<OtherdataInterface>({
citizenId: "",
prefixId: "",
firstname: "",
lastname: "",
});
const avatar = ref<string>("");
//-----(fetch data by id)-----//
@ -69,9 +74,9 @@ const fecthOther = async () => {
showLoader();
await http
.get(config.API.otherByid(paramsId.toString()))
.then((res: any) => {
.then((res: resApiData) => {
const data = res.data.result;
Otherdata.value = res.data.result;
Otherdata.value = data
avatar.value = data.avatar ?? "";
title.value.fullname = `${data.firstname ?? "-"} ${data.lastname ?? "-"}`;
title.value.organizationPositionOld = data.organizationPositionOld ?? "-";
@ -79,24 +84,19 @@ const fecthOther = async () => {
title.value.positionTypeOld = data.positionTypeOld ?? "-";
responseData.value.profileId = data.profileId;
responseData.value.createdAt = data.createdAt;
responseData.value.date = data.date !== null ? new Date(data.date) : new Date();
responseData.value.id = data.id ?? "";
responseData.value.organization = data.organization ?? "";
responseData.value.organizationPositionOld = data.organizationPositionOld ?? "";
responseData.value.positionLevelOld = data.positionLevelOld ?? "";
responseData.value.positionNumberOld = data.positionNumberOld ?? "";
responseData.value.positionTypeOld = data.positionTypeOld ?? "";
responseData.value.reason = data.reason ?? "";
responseData.value.salary = data.salary !== null ? data.salary : 0;
responseData.value.status = data.status ?? "";
responseData.value.avataPath = data.avataPath ?? "";
responseData.value.fullname = `${data.prefix ?? "-"}${data.firstname ?? "-"} ${data.lastname ?? "-"}`;
organizationPositionOld.value = data.organizationPositionOld ?? "";
positionTypeOld.value = data.positionTypeOld ?? "";
positionLevelOld.value = data.positionLevelOld ?? "";
posNo.value = data.positionNumberOld ?? "";
salary.value = data.amountOld ?? "";
organization.value = data.organization ?? "";
date.value = data.positionDate !== null ? new Date(data.positionDate) : null;
reason.value = data.reason ?? "";
})

View file

@ -12,6 +12,7 @@ import { useProfileDataStore } from "@/modules/08_registryEmployee/store";
import type {
Information,
DataOption,
DataOptioninfo
} from "@/modules/04_registry/components/profileType";
import type { InformationOps } from "@/modules/04_registry/interface/index/Main";
import HeaderTop from "@/modules/08_registryEmployee/components/AddEmployee/HeaderTop.vue";
@ -91,7 +92,7 @@ const fetchPerson = async () => {
.then((res) => {
const data = res.data.result;
let optionbloodGroups: DataOption[] = [];
data.bloodGroups.map((r: any) => {
data.bloodGroups.map((r: DataOptioninfo) => {
optionbloodGroups.push({
id: r.id.toString(),
name: r.name.toString(),
@ -101,7 +102,7 @@ const fetchPerson = async () => {
OpsFilter.value.bloodOps = optionbloodGroups;
let optiongenders: DataOption[] = [];
data.genders.map((r: any) => {
data.genders.map((r: DataOptioninfo) => {
optiongenders.push({
id: r.id.toString(),
name: r.name.toString(),
@ -111,7 +112,7 @@ const fetchPerson = async () => {
OpsFilter.value.genderOps = optiongenders;
let optionprefixs: DataOption[] = [];
data.prefixs.map((r: any) => {
data.prefixs.map((r: DataOptioninfo) => {
optionprefixs.push({
id: r.id.toString(),
name: r.name.toString(),
@ -121,7 +122,7 @@ const fetchPerson = async () => {
OpsFilter.value.prefixOps = optionprefixs;
let optionrelationships: DataOption[] = [];
data.relationships.map((r: any) => {
data.relationships.map((r: DataOptioninfo) => {
optionrelationships.push({
id: r.id.toString(),
name: r.name.toString(),
@ -131,7 +132,7 @@ const fetchPerson = async () => {
OpsFilter.value.statusOps = optionrelationships;
let optionreligions: DataOption[] = [];
data.religions.map((r: any) => {
data.religions.map((r: DataOptioninfo) => {
optionreligions.push({
id: r.id.toString(),
name: r.name.toString(),
@ -476,7 +477,7 @@ const clickBack = () => {
<q-page-sticky position="top" expand class="bg-grey-2 text-white" style="z-index: 99; padding: 0% 1% 0% 1%">
<div class="row col-12 q-gutter-sm q-pb-sm text-dark no-wrap items-center">
<q-btn flat round class="bg-teal-1 full-height" color="primary" icon="mdi-chevron-left" dense
@click="router.go(-1)">
@click="router.push(`/receive`)">
</q-btn>
<q-avatar size="65px" rounded class="containerimage">
<img v-if="image == null" src="@/assets/avatar_user.jpg" class="bg-grey-3" style="object-fit: cover" />

View file

@ -131,7 +131,7 @@ const saveOrder = () => {
};
//
const Ordersave = async () => {
const id = selected.value.map((r: any) => r.personalId);
const id = selected.value.map((r: ResponseRow) => r.personalId);
const body = {
id,
};

View file

@ -11,6 +11,8 @@ import type { InformationOps } from "@/modules/04_registry/interface/index/Main"
import type {
Information,
DataOption,
DataOptioninfo,
docList
} from "@/modules/04_registry/components/profileType";
import { defaultInformation } from "@/modules/04_registry/components/profileType";
@ -49,7 +51,7 @@ const status = ref<string>("");
const myForm = ref<QForm | null>(null);
const edit = ref<boolean>(false);
const rows = ref<any[]>([]);
const rows = ref<docList[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -133,7 +135,7 @@ const fetchPerson = async () => {
.then((res) => {
const data = res.data.result;
let optionbloodGroups: DataOption[] = [];
data.bloodGroups.map((r: any) => {
data.bloodGroups.map((r: DataOptioninfo) => {
optionbloodGroups.push({
id: r.id.toString(),
name: r.name.toString(),
@ -143,7 +145,7 @@ const fetchPerson = async () => {
OpsFilter.value.bloodOps = optionbloodGroups;
let optiongenders: DataOption[] = [];
data.genders.map((r: any) => {
data.genders.map((r: DataOptioninfo) => {
optiongenders.push({
id: r.id.toString(),
name: r.name.toString(),
@ -153,7 +155,7 @@ const fetchPerson = async () => {
OpsFilter.value.genderOps = optiongenders;
let optionprefixs: DataOption[] = [];
data.prefixs.map((r: any) => {
data.prefixs.map((r: DataOptioninfo) => {
optionprefixs.push({
id: r.id.toString(),
name: r.name.toString(),
@ -163,7 +165,7 @@ const fetchPerson = async () => {
OpsFilter.value.prefixOps = optionprefixs;
let optionrelationships: DataOption[] = [];
data.relationships.map((r: any) => {
data.relationships.map((r: DataOptioninfo) => {
optionrelationships.push({
id: r.id.toString(),
name: r.name.toString(),
@ -173,7 +175,7 @@ const fetchPerson = async () => {
OpsFilter.value.statusOps = optionrelationships;
let optionreligions: DataOption[] = [];
data.religions.map((r: any) => {
data.religions.map((r: DataOptioninfo) => {
optionreligions.push({
id: r.id.toString(),
name: r.name.toString(),
@ -192,9 +194,9 @@ const getData = async () => {
.get(config.API.receiveDataId(paramsId.toString()))
.then(async (res: any) => {
const data = res.data.result;
let list: any[] = [];
let list: docList[] = [];
if (data.docs.length > 0) {
data.docs.map((doc: any) => {
data.docs.map((doc: docList) => {
list.push({
pathName: doc.pathName ?? "",
fileName: doc.fileName ?? "",
@ -478,7 +480,7 @@ onMounted(async () => {
flat
color="primary"
class="q-mr-sm"
@click="router.go(-1)"
@click="router.push(`/receive`)"
/>
รายละเอยดการรบโอนของ {{ title.fullname }}
</div>

View file

@ -25,7 +25,7 @@ const modal = ref<boolean>(false);
const modalupload = ref<boolean>(false);
const modalTree = ref<boolean>(false);
const myForm = ref<any>();
const personal = ref<any[]>([]);
const personal = ref<ResponseData[]>([]);
const personalId = ref<string>("");
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
@ -236,7 +236,7 @@ const clickCloseUpload = () => {
//
const openModalTree = (id: string) => {
personalId.value = id;
personal.value = listRecevice.value.filter((e: any) => e.id === id);
personal.value = listRecevice.value.filter((e: ResponseData) => e.id === id);
modalTree.value = true;
};
//
@ -272,9 +272,9 @@ const closeModalTree = async () => {
};
//
const nextPage = (row: any) => {
const nextPage = (id: string) => {
router.push({
path: `/receive/${row.personalId}`,
path: `/receive/${id}`,
});
};
@ -322,16 +322,16 @@ onMounted(() => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="no" :props="props" @click="nextPage(props.row)">
<q-td key="no" :props="props" @click="nextPage(props.row.personalId)">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="citizenId" :props="props" @click="nextPage(props.row)" >
<q-td key="citizenId" :props="props" @click="nextPage(props.row.personalId)" >
{{ props.row.citizenId }}
</q-td>
<q-td key="fullname" :props="props" @click="nextPage(props.row)" >
<q-td key="fullname" :props="props" @click="nextPage(props.row.personalId)" >
{{ props.row.fullname }}
</q-td>
<q-td key="organizationName" :props="props" @click="nextPage(props.row)" >
<q-td key="organizationName" :props="props" @click="nextPage(props.row.personalId)" >
<div v-if=" props.row.orgName !== null || props.row.positionPath !== null " >
<div class="col-4">
<div class="text-weight-medium">
@ -350,13 +350,13 @@ onMounted(() => {
</div>
</div>
</q-td>
<q-td key="birthday" :props="props" @click="nextPage(props.row)" >
<q-td key="birthday" :props="props" @click="nextPage(props.row.personalId)" >
{{ props.row.birthday }}
</q-td>
<q-td key="dateText" :props="props" @click="nextPage(props.row)" >
<q-td key="dateText" :props="props" @click="nextPage(props.row.personalId)" >
{{ props.row.dateText }}
</q-td>
<q-td key="statusText" :props="props" @click="nextPage(props.row)" >
<q-td key="statusText" :props="props" @click="nextPage(props.row.personalId)" >
{{ props.row.statusText }}
</q-td>
<q-td auto-width>

View file

@ -10,7 +10,7 @@ import http from "@/plugins/http";
import config from "@/app.config";
import type { QForm } from "quasar";
import type { ResponseData } from "@/modules/05_placement/interface/response/officer";
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
@ -47,14 +47,13 @@ const positionTypeOld = ref<string>("");
const positionLevelOld = ref<string>("");
const positionNumberOld = ref<string>("");
const organizationPositionOld = ref<string>("");
const isActive = ref<string>("");
const avatar = ref<string>("");
const getData = async () => {
showLoader();
await http
.get(config.API.repatriationDetail(dataId))
.then((res: any) => {
.then((res: ResponseData) => {
const data = res.data.result;
(fullname.value = `${data.prefix}${data.firstName} ${data.lastName}`),
(id.value = data.id);
@ -76,7 +75,6 @@ const getData = async () => {
positionLevelOld.value = data.positionLevelOld;
positionNumberOld.value = data.positionNumberOld;
organizationPositionOld.value = data.organizationPositionOld;
isActive.value = data.isActive;
})
.catch((e) => {
messageError($q, e);

View file

@ -13,6 +13,7 @@ import type { QTableProps, QForm } from "quasar";
import type {
TypeFile,
ResponseDataDetail,
rowFile
} from "@/modules/05_placement/interface/response/Transfer";
const $q = useQuasar();
@ -115,7 +116,7 @@ const columns = ref<QTableProps["columns"]>([
},
]);
const rowsFileDownload = ref<any[]>([
const rowsFileDownload = ref<rowFile[]>([
{
no: 1,
fileName:

View file

@ -6,6 +6,7 @@ import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QForm } from "quasar";
import type { resHelpDetail } from "@/modules/05_placement/interface/response/officer";
const $q = useQuasar();
const route = useRoute();
@ -51,9 +52,8 @@ const getData = async () => {
showLoader();
await http
.get(config.API.officerDetail(dataId))
.then((res: any) => {
.then((res: resHelpDetail) => {
const data = res.data.result;
(fullname.value = `${data.prefix}${data.firstName} ${data.lastName}`),
(id.value = data.id);
profileId.value = data.profileId;
@ -70,12 +70,10 @@ const getData = async () => {
status.value = data.status;
dateStart.value = data.dateStart;
dateEnd.value = data.dateEnd;
salary.value = data.salary;
positionTypeOld.value = data.positionTypeOld;
positionLevelOld.value = data.positionLevelOld;
positionNumberOld.value = data.positionNumberOld;
organizationPositionOld.value = data.organizationPositionOld;
isActive.value = data.isActive;
})
.catch((e) => {
})

View file

@ -4,7 +4,7 @@ import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useTransferDataStore } from "@/modules/05_placement/store"
import type { QTableProps } from "quasar";
import type { FormMainProbation, FormMainProbation2,mapData } from "@/modules/05_placement/interface/request/Main";
import type { FormMainProbation, FormMainProbation2,mapData,OpfillterType,CriteriaType } from "@/modules/05_placement/interface/request/Main";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import router from "@/router";
@ -20,10 +20,10 @@ const attrs = ref<any>(useAttrs());
const paging = ref<boolean>(true);
const fillter = ref<number>(0);
const paging2 = ref<boolean>(true);
const Opfillter = ref<any>([{ id: 0, value: "ทั้งหมด" }]);
const Opfillter = ref<OpfillterType[]>([{ id: 0, value: "ทั้งหมด" }]);
const filterRef = ref<any>(null);
const filterRef2 = ref<any>(null);
const dataUpdate = ref<any>([]);
const dataUpdate = ref<FormMainProbation[]>([]);
const probationlist = ref<any>([]);
const filterKeyword = ref<string>("");
const fillterStatus = ref<any>([]);
@ -210,7 +210,7 @@ const ProbationMainFilter = () => {
const updateRows = (body: any) => {
if (body.value !== "ทั้งหมด") {
const filteredRows = dataUpdate.value.filter(
(item: any) => item.probation_status === body.value
(item: FormMainProbation) => item.probation_status === body.value
);
rows.value = filteredRows;
} else {
@ -279,11 +279,11 @@ const fecthlistProbation = async (id: string, data: any) => {
};
const findlist = async (id: string) => {
let data = [
let data:CriteriaType[] = [
{ criteriaType: "is_retire", criteriaValue: "false" },
{ criteriaType: "is_probation", criteriaValue: "true" },
];
let data2 = [
let data2:CriteriaType[] = [
{ criteriaType: "is_retire", criteriaValue: "false" },
{ criteriaType: "is_probation", criteriaValue: "false" },
];