เครื่องราชฯ
This commit is contained in:
parent
8ebbef05d9
commit
1530da36cf
22 changed files with 159 additions and 777 deletions
|
|
@ -27,7 +27,6 @@ const $q = useQuasar();
|
|||
const DataStore = useInsigniaDataStore();
|
||||
const roleDataStore = useroleUserDataStore();
|
||||
|
||||
const modalNote = ref<boolean>(false);
|
||||
const modelPopupReject = ref<boolean>(false);
|
||||
const modelPopupDelete = ref<boolean>(false);
|
||||
const modalAdd = ref<boolean>(false);
|
||||
|
|
@ -233,6 +232,7 @@ onMounted(async () => {
|
|||
}
|
||||
}
|
||||
});
|
||||
// เช็คสถานนะแสดงปุ่มเพิ่ม
|
||||
const checkStatus = computed(() => {
|
||||
if (
|
||||
roleDataStore.insignia1Role &&
|
||||
|
|
@ -241,6 +241,7 @@ const checkStatus = computed(() => {
|
|||
return true;
|
||||
} else return false;
|
||||
});
|
||||
// เลืแกหน่วยงาน
|
||||
const changtypeOc = () => {
|
||||
if (props.fecthInsigniaByOc) {
|
||||
props.fecthInsigniaByOc(
|
||||
|
|
@ -252,26 +253,14 @@ const changtypeOc = () => {
|
|||
}
|
||||
DataStore.typeOc = organization.value;
|
||||
};
|
||||
// เพิ่มราชชื่อ
|
||||
const clickmodalAdd = () => {
|
||||
showLoader();
|
||||
fecthlistRetire();
|
||||
fecthInsignia();
|
||||
fecthlistperson(DataStore.typeOc);
|
||||
insigniaType.value = "";
|
||||
};
|
||||
// fecth profile
|
||||
const fecthlistRetire = async () => {
|
||||
await http
|
||||
.get(config.API.profileOrganizRoot)
|
||||
.then((res) => {
|
||||
const id = res.data.result[0].id;
|
||||
if (id !== "") {
|
||||
fecthlistperson(id);
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
};
|
||||
// เรียกรายชื่อข้าราชการตามหน่วยงานที่จะเพิ่ม
|
||||
const fecthlistperson = async (id: string) => {
|
||||
let data = [{}];
|
||||
data = [
|
||||
|
|
@ -295,10 +284,9 @@ const fecthlistperson = async (id: string) => {
|
|||
position: e.position == null ? "-" : e.position,
|
||||
level: e.positionEmployeeLevel == null ? "-" : e.positionEmployeeLevel,
|
||||
organizationOrganization: e.oc == null ? "-" : e.oc,
|
||||
ocId: DataStore.convertOcid(e.oc),
|
||||
}));
|
||||
modalAdd.value = true;
|
||||
rows2.value = data.filter((e: any) => e.ocId === DataStore.typeOc);
|
||||
rows2.value = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -307,6 +295,7 @@ const fecthlistperson = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
// ยืนยันการเพิ่มราชชื่อ
|
||||
const clickAdd = async (id: string) => {
|
||||
if (insigniaType.value !== "") {
|
||||
dialogConfirm(
|
||||
|
|
@ -319,7 +308,7 @@ const clickAdd = async (id: string) => {
|
|||
);
|
||||
} else dialogMessageNotify($q, "กรุณาเลือกรายชื่อขอพระราชทานเครื่องราชฯ");
|
||||
};
|
||||
|
||||
//เพิ่มราชชื่อข้าราชการ
|
||||
const addlistperson = async (id: string) => {
|
||||
showLoader();
|
||||
let data = {
|
||||
|
|
@ -348,14 +337,14 @@ const addlistperson = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
// เปิด POP แก้ไขเครื่องราชฯ
|
||||
const clickmodalEdit = (props: any) => {
|
||||
insignia.value = props.insigniaSend;
|
||||
person.value = props;
|
||||
modalEdit.value = true;
|
||||
fecthInsignia();
|
||||
};
|
||||
|
||||
// downloadfile รายชื่อข้าราชการสามัญฯ
|
||||
const downloadFile = (response: any, filename: string) => {
|
||||
const link = document.createElement("a");
|
||||
var fileName = filename;
|
||||
|
|
@ -365,6 +354,7 @@ const downloadFile = (response: any, filename: string) => {
|
|||
link.click();
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
// เรียก file รายชื่อข้าราชการสามัญฯ
|
||||
const downloadFileexcel = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -378,35 +368,13 @@ const downloadFileexcel = async () => {
|
|||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// const downloadReport = async (type: string = "pdf") => {
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.reportInsignia("45", type, props.roundId!), {
|
||||
// responseType: "blob",
|
||||
// })
|
||||
// .then(async (res) => {
|
||||
// console.log(res);
|
||||
|
||||
// downloadFile(
|
||||
// res,
|
||||
// `บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา ${props.roundName}.${type}`
|
||||
// );
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
// };
|
||||
|
||||
// ยืนยันการแก้ไขเครื่องราช
|
||||
const clickSave = () => {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -417,7 +385,7 @@ const clickSave = () => {
|
|||
"ต้องการยืนยันการแก้ไขเครื่องราชฯ ที่ยื่นขอนี้หรือไม่ ?"
|
||||
);
|
||||
};
|
||||
|
||||
// แก้ไขเครื่องราช API
|
||||
const listEdit = async (profileId: string) => {
|
||||
let data: any = {
|
||||
insigniaId: insignia.value,
|
||||
|
|
@ -442,11 +410,16 @@ const listEdit = async (profileId: string) => {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
//เปิด POPUP ไม่ยืนขอ
|
||||
const clickReject = (id: string) => {
|
||||
modelPopupReject.value = true;
|
||||
rowid.value = id;
|
||||
};
|
||||
// ปิด POPUP ไม่ยืนขอ
|
||||
const closemodelPopupReject = () => {
|
||||
modelPopupReject.value = false;
|
||||
};
|
||||
// ยืนยัน การไม่ยืนขอ
|
||||
const savaReasonReject = (reason: string) => {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -460,10 +433,7 @@ const savaReasonReject = (reason: string) => {
|
|||
"ต้องการยืนยันการย้ายข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
};
|
||||
const closemodelPopupReject = () => {
|
||||
modelPopupReject.value = false;
|
||||
};
|
||||
|
||||
// ยืนยัน การไม่ยืนขอ API
|
||||
const listreject = async (profileId: string, reason: string) => {
|
||||
await http
|
||||
.put(config.API.insigniaReject(profileId), { reason: reason })
|
||||
|
|
@ -485,14 +455,16 @@ const listreject = async (profileId: string, reason: string) => {
|
|||
await closemodelPopupReject();
|
||||
});
|
||||
};
|
||||
|
||||
//เปิด POPUP คนที่ถูกลบ
|
||||
const clickDelete = (id: string) => {
|
||||
modelPopupDelete.value = true;
|
||||
rowid.value = id;
|
||||
};
|
||||
// ปิด POPUP คนที่ถูกลบ
|
||||
const closemodelPopupDelete = () => {
|
||||
modelPopupDelete.value = false;
|
||||
};
|
||||
// ยืนยัน การลบคนที่ถูกลบ
|
||||
const savaReasonDelete = (reason: string) => {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -506,7 +478,7 @@ const savaReasonDelete = (reason: string) => {
|
|||
"ต้องการยืนยันการลบข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
};
|
||||
|
||||
// ยืนยัน คนที่ถูกลบ API
|
||||
const listdelete = async (id: string, reason: string) => {
|
||||
await http
|
||||
.put(config.API.insigniaDelete(id), { reason: reason })
|
||||
|
|
@ -532,7 +504,7 @@ const listdelete = async (id: string, reason: string) => {
|
|||
const insignia = ref<string>("");
|
||||
const insigniaOptions = ref<any>([]);
|
||||
const insigniaType = ref<string>("");
|
||||
|
||||
// เรียกประเภทเครื่องราชฯ
|
||||
const fecthInsignia = async () => {
|
||||
await http
|
||||
.get(config.API.insignia)
|
||||
|
|
@ -662,30 +634,7 @@ const closeModalEdit = () => {
|
|||
color="primary"
|
||||
@click="downloadFileexcel"
|
||||
>
|
||||
<!-- @click="downloadReport('pdf')" -->
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
<!-- <q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable v-close-popup @click="downloadReport('pdf')">
|
||||
<q-item-section avatar
|
||||
><q-icon color="red" name="mdi-file-pdf"
|
||||
/></q-item-section>
|
||||
<q-item-section>ไฟล์ .PDF</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="downloadReport('docx')">
|
||||
<q-item-section avatar
|
||||
><q-icon color="blue" name="mdi-file-word"
|
||||
/></q-item-section>
|
||||
<q-item-section>ไฟล์ .docx</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="downloadReport('xlsx')">
|
||||
<q-item-section avatar
|
||||
><q-icon color="green" name="mdi-file-excel"
|
||||
/></q-item-section>
|
||||
<q-item-section>ไฟล์ .xlsx</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu> -->
|
||||
</q-btn>
|
||||
<q-btn
|
||||
size="12px"
|
||||
|
|
@ -814,7 +763,7 @@ const closeModalEdit = () => {
|
|||
<q-td key="dateSend" :props="props">
|
||||
{{ props.row.dateSend }}
|
||||
</q-td>
|
||||
|
||||
|
||||
<q-td
|
||||
auto-width
|
||||
v-if="
|
||||
|
|
@ -896,16 +845,16 @@ const closeModalEdit = () => {
|
|||
</q-btn>
|
||||
</q-td>
|
||||
<q-td
|
||||
auto-width
|
||||
v-if="props.row.insigniaSend == 'เหรียญจักรพรรดิมาลา'"
|
||||
>
|
||||
<btnDownloadFile
|
||||
:profileId="props.row.profileId"
|
||||
:round="DataStore.roundId"
|
||||
:optionRound="DataStore.optionRound"
|
||||
/>
|
||||
</q-td>
|
||||
<q-td v-else auto-width></q-td>
|
||||
auto-width
|
||||
v-if="props.row.insigniaSend == 'เหรียญจักรพรรดิมาลา'"
|
||||
>
|
||||
<btnDownloadFile
|
||||
:profileId="props.row.profileId"
|
||||
:round="DataStore.roundId"
|
||||
:optionRound="DataStore.optionRound"
|
||||
/>
|
||||
</q-td>
|
||||
<q-td v-else auto-width></q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
|
|
@ -1087,6 +1036,7 @@ const closeModalEdit = () => {
|
|||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<!-- popup เหตุผลไม่ยื่นขอ -->
|
||||
<DialogPopupReason
|
||||
:modal="modelPopupReject"
|
||||
title="เหตุผลไม่ยื่นขอ"
|
||||
|
|
@ -1094,6 +1044,7 @@ const closeModalEdit = () => {
|
|||
:click-close="closemodelPopupReject"
|
||||
:savaForm="savaReasonReject"
|
||||
/>
|
||||
<!-- เหตุผลที่ลบออก -->
|
||||
<DialogPopupReason
|
||||
:modal="modelPopupDelete"
|
||||
title="เหตุผลที่ลบออก"
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ onMounted(async () => {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// เลือกหน่วยงาน
|
||||
const changtypeOc = () => {
|
||||
if (props.fecthInsigniaByOc) {
|
||||
props.fecthInsigniaByOc(
|
||||
|
|
|
|||
|
|
@ -48,24 +48,18 @@ onMounted(async () => {
|
|||
await fecthOrg();
|
||||
DataStore.mainTab = props.tab;
|
||||
});
|
||||
watch(props, async () => {
|
||||
if (props.tab === "organization") {
|
||||
await fecthOrg();
|
||||
}
|
||||
});
|
||||
|
||||
//หน่วยงานที่ยังไม่ได้เสนอชื่อ
|
||||
const fecthOrg = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.insigniaNosend(props.roundId))
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
let data = res.data.result;
|
||||
rows.value = data.map((e: any) => ({
|
||||
orgId: e.orgId,
|
||||
orgName: e.orgName,
|
||||
}));
|
||||
console.log(rows.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
|
|
@ -15,9 +14,6 @@ import tab2 from "@/modules/07_insignia/components/2_Manage/Tab2.vue";
|
|||
import tab3 from "@/modules/07_insignia/components/2_Manage/Tab3.vue";
|
||||
import tab4 from "@/modules/07_insignia/components/2_Manage/Tab4.vue";
|
||||
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
|
||||
import keycloak from "@/plugins/keycloak";
|
||||
|
||||
const roleUser = ref<string>("admin");
|
||||
|
||||
const roleDataStore = useroleUserDataStore();
|
||||
const DataStore = useInsigniaDataStore();
|
||||
|
|
@ -39,12 +35,14 @@ const stat = ref<any>({
|
|||
orgNoSendCount: 0,
|
||||
orgSendCount: 0,
|
||||
});
|
||||
const modalPopupBackToEdit = ref<boolean>(false); //model แก้ไข
|
||||
|
||||
onMounted(async () => {
|
||||
tab.value = DataStore.mainTab;
|
||||
await fecthlistRound();
|
||||
});
|
||||
|
||||
//เรียกรอบการเสนอขอพระราชทานเครื่อง
|
||||
const fecthlistRound = async () => {
|
||||
await http
|
||||
.get(config.API.listRoundInsignia())
|
||||
|
|
@ -54,13 +52,14 @@ const fecthlistRound = async () => {
|
|||
year: e.period_year,
|
||||
name: e.period_name,
|
||||
}));
|
||||
//มีรอบการเสนอขอพระราชทานเครื่องแสดง UI
|
||||
if (optionRound.value.length !== 0) {
|
||||
DataStore.optionRound = optionRound.value;
|
||||
const lastValue = optionRound.value[0];
|
||||
if (DataStore.roundId) {
|
||||
round.value = DataStore.roundId;
|
||||
round.value = DataStore.roundId; // รอบการเสนอให้ใช้รอบที่เลือก
|
||||
} else {
|
||||
round.value = lastValue.id.toString();
|
||||
round.value = lastValue.id.toString(); // รอบการเสนอให้ใช้รอบล่าสุด
|
||||
}
|
||||
DataStore.roundId = round.value;
|
||||
roundName.value = lastValue.name;
|
||||
|
|
@ -69,11 +68,11 @@ const fecthlistRound = async () => {
|
|||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
messageError($q, err);
|
||||
});
|
||||
};
|
||||
|
||||
//เรียกดู Stat ของรอบการเสนอขอพระราชทานเครื่อง
|
||||
const fecthStat = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -89,6 +88,7 @@ const fecthStat = async (id: string) => {
|
|||
});
|
||||
};
|
||||
|
||||
// เช็คหน่วยงาน
|
||||
const fecthAgency = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -97,11 +97,10 @@ const fecthAgency = async () => {
|
|||
DataStore.agency = res.data.result;
|
||||
loadview.value = true;
|
||||
if (roleDataStore.adminRole) {
|
||||
await fecthType();
|
||||
await fecthType(); // ถ้าไม่มีหนวยงานจะเรียกหน่วยงานทั้งหมด
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
@ -109,7 +108,7 @@ const fecthAgency = async () => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
// เรียกหน่วยงาน
|
||||
const fecthType = async () => {
|
||||
await http
|
||||
.get(config.API.typeOc())
|
||||
|
|
@ -118,23 +117,21 @@ const fecthType = async () => {
|
|||
id: e.organizationId,
|
||||
name: e.organizationName,
|
||||
}));
|
||||
DataStore.fetchOption(optiontypeOc.value);
|
||||
DataStore.fetchOption(optiontypeOc.value); //ค่าของหน่วยงานทั้งหมดไว้ที่ DataStore
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
// loading.value = true;
|
||||
});
|
||||
};
|
||||
|
||||
//เลือกรอบการแสดง
|
||||
const changround = async () => {
|
||||
DataStore.roundId = round.value;
|
||||
fecthStat(round.value);
|
||||
var organization = await (DataStore.agency != null
|
||||
fecthStat(round.value); //เรียกดู Stat รอบที่เลือก
|
||||
var organization = await (DataStore.agency != null //ถ้ามี agency เรียกข้อมูลตาม agency ถ้าไม่มีเรียนตาม Oc ที่เลือก
|
||||
? DataStore.agency
|
||||
: DataStore.typeOc);
|
||||
fecthInsigniaByOc(round.value, organization, "officer", tab.value);
|
||||
fecthInsigniaByOc(round.value, organization, "officer", tab.value); // เรียกข้อมูลรายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
|
||||
// get round name
|
||||
const roundFilter = await optionRound.value.find(
|
||||
(x: any) => round.value === x.id
|
||||
|
|
@ -145,6 +142,8 @@ const changround = async () => {
|
|||
};
|
||||
const requestNote = ref<string>("");
|
||||
const requestStatus = ref<string>("");
|
||||
|
||||
//เรียกข้อมูลรายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์ ตามรอบการเสนอขอ
|
||||
const fecthInsigniaByOc = async (
|
||||
roundId: string,
|
||||
ocId: string,
|
||||
|
|
@ -157,20 +156,15 @@ const fecthInsigniaByOc = async (
|
|||
.then(async (res) => {
|
||||
requestNote.value = res.data.result.requestNote;
|
||||
requestStatus.value = res.data.result.requestStatus;
|
||||
await DataStore.fetchData(res.data.result.items);
|
||||
await DataStore.fetchDataInsignia(res.data.result);
|
||||
await DataStore.fetchData(res.data.result.items); // ส่งรายชื่อข้าราชการสามัญฯ
|
||||
await DataStore.fetchDataInsignia(res.data.result); // ส่งข้อมูลรอบบการแสดง
|
||||
loading.value = true;
|
||||
// แสดงปุมล็อกข้อมูล
|
||||
if (res.data.result.items !== null) {
|
||||
if (res.data.result.items.length !== 0) {
|
||||
hideBottom.value = true;
|
||||
} else hideBottom.value = false;
|
||||
}
|
||||
|
||||
// if (res.data.result.items.length !== 0) {
|
||||
// hideBottom.value = true;
|
||||
// }
|
||||
// DataStore.isLock = await res.data.result.isLock;
|
||||
// DataStore.requestId = await res.data.result.requestId;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -180,6 +174,7 @@ const fecthInsigniaByOc = async (
|
|||
});
|
||||
};
|
||||
|
||||
// ส่งรอบการเสนอขอต่อ เฉพาะ รอบที่ requestStatus st1 และ st4
|
||||
const sendToDirector = async () => {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
|
|
@ -203,15 +198,16 @@ const sendToDirector = async () => {
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
const modalPopupBackToEdit = ref<boolean>(false);
|
||||
//แสดง popup แก้ไข
|
||||
const popupBackToEdit = async () => {
|
||||
modalPopupBackToEdit.value = true;
|
||||
};
|
||||
//ปิด popup แก้ไข
|
||||
const closeModalPopupBackToEdit = async () => {
|
||||
modalPopupBackToEdit.value = false;
|
||||
};
|
||||
|
||||
// ตีกลับรอบการเสนอขอ เฉพาะ รอบที่ requestStatus st3 และ insignia2Role
|
||||
const backToEdit = async (reason: string) => {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -246,6 +242,7 @@ const backToEdit = async (reason: string) => {
|
|||
);
|
||||
};
|
||||
|
||||
// อนุมัติรอบการเสนอขอ เฉพาะ รอบที่ requestStatus st3 และ insignia2Role
|
||||
const directorApproved = async () => {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -274,7 +271,7 @@ const directorApproved = async () => {
|
|||
"ต้องการยืนยันการอนุมัติใช่หรือไม่?"
|
||||
);
|
||||
};
|
||||
|
||||
// ล็อกข้อมูลรอบการเสนอขอ
|
||||
const requestSendNote = async () => {
|
||||
var organization = await (DataStore.agency != null
|
||||
? DataStore.agency
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue