New file |
| | |
| | | import axios from "@/assets/axios"; |
| | | |
| | | /** |
| | | * 文件下载 |
| | | * @returns |
| | | */ |
| | | export const downLoadFileByFilePath = (filePath) => { |
| | | return axios({ |
| | | method: "GET", |
| | | url: "bomFeedbak/downLoadFileByFilePath", |
| | | params: { filePath }, |
| | | responseType: "blob" |
| | | }) |
| | | } |
| | |
| | | import getWebUrl from "@/assets/js/tools/getWebUrl"; |
| | | import { dwgReview } from "@/pages/workplace/apis"; |
| | | import { downloadLog } from "@/pages/system/logs/apis"; |
| | | import { downLoadFileByFilePath } from "@/assets/js/apis"; |
| | | import { updateAttachLock } from "@/pages/resourceManage/materialsCenter/apis"; |
| | | import { updateProductLock } from "@/pages/resourceManage/product/details/apis"; |
| | | import checkPermit from "@/assets/js/tools/checkPermit"; |
| | |
| | | }, |
| | | downloadLog(record) { |
| | | const { parentModel, subModel, url } = record; |
| | | const url1 = this.webUrl + url; |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url1; |
| | | // link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | downloadLog(parentModel, subModel); |
| | | let reg = /(.*\\+)*(.*)$/; |
| | | let fileName = url.match(reg)[2]; |
| | | downLoadFileByFilePath(url).then((res) => { |
| | | let { data, status } = res; |
| | | if (200 == status && data) { |
| | | let url = window.URL.createObjectURL(data); |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | window.URL.revokeObjectURL(url); |
| | | downloadLog(parentModel, subModel); |
| | | } else { |
| | | this.$message.error("下载失败"); |
| | | } |
| | | }); |
| | | }, |
| | | lock(obj) { |
| | | this.currObj = obj; |
| | |
| | | <a-col :span="6" class="label">相关附件</a-col> |
| | | <a-col :span="18"> |
| | | <div class="content"> |
| | | <a-button v-if="FkData.file && viewable" class="btn" type="primary" @click="view">预览</a-button> |
| | | <a-button v-if="FkData.file" class="btn" @click="download">下载</a-button> |
| | | <a-button |
| | | v-if="FkData.file && viewable" |
| | | class="btn" |
| | | type="primary" |
| | | @click="view" |
| | | >预览</a-button |
| | | > |
| | | <a-button v-if="FkData.file" class="btn" @click="download" |
| | | >下载</a-button |
| | | > |
| | | <span v-else>无</span> |
| | | </div> |
| | | </a-col> |
| | |
| | | <script> |
| | | import getWebUrl from "@/assets/js/tools/getWebUrl"; |
| | | import { dwgReview } from "@/pages/workplace/apis"; |
| | | import { downLoadFileByFilePath } from "@/assets/js/apis"; |
| | | |
| | | export default { |
| | | name: "", |
| | | props: { |
| | |
| | | gutter: 16, |
| | | webUrl: getWebUrl(), |
| | | previewVisible: false, |
| | | imgUrl: '', |
| | | imgUrl: "", |
| | | }; |
| | | }, |
| | | components: {}, |
| | |
| | | }); |
| | | }, |
| | | download() { |
| | | const url = this.webUrl + this.FkData.file; |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | // link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | let reg = /(.*\\+)*(.*)$/; |
| | | let fileName = this.FkData.file.match(reg)[2]; |
| | | |
| | | downLoadFileByFilePath(this.FkData.file).then((res) => { |
| | | let { headers, data, status } = res; |
| | | if (200 == status && data) { |
| | | let url = window.URL.createObjectURL(data); |
| | | // const matchRes = /filename=(.*)/.exec(headers["content-disposition"]); |
| | | // const fileName = matchRes ? matchRes[1].trim() : "未知文件名.zip"; |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | window.URL.revokeObjectURL(url); |
| | | } else { |
| | | this.$message.error("下载失败"); |
| | | } |
| | | }); |
| | | }, |
| | | handleCancel() { |
| | | this.previewVisible = false; |
| | |
| | | import { dwgReview } from "@/pages/workplace/apis"; |
| | | import { getInfo, getHistory } from "./apis"; |
| | | import { downloadLog } from "@/pages/system/logs/apis"; |
| | | import { downLoadFileByFilePath } from "@/assets/js/apis"; |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | name: "", |
| | |
| | | }, |
| | | downloadLog(record) { |
| | | const { parentModel, subModel, dwgUrl } = record; |
| | | const url = this.webUrl + dwgUrl; |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | // link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | downloadLog(parentModel, subModel); |
| | | let reg = /(.*\\+)*(.*)$/; |
| | | let fileName = dwgUrl.match(reg)[2]; |
| | | |
| | | downLoadFileByFilePath(dwgUrl).then((res) => { |
| | | let { data, status } = res; |
| | | if (200 == status && data) { |
| | | let url = window.URL.createObjectURL(data); |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | window.URL.revokeObjectURL(url); |
| | | |
| | | downloadLog(parentModel, subModel); |
| | | } else { |
| | | this.$message.error("下载失败"); |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | | |
| | |
| | | import EditLink from "./editLink"; |
| | | import SubmitForm from "./SubmitForm"; |
| | | import FilesTable from "@/pages/components/filesTable"; |
| | | import { downLoadFileByFilePath } from "@/assets/js/apis"; |
| | | |
| | | import getWebUrl from "@/assets/js/tools/getWebUrl"; |
| | | import { |
| | |
| | | downloadLog(record) { |
| | | const { parentModel, subModel, dwgUrl } = record; |
| | | const url = this.webUrl + dwgUrl; |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | // link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | downloadLog(parentModel, subModel); |
| | | let reg = /(.*\\+)*(.*)$/; |
| | | let fileName = dwgUrl.match(reg)[2]; |
| | | |
| | | downLoadFileByFilePath(dwgUrl).then((res) => { |
| | | let { data, status } = res; |
| | | if (200 == status && data) { |
| | | let url = window.URL.createObjectURL(data); |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | window.URL.revokeObjectURL(url); |
| | | |
| | | downloadLog(parentModel, subModel); |
| | | } else { |
| | | this.$message.error("下载失败"); |
| | | } |
| | | }); |
| | | }, |
| | | activeFN() { |
| | | this.resize(); |
| | |
| | | import { setpHistoryEnable, getLockedList, getLogList } from "../apis"; |
| | | import { dwgReview } from "@/pages/workplace/apis"; |
| | | import { downloadLog } from "@/pages/system/logs/apis"; |
| | | import { downLoadFileByFilePath } from "@/assets/js/apis"; |
| | | import { mapGetters } from "vuex"; |
| | | import createWs from "@/assets/js/websocket"; |
| | | |
| | |
| | | downloadLog(record) { |
| | | const { parentCode, subModel, dwgUrl, fileUrl: softwareUrl } = record; |
| | | const url = softwareUrl |
| | | ? this.webUrl + softwareUrl |
| | | : this.webUrl + dwgUrl; |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | // link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | downloadLog(parentCode, subModel); |
| | | ? softwareUrl |
| | | : dwgUrl; |
| | | let reg = /(.*\\+)*(.*)$/; |
| | | let fileName = url.match(reg)[2]; |
| | | |
| | | downLoadFileByFilePath(url).then((res) => { |
| | | let { data, status } = res; |
| | | if (200 == status && data) { |
| | | let url = window.URL.createObjectURL(data); |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | window.URL.revokeObjectURL(url); |
| | | |
| | | downloadLog(parentCode, subModel); |
| | | } else { |
| | | this.$message.error("下载失败"); |
| | | } |
| | | }); |
| | | }, |
| | | // action 检查后要执行的动作 |
| | | checkLock(action) { |