download file ทดลองงาน
This commit is contained in:
parent
c63539190d
commit
c014962eed
8 changed files with 85 additions and 77 deletions
|
|
@ -36,7 +36,7 @@ export default {
|
||||||
reportEvaluateChairman: (type: string, id: string) =>
|
reportEvaluateChairman: (type: string, id: string) =>
|
||||||
`${reportProbation}/17/${type}/${id}`,
|
`${reportProbation}/17/${type}/${id}`,
|
||||||
reportEvaluateResult: (type: string, id: string) =>
|
reportEvaluateResult: (type: string, id: string) =>
|
||||||
`${reportProbation}/19/${type}/${id}`,
|
`${reportProbation}/18/${type}/${id}`,
|
||||||
// reportSurvey:(type:string, id:string) => `${reportProbation}/19/${type}/${id}`,
|
// reportSurvey:(type:string, id:string) => `${reportProbation}/19/${type}/${id}`,
|
||||||
|
|
||||||
//filetransfer
|
//filetransfer
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
import genReport from "@/plugins/genreport";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const isEdit = ref<boolean>(true);
|
const isEdit = ref<boolean>(true);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -917,21 +919,21 @@ function downloadFile(response: any, filename: string) {
|
||||||
async function clickdownloadFile(type: string) {
|
async function clickdownloadFile(type: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.reportAssign(type, assignId.value), {
|
.get(config.API.reportAssign(type, assignId.value))
|
||||||
responseType: "blob",
|
.then(async (res) => {
|
||||||
})
|
const data = res.data.result;
|
||||||
.then((res) => {
|
await genReport(
|
||||||
downloadFile(
|
data,
|
||||||
res,
|
`แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-${fullname.value}`,
|
||||||
`แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-${fullname.value}.${type}`
|
type
|
||||||
);
|
);
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch(async (e) => {
|
.catch(async (e) => {
|
||||||
messageError($q, JSON.parse(await e.response.data.text()));
|
messageError($q, JSON.parse(await e.response.data.text()));
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
})
|
||||||
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** เช็ค จำนวนเดือน เเละ วันที่เริ่ม ไม่เท่ากับ undefined*/
|
/** เช็ค จำนวนเดือน เเละ วันที่เริ่ม ไม่เท่ากับ undefined*/
|
||||||
|
|
@ -1088,7 +1090,7 @@ onMounted(async () => {
|
||||||
<div v-else class="col-12 row q-gutter-md">
|
<div v-else class="col-12 row q-gutter-md">
|
||||||
<div>แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ</div>
|
<div>แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ</div>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="!isEdit && !checkRoutePermisson"
|
v-if="!isEdit"
|
||||||
size="12px"
|
size="12px"
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ const {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");
|
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");
|
||||||
const assignId = ref<string>(route.params.form.toString());
|
const assignId = ref<string>(route.params.form.toString());
|
||||||
const { assign } = probationStore;
|
const { fecthAssignoutput,assign } = probationStore;
|
||||||
const Autherise = ref<any>(null);
|
const Autherise = ref<any>(null);
|
||||||
const dateAutherise = ref<any>(new Date());
|
const dateAutherise = ref<any>(new Date());
|
||||||
const option = ref<any>([]);
|
const option = ref<any>([]);
|
||||||
|
|
@ -106,6 +106,7 @@ async function fecthAssign() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.evaluateCreate(assignId.value))
|
.get(config.API.evaluateCreate(assignId.value))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
|
await fecthAssignoutput(res.data.data);
|
||||||
// if (props.action == "add") {
|
// if (props.action == "add") {
|
||||||
person.value = res.data.data.person;
|
person.value = res.data.data.person;
|
||||||
// option.value.push(res.data.data.commander);
|
// option.value.push(res.data.data.commander);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const router = useRouter();
|
||||||
const routeName = router.currentRoute.value.name;
|
const routeName = router.currentRoute.value.name;
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const probationStore = useProbationDataStore();
|
const probationStore = useProbationDataStore();
|
||||||
const { assign } = probationStore;
|
const { fecthAssignoutput, assign } = probationStore;
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const {
|
const {
|
||||||
date2Thai,
|
date2Thai,
|
||||||
|
|
@ -218,6 +218,7 @@ async function fecthAssign() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.evaluateChairman(assignId.value))
|
.get(config.API.evaluateChairman(assignId.value))
|
||||||
.then(async (res: any) => {
|
.then(async (res: any) => {
|
||||||
|
await fecthAssignoutput(res.data.data);
|
||||||
assign.value = res.data.data.assign;
|
assign.value = res.data.data.assign;
|
||||||
evaluate_no.value = res.data.data.evaluate_no;
|
evaluate_no.value = res.data.data.evaluate_no;
|
||||||
start_date.value = res.data.data.start_date;
|
start_date.value = res.data.data.start_date;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import { useRoute, useRouter } from "vue-router";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
||||||
|
import genReport from "@/plugins/genreport";
|
||||||
|
|
||||||
const probationStore = useProbationDataStore();
|
const probationStore = useProbationDataStore();
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -156,21 +158,21 @@ function downloadFile(response: any, filename: string) {
|
||||||
async function clickdownloadFile(type: string) {
|
async function clickdownloadFile(type: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.reportEvaluateResult(type, assignId.value), {
|
.get(config.API.reportEvaluateResult(type, assignId.value))
|
||||||
responseType: "blob",
|
.then(async (res) => {
|
||||||
})
|
const data = res.data.result;
|
||||||
.then((res) => {
|
await genReport(
|
||||||
downloadFile(
|
data,
|
||||||
res,
|
`แบบรายงานการประเมินฯ_${person.value.name}.${type}`,
|
||||||
`แบบรายงานการประเมินฯ_${probationStore.person.name}.${type}`
|
type
|
||||||
);
|
);
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch(async (e) => {
|
.catch(async (e) => {
|
||||||
messageError($q, JSON.parse(await e.response.data.text()));
|
messageError($q, JSON.parse(await e.response.data.text()));
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
})
|
||||||
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** post/put data
|
/** post/put data
|
||||||
|
|
@ -717,7 +719,10 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
</q-form>
|
</q-form>
|
||||||
|
|
||||||
<q-toolbar class="text-primary" v-if="action == 'add' && !checkRoutePermisson">
|
<q-toolbar
|
||||||
|
class="text-primary"
|
||||||
|
v-if="action == 'add' && !checkRoutePermisson"
|
||||||
|
>
|
||||||
<q-space />
|
<q-space />
|
||||||
<q-btn label="บันทึก" color="secondary" @click="savaForm" />
|
<q-btn label="บันทึก" color="secondary" @click="savaForm" />
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { useRoute, useRouter } from "vue-router";
|
||||||
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
import genReport from "@/plugins/genreport";
|
||||||
|
|
||||||
const Header = defineAsyncComponent(
|
const Header = defineAsyncComponent(
|
||||||
() =>
|
() =>
|
||||||
|
|
@ -63,17 +64,6 @@ function changeTab(tabVal: string) {
|
||||||
dataArrayNumber.value = Number(tabVal.charAt(4));
|
dataArrayNumber.value = Number(tabVal.charAt(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** convert file */
|
|
||||||
function downloadFile(response: any, filename: string) {
|
|
||||||
const link = document.createElement("a");
|
|
||||||
var fileName = filename;
|
|
||||||
link.href = window.URL.createObjectURL(new Blob([response.data]));
|
|
||||||
link.setAttribute("download", fileName);
|
|
||||||
document.body.appendChild(link);
|
|
||||||
link.click();
|
|
||||||
document.body.removeChild(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** download file */
|
/** download file */
|
||||||
async function FileDownload(type: string) {
|
async function FileDownload(type: string) {
|
||||||
let numTab = probationStore.evaluate.find(
|
let numTab = probationStore.evaluate.find(
|
||||||
|
|
@ -83,40 +73,40 @@ async function FileDownload(type: string) {
|
||||||
if (dataRole.value == "mentor") {
|
if (dataRole.value == "mentor") {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.reportEvaluateRecord1(type, numTab.id), {
|
.get(config.API.reportEvaluateRecord1(type, numTab.id))
|
||||||
responseType: "blob",
|
|
||||||
})
|
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
downloadFile(
|
const data = res.data.result;
|
||||||
res,
|
await genReport(
|
||||||
`แบบบันทึกผล(ผู้ดูเเล)_${probationStore.person.name}_ครั้งที่${numTab.no}.${type}`
|
data,
|
||||||
|
`แบบบันทึกผล(ผู้ดูเเล)_${probationStore.person.name}_ครั้งที่${numTab.no}`,
|
||||||
|
type
|
||||||
);
|
);
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch(async (e) => {
|
.catch(async (e) => {
|
||||||
messageError($q, JSON.parse(await e.response.data.text()));
|
messageError($q, JSON.parse(await e.response.data.text()));
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
})
|
||||||
|
.finally(() => {});
|
||||||
} else {
|
} else {
|
||||||
//ผุ้บังคับ
|
//ผุ้บังคับ
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.reportEvaluateRecord1(type, numTab.id), {
|
.get(config.API.reportEvaluateRecord1(type, numTab.id))
|
||||||
responseType: "blob",
|
|
||||||
})
|
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
downloadFile(
|
const data = res.data.result;
|
||||||
res,
|
await genReport(
|
||||||
`แบบบันทึกผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}.${type}`
|
data,
|
||||||
|
`แบบบันทึกผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}`,
|
||||||
|
type
|
||||||
);
|
);
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch(async (e) => {
|
.catch(async (e) => {
|
||||||
messageError($q, JSON.parse(await e.response.data.text()));
|
messageError($q, JSON.parse(await e.response.data.text()));
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
})
|
||||||
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,7 +157,7 @@ onMounted(async () => {
|
||||||
<div class="q-gutter-md" v-else-if="probationStore.tabs.length == 0">
|
<div class="q-gutter-md" v-else-if="probationStore.tabs.length == 0">
|
||||||
<div class="flex justify-center items-center q-my-md q-gutter-md">
|
<div class="flex justify-center items-center q-my-md q-gutter-md">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="!checkRoutePermisson"
|
v-if="!checkRoutePermisson"
|
||||||
outline
|
outline
|
||||||
color="primary"
|
color="primary"
|
||||||
label="สร้างแบบบันทึกผล"
|
label="สร้างแบบบันทึกผล"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
import genReport from "@/plugins/genreport";
|
||||||
|
|
||||||
const Header = defineAsyncComponent(
|
const Header = defineAsyncComponent(
|
||||||
() =>
|
() =>
|
||||||
import(
|
import(
|
||||||
|
|
@ -87,39 +89,42 @@ async function FileDownload(type: string) {
|
||||||
if (dataRole.value == "mentor") {
|
if (dataRole.value == "mentor") {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.reportEvaluateRecord1(type, numTab.id), {
|
.get(config.API.reportEvaluateRecord1(type, numTab.id))
|
||||||
responseType: "blob",
|
|
||||||
})
|
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
downloadFile(
|
const data = res.data.result;
|
||||||
res,
|
await genReport(
|
||||||
`แบบบันทึกผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}.${type}`
|
data,
|
||||||
|
`แบบบันทึกผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}`,
|
||||||
|
type
|
||||||
);
|
);
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch(async (e) => {
|
.catch(async (e) => {
|
||||||
messageError($q, JSON.parse(await e.response.data.text()));
|
messageError($q, JSON.parse(await e.response.data.text()));
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//ผุ้บังคับ
|
//ผุ้บังคับ
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.reportEvaluateRecord1(type, numTab.id), {
|
.get(config.API.reportEvaluateRecord1(type, numTab.id))
|
||||||
responseType: "blob",
|
|
||||||
})
|
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
downloadFile(
|
const data = res.data.result;
|
||||||
res,
|
await genReport(
|
||||||
`แบบบันทึกผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}.${type}`
|
data,
|
||||||
|
`แบบบันทึกผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}`,
|
||||||
|
type
|
||||||
);
|
);
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch(async (e) => {
|
.catch(async (e) => {
|
||||||
messageError($q, JSON.parse(await e.response.data.text()));
|
messageError($q, JSON.parse(await e.response.data.text()));
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import { useRoute, useRouter } from "vue-router";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
||||||
|
|
||||||
|
import genReport from "@/plugins/genreport";
|
||||||
|
|
||||||
const Header = defineAsyncComponent(
|
const Header = defineAsyncComponent(
|
||||||
() =>
|
() =>
|
||||||
import(
|
import(
|
||||||
|
|
@ -86,20 +88,22 @@ async function FileDownload(type: string) {
|
||||||
let numTab = evaluate.value.find((e: any) => e.no === dataArrayNumber.value);
|
let numTab = evaluate.value.find((e: any) => e.no === dataArrayNumber.value);
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.reportEvaluate(type, numTab.id), {
|
.get(config.API.reportEvaluate(type, numTab.id))
|
||||||
responseType: "blob",
|
|
||||||
})
|
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
downloadFile(
|
const data = res.data.result;
|
||||||
res,
|
await genReport(
|
||||||
`แบบประเมินผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}.${type}`
|
data,
|
||||||
|
`แบบประเมินผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}`,
|
||||||
|
type
|
||||||
);
|
);
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch(async (e) => {
|
.catch(async (e) => {
|
||||||
messageError($q, JSON.parse(await e.response.data.text()));
|
messageError($q, JSON.parse(await e.response.data.text()));
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue