Commit 910f8690 authored by “lixuyan”'s avatar “lixuyan”

修改查看pdf

parent 96934f31
...@@ -41,8 +41,7 @@ ...@@ -41,8 +41,7 @@
</template> </template>
<script> <script>
// import { downloadPdfHandle } from '@/api/inventory.js' import { downloadFile } from '@/utils/http'
import axios from 'axios'
export default { export default {
components: {}, components: {},
...@@ -132,37 +131,16 @@ export default { ...@@ -132,37 +131,16 @@ export default {
type: 'error' type: 'error'
}) })
} }
// eslint-disable-next-line no-undef
const baseURl = `${VUE_APP_BASE_API || process.env.VUE_APP_BASE_API}`
const user = 'wcadmin' const user = 'wcadmin'
console.log(row.docsUrl + user) downloadFile(`/gace/mbom/downloadGACEAppData?gaceUrl=${row.docsUrl + user}&docName==${row.docName}`, 'get').then((res) => {
axios({
method: 'get',
url: '/gace/mbom/downloadGACEAppData',
params: {
gaceUrl: row.docsUrl + user,
docName: row.docName
},
baseURL: baseURl,
headers: { token: `${localStorage.getItem('token')}`, 'equipment_id': `${localStorage.getItem('uid')}` },
responseType: 'arraybuffer'
}).then((res) => {
const blob = new Blob([res.data], { const blob = new Blob([res.data], {
type: 'application/pdf' type: 'application/pdf'
}) })
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob) navigator.msSaveBlob(blob)
} else { } else {
// const elink = document.createElement('a')
// elink.download = 'pdf.pdf'
// elink.style.display = 'none'
// elink.href = URL.createObjectURL(blob)
var openUrl = URL.createObjectURL(blob) var openUrl = URL.createObjectURL(blob)
window.open(openUrl) window.open(openUrl)
// obj.document.title = '驱蚊器为切为'
// document.body.appendChild(elink)
// elink.click()
// document.body.removeChild(elink)
} }
}) })
} }
......
...@@ -868,10 +868,13 @@ export default { ...@@ -868,10 +868,13 @@ export default {
if (curRow) { if (curRow) {
that.selectOptions(curRow.id) that.selectOptions(curRow.id)
} else { } else {
!that.procedureId && if (that.procedureId) {
that.selectOptions(that.procedureId)
} else {
that.selectOptions(that.workingProcedure[0].id) that.selectOptions(that.workingProcedure[0].id)
} }
} }
}
}) })
.catch((err) => console.error(err)) .catch((err) => console.error(err))
.finally(() => { .finally(() => {
......
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