เครื่องราช เพิ่ม ()

This commit is contained in:
setthawutttty 2023-10-25 12:54:49 +07:00
parent c91ad3092d
commit ff16be68f3
11 changed files with 120 additions and 74 deletions

View file

@ -130,7 +130,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "insigniaType",
align: "left",
label: "ประเภทเครื่องราชฯ ปัจจุบัน",
label: "ชั้นตราเครื่องราชฯ ปัจจุบัน",
sortable: true,
field: "insigniaType",
headerStyle: "font-size: 14px",

View file

@ -111,7 +111,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "insigniaType",
align: "left",
label: "ประเภทเครื่องราชฯ ปัจจุบัน",
label: "ชั้นตราเครื่องราชฯ ปัจจุบัน",
sortable: true,
field: "insigniaType",
headerStyle: "font-size: 14px",

View file

@ -111,7 +111,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "insigniaType",
align: "left",
label: "ประเภทเครื่องราชฯ ปัจจุบัน",
label: "ชั้นตราเครื่องราชฯ ปัจจุบัน",
sortable: true,
field: "insigniaType",
headerStyle: "font-size: 14px",

View file

@ -1,10 +1,11 @@
<script setup lang="ts">
import { ref, watch,onMounted } from "vue";
import { ref, watch, onMounted } from "vue";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DataOption } from "@/modules/04_registry/components/profileType";
import type { ItemType } from "@/modules/07_insignia/interface/request/Main";
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
@ -32,8 +33,9 @@ const listPerson = ref<any>([]);
const OrgList = ref<DataOption[]>([]);
const filterOrgList = ref<any>([]);
const insigniaNoteProfileId = ref<string>("");
const filterSelectRound = ref<any>()
const selectRound = ref<any>()
const filterSelectRound = ref<any>();
const selectRound = ref<any>();
const type = ref<any>();
//
const clearData = () => {
receivedate.value = null;
@ -70,19 +72,23 @@ const props = defineProps({
type: String,
},
selectRoundOption: {
type: Array,
type: Array,
},
filterSelectRoundOption: {
type: Array,
type: Array,
},
profileId: {
type: String,
default: "",
},
type: {
type: Array,
},
});
// props dialog
watch(props, () => {
type.value = props.type;
if (props.modal == true && props.roundId != "all") {
roundNo.value = props.roundId;
fecthlistInsignia();
@ -97,32 +103,31 @@ watch(props, () => {
//
const fecthlistInsignia = async () => {
if(roundNo.value !== ''&& roundNo.value !== null){
if (roundNo.value !== "" && roundNo.value !== null) {
showLoader();
let data = {
insigniaTypeId: props.typeId,
insigniaNoteId: roundNo.value,
insigniaId: "",
};
await http
.post(config.API.noteSearch(), data)
.then((res) => {
listPerson.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
cardid.value = "";
fullName.value = "";
brand.value = "";
OrganazationId.value = "";
reason.value = "";
hideLoader();
});
};
let data = {
insigniaTypeId: props.typeId,
insigniaNoteId: roundNo.value,
insigniaId: "",
};
await http
.post(config.API.noteSearch(), data)
.then((res) => {
listPerson.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
cardid.value = "";
fullName.value = "";
brand.value = "";
OrganazationId.value = "";
reason.value = "";
hideLoader();
});
}
};
//
const fetchOrgList = async () => {
@ -144,7 +149,7 @@ const fetchOrgList = async () => {
// ];
// } else {
OrgList.value = orgArr;
filterOrgList.value = OrgList.value
filterOrgList.value = OrgList.value;
// }
})
.catch((err) => {
@ -222,7 +227,11 @@ const searchcardid = async () => {
if (node) {
fullName.value = `${node.prefix} ${node.fullName}`;
brand.value = node.requestInsignia;
brand.value = `${node.requestInsignia} (${
type.value.find((item: any) => item.name === node.requestInsignia)
?.shortName || ""
})`;
insigniaNoteProfileId.value = node.id;
insigniaNoteProfileId.value = node.id;
} else {
notifyError($q, "ไม่พบข้อมูลการได้รับในรอบนี้");
@ -252,28 +261,27 @@ const clearReturnDate = () => {
const filterSelector = (val: any, update: Function, name: any) => {
update(() => {
const needle = val.toLowerCase();
if (name === 'filterOrgList') {
OrganazationId.value = ''
if (name === "filterOrgList") {
OrganazationId.value = "";
filterOrgList.value = OrgList.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
if (name === 'filterSelectRoundOption') {
roundNo.value = ''
if (name === "filterSelectRoundOption") {
roundNo.value = "";
filterSelectRound.value = selectRound.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
}
)
}
});
};
const setValue = () => {
filterSelectRound.value = props.filterSelectRoundOption
selectRound.value = props.selectRoundOption
}
filterSelectRound.value = props.filterSelectRoundOption;
selectRound.value = props.selectRoundOption;
};
onMounted(() => {
setValue();
});
setValue();
});
</script>
<template>

View file

@ -22,7 +22,7 @@ const selectRoundOption = ref<OptionDataYear[]>([]);
const filterSelectRoundOption = ref<any>([]);
const selectRoundAllOption = ref<OptionDataYear[]>([]);
const filterSelectRoundAllOption = ref<OptionDataYear[]>([]);
const type = ref<any[]>(DataStore.type)
const modal = ref<boolean>(false);
const action = ref<string>("");
const profileId = ref<string>("");
@ -578,7 +578,7 @@ const clearInsigniaFilters = (name: string) => {
</q-tab-panel>
</q-tab-panels>
<DialogForm :modal="modal" :close="close" :close-and-fecth="closeAndFecth"
<DialogForm :modal="modal" :close="close" :close-and-fecth="closeAndFecth" :type="type"
:round-id="selectRound == '0' ? 'all' : selectRound" :action="action" :profile-id="profileId"
v-model:selectRoundOption="selectRoundOption" v-model:filterSelectRoundOption="filterSelectRoundOption"
:type-id="tab" />

View file

@ -17,4 +17,8 @@ interface FormProprsalsRound2 {
period_doc: any;
period_status:any
}
export type { FormProprsalsRound, FormProprsalsRound2 };
interface ItemType {
name: string;
shortName: string;
}
export type { FormProprsalsRound, FormProprsalsRound2,ItemType };

View file

@ -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(

View file

@ -17,13 +17,18 @@ export const useAllocateDataStore = defineStore("insigniaallocate", () => {
const rows = ref<any>([])
const listInsignia = ref<any>([])
const mainTab = ref<string>("")
const type = ref<any[]>([])
const fetchDatainsignia = async (data: any) => {
// insignia.value = ''
insigniaOp.value = [{ name: "ทั้งหมด", id: "", type: "" }]
data.forEach((e: any) => {
insigniaOp.value.push({ name: e.name, id: e.id, type: e.insigniaType.id })
insigniaOp.value.push({ name: `${e.name} (${e.shortName})`, id: e.id, type: e.insigniaType.id })
});
data.forEach((e: any) => {
type.value.push({
name:e.name,
shortName:e.shortName,
})})
}
const fetchDatainsigniaType = async (data: any,) => {
insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name }))
@ -34,7 +39,7 @@ export const useAllocateDataStore = defineStore("insigniaallocate", () => {
rows.value = [];
let list = await data.map((e: any) => ({
id: e.id,
insignia: e.insignia,
insignia: `${e.insignia} (${type.value.find(item => item.name === e.insignia)?.shortName || ''})`,
insigniaId: e.insigniaId,
total: e.total,
allocate: e.allocate,

View file

@ -15,13 +15,18 @@ export const useBrrowDataStore = defineStore("insigniaBrrow", () => {
const listInsignia = ref<any>([])
const employeeClass = ref<string>("all");
const employeeClassOps = ref<any>([{ name: "ทั้งหมด", id: "all" }, { name: "ข้าราชการ กทม.สามัญ", id: "officer" }, { name: "ลูกจ้างประจำ", id: "perm" }])
const type = ref<any[]>([])
const fetchDataInsignia = async (data: any) => {
insignia.value = ''
insigniaOp.value = [{ name: "ทั้งหมด", id: "", type: "" }]
data.forEach((e: any) => {
insigniaOp.value.push({ name: e.name, id: e.id, type: e.insigniaType.id })
insigniaOp.value.push({ name: `${e.name} (${e.shortName})`, id: e.id, type: e.insigniaType.id })
});
data.forEach((e: any) => {
type.value.push({
name:e.name,
shortName:e.shortName,
})})
}
const fetchDatainsigniaType = async (data: any) => {
insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name }))
@ -36,7 +41,7 @@ export const useBrrowDataStore = defineStore("insigniaBrrow", () => {
position: e.position,
status: status(e.status),
name: e.fullName,
type: e.requestInsignia,
type: `${e.requestInsignia} (${type.value.find(item => item.name === e.requestInsignia)?.shortName || ''})`,
requestInsigniaId: e.requestInsigniaId,
employeeType: profileType(e.profileType),
profileType: e.profileType,
@ -109,5 +114,6 @@ export const useBrrowDataStore = defineStore("insigniaBrrow", () => {
profileType,
fetchlistinsignia,
searchDatatable,
type
};
});

View file

@ -19,7 +19,7 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
const employeeClassOps = ref<any>([{ name: "ทั้งหมด", id: "all" }, { name: "ข้าราชการ กทม.สามัญ", id: "officer" }, { name: "ลูกจ้างประจำ", id: "employee" }])
const rows = ref<any>([])
const listInsignia = ref<any>([])
const type = ref<any[]>([])
const fetchDatainsignia = async (data: any) => {
insignia.value = ''
@ -27,12 +27,18 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
insigniaOp.value = [{ name: "ทั้งหมด", id: "" }]
insigniaOp2.value = []
data.forEach((e: any) => {
insigniaOp.value.push({ name: e.name, id: e.id, insigniaType: e.insigniaType.id })
insigniaOp.value.push({ name: `${e.name} (${e.shortName})`, id: e.id, insigniaType: e.insigniaType.id })
});
data.forEach((e: any) => {
insigniaOp2.value.push({ name: e.name, id: e.id })
insigniaOp2.value.push({ name: `${e.name} (${e.shortName})`, id: e.id })
});
}
data.forEach((e: any) => {
type.value.push({
name:e.name,
shortName:e.shortName,
})
})
}
const fetchDatainsigniaType = async (data: any) => {
insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name }))
}
@ -46,7 +52,7 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
status: status(e.status),
dateReceive: date2Thai(e.dateReceive),
name: e.prefix + e.fullName,
type: e.requestInsignia,
type: `${e.requestInsignia} (${type.value.find(item => item.name === e.requestInsignia)?.shortName || ''})`,
employeeType: profileType(e.profileType),
profileType: e.profileType,
date: date2Thai(e.date),

View file

@ -365,6 +365,7 @@ const addData = () => {
};
const editData = (data: any) => {
personId.value = data.id;
profileType.value = data.profileType;
action.value = "editData";
@ -609,7 +610,7 @@ const clearInsigniaFilters = (name: string) => {
</div>
</q-card>
<div class="row col-12 q-pb-sm q-col-gutter-xs">
<q-select
<q-select
v-model="DataStore.insignia"
dense
outlined