Merge branch 'feat/receive' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-05-12 15:25:10 +07:00
commit 762ed36190
5 changed files with 141 additions and 18 deletions

View file

@ -43,9 +43,9 @@ async function fetchDataProfile(data: DataProfile) {
profile.avatar = data?.avatar ? data.avatar : "";
}
profile.id = data.profileId;
profile.fullName = `${data.prefix ?? ""}${data.firstName ?? ""} ${
data.lastName ?? ""
} `;
profile.fullName = `${data.rank ? data.rank : data.prefix ?? ""}${
data.firstName ?? ""
} ${data.lastName ?? ""} `;
if (data["posTypeNameOld"] !== undefined) {
profile.position =

View file

@ -48,6 +48,7 @@ const informaData = ref<FormAddPerson>({
employeeType: null,
employeeClass: null,
profileType: null,
rank: "",
});
//
@ -60,6 +61,7 @@ const Ops = ref<InformationOps>({
religionOps: [],
employeeClassOps: [],
employeeTypeOps: [],
rankOps: [],
});
//
const OpsFilter = ref<InformationOps>({
@ -71,6 +73,7 @@ const OpsFilter = ref<InformationOps>({
religionOps: [],
employeeClassOps: [],
employeeTypeOps: [],
rankOps: [],
});
// profile
@ -135,6 +138,16 @@ async function fetchPerson() {
});
Ops.value.religionOps = optionreligions;
OpsFilter.value.religionOps = optionreligions;
let rank: DataOption[] = [];
data.rank.map((r: DataOptioninfo) => {
rank.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
Ops.value.rankOps = rank;
OpsFilter.value.rankOps = rank;
})
.catch((e) => {
messageError($q, e);
@ -204,7 +217,13 @@ function filterSelector(val: string, update: Function, refData: string) {
);
});
break;
case "rankOps":
update(() => {
Ops.value.rankOps = OpsFilter.value.rankOps.filter(
(v: DataOption) => v.name.toLowerCase().indexOf(newVal) > -1
);
});
break;
default:
break;
}
@ -227,7 +246,7 @@ function onSubmit() {
if (fileData.value != null) formData.append("File", fileData.value); //
if (informaData.value.citizenId != undefined)
formData.append("citizenId", informaData.value.citizenId);
if (informaData.value.prefix != undefined)
if (informaData.value.prefix != undefined && informaData.value.prefix != "")
formData.append("prefix", informaData.value.prefix);
if (informaData.value.firstName != undefined)
formData.append("firstName", informaData.value.firstName);
@ -256,6 +275,8 @@ function onSubmit() {
formData.append("employeeType", informaData.value.employeeType);
if (informaData.value.employeeClass != undefined)
formData.append("employeeClass", informaData.value.employeeClass);
if (informaData.value.rank != undefined && informaData.value.rank != "")
formData.append("rank", informaData.value.rank);
dialogConfirm($q, async () => {
showLoader();
@ -289,6 +310,15 @@ function updateBirthDate(v: Date) {
age.value = calculateAge(v);
}
function prefixRankRule() {
return [
() =>
!!informaData.value.rank ||
!!informaData.value.prefix ||
"กรุณาเลือกคำนำหน้าชื่อ หรือยศ",
];
}
/**
* ทำงานเมอมการเรยกใช Components
*/
@ -383,7 +413,7 @@ onMounted(async () => {
</div>
<q-card-section class="q-px-lg">
<div class="row q-col-gutter-sm">
<div class="col-3">
<div class="col-2">
<q-input
bg-color="white"
outlined
@ -404,13 +434,14 @@ onMounted(async () => {
mask="#############"
/>
</div>
<div class="col-3">
<div class="col-2">
<q-select
bg-color="white"
v-model="informaData.prefix"
label="คำนำหน้าชื่อ"
outlined
dense
clearable
lazy-rules
class="inputgreen"
:options="Ops.prefixOps"
@ -418,11 +449,8 @@ onMounted(async () => {
option-value="name"
map-options
hide-bottom-space
:rules="[
(val:string) => {
return val.length > 0 || 'กรุณาเลือกคำนำหน้าชื่อ';
},
]"
:rules="prefixRankRule()"
reactive-rules
emit-value
use-input
hide-selected
@ -432,6 +460,32 @@ onMounted(async () => {
)"
/>
</div>
<div class="col-2">
<q-select
bg-color="white"
v-model="informaData.rank"
label="ยศ"
outlined
dense
lazy-rules
clearable
class="inputgreen"
:options="Ops.rankOps"
option-label="name"
option-value="name"
map-options
hide-bottom-space
:rules="prefixRankRule()"
reactive-rules
emit-value
use-input
hide-selected
fill-input
@filter="(inputValue:string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'rankOps'
)"
/>
</div>
<div class="col-3">
<q-input
bg-color="white"

View file

@ -113,6 +113,7 @@ const Ops = ref<InformationOps>({
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
],
rankOps: [],
});
const OpsFilter = ref<InformationOps>({
prefixOps: [],
@ -129,6 +130,7 @@ const OpsFilter = ref<InformationOps>({
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
],
rankOps: [],
});
/** ฟังก์ชันดึงข้อมูลรายการข้อมูลเกี่ยวกับบุคคล (dropdown list)*/
@ -186,6 +188,16 @@ async function fetchPerson() {
});
Ops.value.religionOps = optionreligions;
OpsFilter.value.religionOps = optionreligions;
let rank: DataOption[] = [];
data.rank.map((r: DataOptioninfo) => {
rank.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
Ops.value.rankOps = rank;
OpsFilter.value.rankOps = rank;
})
.catch((e) => {
messageError($q, e);
@ -215,9 +227,9 @@ async function getData() {
}
rows.value = list;
profileId.value = data.profileId;
title.value.fullname = `${data.prefix ?? ""}${data.firstName ?? ""} ${
data.lastName ?? ""
}`;
title.value.fullname = `${data.rank ? data.rank : data.prefix ?? ""}${
data.firstName ?? ""
} ${data.lastName ?? ""}`;
title.value.organizationPositionOld = data.organizationPositionOld ?? "-";
title.value.positionLevelOld = data.positionLevelOld ?? "-";
title.value.positionTypeOld = data.positionTypeOld ?? "-";
@ -230,6 +242,7 @@ async function getData() {
(data.prefix == "00000000-0000-0000-0000-000000000000"
? null
: data.prefix) ?? "",
rank: data.rank ?? "",
firstname: data.firstName ?? "",
lastname: data.lastName ?? "",
birthDate:
@ -295,6 +308,7 @@ async function fetchData(data: any) {
(data.prefix == "00000000-0000-0000-0000-000000000000"
? null
: data.prefix) ?? "",
rank: data.rank ?? "",
firstname: data.firstName ?? "",
lastname: data.lastName ?? "",
birthDate: data.dateOfBirth !== null ? new Date(data.dateOfBirth) : null,
@ -436,6 +450,14 @@ function filterSelector(val: string, update: Function, refData: string) {
});
break;
case "rankOps":
update(() => {
Ops.value.rankOps = OpsFilter.value.rankOps.filter(
(v: DataOption) => v.name.toLowerCase().indexOf(newVal) > -1
);
});
break;
default:
break;
}
@ -470,6 +492,7 @@ function saveData() {
positionNumberOld: posNo.value,
amount: 0,
amountOld: salary.value,
rank: informaData.value.rank,
};
showLoader();
http
@ -517,6 +540,15 @@ function updateBirthDate(v: Date) {
informaData.value.age = calculateAge(v);
}
function prefixRankRule() {
return [
() =>
!!informaData.value.rank ||
!!informaData.value.prefixId ||
"กรุณาเลือกคำนำหน้าชื่อ หรือยศ",
];
}
/** ทำงานเมื่อมีการเรียกใช้ Components*/
onMounted(async () => {
await fetchPerson();
@ -598,7 +630,7 @@ onMounted(async () => {
<div class="col-xs-12">
<div class="text-weight-bold text-grey">อมลสวนต</div>
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<div class="col-xs-6 col-sm-2 col-md-2">
<q-input
:class="getClass(edit)"
hide-bottom-space
@ -614,7 +646,7 @@ onMounted(async () => {
mask="#############"
/>
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<div class="col-xs-6 col-sm-2 col-md-2">
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
@ -634,10 +666,42 @@ onMounted(async () => {
option-value="name"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
clearable
input-debounce="0"
:rules="prefixRankRule()"
reactive-rules
@filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps' ) "
/>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:outlined="edit"
dense
lazy-rules
v-model="informaData.rank"
emit-value
map-options
hide-selected
fill-input
:rules="prefixRankRule()"
option-label="name"
:options="Ops.rankOps"
option-value="name"
:label="`${'ยศ'}`"
reactive-rules
use-input
input-debounce="0"
@filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'rankOps' ) "
clearable
/>
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<q-input
:class="getClass(edit)"

View file

@ -7,6 +7,7 @@ interface InformationOps {
religionOps: DataOption[];
employeeClassOps: DataOption[];
employeeTypeOps: DataOption[];
rankOps: DataOption[];
}
//ข้อมูลส่วนตัว
@ -63,6 +64,7 @@ interface FormAddPerson {
employeeType: string | null;
employeeClass: string | null;
profileType: string | null;
rank?: string;
}
const defaultInformation: Information = {
@ -83,6 +85,7 @@ const defaultInformation: Information = {
employeeType: null,
employeeClass: null,
profileType: null,
rank: null,
};
export { defaultInformation };

View file

@ -110,7 +110,9 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
format(val, row) {
return `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`;
return ` ${row.rank ? row.rank : row.prefix ?? ""}${
row.firstName ?? ""
} ${row.lastName ?? ""}`;
},
},
{