Commit 4bd9bc9d authored by jiaxu.yan's avatar jiaxu.yan

feat: 检查报告

parent c98a7cad
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
type="primary" type="primary"
plain plain
size="mini" size="mini"
@click="goNext(item.id)" @click="downloadPdf(item.id)"
>检查报告</el-button >检查报告</el-button
> >
<el-button <el-button
...@@ -249,6 +249,7 @@ ...@@ -249,6 +249,7 @@
</template> </template>
<script> <script>
import page from '@/mixins/page' import page from '@/mixins/page'
import { pdfDownload } from '@/api/task/task'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
dicts: ['sys_scene_type', 'task_type', 'inspection_item'], dicts: ['sys_scene_type', 'task_type', 'inspection_item'],
...@@ -270,6 +271,47 @@ export default { ...@@ -270,6 +271,47 @@ export default {
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
methods: { methods: {
/**
* 检验报告
*/
downloadPdf(id) {
pdfDownload({
taskId: id,
type: 0
}).then(res => {
const fileUrl =
process.env.VUE_APP_IMAGE_API +
'/vehicle-quality-review-oss/' +
res.data
this.download(fileUrl)
})
},
/**
* 下载pdf
*/
download(fileUrl) {
// 根据pdf文件地址下载
// window.location.href = this.fileUrl
const xhr = new XMLHttpRequest()
xhr.open('GET', fileUrl, true)
xhr.responseType = 'blob'
xhr.onload = () => {
if (xhr.status === 200) {
const blob = new Blob([xhr.response], { type: 'application/pdf' })
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '检查报告.pdf'
link.click()
URL.revokeObjectURL(url)
}
}
xhr.send()
},
/* 跳转到问卷详情*/ /* 跳转到问卷详情*/
goNext(url) { goNext(url) {
this.$router.push({ path: url }) this.$router.push({ path: url })
......
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
type="primary" type="primary"
plain plain
size="mini" size="mini"
@click="goNext(item.id)" @click="downloadPdf(item.id)"
>检查报告</el-button >检查报告</el-button
> >
<el-button <el-button
...@@ -220,6 +220,7 @@ ...@@ -220,6 +220,7 @@
<script> <script>
import page from '@/mixins/page' import page from '@/mixins/page'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { pdfDownload } from '@/api/task/task'
export default { export default {
mixins: [page], mixins: [page],
dicts: ['inspection_item'], dicts: ['inspection_item'],
...@@ -237,6 +238,47 @@ export default { ...@@ -237,6 +238,47 @@ export default {
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
methods: { methods: {
/**
* 检验报告
*/
downloadPdf(id) {
pdfDownload({
taskId: id,
type: 0
}).then(res => {
const fileUrl =
process.env.VUE_APP_IMAGE_API +
'/vehicle-quality-review-oss/' +
res.data
this.download(fileUrl)
})
},
/**
* 下载pdf
*/
download(fileUrl) {
// 根据pdf文件地址下载
// window.location.href = this.fileUrl
const xhr = new XMLHttpRequest()
xhr.open('GET', fileUrl, true)
xhr.responseType = 'blob'
xhr.onload = () => {
if (xhr.status === 200) {
const blob = new Blob([xhr.response], { type: 'application/pdf' })
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '检查报告.pdf'
link.click()
URL.revokeObjectURL(url)
}
}
xhr.send()
},
/* 跳转到问卷详情*/ /* 跳转到问卷详情*/
goNext(url) { goNext(url) {
this.$router.push({ path: url }) this.$router.push({ path: url })
......
...@@ -448,7 +448,7 @@ ...@@ -448,7 +448,7 @@
type="primary" type="primary"
plain plain
size="mini" size="mini"
@click="goNext(item.id)" @click="downloadPdf(item.id)"
>检查报告</el-button >检查报告</el-button
> >
<el-button <el-button
...@@ -486,11 +486,7 @@ ...@@ -486,11 +486,7 @@
import page from '@/mixins/page' import page from '@/mixins/page'
import { getHourDiff } from '@/utils/diff' import { getHourDiff } from '@/utils/diff'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { import { reviewTaskStart, pdfDownload, removeTask } from '@/api/task/task'
reviewTaskStart,
reviewCarTaskStart,
removeTask
} from '@/api/task/task'
import request from '@/utils/request' import request from '@/utils/request'
export default { export default {
dicts: [ dicts: [
...@@ -545,6 +541,47 @@ export default { ...@@ -545,6 +541,47 @@ export default {
this.$store.dispatch('standard/setStandardList') this.$store.dispatch('standard/setStandardList')
}, },
methods: { methods: {
/**
* 检验报告
*/
downloadPdf(id) {
pdfDownload({
taskId: id,
type: 0
}).then(res => {
const fileUrl =
process.env.VUE_APP_IMAGE_API +
'/vehicle-quality-review-oss/' +
res.data
this.download(fileUrl)
})
},
/**
* 下载pdf
*/
download(fileUrl) {
// 根据pdf文件地址下载
// window.location.href = this.fileUrl
const xhr = new XMLHttpRequest()
xhr.open('GET', fileUrl, true)
xhr.responseType = 'blob'
xhr.onload = () => {
if (xhr.status === 200) {
const blob = new Blob([xhr.response], { type: 'application/pdf' })
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '检查报告.pdf'
link.click()
URL.revokeObjectURL(url)
}
}
xhr.send()
},
loadData() { loadData() {
this.loading = true this.loading = true
if (this.active === '0') { if (this.active === '0') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment