提交 6dc69893 authored 作者: 龙菲's avatar 龙菲

完善外部资源和内部资源

上级 995c38bd
...@@ -204,6 +204,7 @@ ...@@ -204,6 +204,7 @@
opacity: 0.5; opacity: 0.5;
} }
</style> </style>
</head> </head>
<body> <body>
......
...@@ -1545,9 +1545,9 @@ ...@@ -1545,9 +1545,9 @@
this._intentStates = new Map(); this._intentStates = new Map();
this.destroyed = false; this.destroyed = false;
this._annotations = []; this._annotations = [];
this.getAnnotations().then((t) => { // this.getAnnotations().then((t) => {
this._annotations = t; // this._annotations = t;
}); // });
} }
get pageNumber() { get pageNumber() {
return this._pageIndex + 1; return this._pageIndex + 1;
...@@ -1556,8 +1556,17 @@ ...@@ -1556,8 +1556,17 @@
return this._annotations; return this._annotations;
} }
addAnnotation(annotations) { addAnnotation(annotations) {
if (Array.isArray(annotations)) {
this._annotations = [...this._annotations, ...annotations];
} else {
this._annotations = [...this._annotations, annotations]; this._annotations = [...this._annotations, annotations];
} }
}
rAddAnnotation(annotations) {
const ids = annotations.map((o) => o.id);
const ds = [...this._annotations].filter((o) => !ids.includes(o.id));
this._annotations = [...ds, ...annotations];
}
removeAnnotation(id) { removeAnnotation(id) {
this._annotations = [...this._annotations].filter( this._annotations = [...this._annotations].filter(
(o) => o.id !== id (o) => o.id !== id
...@@ -15917,7 +15926,7 @@ ...@@ -15917,7 +15926,7 @@
rect.setAttribute("height", rectHeight * 0.1); rect.setAttribute("height", rectHeight * 0.1);
} else if (this.data.annotationType === 12) { } else if (this.data.annotationType === 12) {
rect.setAttribute("x", x); rect.setAttribute("x", x);
rect.setAttribute("y", y + rectHeight * 0.55); rect.setAttribute("y", y + rectHeight * 0.5);
rect.setAttribute("width", rectWidth); rect.setAttribute("width", rectWidth);
rect.setAttribute("height", rectHeight * 0.1); rect.setAttribute("height", rectHeight * 0.1);
} else { } else {
...@@ -17808,7 +17817,7 @@ ...@@ -17808,7 +17817,7 @@
} }
render() { render() {
if (!this.data.popupRef) { if (!this.data.popupRef) {
this._createPopup(); // this._createPopup();
} }
this.container.classList.add("squigglyAnnotation"); this.container.classList.add("squigglyAnnotation");
return this.container; return this.container;
...@@ -18037,7 +18046,6 @@ ...@@ -18037,7 +18046,6 @@
parent: this, parent: this,
elements: null, elements: null,
}; };
console.log(16556, annotations);
for (const data of annotations) { for (const data of annotations) {
if (data.noHTML) { if (data.noHTML) {
continue; continue;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* 资源社区相关接口 * 资源社区相关接口
*/ */
import request from '@/utils/request' import request from '@/utils/request'
import qs from 'qs'
const baseUrl = '/v1/api' const baseUrl = '/v1/api'
...@@ -43,3 +44,14 @@ export const getThesisList = (params) => { ...@@ -43,3 +44,14 @@ export const getThesisList = (params) => {
params params
}) })
} }
// 内部资源列表查询
export const getInnerFileList = (data) => {
return request({
url: baseUrl + '/paper/getInnerFileList',
method: 'post',
data: qs.stringify(data),
headers: { 'content-type': 'application/x-www-form-urlencoded' }
})
}
...@@ -214,7 +214,7 @@ export default { ...@@ -214,7 +214,7 @@ export default {
}; };
// 我的收藏界面只显示已收藏的 // 我的收藏界面只显示已收藏的
if (this.fileType == this.MY_COLLECT) { if (this.fileType == this.MY_COLLECT.code) {
data.removeFlag = this.COLLECTED; data.removeFlag = this.COLLECTED;
} }
const params = new URLSearchParams(); const params = new URLSearchParams();
......
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
<li <li
class="right-menu-item" class="right-menu-item"
@click="handleClickAddFolderBtn" @click="handleClickAddFolderBtn"
v-if="[MY_CREATE, TEMPLATE_MANAGE, MY_COLLECT].includes(fileType)" v-if="[MY_CREATE.code, TEMPLATE_MANAGE.code, MY_COLLECT.code].includes(fileType)"
> >
<i class="el-icon-folder-add"></i> 新建文件夹 <i class="el-icon-folder-add"></i> 新建文件夹
</li> </li>
...@@ -168,7 +168,7 @@ ...@@ -168,7 +168,7 @@
<li <li
class="right-menu-item" class="right-menu-item"
@click="handleCreateFileByTemplate('docx')" @click="handleCreateFileByTemplate('docx')"
v-if="[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)" v-if="[MY_CREATE.code, TEMPLATE_MANAGE.code].includes(fileType)"
> >
<img :src="wordImg" />新建Word文档 <img :src="wordImg" />新建Word文档
</li> </li>
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
<li class="right-menu-item" @click="handleCreateFile('pptx')"> <li class="right-menu-item" @click="handleCreateFile('pptx')">
<img :src="pptImg" />新建 PPT 演示文稿 <img :src="pptImg" />新建 PPT 演示文稿
</li> --> </li> -->
<span v-if="[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)"> <span v-if="[MY_CREATE.code, TEMPLATE_MANAGE.code].includes(fileType)">
<el-divider /> <el-divider />
<li <li
class="right-menu-item" class="right-menu-item"
...@@ -268,11 +268,11 @@ export default { ...@@ -268,11 +268,11 @@ export default {
// 取消收藏按钮是否显示 // 取消收藏按钮是否显示
cancelCollectBtnShow() { cancelCollectBtnShow() {
return this.fileType == this.MY_COLLECT; //我的收藏才显示 return this.fileType == this.MY_COLLECT.code; //我的收藏才显示
}, },
// 删除按钮是否显示 // 删除按钮是否显示
deleteBtnShow() { deleteBtnShow() {
return this.fileType != this.MY_COLLECT; //我的收藏不能删除 return this.fileType != this.MY_COLLECT.code; //我的收藏不能删除
}, },
// 还原按钮是否显示 // 还原按钮是否显示
restoreBtnShow() { restoreBtnShow() {
...@@ -288,11 +288,11 @@ export default { ...@@ -288,11 +288,11 @@ export default {
}, },
// 重命名按钮是否显示 // 重命名按钮是否显示
renameBtnShow() { renameBtnShow() {
return this.fileType != this.MY_COLLECT; //我的收藏不能重命名 return this.fileType != this.MY_COLLECT.code; //我的收藏不能重命名
}, },
// 分享按钮是否显示 // 分享按钮是否显示
shareBtnShow() { shareBtnShow() {
return this.fileType != this.TEMPLATE_MANAGE; //模板管理不能分享 return this.fileType != this.TEMPLATE_MANAGE.code; //模板管理不能分享
}, },
// 下载按钮是否显示 // 下载按钮是否显示
downloadBtnShow() { downloadBtnShow() {
...@@ -602,7 +602,7 @@ export default { ...@@ -602,7 +602,7 @@ export default {
* @param {string} 文件扩展名 docx xlsx pptx * @param {string} 文件扩展名 docx xlsx pptx
*/ */
handleCreateFileByTemplate(extendName) { handleCreateFileByTemplate(extendName) {
const isShowTemplateRatio = this.fileType != this.TEMPLATE_MANAGE; const isShowTemplateRatio = this.fileType != this.TEMPLATE_MANAGE.code;
this.$openDialog this.$openDialog
.addFileByTemplate({ .addFileByTemplate({
extendName, extendName,
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
class="create-operate-group" class="create-operate-group"
v-if=" v-if="
(!selectedFiles.length || !isBatchOperation) && (!selectedFiles.length || !isBatchOperation) &&
[MY_CREATE, TEMPLATE_MANAGE].includes(fileType) [MY_CREATE.code, TEMPLATE_MANAGE.code].includes(fileType)
" "
> >
<!-- 上传模块 --> <!-- 上传模块 -->
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</el-dropdown-item> </el-dropdown-item>
<!-- 只有我的创作采用到新建word文档 --> <!-- 只有我的创作采用到新建word文档 -->
<el-dropdown-item <el-dropdown-item
v-if="[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)" v-if="[MY_CREATE.code, TEMPLATE_MANAGE.code].includes(fileType)"
divided divided
@click.native="handleCreateFile('docx')" @click.native="handleCreateFile('docx')"
> >
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<el-button <el-button
v-if=" v-if="
(!selectedFiles.length || !isBatchOperation) && (!selectedFiles.length || !isBatchOperation) &&
[MY_COLLECT].includes(fileType) [MY_COLLECT.code].includes(fileType)
" "
size="mini" size="mini"
type="primary" type="primary"
...@@ -89,6 +89,20 @@ ...@@ -89,6 +89,20 @@
>新建文件夹</el-button >新建文件夹</el-button
> >
<!-- 内部资源只需要用到上传文件 -->
<!-- <el-button
v-if="
(!selectedFiles.length || !isBatchOperation) &&
[INTERNAL_RESOURCE.code].includes(fileType)
"
size="mini"
type="primary"
icon="el-icon-upload2"
id="uploadFileId"
@click.native="handleUploadFileBtnClick(FILE_UPLOAD)"
>上传文件</el-button
> -->
<div class="batch-operate-group"> <div class="batch-operate-group">
<el-button-group v-if="isBatchOperation"> <el-button-group v-if="isBatchOperation">
<el-button <el-button
...@@ -120,13 +134,13 @@ ...@@ -120,13 +134,13 @@
<el-button <el-button
size="mini" size="mini"
type="primary" type="primary"
v-if="selectedFiles.length && fileType != MY_COLLECT" v-if="selectedFiles.length && fileType != MY_COLLECT.code"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleBatchDeleteBtnClick" @click="handleBatchDeleteBtnClick"
>批量删除</el-button >批量删除</el-button
> >
<el-button <el-button
v-if="selectedFiles.length && fileType == MY_COLLECT" v-if="selectedFiles.length && fileType == MY_COLLECT.code"
size="mini" size="mini"
type="primary" type="primary"
icon="el-icon-delete" icon="el-icon-delete"
...@@ -391,7 +405,7 @@ export default { ...@@ -391,7 +405,7 @@ export default {
* @param {string} extendName 文件扩展名 docx xlsx pptx * @param {string} extendName 文件扩展名 docx xlsx pptx
*/ */
handleCreateFile(extendName) { handleCreateFile(extendName) {
let isShowTemplateRatio = this.fileType != this.TEMPLATE_MANAGE; //是否要展示模板选项,我的创作展示,模板管理不展示 let isShowTemplateRatio = this.fileType != this.TEMPLATE_MANAGE.code; //是否要展示模板选项,我的创作展示,模板管理不展示
this.$openDialog this.$openDialog
.addFileByTemplate({ .addFileByTemplate({
extendName, extendName,
......
// // 文件模块类别
// export const fileTypeConstant = {
// MY_CREATE: 10,//我的创作
// TEMPLATE_MANAGE: 11,//模板管理
// MY_COLLECT: 12,//我的收藏
// INTERNAL_RESOURCE: 13,//内部资源
// }
// 文件模块类别 // 文件模块类别
export const fileTypeConstant = { export const fileTypeConstant = {
MY_CREATE: 10,//我的创作 MY_CREATE: {
TEMPLATE_MANAGE: 11,//模板管理 code: 10,
MY_COLLECT: 12,//我的收藏 path: '/我的创作'
},
TEMPLATE_MANAGE: {
code: 11,
path: '/模板管理'
},
MY_COLLECT: {
code: 12,
path: "/我的收藏"
},
INTERNAL_RESOURCE: {
code: 13,
path: '/内部资源'
}
} }
// 展示模式 // 展示模式
export const displayModeConstant = { export const displayModeConstant = {
TABLE: 0,//列表 TABLE: 0,//列表
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<el-tooltip content="文档地址" effect="dark" placement="bottom"> <el-tooltip content="文档地址" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" /> <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip> --> </el-tooltip> -->
<el-tooltip content="cajViwer下载" effect="dark" placement="bottom"> <el-tooltip content="caj阅读器下载" effect="dark" placement="bottom">
<svg-icon <svg-icon
icon-class="caj-logo" icon-class="caj-logo"
style="font-size: 30px; margin: 0 8px; cursor: pointer" style="font-size: 30px; margin: 0 8px; cursor: pointer"
...@@ -73,7 +73,7 @@ import SizeSelect from "@/components/SizeSelect"; ...@@ -73,7 +73,7 @@ import SizeSelect from "@/components/SizeSelect";
import Search from "@/components/HeaderSearch"; import Search from "@/components/HeaderSearch";
import RuoYiGit from "@/components/RuoYi/Git"; import RuoYiGit from "@/components/RuoYi/Git";
import RuoYiDoc from "@/components/RuoYi/Doc"; import RuoYiDoc from "@/components/RuoYi/Doc";
import { handleDownloadCajViewer } from "@/utils/file";
export default { export default {
components: { components: {
Breadcrumb, Breadcrumb,
...@@ -105,6 +105,8 @@ export default { ...@@ -105,6 +105,8 @@ export default {
}, },
}, },
methods: { methods: {
// 下载caj阅读器
handleDownloadCajViewer,
toggleSideBar() { toggleSideBar() {
this.$store.dispatch("app/toggleSideBar"); this.$store.dispatch("app/toggleSideBar");
}, },
...@@ -121,15 +123,6 @@ export default { ...@@ -121,15 +123,6 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
handleDownloadCajViewer() {
let a = document.createElement("a");
a.href = "/caj-viewer/CAJViewer 8.1_x64-setup.exe";
a.download = "CAJViewer 8.1_x64-setup.exe";
a.style.display = "none";
document.body.appendChild(a);
a.click();
a.remove();
},
}, },
}; };
</script> </script>
......
...@@ -155,3 +155,13 @@ export function openFile(file, $el, localStorage, flag = false) { ...@@ -155,3 +155,13 @@ export function openFile(file, $el, localStorage, flag = false) {
} }
} }
export function handleDownloadCajViewer() {
let a = document.createElement("a");
a.href = "/caj-viewer/CAJViewer 8.1_x64-setup.exe";
a.download = "CAJViewer 8.1_x64-setup.exe";
a.style.display = "none";
document.body.appendChild(a);
a.click();
a.remove();
}
...@@ -24,8 +24,8 @@ export default { ...@@ -24,8 +24,8 @@ export default {
// 修改查询参数,例如,给 "filePath" 参数设置新的值 // 修改查询参数,例如,给 "filePath" 参数设置新的值
// 10-我的创作 11-模板管理 // 10-我的创作 11-模板管理
const newFileType = TEMPLATE_MANAGE; const newFileType = TEMPLATE_MANAGE.code;
const newFilePath = "/模板管理"; const newFilePath = TEMPLATE_MANAGE.path;
const newQueryParams = { const newQueryParams = {
...currentQueryParams, ...currentQueryParams,
fileType: newFileType, fileType: newFileType,
......
...@@ -22,8 +22,8 @@ export default { ...@@ -22,8 +22,8 @@ export default {
const currentQueryParams = this.$route.query; const currentQueryParams = this.$route.query;
// 修改查询参数,例如,给 "filePath" 参数设置新的值 // 修改查询参数,例如,给 "filePath" 参数设置新的值
const newFileType = MY_COLLECT; const newFileType = MY_COLLECT.code;
const newFilePath = "/我的收藏"; const newFilePath = MY_COLLECT.path;
const newQueryParams = { const newQueryParams = {
...currentQueryParams, ...currentQueryParams,
fileType: newFileType, fileType: newFileType,
......
...@@ -22,8 +22,8 @@ export default { ...@@ -22,8 +22,8 @@ export default {
const currentQueryParams = this.$route.query; const currentQueryParams = this.$route.query;
// 修改查询参数,例如,给 "filePath" 参数设置新的值 // 修改查询参数,例如,给 "filePath" 参数设置新的值
const newFileType = MY_CREATE; const newFileType = MY_CREATE.code;
const newFilePath = "/我的创作"; const newFilePath = MY_CREATE.path;
const newQueryParams = { const newQueryParams = {
...currentQueryParams, ...currentQueryParams,
fileType: newFileType, fileType: newFileType,
......
<template>
<el-dialog :visible.async="visible" title="提示">
请使用下载文件后,使用CajViewer打开,<el-link
>点击此处下载CajViewer</el-link
>
</el-dialog>
</template>
<script>
export default {
data() {
return {
visible: false,
};
},
mounted() {},
methods: {},
};
</script>
<style scoped lang="scss"></style>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</div> </div>
<div class="search-input"> <div class="search-input">
<el-input <el-input
placeholder="输入关键词搜索,马上在线阅读" placeholder="输入关键词搜索,马上阅读"
v-model="keyword" v-model="keyword"
clearable clearable
@keyup.native.enter="handleSearch" @keyup.native.enter="handleSearch"
......
<template> <template>
<div class="table"> <div class="table">
<div class="mb8"> <div class="tools">
<!-- <el-button <!-- <el-button
type="primary" type="primary"
plain plain
...@@ -17,6 +17,27 @@ ...@@ -17,6 +17,27 @@
@click.native="handleMultiDownload" @click.native="handleMultiDownload"
>批量下载</el-button >批量下载</el-button
> >
<el-button
v-if="previewType == 'caj'"
type="text"
size="mini"
class="caj"
@click="handleDownloadCajViewer"
>
<svg-icon icon-class="caj-logo" style="font-size: 24px"></svg-icon>
下载Caj阅读器
</el-button>
<el-button
v-if="previewType == 'pdf'"
class="upload"
size="mini"
type="primary"
icon="el-icon-upload2"
id="uploadFileId"
@click.native="handleUploadFileBtnClick(FILE_UPLOAD)"
>上传文件</el-button
>
</div> </div>
<el-table <el-table
v-loading="loading" v-loading="loading"
...@@ -85,14 +106,16 @@ ...@@ -85,14 +106,16 @@
{{ scope.row.collected ? "已收藏" : "收藏" }} {{ scope.row.collected ? "已收藏" : "收藏" }}
</el-link> </el-link>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<el-link
<!-- <el-link
type="primary" type="primary"
icon="el-icon-view" icon="el-icon-view"
@click="handleOpenFile(scope.row)" @click="handleOpenFile(scope.row)"
> >
预览 预览
</el-link> </el-link> -->
<el-divider direction="vertical"></el-divider>
<!-- <el-divider direction="vertical"></el-divider> -->
<el-link <el-link
target="_blank" target="_blank"
type="primary" type="primary"
...@@ -106,10 +129,9 @@ ...@@ -106,10 +129,9 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="list.totalElements > 0" :total="list[totalKey]"
:total="list.totalElements" :page.sync="list[currentKey]"
:page.sync="queryParams.pageNo" :limit.sync="list[sizeKey]"
:limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 多选文件下载,页面隐藏 --> <!-- 多选文件下载,页面隐藏 -->
...@@ -118,18 +140,32 @@ ...@@ -118,18 +140,32 @@
</template> </template>
<script> <script>
// import { list } from "../../mockData";
import { addFavorite, cancelCollect } from "@/api/user/collect"; import { addFavorite, cancelCollect } from "@/api/user/collect";
import { handleDownloadCajViewer } from "@/utils/file";
import { uploadModeConstant, fileTypeConstant } from "@/constants/index";
const { INTERNAL_RESOURCE } = fileTypeConstant;
export default { export default {
props: { props: {
list: { list: {
type: Object, type: Object,
default: () => ({ default: () => ({}),
records: [], },
totalElements: 0, // 第三方资源暂时用Caj,内部资源预览使用pdf
pageCount: 10, previewType: {
pageNo: 1, type: String,
}), default: "pdf",
},
currentKey: {
type: String,
default: "current",
},
sizeKey: {
type: String,
default: "size",
},
totalKey: {
type: String,
default: "total",
}, },
}, },
data() { data() {
...@@ -142,23 +178,8 @@ export default { ...@@ -142,23 +178,8 @@ export default {
single: true, single: true,
// 非多个禁用 // 非多个禁用
multiple: true, multiple: true,
// 显示搜索条件 ...uploadModeConstant,
showSearch: true, INTERNAL_RESOURCE,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
pageNo: 1,
pageCount: 10,
totalElements: 0,
keyword: "", //文件名称
},
// 批量取消的弹窗可见性
multiCancelVisible: false,
}; };
}, },
computed: { computed: {
...@@ -175,8 +196,10 @@ export default { ...@@ -175,8 +196,10 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
// 下载caj阅读器
handleDownloadCajViewer,
getList() { getList() {
this.$emit("getList", this.queryParams); this.$emit("getList");
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
...@@ -184,11 +207,11 @@ export default { ...@@ -184,11 +207,11 @@ export default {
this.single = selection.length != 1; this.single = selection.length != 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
// 点击打开文件 // 点击打开文件
handleOpenFile(file) { handleOpenFile(file) {
this.$file.handleFileNameClickNew(file); this.$file.handleFileNameClickNew(file);
}, },
// 获取下载地址 // 获取下载地址
getDownloadFilePath(file) { getDownloadFilePath(file) {
return file.weburl; return file.weburl;
...@@ -239,7 +262,6 @@ export default { ...@@ -239,7 +262,6 @@ export default {
removeFlag: null, removeFlag: null,
}; };
} }
// console.log(file);
let res = await request(params); let res = await request(params);
if (res.code == 200) { if (res.code == 200) {
let message = file.collected ? "取消收藏成功!" : "收藏成功!"; let message = file.collected ? "取消收藏成功!" : "收藏成功!";
...@@ -261,5 +283,17 @@ export default { ...@@ -261,5 +283,17 @@ export default {
padding: 20px; padding: 20px;
background-color: #fff; background-color: #fff;
border-radius: 4px; border-radius: 4px;
.tools {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
::v-deep .caj {
& > span {
display: flex;
align-items: center;
}
}
}
} }
</style> </style>
<template> <template>
<div class="app-container container"> <div class="app-container container">
<SearchBar ref="SearchBar" @search="loadData" /> <SearchBar ref="SearchBar" @search="loadData" />
<Table ref="Table" :list="list" @getList="loadData" v-loading="loading" /> <Table
ref="Table"
:list="list"
@getList="loadData"
v-loading="loading"
previewType="caj"
currentKey="pageNo"
sizeKey="pageCount"
totalKey="totalElements"
/>
</div> </div>
</template> </template>
<script> <script>
import SearchBar from "../components/searchBar/index.vue"; import SearchBar from "./components/searchBar/index.vue";
import Table from "../components/table/index.vue"; import Table from "./components/table/index.vue";
import { import {
getNewspaperList, getNewspaperList,
getPeriodicalsList, //期刊 getPeriodicalsList, //期刊
...@@ -34,7 +43,7 @@ export default { ...@@ -34,7 +43,7 @@ export default {
async loadData() { async loadData() {
this.loading = true; this.loading = true;
const { activeTab, keyword, currentYear } = this.$refs.SearchBar; const { activeTab, keyword, currentYear } = this.$refs.SearchBar;
const { pageNo, pageCount } = this.$refs.Table.queryParams; const { pageNo, pageCount } = this.list;
const params = { const params = {
keyword, keyword,
pageNo, pageNo,
...@@ -65,6 +74,8 @@ export default { ...@@ -65,6 +74,8 @@ export default {
let res = await request(params); let res = await request(params);
if (res.code == 200) { if (res.code == 200) {
this.list = res.data; this.list = res.data;
this.list.pageCount = Number(this.list.pageCount)
this.list.pageNo = Number(this.list.pageNo)
this.loading = false; this.loading = false;
} }
}, },
......
...@@ -11,39 +11,258 @@ ...@@ -11,39 +11,258 @@
>搜索 >搜索
</el-button> </el-button>
</div> </div>
<Table :list="list" @getList="loadData" v-loading="loading" /> <div class="table">
<el-button
class="upload"
size="mini"
type="primary"
icon="el-icon-upload2"
id="uploadFileId"
@click.native="handleUploadFileBtnClick(FILE_UPLOAD)"
>上传文件</el-button
>
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click.native="handleMultiDownload"
>批量下载</el-button
>
<el-table
v-loading="loading"
:data="list.records"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="文件名称"
align="center"
prop="name"
show-overflow-tooltip
>
<template slot-scope="scope">
<div class="fileName">
<img :src="$file.setFileImg(scope.row)" />
<el-link @click="handleOpenFile(scope.row)">
{{ scope.row.fileName }}
</el-link>
</div>
</template>
</el-table-column>
<el-table-column
label="作者"
align="center"
prop="author"
show-overflow-tooltip
>
</el-table-column>
<!-- <el-table-column
show-overflow-tooltip
label="年份"
prop="year"
align="center"
/> -->
<el-table-column
show-overflow-tooltip
label="机构"
prop="organize"
align="center"
>
</el-table-column>
<el-table-column
label="文件大小"
align="center"
prop="fileSize"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $file.calculateFileSize(scope.row.fileSize) }}
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-link
type="primary"
:icon="
scope.row.collected ? 'el-icon-star-on' : 'el-icon-star-off'
"
@click="handleCollect(scope.row)"
>
{{ scope.row.collected ? "已收藏" : "收藏" }}
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="primary"
icon="el-icon-view"
@click="handleOpenFile(scope.row)"
>
预览
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
target="_blank"
type="primary"
icon="el-icon-download"
:href="$file.getDownloadFilePath(scope.row)"
:download="scope.row.fileName + '.' + scope.row.extendName"
>
下载
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
:total="list.total"
:page.sync="list.current"
:limit.sync="list.size"
@pagination="loadData"
/>
</div>
</div> </div>
</template> </template>
<script> <script>
import Table from "../components/table/index.vue"; import { getInnerFileList } from "@/api/resource";
import { uploadModeConstant, fileTypeConstant } from "@/constants/index";
const { INTERNAL_RESOURCE } = fileTypeConstant;
export default { export default {
components: {
Table,
},
data() { data() {
return { return {
keyword: "", keyword: "",
list: { list: {
records: [], records: [],
totalElements: 0, total: 0,
pageCount: 10, size: 10,
pageNo: 1, current: 1,
}, },
INTERNAL_RESOURCE,
// 遮罩层
loading: false, loading: false,
// 选中数组
selectedFiles: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
...uploadModeConstant,
INTERNAL_RESOURCE,
}; };
}, },
computed: {
// 批量下载文件链接
batchDownloadLink() {
return `${
process.env.VUE_APP_BASE_API
}/v1/api/folder/transfer/batchDownloadFile?userFileIds=${this.selectedFiles
.map((item) => item.userFileId)
.join(",")}`;
},
},
mounted() {
this.loadData();
},
methods: { methods: {
handleSearch(keyword) { handleSearch(keyword) {
console.log("search", keyword); this.loadData();
},
// 点击打开文件
handleOpenFile(file) {
this.$file.handleFileNameClickNew(file);
},
async loadData() {
this.loading = true;
const { size, current } = this.list;
let params = {
fileType: this.INTERNAL_RESOURCE.code,
filePath: this.INTERNAL_RESOURCE.path,
currentPage: current,
pageCount: size,
fileName: this.keyword,
};
let res = await getInnerFileList(params);
this.loading = false;
if (res.code == 200) {
this.list = res.data;
this.list.current = Number(this.list.current);
this.list.size = Number(this.list.size);
}
},
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedFiles = selection;
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/**
* 上传文件按钮点击事件
* @description 通过Bus通信,开启全局上传文件流程
* @param {boolean} uploadWay 上传方式 0-文件上传 1-文件夹上传 2-粘贴图片或拖拽上传
*/
handleUploadFileBtnClick(uploadWay) {
const params = { filePath: this.INTERNAL_RESOURCE.path, isDir: 0 };
this.$openBox.uploadFile({
params,
uploadWay,
serviceEl: this,
callType: 1, // callType 调用此服务的方式:1 - 顶部栏,2 - 右键菜单
});
},
// 点击收藏
handleCollect(row) {
console.log("点击收藏", row);
this.loading = true;
const { extendName, fileName } = row;
const filePath = "/我的收藏";
const WORD = ["docx", "doc"]; //暂时只考虑新建word的情况
let filetype = "w";
// const PDF = ["pdf", "doc"];
// const EXCEL = ["xlsx", "xls"];
if (WORD.includes(row.extendName)) {
filetype = "w";
}
const params = {
filetype,
extendName,
filePath,
fileName,
isTemplate: false,
templateId: "",
};
newfile(params)
.then((res) => {
this.loading = false;
if (res.code == 200) {
this.$message.success("收藏成功!");
}
})
.catch(() => {
this.loading = false;
});
}, },
loadData() {},
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
background-color: #f7f8fa; background-color: #f7f8fa;
padding: 20px 40px; padding: 20px;
}
.upload {
margin-bottom: 10px;
} }
.search-input { .search-input {
display: flex; display: flex;
...@@ -60,4 +279,27 @@ export default { ...@@ -60,4 +279,27 @@ export default {
} }
} }
} }
.table {
margin: 0 0 20px;
padding: 20px;
background-color: #fff;
border-radius: 4px;
.tools {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.fileName {
display: flex;
justify-content: center;
align-items: center;
img {
width: 18px;
height: 18px;
object-fit: contain;
margin-right: 4px;
}
}
</style> </style>
...@@ -143,8 +143,6 @@ import { shareStatusConstant, shareTypeConstant } from "./constant"; ...@@ -143,8 +143,6 @@ import { shareStatusConstant, shareTypeConstant } from "./constant";
import { fileTypeConstant } from "@/constants"; import { fileTypeConstant } from "@/constants";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
const { PUBLIC_SHARE } = shareTypeConstant; const { PUBLIC_SHARE } = shareTypeConstant;
const { MY_COLLECT } = fileTypeConstant;
export default { export default {
name: "myShare", name: "myShare",
dicts: ["share_type", "share_status"], dicts: ["share_type", "share_status"],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论