Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop

This commit is contained in:
Warunee Tamkoo 2023-09-01 15:18:22 +07:00
commit e312462f80
4 changed files with 44 additions and 16 deletions

View file

@ -71,6 +71,7 @@ export default {
insigniaManageOrgAdd: () => `${insignia}/manage/org`,
insigniaManageOrgDashboard: (insigniaManageId: string) =>
`${insignia}/manage/org/dashboard/${insigniaManageId}`,
insigniaDowanload: (id: string) => `${insignia}/request/download/excel/${id}`,
// ยืม-คืนเครื่องราชฯ
insigniaManageBorrow: () => `${insignia}/manage/borrow`,

View file

@ -352,26 +352,47 @@ const downloadFile = (response: any, filename: string) => {
link.click();
document.body.removeChild(link);
};
const downloadReport = async (type: string = "pdf") => {
const downloadFileexcel = async () => {
showLoader();
await http
.get(config.API.reportInsignia("45", type, props.roundId!), {
.get(config.API.insigniaDowanload(DataStore.requestId), {
responseType: "blob",
})
.then(async (res) => {
downloadFile(
await downloadFile(
res,
`บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา ${props.roundName}.${type}`
`รายชื่อข้าราชการสามัญฯ ${props.roundName}.xlsx`
);
})
.catch((e) => {
messageError($q, e);
.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(
@ -503,7 +524,6 @@ const fecthInsignia = async () => {
messageError($q, e);
});
};
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
};
@ -603,10 +623,17 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
/>
</div>
<div>
<q-btn size="md" icon="mdi-download" flat round color="primary">
<q-btn
size="md"
icon="mdi-download"
flat
round
color="primary"
@click="downloadFileexcel"
>
<!-- @click="downloadReport('pdf')" -->
<q-tooltip>ดาวนโหลด</q-tooltip>
<q-menu>
<!-- <q-menu>
<q-list style="min-width: 150px">
<q-item clickable v-close-popup @click="downloadReport('pdf')">
<q-item-section avatar
@ -627,7 +654,7 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
<q-item-section>ไฟล .xlsx</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-menu> -->
</q-btn>
<q-btn
size="12px"

View file

@ -154,11 +154,11 @@ const fecthInsigniaByOc = async (
await http
.get(config.API.insigniaList(roundId, ocId, role, status))
.then(async (res) => {
console.log(res);
requestNote.value = res.data.result.requestNote;
requestStatus.value = res.data.result.requestStatus;
await DataStore.fetchData(res.data.result.items);
DataStore.isLock = await res.data.result.isLock;
DataStore.requestId = await res.data.result.requestId;
})
.catch((err) => {
messageError($q, err);
@ -310,7 +310,7 @@ const requestSendNote = async () => {
<q-space />
<!-- สกจ. Freez อม -->
<q-btn
v-if="roleUser == 'admin'"
v-if="roleUser == 'admin' && DataStore.isLock !== true"
dense
unelevated
label="ล็อกข้อมูล"

View file

@ -7,6 +7,7 @@ const { date2Thai } = mixin;
export const useInsigniaDataStore = defineStore("insignia", () => {
const isLock = ref<boolean>(false)
const requestId = ref<string>("")
let optionsTypeOc = ref<any>([]);
let typeOc = ref<string>("");
const agency = ref<string>("");
@ -26,8 +27,6 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
};
const fetchData = async (data: any) => {
console.log(data);
if (data !== null) {
let datalist = await data.map((e: any) => ({
id: e.id,
@ -129,6 +128,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
selectEmployeeClass,
employeeClass,
employeeClassOps,
isLock
isLock,
requestId
};
});