เเก้ฟิล เพิ่ม api ไฟล์

This commit is contained in:
setthawutttty 2023-12-15 13:48:42 +07:00
parent 339c7d2c10
commit 68e78403ca
5 changed files with 94 additions and 21 deletions

View file

@ -3,6 +3,7 @@ import { ref, onMounted, reactive } from "vue";
import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import genReport from "@/plugins/genreport";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QForm } from "quasar";
@ -54,7 +55,6 @@ function getData() {
http
.get(config.API.appealByID(id.value))
.then((res) => {
console.log(res);
const dataList = res.data.result;
data.id = dataList.id;
data.title = dataList.title;
@ -80,6 +80,23 @@ function getData() {
});
}
async function getReport(fileName: string) {
showLoader();
await http
.get(config.API.appealByPrintReport(id.value))
.then(async (res) => {
console.log(res.data.result.data);
const data = res.data.result
await genReport(data, fileName);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
getData();
});
@ -101,7 +118,7 @@ onMounted(() => {
/>
แกไขอทธรณ/องทกข
</div>
<Form :data="data" />
<Form :data="data" :get-report="getReport" />
</div>
</div>
</template>