เครื่องราช เพิ่ม ()
This commit is contained in:
parent
c91ad3092d
commit
ff16be68f3
11 changed files with 120 additions and 74 deletions
|
|
@ -53,8 +53,9 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
|
|||
level: e.rank,
|
||||
salary: e.salary,
|
||||
salary2: Number(e.salary).toLocaleString(),
|
||||
insigniaType: e.lastInsignia,
|
||||
insigniaSend: e.requestInsignia,
|
||||
insigniaType: e.lastInsignia ? `${e.lastInsignia} (${dataInsigniaType.value.find((item: any) => item.name === e.lastInsignia)?.shortName || ''})` : '',
|
||||
insigniaCheck: e.requestInsignia,
|
||||
insigniaSend: e.requestInsignia ? `${e.requestInsignia} (${dataInsigniaType.value.find((item: any) => item.name === e.requestInsignia)?.shortName || ''})` : '',
|
||||
insigniaLevel: e.level,
|
||||
dateSend: date2Thai(e.requestDate),
|
||||
requestNote: e.requestNote,
|
||||
|
|
@ -66,13 +67,24 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
|
|||
isApprove: e.isApprove,
|
||||
statusMark:
|
||||
e.markDiscipline === true ||
|
||||
e.markLeave === true ||
|
||||
e.markRate === true
|
||||
e.markLeave === true ||
|
||||
e.markRate === true
|
||||
? true
|
||||
: false,
|
||||
}));
|
||||
const item = datalist
|
||||
for (let j = 0; j < item.length; j++) {
|
||||
const data = item[j];
|
||||
const filteredData = dataInsigniaType.value.find((item: any) => item.name === data.insigniaType);
|
||||
if (filteredData) {
|
||||
data.insigniaType = `${data.insigniaType} (${filteredData.shortName})`;
|
||||
} else {
|
||||
data.insigniaType = data.insigniaType;
|
||||
}
|
||||
}
|
||||
|
||||
rows.value = await datalist;
|
||||
listinsignia.value = await datalist;
|
||||
listinsignia.value = await item;
|
||||
searchDataTable(typeinsignia.value, employeeClass.value);
|
||||
filtertypeInsignia();
|
||||
} else rows.value = [];
|
||||
|
|
@ -96,19 +108,23 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
|
|||
// หาประเภทเครื่องราชทั้งหมดที่อยู่ในรายชื่อข้าราชการสามัญฯ
|
||||
const filtertypeInsignia = async () => {
|
||||
typeinsignia.value = "all";
|
||||
|
||||
if (listinsignia.value.length !== 0) {
|
||||
// หาประเภทเครื่องราชที่ขอที่ชื่อซ้ำกัน
|
||||
const double_name = [
|
||||
...new Set(listinsignia.value.map((item: any) => item.insigniaSend)),
|
||||
...new Set(listinsignia.value.map((item: any) => item.insigniaCheck)),
|
||||
];
|
||||
typeinsigniaOptions.value = [{ id: "all", name: "ทั้งหมด" }];
|
||||
for (let i = 1; i <= double_name.length; i++) {
|
||||
const type = double_name[i - 1];
|
||||
const filterShortName = dataInsigniaType.value.find((item: any) => item.name === type)
|
||||
const listtype = {
|
||||
id: type,
|
||||
name: type,
|
||||
name: `${type} (${filterShortName.shortName})`,
|
||||
|
||||
};
|
||||
typeinsigniaOptions.value.push(listtype);
|
||||
|
||||
}
|
||||
} else typeinsigniaOptions.value = [{ id: "all", name: "ทั้งหมด" }];
|
||||
};
|
||||
|
|
@ -119,12 +135,12 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
|
|||
if (type !== "all" && employeeClasstype !== "all") {
|
||||
rows.value = listinsignia.value.filter(
|
||||
(e: any) =>
|
||||
e.insigniaSend === type &&
|
||||
e.insigniaCheck === type &&
|
||||
e.employeeType === profileType(employeeClasstype)
|
||||
);
|
||||
} else if (type !== "all" && employeeClasstype === "all") {
|
||||
rows.value = listinsignia.value.filter(
|
||||
(e: any) => e.insigniaSend === type
|
||||
(e: any) => e.insigniaCheck === type
|
||||
);
|
||||
} else if (type === "all" && employeeClasstype !== "all") {
|
||||
rows.value = listinsignia.value.filter(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue