เครื่องราช => ปรับการเรียกประเภทเครื่องราช
This commit is contained in:
parent
7041a9e050
commit
5a8f6d6434
9 changed files with 47 additions and 31 deletions
|
|
@ -6,6 +6,8 @@ const orgProfile = `${env.API_URI}/org/profile`;
|
||||||
const orgEmployeePos = `${env.API_URI}/org/employee/pos`;
|
const orgEmployeePos = `${env.API_URI}/org/employee/pos`;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
keycloakPosition: () => `${organization}/profile/keycloak/position`,
|
||||||
|
|
||||||
/** โครงสร้างอัตรากำลัง*/
|
/** โครงสร้างอัตรากำลัง*/
|
||||||
activeOrganization: `${organization}/active`,
|
activeOrganization: `${organization}/active`,
|
||||||
orgByid: (id: string) => `${organization}/${id}`,
|
orgByid: (id: string) => `${organization}/${id}`,
|
||||||
|
|
|
||||||
|
|
@ -743,7 +743,6 @@ function clearInsigniaFilters(name: string) {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
organizationOptions.value = await DataStore.optionsTypeOc;
|
organizationOptions.value = await DataStore.optionsTypeOc;
|
||||||
organization.value = await DataStore.typeOc;
|
organization.value = await DataStore.typeOc;
|
||||||
console.log(organization.value);
|
|
||||||
|
|
||||||
if (organization.value !== "" || organization.value !== undefined) {
|
if (organization.value !== "" || organization.value !== undefined) {
|
||||||
if (props.fecthInsigniaByOc) {
|
if (props.fecthInsigniaByOc) {
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ async function fecthlistRound() {
|
||||||
DataStore.roundId = round.value;
|
DataStore.roundId = round.value;
|
||||||
roundName.value = lastValue.name;
|
roundName.value = lastValue.name;
|
||||||
await fecthStat(round.value);
|
await fecthStat(round.value);
|
||||||
await fecthAgency();
|
// await fecthAgency();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -92,47 +92,59 @@ const fecthStat = async (id: string) => {
|
||||||
|
|
||||||
/** funcion เช็คหน่วยงาน*/
|
/** funcion เช็คหน่วยงาน*/
|
||||||
async function fecthAgency() {
|
async function fecthAgency() {
|
||||||
showLoader();
|
|
||||||
await http
|
await http
|
||||||
.get(config.API.insigniaAgency())
|
.get(config.API.keycloakPosition())
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
loadview.value = true;
|
loadview.value = true;
|
||||||
DataStore.agency = res.data.result;
|
DataStore.agency = res.data.result.rootId;
|
||||||
DataStore.typeOc = DataStore.agency;
|
DataStore.typeOc = DataStore.agency;
|
||||||
if (roleDataStore.adminRole) {
|
|
||||||
await fecthType(); // ถ้าไม่มีหนวยงานจะเรียกหน่วยงานทั้งหมด
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** funcion เรียกหน่อยวงาน*/
|
function fetchActiveId() {
|
||||||
async function fecthType() {
|
http
|
||||||
await http
|
.get(config.API.activeOrganization)
|
||||||
.get(config.API.typeOc())
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
optiontypeOc.value = res.data.result.map((e: any) => ({
|
const data = res.data.result;
|
||||||
id: e.organizationId,
|
fetchListOrg(data.activeId);
|
||||||
name: e.organizationName,
|
|
||||||
}));
|
|
||||||
DataStore.fetchOption(optiontypeOc.value); //ค่าของหน่วยงานทั้งหมดไว้ที่ DataStore
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function fetchListOrg(id: string) {
|
||||||
|
showLoader();
|
||||||
|
http
|
||||||
|
.get(config.API.orgByid(id))
|
||||||
|
.then(async (res) => {
|
||||||
|
const data = await res.data.result.map((item: any) => ({
|
||||||
|
id: item.orgTreeId,
|
||||||
|
name: item.orgName,
|
||||||
|
}));
|
||||||
|
optiontypeOc.value = data;
|
||||||
|
DataStore.fetchOption(optiontypeOc.value); //ค่าของหน่วยงานทั้งหมดไว้ที่ DataStore
|
||||||
|
fecthAgency();
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**function เรียกประเภทเครื่องราช*/
|
/**function เรียกประเภทเครื่องราช*/
|
||||||
async function fecthInsignia() {
|
async function fecthInsignia() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.insignia)
|
.get(config.API.insigniaOrg)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
DataStore.fetchInsigniaType(data);
|
DataStore.fetchInsigniaType(data);
|
||||||
|
|
@ -397,6 +409,7 @@ async function uploadFile(event: any) {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
tab.value = DataStore.mainTab;
|
tab.value = DataStore.mainTab;
|
||||||
await fecthlistRound();
|
await fecthlistRound();
|
||||||
|
await fetchActiveId();
|
||||||
DataStore.dataInsigniaType.length === 0 && (await fecthInsignia());
|
DataStore.dataInsigniaType.length === 0 && (await fecthInsignia());
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -652,13 +665,13 @@ onMounted(async () => {
|
||||||
|
|
||||||
<!-- popup หมายเหตุ -->
|
<!-- popup หมายเหตุ -->
|
||||||
<DialogPopupReason
|
<DialogPopupReason
|
||||||
v-model:modal="modalPopupBackToEdit"
|
v-model:modal="modalPopupBackToEdit"
|
||||||
title="หมายเหตุการตีกลับ"
|
title="หมายเหตุการตีกลับ"
|
||||||
label="หมายเหตุ"
|
label="หมายเหตุ"
|
||||||
:savaForm="backToEdit"
|
:savaForm="backToEdit"
|
||||||
/>
|
/>
|
||||||
<DialogPopupReason
|
<DialogPopupReason
|
||||||
v-model:modal="modalbackInsignia2Role"
|
v-model:modal="modalbackInsignia2Role"
|
||||||
title="หมายเหตุการตีกลับ"
|
title="หมายเหตุการตีกลับ"
|
||||||
label="หมายเหตุ"
|
label="หมายเหตุ"
|
||||||
:savaForm="backToEditinsignia2Role"
|
:savaForm="backToEditinsignia2Role"
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ async function fecthRound() {
|
||||||
/** function เรียกประเภทเครื่องราช*/
|
/** function เรียกประเภทเครื่องราช*/
|
||||||
async function fecthInsignia() {
|
async function fecthInsignia() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.insignia)
|
.get(config.API.insigniaOrg)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
DataStore.fetchDatainsignia(data);
|
DataStore.fetchDatainsignia(data);
|
||||||
|
|
@ -151,7 +151,7 @@ async function fecthInsignia() {
|
||||||
|
|
||||||
/** function เรียก Tab*/
|
/** function เรียก Tab*/
|
||||||
const fecthInsigniaType = async () => {
|
const fecthInsigniaType = async () => {
|
||||||
await http(config.API.insigniaType)
|
await http(config.API.insigniaTypeOrg)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
DataStore.fetchDatainsigniaType(data);
|
DataStore.fetchDatainsigniaType(data);
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ async function fecthRound() {
|
||||||
/** function เรียกประเภทเครื่องราชฯ*/
|
/** function เรียกประเภทเครื่องราชฯ*/
|
||||||
async function fecthInsignia() {
|
async function fecthInsignia() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.insignia)
|
.get(config.API.insigniaOrg)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
DataStore.fetchDataInsignia(data);
|
DataStore.fetchDataInsignia(data);
|
||||||
|
|
@ -324,7 +324,7 @@ async function fecthInsignia() {
|
||||||
|
|
||||||
/** function เรียกระดับเครื่องราชฯ Tab*/
|
/** function เรียกระดับเครื่องราชฯ Tab*/
|
||||||
async function fecthInsigniaType() {
|
async function fecthInsigniaType() {
|
||||||
await http(config.API.insigniaType)
|
await http(config.API.insigniaTypeOrg)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
DataStore.fetchDatainsigniaType(data);
|
DataStore.fetchDatainsigniaType(data);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export const useAllocateDataStore = defineStore("insigniaallocate", () => {
|
||||||
insigniaOp.value.push({
|
insigniaOp.value.push({
|
||||||
name: `${e.name} (${e.shortName})`,
|
name: `${e.name} (${e.shortName})`,
|
||||||
id: e.id,
|
id: e.id,
|
||||||
type: e.insigniaType.id,
|
type: e.insigniaTypeId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
data.forEach((e: any) => {
|
data.forEach((e: any) => {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export const useBrrowDataStore = defineStore("insigniaBrrow", () => {
|
||||||
insigniaOp.value.push({
|
insigniaOp.value.push({
|
||||||
name: `${e.name} (${e.shortName})`,
|
name: `${e.name} (${e.shortName})`,
|
||||||
id: e.id,
|
id: e.id,
|
||||||
type: e.insigniaType.id,
|
type: e.insigniaTypeId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
data.forEach((e: any) => {
|
data.forEach((e: any) => {
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,10 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
|
||||||
insigniaOp.value.push({
|
insigniaOp.value.push({
|
||||||
name: `${e.name} (${e.shortName})`,
|
name: `${e.name} (${e.shortName})`,
|
||||||
id: e.id,
|
id: e.id,
|
||||||
insigniaType: e.insigniaType.id,
|
insigniaType: e.insigniaTypeId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
data.forEach((e: any) => {
|
data.forEach((e: any) => {
|
||||||
insigniaOp2.value.push({ name: `${e.name} (${e.shortName})`, id: e.id });
|
insigniaOp2.value.push({ name: `${e.name} (${e.shortName})`, id: e.id });
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ async function fecthRound() {
|
||||||
/** function เรียกประเภทเครื่องราช*/
|
/** function เรียกประเภทเครื่องราช*/
|
||||||
async function fecthInsignia() {
|
async function fecthInsignia() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.insignia)
|
.get(config.API.insigniaOrg)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
DataStore.fetchDatainsignia(data);
|
DataStore.fetchDatainsignia(data);
|
||||||
|
|
@ -266,7 +266,7 @@ async function fecthInsignia() {
|
||||||
|
|
||||||
/** function เรียกระดับเครื่องราช*/
|
/** function เรียกระดับเครื่องราช*/
|
||||||
async function fecthInsigniaType() {
|
async function fecthInsigniaType() {
|
||||||
await http(config.API.insigniaType)
|
await http(config.API.insigniaTypeOrg)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
DataStore.fetchDatainsigniaType(data);
|
DataStore.fetchDatainsigniaType(data);
|
||||||
|
|
@ -299,6 +299,7 @@ watch(tab, () => {
|
||||||
if (tab.value !== "doc") {
|
if (tab.value !== "doc") {
|
||||||
DataStore.insignia = "";
|
DataStore.insignia = "";
|
||||||
fecthlistInsignia();
|
fecthlistInsignia();
|
||||||
|
|
||||||
insigniaTypeOption.value = DataStore.insigniaOp.filter(
|
insigniaTypeOption.value = DataStore.insigniaOp.filter(
|
||||||
(e: any) => e.insigniaType == tab.value || e.name == "ทั้งหมด"
|
(e: any) => e.insigniaType == tab.value || e.name == "ทั้งหมด"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue