fix PDF = undefined

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-21 09:30:54 +07:00
parent 4d4a95c2b9
commit 4f0eecfffe
15 changed files with 24 additions and 2 deletions

View file

@ -70,6 +70,8 @@ async function getReportRecruit() {
* @param data อมลบญชนลา * @param data อมลบญชนลา
*/ */
async function genReport(data: any) { async function genReport(data: any) {
pdfSrc.value = undefined;
page.value = 1;
await axios await axios
.post(`${config.API.reportTemplate}/xlsx`, data, { .post(`${config.API.reportTemplate}/xlsx`, data, {
headers: { headers: {

View file

@ -101,6 +101,7 @@ function fetchDataReport() {
} }
isLoadPDF.value = true; isLoadPDF.value = true;
pdfSrc.value = undefined; pdfSrc.value = undefined;
page.value = 1;
const queryParams = { const queryParams = {
nodeId: nodeId:
reportType.value.type === "probation" && reportType.value.id === "2" reportType.value.type === "probation" && reportType.value.id === "2"

View file

@ -142,6 +142,8 @@ function fetchDataReport() {
* @param data อมลบญชนลา * @param data อมลบญชนลา
*/ */
async function fetchDocumentTemplate(data: any) { async function fetchDocumentTemplate(data: any) {
pdfSrc.value = undefined;
page.value = 1;
await axios await axios
.post(`${config.API.reportTemplate}/xlsx`, data, { .post(`${config.API.reportTemplate}/xlsx`, data, {
headers: { headers: {

View file

@ -256,6 +256,8 @@ async function onUpdateFilter() {
* @param data อมลบญชนลา * @param data อมลบญชนลา
*/ */
async function fetchDocumentTemplate(data: any, type: string = "docx") { async function fetchDocumentTemplate(data: any, type: string = "docx") {
pdfSrc.value = undefined;
page.value = 1;
await axios await axios
.post(`${config.API.reportTemplate}/${type}`, data, { .post(`${config.API.reportTemplate}/${type}`, data, {
headers: { headers: {

View file

@ -127,6 +127,7 @@ async function updateLeaveday() {
isReport.value = false; isReport.value = false;
isLoadPDF.value = true; isLoadPDF.value = true;
pdfSrc.value = undefined; pdfSrc.value = undefined;
page.value = 1;
// fetchLeaveday // fetchLeaveday
fetchLeaveday( fetchLeaveday(

View file

@ -108,6 +108,7 @@ async function updateFilterType(type: string) {
isReport.value = false; isReport.value = false;
isLoadPDF.value = true; isLoadPDF.value = true;
pdfSrc.value = undefined; pdfSrc.value = undefined;
page.value = 1;
switch (type) { switch (type) {
case "DAY": case "DAY":
body = { body = {

View file

@ -121,6 +121,7 @@ function onSelectedNode(id: string, level: number) {
async function onUpdateFilter() { async function onUpdateFilter() {
isLoadPDF.value = true; isLoadPDF.value = true;
pdfSrc.value = undefined; pdfSrc.value = undefined;
page.value = 1;
if (nodeId) { if (nodeId) {
const body = { const body = {
nodeId: nodeId.value, nodeId: nodeId.value,

View file

@ -195,6 +195,8 @@ function fetchReport() {
* @param data อมลบญชนลา * @param data อมลบญชนลา
*/ */
function genPDf(data: ResReport) { function genPDf(data: ResReport) {
pdfSrc.value = undefined;
page.value = 1;
showLoader(); showLoader();
axios axios
.post(config.API.reportTemplate + `/docx`, data, { .post(config.API.reportTemplate + `/docx`, data, {
@ -429,7 +431,7 @@ function onCloseModal() {
* function fetch รายชอขอมลทะเบยนประว * function fetch รายชอขอมลทะเบยนประว
*/ */
function fetchListPerson() { function fetchListPerson() {
rowsPerson.value = [] rowsPerson.value = [];
showLoader(); showLoader();
let queryParams = { let queryParams = {
page: formFilter.page, page: formFilter.page,

View file

@ -114,6 +114,8 @@ async function fetchDataCommand(type: string) {
/** ฟังชั่นกำหนดค่าของ PDF*/ /** ฟังชั่นกำหนดค่าของ PDF*/
async function fetchPDF(data: any, type: string = "docx?folder=command") { async function fetchPDF(data: any, type: string = "docx?folder=command") {
isLoadView.value = false; isLoadView.value = false;
pdfSrc.value = undefined;
page.value = 1;
axios axios
.get(data.downloadUrl, { .get(data.downloadUrl, {
method: "GET", method: "GET",
@ -155,6 +157,7 @@ watch(
} else { } else {
tab.value = "main"; tab.value = "main";
pdfSrc.value = undefined; pdfSrc.value = undefined;
page.value = 1;
} }
} }
); );

View file

@ -61,6 +61,8 @@ async function fetchDataCommand(type: string) {
/** ฟังชั่นกำหนดค่าของ PDF*/ /** ฟังชั่นกำหนดค่าของ PDF*/
async function fetchPDF(data: any, type: string = "docx?folder=command") { async function fetchPDF(data: any, type: string = "docx?folder=command") {
isLoadView.value = false; isLoadView.value = false;
pdfSrc.value = undefined;
page.value = 1;
await axios await axios
.post(config.API.reportTemplate + `/${type}`, data, { .post(config.API.reportTemplate + `/${type}`, data, {
headers: { headers: {

View file

@ -74,6 +74,7 @@ async function fetchPDF(type: string = "docx") {
function onClose() { function onClose() {
modal.value = false; modal.value = false;
pdfSrc.value = undefined; pdfSrc.value = undefined;
page.value = 1
} }
watch(modal, () => { watch(modal, () => {

View file

@ -63,6 +63,7 @@ watch(modal, (val) => {
fetchPDF(dataFile.value.downloadUrl, dataFile.value.fileType); fetchPDF(dataFile.value.downloadUrl, dataFile.value.fileType);
} else { } else {
pdfSrc.value = undefined; pdfSrc.value = undefined;
page.value = 1;
numOfPages.value = 0; numOfPages.value = 0;
} }
}); });

View file

@ -79,7 +79,7 @@ async function getReport(list: string) {
)?.val; )?.val;
const newReport = listFind === "report2" ? "report2-history" : listFind; const newReport = listFind === "report2" ? "report2-history" : listFind;
pdfSrc.value = undefined; pdfSrc.value = undefined;
numOfPages.value = 1; page.value = 1;
isLoadPDF.value = true; isLoadPDF.value = true;
if (newReport) { if (newReport) {
await http await http

View file

@ -86,6 +86,7 @@ async function getReport() {
) { ) {
loadingBtn.value = true; loadingBtn.value = true;
pdfSrc.value = undefined; pdfSrc.value = undefined;
page.value = 1;
await http await http
.get( .get(
config.API.developmentReport() + config.API.developmentReport() +

View file

@ -71,6 +71,8 @@ async function fetchReport() {
* @param data อมลบญชนลา * @param data อมลบญชนลา
*/ */
async function fetchDocumentTemplate(data: any) { async function fetchDocumentTemplate(data: any) {
pdfSrc.value = undefined;
page.value = 1;
await axios await axios
.post(`${config.API.reportTemplate}/xlsx`, data, { .post(`${config.API.reportTemplate}/xlsx`, data, {
headers: { headers: {