| | |
| | | :model="editConfig.infomation" |
| | | :rules="rules" |
| | | label-position="right" |
| | | label-width="308px" |
| | | label-width="150px" |
| | | size="mini" |
| | | > |
| | | <!-- 信息 --> |
| | |
| | | <span style="margin-left: 5px">合同附件</span> |
| | | </div> |
| | | </template> |
| | | <div class="annex-view"> |
| | | <div v-if="file_id === 0" class="annex-view"> |
| | | <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" |
| | |
| | | </el-upload> |
| | | </div> |
| | | </div> |
| | | <div v-if="file_name && file_name.length > 0" class="file-content"> |
| | | <!-- v-if="file_name && file_name.length > 0" --> |
| | | <div v-else class="file-content"> |
| | | <div>{{ file_name }}</div> |
| | | <div> |
| | | <el-button type="text">预览</el-button> |
| | | <el-button type="text">下载</el-button> |
| | | <el-button type="text">删除</el-button> |
| | | <el-button type="text" @click="previewClick" style="margin-left: 10px">预览</el-button> |
| | | <el-button type="text" @click="downloadClick">下载</el-button> |
| | | <el-button type="text" @click="delContractClick">删除</el-button> |
| | | </div> |
| | | <div ref="file"></div> |
| | | </div> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { createSupplier, createContract, updateSupplier, getIndustryList } from "@/api/supplierManage/supplier" |
| | | import { |
| | | createSupplier, |
| | | createContract, |
| | | updateSupplier, |
| | | getIndustryList, |
| | | getSupplierTypeList, |
| | | // downloadContract |
| | | // previewContract |
| | | } from "@/api/supplierManage/supplier" |
| | | import EditDropdownDialog from "@/views/other/commonDialog/EditDropdownDialog" |
| | | import { getSupplierTypeList } from "@/api/supplierManage/supplier" |
| | | import { getMemberList } from "@/api/common/other" |
| | | import { getMemberListFromGrpc } from "@/api/common/other" |
| | | import download from "downloadjs" |
| | | // import { renderAsync } from "docx-preview" |
| | | 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: "80%", |
| | | dialogWidth: "50%", |
| | | editConfig: this.addCommonConfig, |
| | | rules: { |
| | | name: [{ required: true, message: "请输入", trigger: "blur" }], |
| | |
| | | infomation: {} |
| | | }, |
| | | fileList: [], |
| | | file_name: "", |
| | | file_id: this.addCommonConfig.infomation.fileId |
| | | file_name: this.addCommonConfig.infomation.file_name, |
| | | file_id: this.addCommonConfig.infomation.fileId, |
| | | previewUrl: "", |
| | | loading: false |
| | | } |
| | | }, |
| | | created() { |
| | | this.getSupplierTypeList() |
| | | this.getIndustryList() |
| | | this.getMemberList() |
| | | if (this.editConfig.title === "修改") { |
| | | // this.previewContract() |
| | | } |
| | | }, |
| | | methods: { |
| | | // 销售负责人 |
| | | async getMemberList() { |
| | | await getMemberList({ |
| | | await getMemberListFromGrpc({ |
| | | page: 1, |
| | | pageSize: 100 |
| | | }).then((res) => { |
| | | console.log(res) |
| | | this.memberOptions = res.data.data.list |
| | | this.memberOptions = res.data.list |
| | | }) |
| | | }, |
| | | // 供应商类型 |
| | |
| | | page: 1, |
| | | pageSize: 100 |
| | | }).then((res) => { |
| | | this.supplierTypeOptions = res.data.data.list |
| | | this.supplierTypeOptions = res.data.list |
| | | }) |
| | | }, |
| | | // 所属行业 |
| | |
| | | page: 1, |
| | | pageSize: 100 |
| | | }).then((res) => { |
| | | this.industryOptions = res.data.data.list |
| | | this.industryOptions = res.data.list |
| | | }) |
| | | }, |
| | | handleClose() { |
| | |
| | | name: data.name || "", |
| | | number: data.number || "", |
| | | phone: data.phone || "", |
| | | responsiblePersonId: data.responsiblePersonId || 0, |
| | | responsiblePersonName: data.responsiblePersonName || document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1"), |
| | | status: data.status || 0, |
| | | supplierType: data.supplierType || "", |
| | | url: data.url || "" |
| | |
| | | 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 |
| | | } |
| | | }) |
| | | } |
| | |
| | | handleExceed(files, fileList) { |
| | | console.log(fileList) |
| | | this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件`) |
| | | }, |
| | | // 下载合同 |
| | | downloadClick() { |
| | | let url = "/api/downloadContract?id=" + this.file_id |
| | | download(url, "", "") |
| | | }, |
| | | // 删除合同 |
| | | delContractClick() { |
| | | // deleteContract({ |
| | | // id: this.file_id |
| | | // }).then((res) => { |
| | | // console.log(res) |
| | | // this.$message.success(res.msg) |
| | | this.file_id = 0 |
| | | // }) |
| | | }, |
| | | // 预览合同 |
| | | // 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") |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | .file-content { |
| | | display: flex; |
| | | } |
| | | } |
| | | .dialog-footer { |
| | | background-color: #f5f5f5; |
| | | height: 55px; |
| | | line-height: 55px; |
| | | } |
| | | } |
| | | } |