提交 ac60ec94 authored 作者: 龙菲's avatar 龙菲

修改我的共享为仅我分享出去的,增加共享社区为分享给我的

上级 45552d0d
<template>
<!-- 别人分享给我的 -->
<div>
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="文件名称" prop="fileName">
<el-input
v-model="queryParams.fileName"
placeholder="请输入文件名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
clearable
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<div class="mb8">
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click.native="handleMultiDownload"
>批量下载</el-button
>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</div>
<el-table
v-loading="loading"
:data="shareList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="文件名称"
align="center"
prop="fileName"
:show-overflow-tooltip="true"
>
<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"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.share_type"
:value="scope.row.shareType"
/>
</template>
</el-table-column>
<el-table-column
label="分享人"
align="center"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
{{ scope.row.shareFrom }}
</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="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
v-show="total > 0"
:total="total"
:page.sync="queryParams.currentPage"
:limit.sync="queryParams.pageCount"
@pagination="getList"
/>
<!-- 多选文件下载,页面隐藏 -->
<a :href="batchDownloadLink" ref="batchDownloadRef"></a>
</div>
</template>
<script>
import { getMyShareList, removeShare } from "@/api/user/share";
import { shareStatusConstant } from "../constant";
import { mapGetters } from "vuex";
export default {
name: "myShare",
dicts: ["share_type", "share_status"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
selectedFiles: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
shareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
currentPage: 1,
pageCount: 10,
fileName: "", //文件名称
shareStatus: "", //分享状态
shareTo: "", //分享给谁
},
// 分享状态常量
shareStatusConstant,
// 批量取消的弹窗可见性
multiCancelVisible: false,
selectedFiles: [],
};
},
computed: {
...mapGetters(["userInfo"]),
// 批量下载文件链接
batchDownloadLink() {
return `${
process.env.VUE_APP_BASE_API
}/v1/api/folder/transfer/batchDownloadFile?userFileIds=${this.selectedFiles
.map((item) => item.userFileId)
.join(",")}`;
},
},
created() {
this.getList();
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedFiles = selection;
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
// 分享给我的
this.queryParams.shareTo = this.userInfo.userId;
getMyShareList(this.queryParams).then((res) => {
this.total = res.data.total;
this.loading = false;
this.shareList = res.data.records;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.resetForm("queryForm");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.currentPage = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 点击打开文件
handleOpenFile(file) {
this.$file.handleFileNameClickNew(file);
},
// 批量下载
handleMultiDownload() {
this.$refs["batchDownloadRef"].click();
},
},
};
</script>
<style lang="scss" scoped>
.fileName {
display: flex;
justify-content: center;
align-items: center;
img {
width: 18px;
height: 18px;
object-fit: contain;
margin-right: 4px;
}
}
.multi-verify {
.buttons {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
}
</style>
<template>
<!-- 分享给别人的 -->
<div>
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="文件名称" prop="fileName">
<el-input
v-model="queryParams.fileName"
placeholder="请输入文件名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
clearable
/>
</el-form-item>
<el-form-item label="分享状态" prop="fileName">
<el-select
v-model="queryParams.shareStatus"
placeholder="请选择分享状态"
clearable
>
<el-option
v-for="item in dict.type.share_status"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<div class="mb8">
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click.native="handleMultiRevoke"
>批量取消分享</el-button
>
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click.native="handleMultiDownload"
>批量下载</el-button
>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</div>
<el-table
v-loading="loading"
:data="shareList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="文件名称"
align="center"
prop="fileName"
:show-overflow-tooltip="true"
>
<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"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.share_type"
:value="scope.row.shareType"
/>
</template>
</el-table-column>
<el-table-column label="分享状态" align="center" prop="status">
<template slot-scope="scope">
<el-tag :type="getShareStatusTagType(scope.row.shareStatus)"
><dict-tag
:options="dict.type.share_status"
:value="scope.row.shareStatus"
/></el-tag>
</template>
</el-table-column>
<el-table-column
label="审核意见"
align="center"
prop="verifyDesc"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-link
v-if="scope.row.shareStatus == shareStatusConstant.SHARED"
type="primary"
icon="el-icon-circle-close"
@click="handleCancelShare(scope.row.shareId)"
>
取消分享
</el-link>
<el-divider
direction="vertical"
v-if="scope.row.shareStatus == shareStatusConstant.SHARED"
></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
v-show="total > 0"
:total="total"
:page.sync="queryParams.currentPage"
:limit.sync="queryParams.pageCount"
@pagination="getList"
/>
<!-- 多选文件下载,页面隐藏 -->
<a :href="batchDownloadLink" ref="batchDownloadRef"></a>
<el-dialog
title="批量取消"
:visible.sync="multiCancelVisible"
width="400px"
>
<div class="multi-verify">
<div class="text">
一共选择了{{ selectedFiles.length }}条数据,是否确定批量取消分享?
</div>
<div class="buttons">
<el-button
size="mini"
type="primary"
icon="el-icon-check"
@click="handleSubmitMultiRemoveShare"
>确定</el-button
>
<el-button
size="mini"
type="text"
@click="handleCloseMultiRemoveShare"
>取消</el-button
>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { getMyShareList, removeShare } from "@/api/user/share";
import { shareStatusConstant } from "../constant";
import { mapGetters } from "vuex";
export default {
name: "myShare",
dicts: ["share_type", "share_status"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
selectedFiles: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
shareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
currentPage: 1,
pageCount: 10,
fileName: "", //文件名称
shareStatus: "", //分享状态
},
// 分享状态常量
shareStatusConstant,
// 批量取消的弹窗可见性
multiCancelVisible: false,
};
},
computed: {
...mapGetters(["userInfo"]),
getShareStatusTagType(shareStatus) {
return (shareStatus) => {
switch (shareStatus) {
case shareStatusConstant.SHARED: //已分享
return "success";
case shareStatusConstant.IS_REVIEW: //审核中
return "primary";
case shareStatusConstant.REVOKED: //已撤销
return "info";
case shareStatusConstant.REJECTED: //已驳回
return "danger";
}
};
},
// 批量下载文件链接
batchDownloadLink() {
return `${
process.env.VUE_APP_BASE_API
}/v1/api/folder/transfer/batchDownloadFile?userFileIds=${this.selectedFiles
.map((item) => item.userFileId)
.join(",")}`;
},
},
created() {
this.getList();
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedFiles = selection;
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
this.queryParams.shareFrom = this.userInfo.userId;
getMyShareList(this.queryParams).then((res) => {
this.total = res.data.total;
this.loading = false;
this.shareList = res.data.records;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.resetForm("queryForm");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.currentPage = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 点击取消分享
async handleCancelShare(fileIds) {
const params = {
fileIds,
};
let res = await removeShare(params);
if (res.code == 200) {
this.$message.success("取消分享成功!");
this.getList();
}
},
// 批量取消分享
handleMultiRevoke() {
this.multiCancelVisible = true;
},
// 批量下载
handleMultiDownload() {
this.$refs["batchDownloadRef"].click();
},
// 提交批量取消分享
handleSubmitMultiRemoveShare() {
const fileIds = this.selectedFiles.map((item) => item.shareId).join(",");
this.handleCancelShare(fileIds);
this.handleCloseMultiRemoveShare();
},
// 关闭批量取消分享
handleCloseMultiRemoveShare() {
this.multiCancelVisible = false;
},
// 点击打开文件
handleOpenFile(file) {
this.$file.handleFileNameClickNew(file);
},
},
};
</script>
<style lang="scss" scoped>
.fileName {
display: flex;
justify-content: center;
align-items: center;
img {
width: 18px;
height: 18px;
object-fit: contain;
margin-right: 4px;
}
}
.multi-verify {
.buttons {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
}
</style>
<template> <template>
<!-- 分享给别人的 -->
<div class="app-container"> <div class="app-container">
<el-tabs v-model="tabActive" type="card"> <el-form
<el-tab-pane label="别人分享给我的" name="shareFrom"> :model="queryParams"
<ShareFrom ref="ShareFrom" /> ref="queryForm"
</el-tab-pane> size="small"
<el-tab-pane label="我分享的" name="shareTo"> :inline="true"
<ShareTo ref="ShareTo" /> v-show="showSearch"
</el-tab-pane> label-width="68px"
</el-tabs> >
<el-form-item label="文件名称" prop="fileName">
<el-input
v-model="queryParams.fileName"
placeholder="请输入文件名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
clearable
/>
</el-form-item>
<el-form-item label="分享状态" prop="fileName">
<el-select
v-model="queryParams.shareStatus"
placeholder="请选择分享状态"
clearable
>
<el-option
v-for="item in dict.type.share_status"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<div class="mb8">
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click.native="handleMultiRevoke"
>批量取消分享</el-button
>
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click.native="handleMultiDownload"
>批量下载</el-button
>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</div>
<el-table
v-loading="loading"
:data="shareList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="文件名称"
align="center"
prop="fileName"
:show-overflow-tooltip="true"
>
<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"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.share_type"
:value="scope.row.shareType"
/>
</template>
</el-table-column>
<el-table-column label="分享状态" align="center" prop="status">
<template slot-scope="scope">
<el-tag :type="getShareStatusTagType(scope.row.shareStatus)"
><dict-tag
:options="dict.type.share_status"
:value="scope.row.shareStatus"
/></el-tag>
</template>
</el-table-column>
<el-table-column
label="审核意见"
align="center"
prop="verifyDesc"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-link
v-if="scope.row.shareStatus == shareStatusConstant.SHARED"
type="primary"
icon="el-icon-circle-close"
@click="handleCancelShare(scope.row.shareId)"
>
取消分享
</el-link>
<el-divider
direction="vertical"
v-if="scope.row.shareStatus == shareStatusConstant.SHARED"
></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
v-show="total > 0"
:total="total"
:page.sync="queryParams.currentPage"
:limit.sync="queryParams.pageCount"
@pagination="getList"
/>
<!-- 多选文件下载,页面隐藏 -->
<a :href="batchDownloadLink" ref="batchDownloadRef"></a>
<el-dialog
title="批量取消"
:visible.sync="multiCancelVisible"
width="400px"
>
<div class="multi-verify">
<div class="text">
一共选择了{{ selectedFiles.length }}条数据,是否确定批量取消分享?
</div>
<div class="buttons">
<el-button
size="mini"
type="primary"
icon="el-icon-check"
@click="handleSubmitMultiRemoveShare"
>确定</el-button
>
<el-button
size="mini"
type="text"
@click="handleCloseMultiRemoveShare"
>取消</el-button
>
</div>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import ShareTo from "./components/shareTo"; import { getMyShareList, removeShare } from "@/api/user/share";
import ShareFrom from "./components/shareFrom"; import { shareStatusConstant } from "./constant";
import { mapGetters } from "vuex";
export default { export default {
components: { name: "myShare",
ShareTo, dicts: ["share_type", "share_status"],
ShareFrom,
},
watch: {
tabActive(value) {
if (value == "shareFrom") {
this.$refs.ShareFrom.getList();
}
if (value == "shareTo") {
this.$refs.ShareTo.getList();
}
},
},
data() { data() {
return { return {
tabActive: "shareFrom", // 遮罩层
loading: true,
// 选中数组
selectedFiles: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
shareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
currentPage: 1,
pageCount: 10,
fileName: "", //文件名称
shareStatus: "", //分享状态
},
// 分享状态常量
shareStatusConstant,
// 批量取消的弹窗可见性
multiCancelVisible: false,
}; };
}, },
computed: {
...mapGetters(["userInfo"]),
getShareStatusTagType(shareStatus) {
return (shareStatus) => {
switch (shareStatus) {
case shareStatusConstant.SHARED: //已分享
return "success";
case shareStatusConstant.IS_REVIEW: //审核中
return "primary";
case shareStatusConstant.REVOKED: //已撤销
return "info";
case shareStatusConstant.REJECTED: //已驳回
return "danger";
}
};
},
// 批量下载文件链接
batchDownloadLink() {
return `${
process.env.VUE_APP_BASE_API
}/v1/api/folder/transfer/batchDownloadFile?userFileIds=${this.selectedFiles
.map((item) => item.userFileId)
.join(",")}`;
},
},
created() {
this.getList();
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedFiles = selection;
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
this.queryParams.shareFrom = this.userInfo.userId;
getMyShareList(this.queryParams).then((res) => {
this.total = res.data.total;
this.loading = false;
this.shareList = res.data.records;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.resetForm("queryForm");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.currentPage = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 点击取消分享
async handleCancelShare(fileIds) {
const params = {
fileIds,
};
let res = await removeShare(params);
if (res.code == 200) {
this.$message.success("取消分享成功!");
this.getList();
}
},
// 批量取消分享
handleMultiRevoke() {
this.multiCancelVisible = true;
},
// 批量下载
handleMultiDownload() {
this.$refs["batchDownloadRef"].click();
},
// 提交批量取消分享
handleSubmitMultiRemoveShare() {
const fileIds = this.selectedFiles.map((item) => item.shareId).join(",");
this.handleCancelShare(fileIds);
this.handleCloseMultiRemoveShare();
},
// 关闭批量取消分享
handleCloseMultiRemoveShare() {
this.multiCancelVisible = false;
},
// 点击打开文件
handleOpenFile(file) {
this.$file.handleFileNameClickNew(file);
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.app-container { .fileName {
height: 100%; display: flex;
justify-content: center;
align-items: center;
img {
width: 18px;
height: 18px;
object-fit: contain;
margin-right: 4px;
}
}
.multi-verify {
.buttons {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
} }
</style> </style>
//分享类型
export const shareTypeConstant = {
PUBLIC_SHARE: 0, //分享给公共社区
DEPT_SHARE: 1, //分享给部门
PERSONAL_SHARE: 2 //分享给个人
}
// 分享状态
export const shareStatusConstant = {
SHARED: 0, //已分享
IS_REVIEW: 1,//审核中 仅部门和社区需要审核,分享到个人不需要审核
REVOKED: 2,//已撤销
REJECTED: 3,//已驳回
}
\ No newline at end of file
<template> <template>
<div>共享社区</div> <!-- 别人分享给我的 -->
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="文件名称" prop="fileName">
<el-input
v-model="queryParams.fileName"
placeholder="请输入文件名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
clearable
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<div class="mb8">
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click.native="handleMultiDownload"
>批量下载</el-button
>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</div>
<el-table
v-loading="loading"
:data="shareList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="文件名称"
align="center"
prop="fileName"
:show-overflow-tooltip="true"
>
<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"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.share_type"
:value="scope.row.shareType"
/>
</template>
</el-table-column>
<el-table-column
label="分享人"
align="center"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
{{ scope.row.shareFrom }}
</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="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
v-show="total > 0"
:total="total"
:page.sync="queryParams.currentPage"
:limit.sync="queryParams.pageCount"
@pagination="getList"
/>
<!-- 多选文件下载,页面隐藏 -->
<a :href="batchDownloadLink" ref="batchDownloadRef"></a>
</div>
</template> </template>
<script></script>
<style lang="scss"></style> <script>
import { getMyShareList, removeShare } from "@/api/user/share";
import { shareStatusConstant } from "./constant";
import { mapGetters } from "vuex";
export default {
name: "myShare",
dicts: ["share_type", "share_status"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
selectedFiles: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
shareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
currentPage: 1,
pageCount: 10,
fileName: "", //文件名称
shareStatus: "", //分享状态
shareTo: "", //分享给谁
},
// 分享状态常量
shareStatusConstant,
// 批量取消的弹窗可见性
multiCancelVisible: false,
selectedFiles: [],
};
},
computed: {
...mapGetters(["userInfo"]),
// 批量下载文件链接
batchDownloadLink() {
return `${
process.env.VUE_APP_BASE_API
}/v1/api/folder/transfer/batchDownloadFile?userFileIds=${this.selectedFiles
.map((item) => item.userFileId)
.join(",")}`;
},
},
created() {
this.getList();
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedFiles = selection;
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
// 分享给我的
this.queryParams.shareTo = this.userInfo.userId;
getMyShareList(this.queryParams).then((res) => {
this.total = res.data.total;
this.loading = false;
this.shareList = res.data.records;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.resetForm("queryForm");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.currentPage = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 点击打开文件
handleOpenFile(file) {
this.$file.handleFileNameClickNew(file);
},
// 批量下载
handleMultiDownload() {
this.$refs["batchDownloadRef"].click();
},
},
};
</script>
<style lang="scss" scoped>
.fileName {
display: flex;
justify-content: center;
align-items: center;
img {
width: 18px;
height: 18px;
object-fit: contain;
margin-right: 4px;
}
}
.multi-verify {
.buttons {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论