| | |
| | | <div @click="addAnnexClick"> |
| | | <el-upload |
| | | class="upload-demo" |
| | | action="https://jsonplaceholder.typicode.com/posts/" |
| | | :headers="headers" |
| | | action="" |
| | | :limit="1" |
| | | :before-upload="beforeAvatarUpload" |
| | | :on-exceed="handleExceed" |
| | |
| | | createContract, |
| | | updateSupplier, |
| | | getIndustryList, |
| | | getSupplierTypeList |
| | | getSupplierTypeList, |
| | | // downloadContract |
| | | // previewContract |
| | | } from "@/api/supplierManage/supplier" |
| | | import EditDropdownDialog from "@/views/other/commonDialog/EditDropdownDialog" |
| | | import { getMemberListFromGrpc } from "@/api/common/other" |
| | | import download from "downloadjs" |
| | | // import { renderAsync } from "docx-preview" |
| | | // import axios from "axios" |
| | | import axios from "axios" |
| | | export default { |
| | | name: "AddSupplierDialog", |
| | | props: { |
| | |
| | | } |
| | | }, |
| | | components: { EditDropdownDialog }, |
| | | computed: {}, |
| | | computed: { |
| | | headers() { |
| | | const authorization = "Bearer "+document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1")|| '' |
| | | return { authorization } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | dialogWidth: "50%", |
| | |
| | | pageSize: 100 |
| | | }).then((res) => { |
| | | console.log(res) |
| | | this.memberOptions = res.data.data.list |
| | | this.memberOptions = res.data.list |
| | | }) |
| | | }, |
| | | // 供应商类型 |
| | |
| | | fd.append("name", file.name) |
| | | // 调用接口 |
| | | createContract(fd).then((res) => { |
| | | if (res.status == 200) { |
| | | console.log(res.data.data) |
| | | if (res.code == 200) { |
| | | this.file_name = file.name |
| | | this.file_id = res.data.data.id |
| | | this.file_id = res.data.id |
| | | } |
| | | }) |
| | | } |
| | |
| | | }, |
| | | // 下载合同 |
| | | downloadClick() { |
| | | let url = "/api/con/downloadContract?id=" + this.file_id |
| | | let url = "/api/downloadContract?id=" + this.file_id |
| | | download(url, "", "") |
| | | }, |
| | | // 删除合同 |
| | |
| | | // }) |
| | | }, |
| | | // 预览合同 |
| | | async previewClick() { |
| | | this.previewUrl = "/api/con/previewContract?id=" + this.file_id |
| | | if (this.file_name.includes("pdf")) { |
| | | window.open(this.previewUrl, "_blank") |
| | | } else { |
| | | let routeUrl = this.$router.resolve({ |
| | | path: "/PreviewFile", |
| | | query: { |
| | | //要传的参数 |
| | | previewUrl: this.previewUrl |
| | | } |
| | | }) |
| | | window.open(routeUrl.href, "_blank") |
| | | } |
| | | // async previewClick() { |
| | | // this.previewUrl = "/api/con/previewContract?id=" + this.file_id |
| | | // if (this.file_name.includes("pdf")) { |
| | | // window.open(this.previewUrl, "_blank") |
| | | // } else { |
| | | // let routeUrl = this.$router.resolve({ |
| | | // path: "/PreviewFile", |
| | | // query: { |
| | | // //要传的参数 |
| | | // previewUrl: this.previewUrl |
| | | // } |
| | | // }) |
| | | // window.open(routeUrl.href, "_blank") |
| | | // } |
| | | // } |
| | | async previewClick() { |
| | | this.previewUrl = "/api/previewContract?id=" + this.file_id |
| | | if (this.file_name.includes("pdf")) { |
| | | console.log("是pdf文件") |
| | | await axios.get(this.previewUrl, { headers: { "Authorization":"Bearer "+ document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1")} }) |
| | | .then(response => { |
| | | window.open(this.previewUrl, "_blank") |
| | | console.log("response",response,this.previewUrl) |
| | | }) |
| | | .catch(error => { |
| | | console.error(error); |
| | | }); |
| | | } else { |
| | | console.log(this.previewUrl,"看看是啥子") |
| | | let routeUrl = this.$router.resolve({ |
| | | path: "/PreviewFile", |
| | | query: { |
| | | //要传的参数 |
| | | previewUrl: this.previewUrl |
| | | } |
| | | }) |
| | | window.open(routeUrl.href, "_blank") |
| | | } |
| | | } |
| | | } |
| | | } |