8
0

update preview pdf

Este cometimento está contido em:
lb 2023-05-25 14:15:27 +08:00
ascendente 03661f63b5
cometimento 66efe8c476
6 ficheiros modificados com 62 adições e 16 eliminações

Ver ficheiro

@ -38,10 +38,10 @@
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script>
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.103:8080/pms-am';
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.21:8080/pms-am'; // xv
// window.SITE_CONFIG['apiURL'] = 'http://localhost:3000/pms-am'; // xv
// window.SITE_CONFIG['apiURL'] = 'http://localhost:3000/p//////ms-am'; // xv
</script>
<% } %>
<!-- 集成测试环境 -->

Ver ficheiro

@ -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,
});

Ver ficheiro

@ -7,6 +7,7 @@
{{ file.name }}
</span>
<div class="h-4 space-x-2">
<button class="el-icon-view color-blue" @click="hanlePreview(file)" title="点击预览"></button>
<button class="el-icon-download color-blue" @click="handleDownload(file)" title="点击下载"></button>
<button class="el-icon-delete color-red" v-if="!detailMode" @click="handleDelete(file)" title="点击删除"></button>
</div>
@ -17,15 +18,8 @@
<div class="top-search">
<transition name="fade" mode="out-in">
<button v-if="!showSearchInput" class="el-icon-search search-btn" @click="handleSearchClick"></button>
<el-input
v-else
size="mini"
placeholder="请输入关键字"
clearable
@keydown.enter.native="showSearchInput = false"
@keydown.esc.stop.native="showSearchInput = false"
v-model="searchCondition"
/>
<el-input v-else size="mini" placeholder="请输入关键字" clearable @keydown.enter.native="showSearchInput = false"
@keydown.esc.stop.native="showSearchInput = false" v-model="searchCondition" />
</transition>
</div>
@ -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;

Ver ficheiro

@ -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;

Ver ficheiro

@ -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: [

Ver ficheiro

@ -21,7 +21,7 @@ module.exports = {
productionSourceMap: false,
devServer: {
open: true,
port: 8001,
port: 9000,
overlay: {
errors: true,
warnings: true