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

第三方资源增加年份搜索

上级 1d660b24
import Vue from 'vue'
import router from '@/router/index'
import qwConfig from '@/utils/qwConfig'
import { Message } from 'element-ui'
import {
fileImgMap,
......@@ -86,67 +85,6 @@ const fileFunction = {
}&shareBatchNum=${row.shareBatchNum == null ? '' : row.shareBatchNum
}&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
......
......@@ -21,31 +21,60 @@
>搜索
</el-button>
</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>
</template>
<script>
export default {
props: {
hasType: {
type: Boolean,
default: true,
},
},
data() {
return {
leftTabActiveName: "按类别",
tabs: ["报纸", "论文", "会议", "期刊"],
years: [
"全部",
"2020",
"2019",
"2018",
"2017",
"2016",
"2015",
"2014",
"2013",
"2012",
],
activeTab: "报纸",
keyword: "",
currentYear: "全部",
};
},
watch: {
currentYear(value) {
this.$emit("search");
},
},
methods: {
handleClickTab(item) {
this.activeTab = item;
this.handleSearch();
},
handleSearch() {
const { keyword } = this;
const params = {
keyword,
// pageNo: 1,
// pageCount: 10,
};
this.$emit("search", params);
this.$emit("search");
},
},
};
......@@ -56,7 +85,6 @@ export default {
background-color: #fff;
padding: 20px;
border-radius: 8px;
.tab {
display: flex;
margin-bottom: 20px;
......@@ -102,5 +130,10 @@ export default {
}
}
}
.years {
display: flex;
align-items: center;
padding: 20px 10px 10px;
}
}
</style>
......@@ -17,10 +17,6 @@
@click.native="handleMultiDownload"
>批量下载</el-button
>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</div>
<el-table
v-loading="loading"
......@@ -54,6 +50,12 @@
show-overflow-tooltip
>
</el-table-column>
<el-table-column
show-overflow-tooltip
label="年份"
prop="year"
align="center"
/>
<el-table-column
show-overflow-tooltip
label="机构"
......@@ -95,8 +97,8 @@
target="_blank"
type="primary"
icon="el-icon-download"
:href="$file.getDownloadFilePath(scope.row)"
:download="scope.row.fileName + '.' + scope.row.extendName"
:href="getDownloadFilePath(scope.row)"
:download="getDownloadFileName(scope.row)"
>
下载
</el-link>
......@@ -187,6 +189,18 @@ export default {
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) {
let request;
......@@ -209,8 +223,8 @@ export default {
extendName,
filePath: "/我的收藏",
userId: this.$store.getters.userInfo.userId,
//以下字段必填但可为空
deleteFlag: null,
//以下字段
timeStampName: null,
storageType: null,
pointCount: null,
......@@ -243,7 +257,7 @@ export default {
align-items: center;
}
.table {
margin: 40px 0 20px;
margin: 0 0 20px;
padding: 20px;
background-color: #fff;
border-radius: 4px;
......
......@@ -33,17 +33,20 @@ export default {
methods: {
async loadData() {
this.loading = true;
const { activeTab, keyword } = this.$refs.SearchBar;
const { activeTab, keyword, currentYear } = this.$refs.SearchBar;
const { pageNo, pageCount } = this.$refs.Table.queryParams;
const params = {
keyword,
pageNo,
pageCount,
year: currentYear,
};
if (keyword) {
params.pageNo = 1;
}
console.log(params);
if (params.year == "全部") {
params.year = "";
}
let request;
switch (activeTab) {
case "报纸":
......@@ -71,6 +74,7 @@ export default {
<style lang="scss" scoped>
.container {
background-color: #f7f8fa;
padding: 20px 40px;
padding: 20px;
box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
}
</style>
<template>
<div class="app-container container">
<SearchBar @search="handleRearch" />
<Table />
<div class="search-input">
<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>
</template>
<script>
import SearchBar from "../components/searchBar/index.vue";
import Table from "../components/table/index.vue";
export default {
components: {
SearchBar,
Table,
},
data() {
return {
keyword: "",
list: {
records: [],
totalElements: 0,
pageCount: 10,
pageNo: 1,
},
loading: false,
};
},
methods: {
handleRearch(keyword) {
console.log("search",keyword);
handleSearch(keyword) {
console.log("search", keyword);
},
loadData() {},
},
};
</script>
......@@ -24,4 +45,19 @@ export default {
background-color: #f7f8fa;
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>
......@@ -248,7 +248,7 @@ export default {
this.$refs["batchDownloadRef"].click();
},
// 收藏
async handleCollect(row) {
handleCollect(row) {
console.log("点击收藏", row);
this.loading = true;
const { extendName, fileName } = row;
......@@ -265,29 +265,19 @@ export default {
extendName,
filePath,
fileName,
// isTemplate,
// templateId: templateId[0] || "",
isTemplate:false,
templateId: "",
};
let res = await newfile(params);
newfile(params)
.then((res) => {
this.loading = false;
if (res.code == 200) {
this.$message.success("收藏成功!");
}
// newfile(params)
// .then((res) => {
// this.sureBtnLoading = 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;
// });
})
.catch(() => {
this.loading = false;
});
},
},
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论