提交 995c38bd authored 作者: 龙菲's avatar 龙菲

第三方资源增加年份搜索

上级 1d660b24
import Vue from 'vue' import Vue from 'vue'
import router from '@/router/index' import router from '@/router/index'
import qwConfig from '@/utils/qwConfig'
import { Message } from 'element-ui' import { Message } from 'element-ui'
import { import {
fileImgMap, fileImgMap,
...@@ -86,67 +85,6 @@ const fileFunction = { ...@@ -86,67 +85,6 @@ const fileFunction = {
}&shareBatchNum=${row.shareBatchNum == null ? '' : row.shareBatchNum }&shareBatchNum=${row.shareBatchNum == null ? '' : row.shareBatchNum
}&extractionCode=${row.extractionCode == null ? '' : row.extractionCode}` }&extractionCode=${row.extractionCode == null ? '' : row.extractionCode}`
}, },
/**
* 获取 Onlyoffice 文件创建路径
* @param {object} row
* @returns {string} office 文件创建路径
*/
createFileOnlineByOffice(data) {
let fileUrl = `${location.protocol}//${location.host}${process.env.VUE_APP_BASE_API}`
const { href } = router.resolve({
name: 'Onlyoffice',
query: {
fileUrl: fileUrl,
fileName: data.fileName,
filePath: data.filePath,
extendName: data.extendName,
ot: 'add'
}
})
window.open(href, '_blank')
},
/**
* 获取 Onlyoffice 文件在线预览路径
* @param {object} row
* @returns {string} office 文件在线预览路径
*/
getFileOnlineViewPathByOffice(row) {
let userFileId = row.userFileId
const { href } = router.resolve({
name: 'Onlyoffice',
query: {
userFileId: userFileId,
ot: 'detail'
}
})
window.open(href, '_blank')
},
/**
* 获取 Onlyoffice 文件在线编辑路径
* @param {object} row
* @returns {string} office 文件在线编辑路径
*/
getFileOnlineEditPathByOffice(row) {
let userFileId = row.userFileId
const { href } = router.resolve({
name: 'Onlyoffice',
query: {
userFileId: userFileId,
ot: 'edit'
}
})
window.open(href, '_blank')
},
/**
* 获取分享链接
* @param {string} shareBatchNum
* @returns {string} 完整的分享链接
*/
getShareLink(shareBatchNum) {
return `${location.protocol}//${location.host}/share/${shareBatchNum}`
},
/** /**
* 复制分享链接 * 复制分享链接
* @param {string} shareBatchNum * @param {string} shareBatchNum
......
...@@ -21,31 +21,60 @@ ...@@ -21,31 +21,60 @@
>搜索 >搜索
</el-button> </el-button>
</div> </div>
<div class="years">
年份:
<el-radio-group v-model="currentYear">
<el-radio
v-for="(item, index) in years"
:key="index"
:label="item"
></el-radio>
</el-radio-group>
</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
props: {
hasType: {
type: Boolean,
default: true,
},
},
data() { data() {
return { return {
leftTabActiveName: "按类别",
tabs: ["报纸", "论文", "会议", "期刊"], tabs: ["报纸", "论文", "会议", "期刊"],
years: [
"全部",
"2020",
"2019",
"2018",
"2017",
"2016",
"2015",
"2014",
"2013",
"2012",
],
activeTab: "报纸", activeTab: "报纸",
keyword: "", keyword: "",
currentYear: "全部",
}; };
}, },
watch: {
currentYear(value) {
this.$emit("search");
},
},
methods: { methods: {
handleClickTab(item) { handleClickTab(item) {
this.activeTab = item; this.activeTab = item;
this.handleSearch(); this.handleSearch();
}, },
handleSearch() { handleSearch() {
const { keyword } = this; this.$emit("search");
const params = {
keyword,
// pageNo: 1,
// pageCount: 10,
};
this.$emit("search", params);
}, },
}, },
}; };
...@@ -56,7 +85,6 @@ export default { ...@@ -56,7 +85,6 @@ export default {
background-color: #fff; background-color: #fff;
padding: 20px; padding: 20px;
border-radius: 8px; border-radius: 8px;
.tab { .tab {
display: flex; display: flex;
margin-bottom: 20px; margin-bottom: 20px;
...@@ -102,5 +130,10 @@ export default { ...@@ -102,5 +130,10 @@ export default {
} }
} }
} }
.years {
display: flex;
align-items: center;
padding: 20px 10px 10px;
}
} }
</style> </style>
...@@ -17,10 +17,6 @@ ...@@ -17,10 +17,6 @@
@click.native="handleMultiDownload" @click.native="handleMultiDownload"
>批量下载</el-button >批量下载</el-button
> >
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</div> </div>
<el-table <el-table
v-loading="loading" v-loading="loading"
...@@ -54,6 +50,12 @@ ...@@ -54,6 +50,12 @@
show-overflow-tooltip show-overflow-tooltip
> >
</el-table-column> </el-table-column>
<el-table-column
show-overflow-tooltip
label="年份"
prop="year"
align="center"
/>
<el-table-column <el-table-column
show-overflow-tooltip show-overflow-tooltip
label="机构" label="机构"
...@@ -95,8 +97,8 @@ ...@@ -95,8 +97,8 @@
target="_blank" target="_blank"
type="primary" type="primary"
icon="el-icon-download" icon="el-icon-download"
:href="$file.getDownloadFilePath(scope.row)" :href="getDownloadFilePath(scope.row)"
:download="scope.row.fileName + '.' + scope.row.extendName" :download="getDownloadFileName(scope.row)"
> >
下载 下载
</el-link> </el-link>
...@@ -187,6 +189,18 @@ export default { ...@@ -187,6 +189,18 @@ export default {
this.$file.handleFileNameClickNew(file); this.$file.handleFileNameClickNew(file);
}, },
// 获取下载地址
getDownloadFilePath(file) {
return file.weburl;
},
// 获取下载文件名
getDownloadFileName(file) {
const { name, weburl } = file;
const suffix = weburl.split(".")[1];
return name + "." + suffix;
},
// 点击收藏 // 点击收藏
async handleCollect(file) { async handleCollect(file) {
let request; let request;
...@@ -209,8 +223,8 @@ export default { ...@@ -209,8 +223,8 @@ export default {
extendName, extendName,
filePath: "/我的收藏", filePath: "/我的收藏",
userId: this.$store.getters.userInfo.userId, userId: this.$store.getters.userInfo.userId,
//以下字段必填但可为空
deleteFlag: null, deleteFlag: null,
//以下字段
timeStampName: null, timeStampName: null,
storageType: null, storageType: null,
pointCount: null, pointCount: null,
...@@ -243,7 +257,7 @@ export default { ...@@ -243,7 +257,7 @@ export default {
align-items: center; align-items: center;
} }
.table { .table {
margin: 40px 0 20px; margin: 0 0 20px;
padding: 20px; padding: 20px;
background-color: #fff; background-color: #fff;
border-radius: 4px; border-radius: 4px;
......
...@@ -33,17 +33,20 @@ export default { ...@@ -33,17 +33,20 @@ export default {
methods: { methods: {
async loadData() { async loadData() {
this.loading = true; this.loading = true;
const { activeTab, keyword } = this.$refs.SearchBar; const { activeTab, keyword, currentYear } = this.$refs.SearchBar;
const { pageNo, pageCount } = this.$refs.Table.queryParams; const { pageNo, pageCount } = this.$refs.Table.queryParams;
const params = { const params = {
keyword, keyword,
pageNo, pageNo,
pageCount, pageCount,
year: currentYear,
}; };
if (keyword) { if (keyword) {
params.pageNo = 1; params.pageNo = 1;
} }
console.log(params); if (params.year == "全部") {
params.year = "";
}
let request; let request;
switch (activeTab) { switch (activeTab) {
case "报纸": case "报纸":
...@@ -71,6 +74,7 @@ export default { ...@@ -71,6 +74,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
background-color: #f7f8fa; background-color: #f7f8fa;
padding: 20px 40px; padding: 20px;
box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
} }
</style> </style>
<template> <template>
<div class="app-container container"> <div class="app-container container">
<SearchBar @search="handleRearch" /> <div class="search-input">
<Table /> <el-input
placeholder="输入关键词搜索,马上在线阅读"
v-model="keyword"
clearable
@keyup.native.enter="handleSearch"
></el-input>
<el-button icon="el-icon-search" type="primary" @click="handleSearch"
>搜索
</el-button>
</div>
<Table :list="list" @getList="loadData" v-loading="loading" />
</div> </div>
</template> </template>
<script> <script>
import SearchBar from "../components/searchBar/index.vue";
import Table from "../components/table/index.vue"; import Table from "../components/table/index.vue";
export default { export default {
components: { components: {
SearchBar,
Table, Table,
}, },
data() {
return {
keyword: "",
list: {
records: [],
totalElements: 0,
pageCount: 10,
pageNo: 1,
},
loading: false,
};
},
methods: { methods: {
handleRearch(keyword) { handleSearch(keyword) {
console.log("search",keyword); console.log("search", keyword);
}, },
loadData() {},
}, },
}; };
</script> </script>
...@@ -24,4 +45,19 @@ export default { ...@@ -24,4 +45,19 @@ export default {
background-color: #f7f8fa; background-color: #f7f8fa;
padding: 20px 40px; padding: 20px 40px;
} }
.search-input {
display: flex;
background-color: #fff;
padding: 20px;
border-radius: 8px;
.el-button {
margin-left: 20px;
}
::v-deep .el-input {
input {
background-color: #f7f8fa;
border: none;
}
}
}
</style> </style>
...@@ -248,7 +248,7 @@ export default { ...@@ -248,7 +248,7 @@ export default {
this.$refs["batchDownloadRef"].click(); this.$refs["batchDownloadRef"].click();
}, },
// 收藏 // 收藏
async handleCollect(row) { handleCollect(row) {
console.log("点击收藏", row); console.log("点击收藏", row);
this.loading = true; this.loading = true;
const { extendName, fileName } = row; const { extendName, fileName } = row;
...@@ -265,29 +265,19 @@ export default { ...@@ -265,29 +265,19 @@ export default {
extendName, extendName,
filePath, filePath,
fileName, fileName,
// isTemplate, isTemplate:false,
// templateId: templateId[0] || "", templateId: "",
}; };
let res = await newfile(params); newfile(params)
.then((res) => {
this.loading = false; this.loading = false;
if (res.code == 200) { if (res.code == 200) {
this.$message.success("收藏成功!"); this.$message.success("收藏成功!");
} }
// newfile(params) })
// .then((res) => { .catch(() => {
// this.sureBtnLoading = false; this.loading = false;
// if (res.code == 200) { });
// this.$message.success("文件创建成功");
// this.$refs[formName].resetFields();
// this.visible = false;
// this.callback("confirm");
// } else {
// this.$message.warning(res.message);
// }
// })
// .catch(() => {
// this.sureBtnLoading = false;
// });
}, },
}, },
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论