diff --git a/public/index.html b/public/index.html index 8cd3f34..7027717 100644 --- a/public/index.html +++ b/public/index.html @@ -38,10 +38,10 @@ <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %> <% } %> diff --git a/src/components/DialogWithMenu.vue b/src/components/DialogWithMenu.vue index 584a3bd..efd6428 100644 --- a/src/components/DialogWithMenu.vue +++ b/src/components/DialogWithMenu.vue @@ -519,9 +519,18 @@ export default { // 显示图片 this.currentImgUrl = URL.createObjectURL(res); this.imgPreviewDialogVisible = true; + } else if (/pdf/i.test(res.type)) { + // 预览pdf + let a = document.createElement('a') + a.setAttribute('target', '_blank') + a.href = URL.createObjectURL(res) + a.click() + console.log('before remove a ', a) + a.remove() + console.log('removed a ', a) } else { this.$message({ - message: "非图片文件请下载后预览", + message: "非图片和PDF文件请下载后预览", type: "error", duration: 1500, }); diff --git a/src/components/uploadBtn/components/FileList.vue b/src/components/uploadBtn/components/FileList.vue index 8446e7b..ad9a801 100644 --- a/src/components/uploadBtn/components/FileList.vue +++ b/src/components/uploadBtn/components/FileList.vue @@ -7,6 +7,7 @@ {{ file.name }}
+
@@ -17,15 +18,8 @@ @@ -77,6 +71,34 @@ export default { }, }, methods: { + hanlePreview(file) { + // 加载图片 + this.$http + .get("/pms/attachment/downloadFile", { + params: { + attachmentId: file.id, + type: 0, // 0 预览,1 下载 + }, + responseType: "blob", + }) + .then(({ data: res }) => { + console.log("preivew", res); + if (/image/i.test(res.type) || /pdf/i.test(res.type)) { + let a = document.createElement('a') + a.setAttribute('target', '_blank') + a.href = URL.createObjectURL(res) + a.click() + a.remove() + } else { + this.$message({ + message: "非图片和PDF文件请下载后预览", + type: "error", + duration: 1500, + }); + } + }); + + }, handleDownload(file) { console.log("[FileList] handleDownload", file); this.$http @@ -153,7 +175,7 @@ li { list-style: none; } -.filelist > li { +.filelist>li { display: flex; justify-content: space-between; align-items: center; @@ -178,12 +200,15 @@ li { ::-webkit-scrollbar { width: 8px; } + ::-webkit-scrollbar-track { width: 8px; } + ::-webkit-scrollbar-button { display: none; } + ::-webkit-scrollbar-thumb { background: rgb(175, 175, 175); border-radius: 4px; @@ -193,6 +218,7 @@ li { color: #0b58ff; cursor: pointer; } + .color-red { color: rgba(222, 15, 15, 0.89); cursor: pointer; diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index db8f90c..bebfe7e 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -338,6 +338,10 @@ export default { this.openDialog(data, false, { key: "attachment" }); break; } + case "view-attachment-justform-version": { + console.log(data) + break; + } case "view-recipe": { this.openDialog(data, true, { key: "attr" }); break; diff --git a/src/views/modules/pms/shape/config.js b/src/views/modules/pms/shape/config.js index 902f652..7ba19d3 100644 --- a/src/views/modules/pms/shape/config.js +++ b/src/views/modules/pms/shape/config.js @@ -1,5 +1,5 @@ import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent"; -// import switchBtn from "@/components/noTemplateComponents/switchBtn"; +import TableTextComponent from "@/components/noTemplateComponents/detailComponent"; import request from "@/utils/request"; import { timeFilter, dictFilter } from "@/utils/filters"; @@ -108,6 +108,13 @@ export default function () { { input: true, label: "短描述", prop: "shortDesc", elparams: { placeholder: "短描述" } }, ], [{ textarea: true, label: "描述", prop: "description", elparams: { placeholder: "描述" } }], + [{ + upload: true, + actionUrl: window.SITE_CONFIG['apiURL'] + '/pms/attachment/uploadFileFormData?typeCode=shape', + label: "上传资料", + prop: "files", + elparams: null + }], [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], ], operations: [ diff --git a/vue.config.js b/vue.config.js index ed3798d..7adf5ec 100644 --- a/vue.config.js +++ b/vue.config.js @@ -21,7 +21,7 @@ module.exports = { productionSourceMap: false, devServer: { open: true, - port: 8001, + port: 9000, overlay: { errors: true, warnings: true