| | |
| | | <a-tag v-else class="tag-all" color="#f50"> 适用全部 </a-tag> |
| | | <template v-if="canDownload"> |
| | | <a-divider type="vertical"></a-divider> |
| | | <a v-if="record.isCanPreview" :disabled="!record.status" @click="downloadFile(record)">预览</a> |
| | | <a v-else :disabled="!record.status" @click="downloadFile(record)">下载</a> |
| | | <a |
| | | v-if="record.isCanPreview" |
| | | :disabled="!record.status" |
| | | @click="downloadFile(record)" |
| | | >预览</a |
| | | > |
| | | <a |
| | | v-else |
| | | :disabled="!record.status" |
| | | @click="downloadFile(record)" |
| | | >下载</a |
| | | > |
| | | </template> |
| | | <a-divider type="vertical"></a-divider> |
| | | <a-popover title="" trigger="hover"> |
| | |
| | | </div> |
| | | </a-modal> |
| | | |
| | | <!-- 日志 --> |
| | | <a-modal |
| | | :visible="pdfInfo.visible" |
| | | :footer="null" |
| | | :width="960" |
| | | title="文件预览" |
| | | :destroyOnClose="true" |
| | | @cancel="pdfCancel"> |
| | | <div style="height:600px; overflow-y: auto"> |
| | | <iframe :src="pdfInfo.src"></iframe> |
| | | </div> |
| | | |
| | | </a-modal> |
| | | <!-- 日志 --> |
| | | <a-modal |
| | | :visible="pdfInfo.visible" |
| | | :footer="null" |
| | | :width="960" |
| | | title="文件预览" |
| | | :destroyOnClose="true" |
| | | @cancel="pdfCancel" |
| | | > |
| | | <div style="height:600px; overflow-y: auto"> |
| | | <iframe :src="pdfInfo.src"></iframe> |
| | | </div> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import getFileTypeAndName from "@/assets/js/tools/getFileTypeAndName"; |
| | | import VuePdf from "vue-pdf"; |
| | | |
| | | |
| | | export default { |
| | | components: { |
| | | AdvanceTable, |
| | | Pop, |
| | | DescRes, |
| | | EmailCard, |
| | | VuePdf, |
| | | VuePdf, |
| | | }, |
| | | name: "list", |
| | | data() { |
| | | return { |
| | | pdfInfo: { |
| | | visible: false, |
| | | src: "", |
| | | loadedRatio: 0, |
| | | page: 1, |
| | | numPages: 0, |
| | | rotate: 0, |
| | | }, |
| | | rowFileName: '', |
| | | pdfInfo: { |
| | | visible: false, |
| | | src: "", |
| | | loadedRatio: 0, |
| | | page: 1, |
| | | numPages: 0, |
| | | rotate: 0, |
| | | }, |
| | | rowFileName: "", |
| | | logList: [], |
| | | logVisible: false, |
| | | currentObj: null, |
| | |
| | | width: 260, |
| | | customCell: this.customCell, |
| | | }, |
| | | { |
| | | title: "是否锁定", |
| | | dataIndex: "status", |
| | | dataType: "boolean", |
| | | align: "center", |
| | | searchAble: true, |
| | | width: 100, |
| | | scopedSlots: { customRender: "status" }, |
| | | }, |
| | | { |
| | | title: "是否锁定", |
| | | dataIndex: "status", |
| | | dataType: "boolean", |
| | | align: "center", |
| | | searchAble: true, |
| | | width: 100, |
| | | search: { |
| | | default: true, |
| | | }, |
| | | scopedSlots: { customRender: "status" }, |
| | | }, |
| | | { |
| | | title: "操作", |
| | | dataIndex: "operation", |
| | |
| | | let name2 = fileName + fileVersion; |
| | | |
| | | if (name1.toLowerCase() != name2.toLowerCase()) { |
| | | console.log(name1.toLowerCase()+"&&&&&&"+ name2.toLowerCase()); |
| | | console.log(name1.toLowerCase() + "&&&&&&" + name2.toLowerCase()); |
| | | this.$message.error("sop与说明文件可能不匹配"); |
| | | return false; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | if (this.rowFileName.toLowerCase() != this.resObj.fileName.toLowerCase()) { |
| | | if ( |
| | | this.rowFileName.toLowerCase() != this.resObj.fileName.toLowerCase() |
| | | ) { |
| | | this.$message.error("说明文件与该条记录可能不匹配"); |
| | | return false; |
| | | } |
| | |
| | | const { pageCurr, pageSize, conditions, columns } = this; |
| | | let params = { pageCurr, pageSize }; |
| | | let data = {}; |
| | | console.log(this.conditions['status']); |
| | | Object.keys(conditions).forEach((v) => { |
| | | switch (v) { |
| | | case "code": |
| | | case "model": |
| | | params[v] = conditions[v]; |
| | | break; |
| | | case "status": |
| | | params[v] = conditions[v]?1:0; |
| | | break; |
| | | case "status": |
| | | params[v] = conditions[v] ? 1 : 0; |
| | | break; |
| | | case "parentType": |
| | | case "chileType": |
| | | data[v] = conditions[v]; |
| | |
| | | list = data2.list; |
| | | total = data2.total; |
| | | } |
| | | this.dataSource = list.map(item=>{ |
| | | const fileInfo = getFileTypeAndName(item.fileUrl); |
| | | item.isCanPreview = fileInfo.type === "pdf"; |
| | | return item; |
| | | this.dataSource = list.map((item) => { |
| | | const fileInfo = getFileTypeAndName(item.fileUrl); |
| | | item.isCanPreview = fileInfo.type === "pdf"; |
| | | return item; |
| | | }); |
| | | this.total = total; |
| | | this.getSopType1(); |
| | |
| | | }); |
| | | }, |
| | | downloadFile(record) { |
| | | const fileInfo = getFileTypeAndName(record.fileUrl); |
| | | let url = this.webUrl + record.fileUrl; |
| | | if(fileInfo.type === 'pdf') { // 预览 |
| | | window.open(url); |
| | | }else { // 下载 |
| | | let loading = this.$layer.loading(); |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | let fileName = record.fileUrl.split("/").pop(); |
| | | link.href = url; |
| | | link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | this.$layer.close(loading); |
| | | document.body.removeChild(link); |
| | | } |
| | | const fileInfo = getFileTypeAndName(record.fileUrl); |
| | | let url = this.webUrl + record.fileUrl; |
| | | if (fileInfo.type === "pdf") { |
| | | // 预览 |
| | | window.open(url); |
| | | } else { |
| | | // 下载 |
| | | let loading = this.$layer.loading(); |
| | | let link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | let fileName = record.fileUrl.split("/").pop(); |
| | | link.href = url; |
| | | link.download = fileName; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | this.$layer.close(loading); |
| | | document.body.removeChild(link); |
| | | } |
| | | }, |
| | | reasonCancel() { |
| | | this.reasonVisible = false; |
| | |
| | | logCancel() { |
| | | this.logVisible = false; |
| | | }, |
| | | pdfCancel() { |
| | | this.pdfInfo.visible = false; |
| | | }, |
| | | pdfCancel() { |
| | | this.pdfInfo.visible = false; |
| | | }, |
| | | goHistory(record) { |
| | | let { fileName } = record; |
| | | this.$router.push({ |