Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop
This commit is contained in:
commit
3736aa7e80
4 changed files with 130 additions and 29 deletions
|
|
@ -27,7 +27,9 @@ interface TypeData {
|
|||
interface OptionDataInsignia {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
type?: string;
|
||||
insigniaType?: string;
|
||||
label?: string;
|
||||
}
|
||||
interface InsigniaType {
|
||||
label: string;
|
||||
|
|
@ -96,6 +98,39 @@ interface DataAllocate {
|
|||
year: number;
|
||||
}
|
||||
|
||||
interface DataInsignia {
|
||||
name: string;
|
||||
shortName: string;
|
||||
}
|
||||
|
||||
interface DataRecord {
|
||||
id: string;
|
||||
citizenId: string;
|
||||
prefix: string;
|
||||
position: string;
|
||||
status: string;
|
||||
dateReceive: string | Date | null;
|
||||
name: string;
|
||||
type: string;
|
||||
employeeType: string | undefined;
|
||||
profileType: string;
|
||||
date: string | Date | null;
|
||||
volumeNo: string;
|
||||
section: string;
|
||||
page: string;
|
||||
number: string;
|
||||
vatnumber: string;
|
||||
datepay: string | Date | null;
|
||||
typepay: string;
|
||||
address: string;
|
||||
dateReceiveInsignia: string;
|
||||
dateReturnInsignia: string;
|
||||
docReceiveInsignia: string;
|
||||
docReturnInsignia: string;
|
||||
orgReceiveInsignia: string;
|
||||
orgReturnInsignia: string;
|
||||
}
|
||||
|
||||
export type {
|
||||
OptionData,
|
||||
OptionDataYear,
|
||||
|
|
@ -110,4 +145,6 @@ export type {
|
|||
DataPerson,
|
||||
DataDocuments,
|
||||
DataAllocate,
|
||||
DataRecord,
|
||||
DataInsignia,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -45,10 +45,58 @@ interface ResponseAllocate {
|
|||
total: number;
|
||||
}
|
||||
|
||||
interface ResponseInsigniaType {
|
||||
createdAt: string;
|
||||
id: string;
|
||||
insigniaTypeId: string;
|
||||
insigniaTypeName: string;
|
||||
isActive: boolean;
|
||||
lastUpdateFullName: string;
|
||||
lastUpdatedAt: string;
|
||||
name: string;
|
||||
note: string;
|
||||
shortName: string;
|
||||
}
|
||||
|
||||
interface ResponseRecordLists {
|
||||
address: string;
|
||||
citizenId: string;
|
||||
date: string | Date;
|
||||
datePayment: string | Date;
|
||||
dateReceive: string | Date;
|
||||
dateReceiveInsignia: string;
|
||||
dateReturnInsignia: string;
|
||||
docReceiveInsignia: string;
|
||||
docReturnInsignia: string;
|
||||
fullName: string;
|
||||
id: string;
|
||||
issue: string;
|
||||
no: string;
|
||||
number: string;
|
||||
orgReceiveInsignia: string;
|
||||
orgReturnInsignia: string;
|
||||
organizationOrganizationReceive: string;
|
||||
organizationOrganizationSend: string;
|
||||
page: string;
|
||||
position: string;
|
||||
prefix: string;
|
||||
profileType: string;
|
||||
requestInsignia: string;
|
||||
requestInsigniaId: string;
|
||||
requestInsigniaShortName: string;
|
||||
salary: number;
|
||||
section: string;
|
||||
status: string;
|
||||
typePayment: string;
|
||||
volumeNo: string;
|
||||
}
|
||||
|
||||
export type {
|
||||
ResponseObject,
|
||||
ResponsePeriod,
|
||||
ResponseNoSend,
|
||||
ResponseRound,
|
||||
ResponseAllocate,
|
||||
ResponseInsigniaType,
|
||||
ResponseRecordLists,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,17 @@ import { defineStore } from "pinia";
|
|||
import { ref } from "vue";
|
||||
|
||||
/** import Type*/
|
||||
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
|
||||
import type {
|
||||
OptionData,
|
||||
DataRecord,
|
||||
DataInsignia,
|
||||
OptionDataInsignia,
|
||||
InsigniaType,
|
||||
} from "@/modules/07_insignia/interface/index/Main";
|
||||
import type {
|
||||
ResponseInsigniaType,
|
||||
ResponseRecordLists,
|
||||
} from "@/modules/07_insignia/interface/response/Main";
|
||||
|
||||
/** import Stores */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
|
@ -11,9 +21,9 @@ const { date2Thai } = mixin;
|
|||
|
||||
export const useResultDataStore = defineStore("insigniaResult", () => {
|
||||
const insignia = ref<string>("");
|
||||
const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "" }]);
|
||||
const insigniaOp2 = ref<any[]>([]);
|
||||
const insigniaType = ref<any>();
|
||||
const insigniaOp = ref<OptionDataInsignia[]>([{ name: "ทั้งหมด", id: "" }]);
|
||||
const insigniaOp2 = ref<OptionData[]>([]);
|
||||
const insigniaType = ref<InsigniaType[]>([]);
|
||||
const invoiceType = ref<string>("all");
|
||||
const invoiceTypeop = ref<OptionData[]>([
|
||||
{ name: "ทั้งหมด", id: "all" },
|
||||
|
|
@ -26,20 +36,20 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
|||
{ name: "ข้าราชการ กทม.สามัญ", id: "officer" },
|
||||
{ name: "ลูกจ้างประจำ", id: "employee" },
|
||||
]);
|
||||
const rows = ref<any[]>([]);
|
||||
const listInsignia = ref<any>([]);
|
||||
const type = ref<any[]>([]);
|
||||
const rows = ref<DataRecord[]>([]);
|
||||
const listInsignia = ref<DataRecord[]>([]);
|
||||
const type = ref<DataInsignia[]>([]);
|
||||
|
||||
/**
|
||||
* function เรียกประเภทเครื่องราช
|
||||
* @param data ประเภทเครื่องราช
|
||||
*/
|
||||
async function fetchDatainsignia(data: any) {
|
||||
async function fetchDatainsignia(data: ResponseInsigniaType[]) {
|
||||
insignia.value = "";
|
||||
invoiceType.value = "all";
|
||||
insigniaOp.value = [{ name: "ทั้งหมด", id: "" }];
|
||||
insigniaOp2.value = [];
|
||||
data.forEach((e: any) => {
|
||||
data.forEach((e: ResponseInsigniaType) => {
|
||||
insigniaOp.value.push({
|
||||
name: `${e.name} (${e.shortName})`,
|
||||
id: e.id,
|
||||
|
|
@ -47,10 +57,10 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
|||
});
|
||||
});
|
||||
|
||||
data.forEach((e: any) => {
|
||||
data.forEach((e: ResponseInsigniaType) => {
|
||||
insigniaOp2.value.push({ name: `${e.name} (${e.shortName})`, id: e.id });
|
||||
});
|
||||
data.forEach((e: any) => {
|
||||
data.forEach((e: ResponseInsigniaType) => {
|
||||
type.value.push({
|
||||
name: e.name,
|
||||
shortName: e.shortName,
|
||||
|
|
@ -62,23 +72,28 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
|||
* function เรียกประเภทเครื่องราช
|
||||
* @param data ประเภทเครื่องราช
|
||||
*/
|
||||
async function fetchDatainsigniaType(data: any) {
|
||||
insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name }));
|
||||
async function fetchDatainsigniaType(data: ResponseInsigniaType[]) {
|
||||
insigniaType.value = data.map((e: ResponseInsigniaType) => ({
|
||||
name: e.id,
|
||||
label: e.name,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* function บันทึกผลการได้รับพระราชทานเครื่องราชอิสริยาภรณ์/การจ่ายใบกำกับ
|
||||
* @param data รายชื่อข้าราชการสามัญฯ
|
||||
*/
|
||||
async function fetchlistinsignia(data: any) {
|
||||
async function fetchlistinsignia(data: ResponseRecordLists[]) {
|
||||
console.log(data);
|
||||
|
||||
rows.value = [];
|
||||
let alllist = await data.map((e: any) => ({
|
||||
const alllist = await data.map((e: ResponseRecordLists) => ({
|
||||
id: e.id,
|
||||
citizenId: e.citizenId,
|
||||
prefix: e.prefix,
|
||||
position: e.position,
|
||||
status: status(e.status),
|
||||
dateReceive: date2Thai(e.dateReceive),
|
||||
status: status(e.status) ?? "",
|
||||
dateReceive: e.dateReceive ?? date2Thai(e.dateReceive),
|
||||
name: e.fullName,
|
||||
type: `${e.requestInsignia} (${
|
||||
type.value.find((item) => item.name === e.requestInsignia)?.shortName ||
|
||||
|
|
@ -88,13 +103,13 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
|||
e.profileType === "" ? "officer" : e.profileType
|
||||
),
|
||||
profileType: e.profileType === "" ? "officer" : e.profileType,
|
||||
date: date2Thai(e.date),
|
||||
date: e.date ?? date2Thai(e.date),
|
||||
volumeNo: e.volumeNo,
|
||||
section: e.section,
|
||||
page: e.page,
|
||||
number: e.no,
|
||||
vatnumber: e.number,
|
||||
datepay: date2Thai(e.datePayment),
|
||||
datepay: e.datePayment ?? date2Thai(e.datePayment),
|
||||
typepay: e.typePayment,
|
||||
address: e.address,
|
||||
dateReceiveInsignia: e.dateReceiveInsignia,
|
||||
|
|
@ -104,6 +119,7 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
|||
orgReceiveInsignia: e.orgReceiveInsignia,
|
||||
orgReturnInsignia: e.orgReturnInsignia,
|
||||
}));
|
||||
|
||||
rows.value = alllist;
|
||||
listInsignia.value = alllist;
|
||||
searchData(invoiceType.value, employeeClass.value);
|
||||
|
|
@ -129,7 +145,7 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
|||
rows.value = list;
|
||||
} else if (invoice === "all" && employeeClass !== "all") {
|
||||
let list = listInsignia.value.filter(
|
||||
(e: any) => e.employeeType === profileType(employeeClass)
|
||||
(e: DataRecord) => e.employeeType === profileType(employeeClass)
|
||||
);
|
||||
rows.value = list;
|
||||
} else if (invoice === "all" && employeeClass == "all") {
|
||||
|
|
@ -158,27 +174,29 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
|||
* function convert สถานภาพ
|
||||
* @param val สถานภาพ
|
||||
*/
|
||||
const profileType = (val: string) => {
|
||||
switch (val) {
|
||||
function profileType(val: string) {
|
||||
const newVal = val.toLocaleLowerCase();
|
||||
switch (newVal) {
|
||||
case "officer":
|
||||
return "ข้าราชการ กทม.สามัญ";
|
||||
case "employee":
|
||||
return "ลูกจ้างประจำ";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* function convert สถานะ การจ่าย
|
||||
* @param val สถานะ การจ่าย
|
||||
*/
|
||||
const convertDatepay = (val: any) => {
|
||||
function convertDatepay(val: string | null) {
|
||||
switch (val) {
|
||||
case null:
|
||||
return "noDate";
|
||||
default:
|
||||
return "haveDate";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
rows,
|
||||
insignia,
|
||||
|
|
@ -195,7 +213,5 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
|||
profileType,
|
||||
fetchlistinsignia,
|
||||
searchData,
|
||||
// selectInvoice,
|
||||
// selectEmployeeClass,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ const visibleColumns = ref<String[]>([
|
|||
"dateReceive",
|
||||
"date",
|
||||
"employeeType",
|
||||
"volumeNo",
|
||||
" ",
|
||||
"section",
|
||||
"page",
|
||||
"number",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue