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

修改我的分享选择人员为非权限接口;增加分享给我的tab;增加我的收藏的取消收藏

上级 f584102f
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
// 查询用户列表
// 查询用户列表(带权限)
export function listUser(query) {
return request({
url: '/system/user/list',
......@@ -10,6 +10,16 @@ export function listUser(query) {
})
}
// 查询用户列表
export function getAllUserList(query) {
return request({
url: '/system/user/getAllUser',
method: 'get',
params: query
})
}
// 查询用户详细
export function getUser(userId) {
return request({
......
......@@ -20,3 +20,12 @@ export const getCollect = params => {
params
})
}
// 取消收藏
export const cancelCollect = params => {
return request({
url: baseUrl + '/folder/file/removeFavorite',
method: 'get',
params
})
}
......@@ -27,6 +27,7 @@ export const getShare = params => {
export const getMyShareList = params => {
return request({
url: baseUrl + '/folder/share/shareList',
// url: baseUrl + '/folder/share/searchShareList',
method: 'get',
params
})
......
......@@ -83,6 +83,7 @@ import {
getMyShareFileList,
searchFile,
} from "@/api/qwFile";
import { fileTypeConstant, collectConstant } from "./constants";
export default {
name: "FileList",
......@@ -105,6 +106,8 @@ export default {
total: 0,
},
searchFileName: "", //当前搜索的文件名称,支持文件名和文件夹名
...fileTypeConstant,
...collectConstant,
};
},
computed: {
......@@ -209,6 +212,11 @@ export default {
pageCount: this.pageData.pageCount,
fileName: this.searchFileName,
};
// 我的收藏界面只显示已收藏的
if (this.fileType == this.MY_COLLECT) {
data.removeFlag = this.COLLECTED;
}
const params = new URLSearchParams();
for (const key in data) {
params.append(key, data[key]);
......@@ -250,142 +258,12 @@ export default {
}
});
},
/**
* 表格数据获取相关事件 | 获取我的创作文件列表
*/
showMyCreateFile() {
let data = {
fileType: this.fileType,
filePath: this.filePath,
currentPage: this.pageData.currentPage,
pageCount: this.pageData.pageCount,
fileName: this.searchFileName,
};
const params = new URLSearchParams();
for (const key in data) {
params.append(key, data[key]);
}
getFileListByPath(params).then((res) => {
if (res.code == 200) {
this.fileList = res.data.records;
this.pageData.total = res.data.total;
this.loading = false;
} else {
this.$message.error(res.msg);
}
});
},
/**
* 表格数据获取相关事件 | 获取我的收藏文件列表
*/
showMyFavoriteFile() {
let data = {
fileType: this.fileType,
filePath: this.filePath,
currentPage: this.pageData.currentPage,
pageCount: this.pageData.pageCount,
fileName: this.searchFileName,
};
const params = new URLSearchParams();
for (const key in data) {
params.append(key, data[key]);
}
getFileListByPath(params).then((res) => {
if (res.code == 200) {
this.fileList = res.data.records;
this.pageData.total = res.data.total;
} else {
this.$message.error(res.msg);
}
this.loading = false;
});
},
/**
* 表格数据获取相关事件 | 获取我的笔记文件列表
*/
showMyNoteFile() {
let data = {
fileType: this.fileType,
filePath: this.filePath,
currentPage: this.pageData.currentPage,
pageCount: this.pageData.pageCount,
fileName: this.searchFileName,
};
const params = new URLSearchParams();
for (const key in data) {
params.append(key, data[key]);
}
getFileListByPath(params).then((res) => {
if (res.code == 200) {
this.fileList = res.data.records;
this.pageData.total = res.data.total;
} else {
this.$message.error(res.msg);
}
this.loading = false;
});
},
/**
* 表格数据获取相关事件 | 获取我的分享列表
*/
showMyShareFile() {
let data = {
shareFilePath: this.filePath,
shareBatchNum: this.$route.query.shareBatchNum,
currentPage: this.pageData.currentPage,
pageCount: this.pageData.pageCount,
};
getMyShareFileList(data).then((res) => {
if (res.code == 200) {
this.fileList = res.data.records;
this.pageData.total = Number(res.data.total);
} else {
this.$message.error(res.msg);
}
this.loading = false;
});
},
/**
* 表格数据获取相关事件 | 根据文件类型展示文件列表
*/
showFileListByType() {
// 分类型
let data = {
fileType: this.fileType,
currentPage: this.pageData.currentPage,
pageCount: this.pageData.pageCount,
};
getFileListByType(data).then((res) => {
if (res.code == 200) {
this.fileList = res.data.records;
this.pageData.total = Number(res.data.total);
this.loading = false;
} else {
this.$message.error(res.msg);
}
});
},
/**
* 获取搜索文件结果列表
* @param {string} fileName 文件名称
*/
getSearchFileList(fileName) {
// this.loading = true;
this.searchFileName = fileName;
// searchFile({
// currentPage: this.pageData.currentPage,
// pageCount: this.pageData.pageCount,
// fileName: fileName,
// }).then((res) => {
// this.loading = false;
// if (res.code == 200) {
// this.fileList = res.data.records;
// this.pageData.total = res.data.total;
// } else {
// this.$message.error(res.msg);
// }
// });
},
},
};
......
......@@ -16,6 +16,13 @@
>
<i class="el-icon-view"></i> 查看
</li>
<li
class="right-menu-item"
@click="handleCancelCollect(selectedFile)"
v-if="cancelCollectBtnShow"
>
<i class="el-icon-star-off"></i> 取消收藏
</li>
<li
class="right-menu-item"
@click="handleDeleteFileBtnClick(selectedFile)"
......@@ -23,13 +30,13 @@
>
<i class="el-icon-delete"></i> 删除
</li>
<li
<!-- <li
class="right-menu-item"
@click="handleRestoreFileBtnClick(selectedFile)"
v-if="restoreBtnShow"
>
<i class="el-icon-refresh-left"></i> 还原
</li>
</li> -->
<li
class="right-menu-item"
@click="handleCopyFileBtnClick(selectedFile)"
......@@ -146,15 +153,23 @@
<li class="right-menu-item" @click="callback('confirm')">
<i class="el-icon-refresh"></i> 刷新
</li>
<template v-if="fileType === 0">
<template>
<el-divider />
<li class="right-menu-item" @click="handleClickAddFolderBtn">
<li
class="right-menu-item"
@click="handleClickAddFolderBtn"
v-if="[MY_CREATE, TEMPLATE_MANAGE, MY_COLLECT].includes(fileType)"
>
<i class="el-icon-folder-add"></i> 新建文件夹
</li>
<!-- <li class="right-menu-item" @click="handleCreateFile('docx')">
<img :src="wordImg" />新建 Word 空白文档
</li> -->
<li class="right-menu-item" @click="handleCreateFileByTemplate('docx')">
<li
class="right-menu-item"
@click="handleCreateFileByTemplate('docx')"
v-if="[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)"
>
<img :src="wordImg" />新建Word文档
</li>
<!-- <li class="right-menu-item" @click="handleCreateFile('xlsx')">
......@@ -163,16 +178,27 @@
<li class="right-menu-item" @click="handleCreateFile('pptx')">
<img :src="pptImg" />新建 PPT 演示文稿
</li> -->
<el-divider />
<li class="right-menu-item" @click="handleUploadFileBtnClick(1)">
<i class="el-icon-upload2"></i> 上传文件
</li>
<li class="right-menu-item" @click="handleUploadFileBtnClick(2)">
<i class="el-icon-folder-opened"></i> 上传文件夹
</li>
<li class="right-menu-item" @click="handleUploadFileBtnClick(3)">
<i class="el-icon-thumb"></i> 拖拽上传
</li>
<span v-if="[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)">
<el-divider />
<li
class="right-menu-item"
@click="handleUploadFileBtnClick(FILE_UPLOAD)"
>
<i class="el-icon-upload2"></i> 上传文件
</li>
<li
class="right-menu-item"
@click="handleUploadFileBtnClick(FOLDER_UPLOAD)"
>
<i class="el-icon-folder-opened"></i> 上传文件夹
</li>
<li
class="right-menu-item"
@click="handleUploadFileBtnClick(PASTE_DRAG)"
>
<i class="el-icon-thumb"></i> 拖拽上传
</li>
</span>
</template>
</ul>
</transition>
......@@ -180,11 +206,14 @@
<script>
import router from "@/router/index.js";
import store from "@/store";
import {
officeFileType,
fileSuffixCodeModeMap,
markdownFileType,
} from "@/libs/qiwen/map.js";
import { fileTypeConstant, uploadModeConstant } from "../../constants";
import { cancelCollect } from "@/api/user/collect";
export default {
name: "ContextMenu",
......@@ -213,6 +242,8 @@ export default {
wordImg: require("@/assets/images/file/file_word.svg"),
excelImg: require("@/assets/images/file/file_excel.svg"),
pptImg: require("@/assets/images/file/file_ppt.svg"),
...fileTypeConstant,
...uploadModeConstant,
};
},
computed: {
......@@ -234,41 +265,53 @@ export default {
seeBtnShow() {
return this.fileType !== 6;
},
// 取消收藏按钮是否显示
cancelCollectBtnShow() {
return this.fileType == this.MY_COLLECT; //我的收藏才显示
},
// 删除按钮是否显示
deleteBtnShow() {
return this.fileType !== 8 && !["Share"].includes(this.routeName);
return this.fileType != this.MY_COLLECT; //我的收藏不能删除
// return this.fileType !== 8 && !["Share"].includes(this.routeName);
},
// 还原按钮是否显示
restoreBtnShow() {
return this.fileType === 6 && !["Share"].includes(this.routeName);
return true;
// return this.fileType === 6 && !["Share"].includes(this.routeName);
},
// 复制按钮是否显示
copyBtnShow() {
return (
![6, 8].includes(this.fileType) && !["Share"].includes(this.routeName)
);
return true;
// return (
// ![6, 8].includes(this.fileType) && !["Share"].includes(this.routeName)
// );
},
// 移动按钮是否显示
moveBtnShow() {
return (
![6, 8].includes(this.fileType) && !["Share"].includes(this.routeName)
);
return true;
// return (
// ![6, 8].includes(this.fileType) && !["Share"].includes(this.routeName)
// );
},
// 重命名按钮是否显示
renameBtnShow() {
return (
![6, 8].includes(this.fileType) && !["Share"].includes(this.routeName)
);
return this.fileType != this.MY_COLLECT; //我的收藏不能重命名
// return (
// ![6, 8].includes(this.fileType) && !["Share"].includes(this.routeName)
// );
},
// 分享按钮是否显示
shareBtnShow() {
return (
![6, 8].includes(this.fileType) && !["Share"].includes(this.routeName)
);
return true;
// return (
// ![6, 8].includes(this.fileType) && !["Share"].includes(this.routeName)
// );
},
// 下载按钮是否显示
downloadBtnShow() {
return ![6, 8].includes(this.fileType);
return true;
// return ![6, 8].includes(this.fileType);
},
// 解压缩按钮是否显示
unzipBtnShow() {
......@@ -288,13 +331,20 @@ export default {
},
// 在线编辑按钮是否显示
onlineEditBtnShow() {
// 只有我的Word文件才显示
// 根据当前文件的作者的userId进行判断,和本人一致则是可编辑
console.log("onlineEditBtnShow", this.selectedFile);
return (
![6, 8].includes(this.fileType) &&
(this.officeFileType.includes(this.selectedFile.extendName) ||
this.markdownFileType.includes(this.selectedFile.extendName) ||
this.fileSuffixCodeModeMap.has(this.selectedFile.extendName)) &&
!["Share"].includes(this.routeName)
["doc", "docx"].includes(this.selectedFile.extendName) &&
this.selectedFile.userId == store.getters.userInfo.userId
);
// return (
// ![6, 8].includes(this.fileType) &&
// (this.officeFileType.includes(this.selectedFile.extendName) ||
// this.markdownFileType.includes(this.selectedFile.extendName) ||
// this.fileSuffixCodeModeMap.has(this.selectedFile.extendName)) &&
// !["Share"].includes(this.routeName)
// );
},
// 复制链接按钮是否显示
copyLinkBtnShow() {
......@@ -431,6 +481,7 @@ export default {
this.callback(res);
});
},
/**
* 删除按钮点击事件
* @description 区分 删除到回收站中 | 在回收站中彻底删除,打开确认对话框
......@@ -448,6 +499,22 @@ export default {
this.callback(res);
});
},
/**
* 取消收藏事件
*/
handleCancelCollect(fileInfo) {
const { userFileId } = fileInfo;
const params = { fileIds: userFileId };
cancelCollect(params).then((res) => {
if (res.code == 200) {
this.$message.success("取消收藏成功!");
}
});
// 在then里面调用不生效
this.callback("confirm");
},
/**
* 还原按钮点击事件
* @description 调用接口,在回收站中还原文件
......@@ -464,6 +531,7 @@ export default {
this.callback(res);
});
},
/**
* 文件重命名按钮点击事件
* @description 打开确认对话框让用户输入新的文件名
......@@ -510,19 +578,7 @@ export default {
* @param {object} fileInfo 文件信息
*/
handleClickFileEdit(fileInfo) {
if (this.officeFileType.includes(fileInfo.extendName)) {
// office 编辑页面
this.$file.getFileOnlineEditPathByOffice(fileInfo);
} else if (this.markdownFileType.includes(fileInfo.extendName)) {
// markdown 编辑浮层
this.$openBox.markdownPreview({
fileInfo: fileInfo,
editable: true,
});
} else {
// 代码编辑对话框
this.$openBox.codePreview({ fileInfo: fileInfo, isEdit: true });
}
this.$file.handleFileNameClickNew(fileInfo);
},
/**
* 文件详情按钮点击事件
......
......@@ -91,7 +91,9 @@
<ul class="file-list" v-show="!collapse">
<li
class="file-item"
:class="{ 'custom-status-item': uploadStatus[file.id] !== '' }"
:class="{
'custom-status-item': uploadStatus[file.id] !== '',
}"
v-for="file in props.fileList"
:key="file.id"
>
......@@ -305,7 +307,6 @@ export default {
* @param {string} response 服务端响应内容,永远都是字符串
*/
handleFileSuccess(rootFile, file, response) {
if (response == "") {
this.uploadStatus[file.id] = "上传失败";
this.callback(false);
......@@ -313,7 +314,7 @@ export default {
}
let result = JSON.parse(response);
if (result.code===200) {
if (result.code === 200) {
this.uploadStatus[file.id] = "";
if (this.filesLength === 1) {
// 本次所有的文件均已上传完毕
......@@ -369,10 +370,11 @@ export default {
currentChunk++;
loadNext();
// 实时展示MD5的计算进度
this.uploadStatus[file.id] = `校验MD5 ${((currentChunk / chunks) * 100).toFixed(
0
)}%`;
this.uploadStatus = JSON.parse(JSON.stringify(this.uploadStatus))
this.uploadStatus[file.id] = `校验MD5 ${(
(currentChunk / chunks) *
100
).toFixed(0)}%`;
this.uploadStatus = JSON.parse(JSON.stringify(this.uploadStatus));
} else {
let md5 = spark.end();
this.calculateFileMD5End(md5, file);
......@@ -409,8 +411,8 @@ export default {
file.uniqueIdentifier = md5;
file.resume();
// 移除自定义状态
this.uploadStatus[file.id] = ''
this.uploadStatus = JSON.parse(JSON.stringify(this.uploadStatus))
this.uploadStatus[file.id] = "";
this.uploadStatus = JSON.parse(JSON.stringify(this.uploadStatus));
},
/**
* 关闭上传面板,并停止上传
......
......@@ -322,7 +322,7 @@ export default {
border-top: 1px solid $BorderBase;
.file-list {
height: calc(100vh - 206px);
height: calc(100vh - 300px);
overflow-y: auto;
display: flex;
flex-wrap: wrap;
......
......@@ -4,13 +4,15 @@
:class="'file-type-' + fileType"
ref="operationMenuRef"
>
<!-- 我的创作和模板管理使用按钮组,我的收藏使用单个按钮(因为只用到新建文件夹一个功能) -->
<el-button-group
class="create-operate-group"
v-if="
(!selectedFiles.length || !isBatchOperation) &&
[0, 10, 11, 12].includes(fileType)
[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)
"
>
<!-- 上传模块 -->
<el-dropdown class="upload-drop" trigger="hover">
<el-button
size="mini"
......@@ -20,21 +22,21 @@
>上传<i class="el-icon-arrow-down el-icon--right"></i
></el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleUploadFileBtnClick(0)"
<el-dropdown-item @click.native="handleUploadFileBtnClick(FILE_UPLOAD)"
>上传文件</el-dropdown-item
>
<el-dropdown-item @click.native="handleUploadFileBtnClick(1)"
<el-dropdown-item @click.native="handleUploadFileBtnClick(FOLDER_UPLOAD)"
>上传文件夹</el-dropdown-item
>
<el-dropdown-item
@click.native="handleUploadFileBtnClick(2)"
@click.native="handleUploadFileBtnClick(PASTE_DRAG)"
title="截图粘贴或拖拽上传"
:disabled="screenWidth <= 520"
>拖拽上传</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
<!-- 新建模块 -->
<el-dropdown class="create-drop" trigger="hover">
<el-button
size="mini"
......@@ -47,8 +49,9 @@
<el-dropdown-item @click.native="handleClickAddFolderBtn">
<div class="img-text-wrapper"><img :src="dirImg" /> 新建文件夹</div>
</el-dropdown-item>
<!-- 只有我的创作采用到新建word文档 -->
<el-dropdown-item
v-if="fileType == 10"
v-if="[MY_CREATE].includes(fileType)"
divided
@click.native="handleCreateFileByTemplate('docx')"
>
......@@ -56,6 +59,7 @@
<img :src="wordImg" />新建Word 文档
</div>
</el-dropdown-item>
<!-- 暂时不考虑新建Word文档类型之外的 -->
<!-- <el-dropdown-item @click.native="handleCreateFile('xlsx')">
<div class="img-text-wrapper">
<img :src="excelImg" />Excel 工作表
......@@ -69,16 +73,20 @@
</el-dropdown-menu>
</el-dropdown>
</el-button-group>
<!-- 我的收藏只需要用到新建文件夹 -->
<el-button
v-if="(!selectedFiles.length || !isBatchOperation) &&[MY_COLLECT].includes(fileType)"
size="mini"
type="primary"
icon="el-icon-plus"
id="uploadFileId"
@click="handleClickAddFolderBtn"
>新建文件夹</i
></el-button>
<div class="batch-operate-group">
<el-button-group v-if="isBatchOperation">
<el-button
size="mini"
type="primary"
v-if="selectedFiles.length"
icon="el-icon-delete"
@click="handleBatchDeleteBtnClick"
>批量删除</el-button
>
<el-button
size="mini"
type="primary"
......@@ -105,6 +113,22 @@
@click="handleBatchShareBtnClick"
>批量分享</el-button
>
<el-button
size="mini"
type="primary"
v-if="selectedFiles.length && fileType!=MY_COLLECT"
icon="el-icon-delete"
@click="handleBatchDeleteBtnClick"
>批量删除</el-button
>
<el-button
v-if="selectedFiles.length && fileType==MY_COLLECT"
size="mini"
type="primary"
icon="el-icon-delete"
@click="handleBatchDeleteBtnClick"
>批量取消收藏</el-button
>
</el-button-group>
</div>
......@@ -133,7 +157,7 @@
class="batch-icon el-icon-finished"
:class="isBatchOperation ? 'active' : ''"
:title="isBatchOperation ? '取消批量操作' : '批量操作'"
v-if="fileModel === 1 && fileType !== 8"
v-if="fileModel === GRID && fileType !== 8"
@click="handleBatchOperationChange()"
></i>
<i
......@@ -153,22 +177,22 @@
></i> -->
<svg-icon
icon-class="icon-liebiao"
@click="handleFileDisplayModelChange(0)"
@click="handleFileDisplayModelChange(TABLE)"
title="列表模式"
:class="{ active: fileGroupLable === 0, 'model-icon': true }"
:class="{ active: fileGroupLable === TABLE, 'model-icon': true }"
></svg-icon>
<i
class="model-icon el-icon-s-grid"
:class="{ active: fileGroupLable === 1 }"
:class="{ active: fileGroupLable === GRID }"
title="网格模式"
@click="handleFileDisplayModelChange(1)"
@click="handleFileDisplayModelChange(GRID)"
></i>
<i
class="model-icon el-icon-date"
:class="{ active: fileGroupLable === 2 }"
:class="{ active: fileGroupLable === TIMELINE }"
title="时间线模式"
v-if="fileType === 1"
@click="handleFileDisplayModelChange(2)"
@click="handleFileDisplayModelChange(TIMELINE)"
></i>
<el-divider direction="vertical"></el-divider>
</template>
......@@ -194,18 +218,18 @@
size="mini"
@change="handleFileDisplayModelChange"
>
<el-radio-button :label="0">
<el-radio-button :label="TABLE">
<i class="iconfont icon-liebiao1"></i> 列表
</el-radio-button>
<el-radio-button :label="1">
<el-radio-button :label="GRID">
<i class="el-icon-s-grid"></i> 网格
</el-radio-button>
<el-radio-button :label="2" v-if="fileType === 1">
<el-radio-button :label="TIMELINE" v-if="fileType === 1">
<i class="el-icon-date"></i> 时间线
</el-radio-button>
</el-radio-group>
</div>
<template v-if="fileGroupLable === 1 || fileGroupLable === 2">
<template v-if="fileGroupLable === GRID || fileGroupLable === TIMELINE">
<el-divider class="split-line"></el-divider>
<!-- 图标大小调整 -->
<div class="change-grid-size">
......@@ -229,6 +253,7 @@
<script>
import SelectColumn from "./SelectColumn.vue";
import { mapState } from "vuex";
import { displayModeConstant, fileTypeConstant,uploadModeConstant } from "../constants";
export default {
name: "OperationMenu",
props: {
......@@ -258,6 +283,9 @@ export default {
wordImg: require("@/assets/images/file/file_word.svg"),
excelImg: require("@/assets/images/file/file_excel.svg"),
pptImg: require("@/assets/images/file/file_ppt.svg"),
...displayModeConstant,
...fileTypeConstant,
...uploadModeConstant
};
},
computed: {
......@@ -313,7 +341,7 @@ export default {
watch: {
// 显示拖拽上传文件遮罩
showUploadMask() {
this.handleUploadFileBtnClick(3);
this.handleUploadFileBtnClick(this.PASTE_DRAG);
},
fileType(newValue, oldValue) {
if (oldValue === 1 && this.fileModel === 2) {
......
// 文件模块类别
export const fileTypeConstant = {
MY_CREATE: 10,//我的创作
TEMPLATE_MANAGE: 11,//模板管理
MY_COLLECT: 12,//我的收藏
}
// 展示模式
export const displayModeConstant = {
TABLE: 0,//列表
GRID: 1,//网格
TIMELINE: 2,//时间线
}
// 上传方式
export const uploadModeConstant = {
FILE_UPLOAD: 0,//文件上传
FOLDER_UPLOAD: 1,//文件夹上传
PASTE_DRAG: 2,//粘贴图片或拖拽上传
}
// 是否收藏
export const collectConstant = {
COLLECTED: 0, //收藏
NOT_COLLECTED: 1 ,//未收藏
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
title="分享文件"
:visible.sync="visible"
:close-on-click-modal="false"
width="780px"
width="480px"
@close="handleDialogCancel"
top="20vh"
>
......@@ -14,23 +14,24 @@
:model="form"
ref="shareFileForm"
label-suffix=":"
label-width="180px"
:label-position="screenWidth <= 520 ? 'top' : 'right'"
label-width="160px"
:rules="rules"
size="mini"
>
<el-form-item label="分享给部门或个人" prop="shareType">
<el-radio-group v-model="form.shareType">
<el-radio :label="0">分享到公共社区(需审核)</el-radio>
<el-radio :label="1">分享到部门(需审核)</el-radio>
<el-radio :label="2">分享到个人</el-radio>
<el-radio :label="PUBLIC_SHARE">分享到公共社区(需审核)</el-radio>
<el-radio :label="DEPT_SHARE">分享到部门(需审核)</el-radio>
<el-radio :label="PERSONAL_SHARE">分享到个人</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
:label="getChooseDataLabel"
v-if="form.shareType == 1 || form.shareType == 2"
v-if="form.shareType == DEPT_SHARE || form.shareType == PERSONAL_SHARE"
prop="deptOrUser"
>
<el-tree
v-if="form.shareType == 1"
v-if="form.shareType == DEPT_SHARE"
class="tree-border"
:data="deptOptions"
show-checkbox
......@@ -40,65 +41,26 @@
empty-text="加载中,请稍候"
:props="defaultProps"
></el-tree>
<PaginationSelector
v-if="form.shareType == 2"
@pageNationChange="pageNationChange"
@change="handleChangUserName"
:optionSource="userListAllByLocal"
<el-select
v-if="form.shareType == PERSONAL_SHARE"
v-model="userIds"
labelKey="userName"
valueKey="userId"
:paginationOption="setSelectPage"
/>
</el-form-item>
<!-- <el-form-item label="链接有效期至" prop="endTime">
<el-date-picker
v-model="form.endTime"
type="datetime"
placeholder="选择日期时间"
align="right"
value-format="yyyy-MM-dd HH:mm:ss"
:editable="false"
:clearable="false"
:picker-options="pickerOptions"
filterable
remote
multiple
:remote-method="getAllUserListRemote"
:loading="loading"
placeholder="请选择人员(支持搜索)"
>
</el-date-picker>
</el-form-item> -->
<!-- <el-form-item label="是否需要提取码" prop="shareType">
<el-radio-group v-model="form.isNeedCode">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item> -->
</el-form>
<!-- <el-form
v-if="shareIsSuccess"
class="share-success-form"
:model="shareData"
ref="shareSuccessForm"
label-suffix=":"
label-width="90px"
:label-position="screenWidth <= 520 ? 'top' : 'right'"
>
<div class="success-tip">
<i class="el-icon-success"></i>
<span class="text">成功创建分享链接</span>
</div>
<el-form-item label="分享链接" prop="shareBatchNum">
<el-input
:value="$file.getShareLink(shareData.shareBatchNum)"
:readonly="true"
type="textarea"
autosize
></el-input>
</el-form-item>
<el-form-item label="提取码" prop="extractionCode">
<el-input
v-model="shareData.extractionCode"
:readonly="true"
></el-input>
<el-option
v-for="item in options"
:key="item.userId"
:label="item.userName"
:value="item.userId"
>
</el-option>
</el-select>
</el-form-item>
</el-form> -->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button
v-if="shareIsSuccess"
......@@ -125,13 +87,10 @@
<script>
import store from "@/store/index.js";
import { shareFile } from "@/api/qwFile";
import { deptTreeSelect, listUser } from "@/api/system/user";
import { deptTreeSelect, getAllUserList } from "@/api/system/user";
import PaginationSelector from "@/components/PaginationSelector";
const shareTypeConstant = {
PUBLIC_SHARE: 0, //分享给公共社区
DEPT_SHARE: 1, //分享给部门
PERSONAL_SHARE: 2, //分享给个人
};
import { shareTypeConstant } from "./constants";
const { DEPT_SHARE, PERSONAL_SHARE } = shareTypeConstant;
export default {
name: "ShareFileDialog",
......@@ -139,6 +98,15 @@ export default {
PaginationSelector,
},
data() {
const validateDeptOrUser = (rule, value, callback) => {
if (this.form.shareType == DEPT_SHARE && !this.getDeptAllCheckedKeys()) {
return callback(new Error("请选择组织"));
}
if (this.form.shareType == PERSONAL_SHARE && this.userIds.length == 0) {
return callback(new Error("请选择人员"));
}
return callback();
};
return {
visible: false, // 对话框是否可见
// 分享文件对话框数据
......@@ -155,6 +123,12 @@ export default {
endTime: [
{ required: true, message: "请选择链接有效期", trigger: "blur" },
],
deptOrUser: [
{
validator: validateDeptOrUser,
required: true,
},
],
},
sureBtnLoading: false,
pickerOptions: {
......@@ -221,10 +195,9 @@ export default {
pagerCount: 5, //按钮数,超过时会折叠
total: 0, //总条数
},
userIds: "", //用户id集合,用于绑定数据
userIdsParams: "", //用户id集合,用于提交给后台
userListAllByLocal: [],
userListAllPaged: [],
userIds: [], //用户id集合,用于绑定数据
options: [],
...shareTypeConstant,
};
},
computed: {
......@@ -233,21 +206,21 @@ export default {
return store.state.common.screenWidth;
},
getChooseDataLabel() {
if (this.form.shareType == shareTypeConstant.DEPT_SHARE) {
if (this.form.shareType == this.DEPT_SHARE) {
return "选择部门";
} else if (this.form.shareType == shareTypeConstant.PERSONAL_SHARE) {
} else if (this.form.shareType == this.PERSONAL_SHARE) {
return "选择个人";
}
},
},
watch: {
"form.shareType"(value) {
if (value == shareTypeConstant.DEPT_SHARE) {
if (value == this.DEPT_SHARE) {
this.getDeptTree();
// 清空人员的选择
this.clearCheckedUser();
} else if (value == shareTypeConstant.PERSONAL_SHARE) {
this.getUserList();
} else if (value == this.PERSONAL_SHARE) {
this.getAllUserListRemote();
// 清空部门的选择
this.clearCheckedDept();
} else {
......@@ -279,10 +252,9 @@ export default {
if (this.form.shareType == 1) {
this.form.shareTo = this.getDeptAllCheckedKeys();
} else if (this.form.shareType == 2) {
this.form.shareTo = this.userIdsParams;
this.form.shareTo = this.userIds.join(",");
}
this.sureBtnLoading = true;
this.$refs[formName].validate((valid) => {
if (valid) {
shareFile({
......@@ -293,13 +265,11 @@ export default {
.then((res) => {
this.sureBtnLoading = false;
if (res.code == 200) {
// this.shareData = res.data;
// this.shareIsSuccess = true;
this.$message.success("分享成功!");
this.callback("confirm");
} else {
this.$message.error(res.message);
}
this.handleDialogCancel();
})
.catch(() => {
this.sureBtnLoading = false;
......@@ -344,16 +314,9 @@ export default {
//重新调用分页查询的方法
this.getUserList(this.setSelectPage);
},
//获取下拉框中的运动员编号--保存方案
handleChangUserName(val) {
this.userIdsParams = val.join(",");
},
// 清空选中的人员
clearCheckedUser() {
this.userIds = "";
this.userIdsParams = "";
this.userIds = [];
},
// 清空组织的选择
clearCheckedDept() {
......@@ -361,25 +324,18 @@ export default {
this.$refs.dept.setCheckedKeys([]);
}
},
//查询所有用户列表
getUserList(setSelectPage) {
const { pageNum, pageSize } = this.setSelectPage;
const params = { pageNum, pageSize };
listUser(params).then((res) => {
//下拉列表数据源绑定
this.userListAllByLocal = res.rows;
//绑定总记录数
this.setSelectPage.total = res.total;
//
if (this.userListAllPaged.length === 0) {
this.userListAllPaged = res.rows;
} else {
//追加数据
for (let i = 0; i < res.rows.length; i++) {
this.userListAllPaged.push(res.rows[i]);
}
}
});
//查询远程用户
getAllUserListRemote(query) {
if (query !== "") {
this.loading = true;
const params = { pageNum: 1, pageSize: 20, userName: query };
getAllUserList(params).then((res) => {
this.options = res.rows;
this.loading = false;
});
} else {
this.options = [];
}
},
},
};
......@@ -399,4 +355,9 @@ export default {
line-height: 20px;
}
}
::v-deep .el-radio {
display: flex;
margin: 10px 0;
}
</style>
export const shareTypeConstant = {
PUBLIC_SHARE: 0, //分享给公共社区
DEPT_SHARE: 1, //分享给部门
PERSONAL_SHARE: 2, //分享给个人
};
\ No newline at end of file
......@@ -339,52 +339,50 @@ const fileFunction = {
})
}
} else {
// return
const WORD = ['doc', 'docx']
const PDF = ['pdf']
// 若当前点击项是word
if (WORD.includes(row.extendName.toLowerCase())) {
if (WORD.includes(row.extendName.toLowerCase()) || WORD.includes(row.suffix.toLowerCase())) {
let flag = false
const { fileId, username } = row
const { fileId, userId, id } = row
// 根据当前文件的作者的userId进行判断,和本人一致则是可编辑
if (store.getters.name == username) {
if (store.getters.userInfo.userId == userId) {
flag = true
}
const params = {
fileId,
fileId: fileId,
flag
}
let resolve = router.resolve({
path: '/wpsReader',
query: {
wpsUrl: `https://wwo.wps.cn/office/w/2c9a8083849eac7001849eae1df50001?_w_userid=1638778159578505218&_w_filrread=1&_w_filetype=db&_w_filepath=http://222.85.214.245:9559/ls/public/stream?randomCode=34df183096eb4996a93c3f779702e45d&_w_tokentype=1&_w_appid=1058dd766ec443c79f95933ec6a41169&_w_redirectkey=123456&_w_signature=E1OEcnnGEgVfK7mcnGDFgXJSLPY%3D`,
// wpsUrl: `http://localhost/office/w/2c9a8083849eac7001849eae1df50001?_w_userid=1638778159578505218&_w_filrread=1&_w_filetype=db&_w_filepath=http://222.85.214.245:9559/ls/public/stream?randomCode=34df183096eb4996a93c3f779702e45d&_w_tokentype=1&_w_appid=1058dd766ec443c79f95933ec6a41169&_w_redirectkey=123456&_w_signature=E1OEcnnGEgVfK7mcnGDFgXJSLPY%3D`,
token: `0617753de96249a5a9839daf9b8ff8b5`,
fileId
}
})
window.open(resolve.href, '_blank')
// getViewUrlDbPath(params).then(res => {
// if (res.data) {
// // console.log('res.data', res.data);
// // 跳转 使用sessionStorage,避免关键信息在ip中暴露
// // 使用push会停留当前页面,故不采纳
// // params 传递参数,子组件无法渲染iframe组件,故不采纳
// localStorage.wpsUrl = res.data.wpsUrl
// localStorage.token = res.data.token
// let resolve = router.resolve({
// path: '/wpsReader',
// query: {
// wpsUrl: res.data.wpsUrl,
// token: res.data.token
// }
// })
// window.open(resolve.href, '_blank')
// let resolve = router.resolve({
// path: '/wpsReader',
// query: {
// wpsUrl: `https://wwo.wps.cn/office/w/2c9a8083849eac7001849eae1df50001?_w_userid=1638778159578505218&_w_filrread=1&_w_filetype=db&_w_filepath=http://222.85.214.245:9559/ls/public/stream?randomCode=34df183096eb4996a93c3f779702e45d&_w_tokentype=1&_w_appid=1058dd766ec443c79f95933ec6a41169&_w_redirectkey=123456&_w_signature=E1OEcnnGEgVfK7mcnGDFgXJSLPY%3D`,
// // wpsUrl: `http://localhost/office/w/2c9a8083849eac7001849eae1df50001?_w_userid=1638778159578505218&_w_filrread=1&_w_filetype=db&_w_filepath=http://222.85.214.245:9559/ls/public/stream?randomCode=34df183096eb4996a93c3f779702e45d&_w_tokentype=1&_w_appid=1058dd766ec443c79f95933ec6a41169&_w_redirectkey=123456&_w_signature=E1OEcnnGEgVfK7mcnGDFgXJSLPY%3D`,
// token: `0617753de96249a5a9839daf9b8ff8b5`,
// fileId
// }
// })
// return false
// window.open(resolve.href, '_blank')
getViewUrlDbPath(params).then(res => {
if (res.data) {
// console.log('res.data', res.data);
// 跳转 使用sessionStorage,避免关键信息在ip中暴露
// 使用push会停留当前页面,故不采纳
// params 传递参数,子组件无法渲染iframe组件,故不采纳
localStorage.wpsUrl = res.data.wpsUrl
localStorage.token = res.data.token
let resolve = router.resolve({
path: '/wpsReader',
query: {
wpsUrl: res.data.wpsUrl,
token: res.data.token
}
})
window.open(resolve.href, '_blank')
}
})
return false
}
// 若当前点击项是pdf
if (PDF.includes(row.extendName.toLowerCase())) {
......
......@@ -11,6 +11,7 @@ const getters = {
avatar: state => state.user.avatar,
name: state => state.user.name,
introduction: state => state.user.introduction,
userInfo: state => state.user.userInfo,
roles: state => state.user.roles,
permissions: state => state.user.permissions,
permission_routes: state => state.permission.routes,
......
......@@ -7,7 +7,8 @@ const user = {
name: '',
avatar: '',
roles: [],
permissions: []
permissions: [],
userInfo: {}
},
mutations: {
......@@ -25,7 +26,11 @@ const user = {
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
}
},
SET_USERINFO: (state, userInfo) => {
state.userInfo = userInfo
},
},
actions: {
......@@ -60,6 +65,7 @@ const user = {
}
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
commit('SET_USERINFO', user)
resolve(res)
}).catch(error => {
reject(error)
......
......@@ -44,13 +44,13 @@
<template #header>
<span class="card-more" @click="handleToCreate"> 更多 </span>
</template>
<el-table :data="createList.records" size="small">
<el-table :data="createList.records">
<el-table-column width="280px" label="名称" show-overflow-tooltip>
<template slot-scope="{ row }">
<span>
<el-link @click="handleClickName(row)">
<svg-icon icon-class="word"></svg-icon>
{{ row.name }}
</span>
</el-link>
</template>
</el-table-column>
<el-table-column label="作者" prop="creatorName" />
......@@ -64,15 +64,15 @@
<template #header>
<span class="card-more" @click="handleToRead"> 更多 </span>
</template>
<el-table :data="readList.records" size="small">
<el-table :data="readList.records">
<el-table-column width="280px" label="名称" show-overflow-tooltip>
<template slot-scope="{ row }">
<span class="name" @click="handleClickName(row)"
<el-link class="name" @click="handleClickName(row)"
><svg-icon
style="margin-right: 4px"
:icon-class="getIcon(row)"
></svg-icon>
{{ row.name }}</span
{{ row.name }}</el-link
>
</template>
</el-table-column>
......@@ -170,6 +170,7 @@ export default {
// 点击表格某一行
handleClickName(row) {
console.log("row", row);
this.$file.handleFileNameClickNew(row)
},
handleToCreate() {
this.$router.push("/mine/myCreate");
......
//分享类型
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>
<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="handleMultiRevoke"
>批量取消收藏</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"
style="margin-right: 16px"
@click="handleCancelShare(scope.row.shareId)"
>
<svg-icon icon-class="revoke"> </svg-icon>取消分享
</el-link>
<el-link
type="primary"
icon="el-icon-view"
@click="handleOpenFile(scope.row)"
>
预览
</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"
/>
<el-dialog
title="批量取消"
:visible.sync="multiCancelVisible"
width="400px"
>
<div class="multi-verify">
<div class="text">
一共选择了{{ shareIdsArr.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>
<FileList />
</div>
</template>
<script>
import { getMyShareList, removeShare } from "@/api/user/share";
import { shareStatusConstant } from "./constant";
import FileList from "@/components/file/FileList.vue";
import { fileTypeConstant } from "@/components/file/constants";
const { MY_COLLECT } = fileTypeConstant;
export default {
name: "myShare",
dicts: ["share_type", "share_status"],
components: {
FileList,
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
shareIdsArr: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
shareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
currentPage: 1,
pageCount: 10,
fileName: "", //文件名称
shareStatus: "", //分享状态
},
// 分享状态常量
shareStatusConstant,
// 批量取消的弹窗可见性
multiCancelVisible: false,
shareIdsArr: [],
isInit: false,
};
},
computed: {
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";
}
};
},
},
created() {
this.getList();
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.shareIdsArr = selection.map((item) => item.shareId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
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;
},
// 提交批量取消分享
handleSubmitMultiRemoveShare() {
const fileIds = this.shareIdsArr.join(",");
this.handleCancelShare(fileIds);
this.handleCloseMultiRemoveShare();
},
// 关闭批量取消分享
handleCloseMultiRemoveShare() {
this.multiCancelVisible = false;
},
// 点击打开文件
handleOpenFile(file) {
this.$file.handleFileNameClickNew(file);
},
mounted() {
this.isInit = false;
// 读取当前的查询参数
const currentQueryParams = this.$route.query;
// 修改查询参数,例如,给 "filePath" 参数设置新的值
const newFileType = MY_COLLECT;
const newFilePath = "/我的收藏";
const newQueryParams = {
...currentQueryParams,
fileType: newFileType,
filePath: newFilePath,
};
// 使用 this.$router.push() 导航到当前路由,并传递新的查询参数
this.$router.push({ query: newQueryParams });
this.isInit = true;
},
};
</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>
......@@ -5,6 +5,8 @@
</template>
<script>
import FileList from "@/components/file/FileList.vue";
import { fileTypeConstant } from "@/components/file/constants";
const { MY_CREATE } = fileTypeConstant;
export default {
components: {
FileList,
......@@ -20,9 +22,13 @@ export default {
const currentQueryParams = this.$route.query;
// 修改查询参数,例如,给 "filePath" 参数设置新的值
const newFileType = 10;
const newFilePath = '/我的创作';
const newQueryParams = { ...currentQueryParams, fileType: newFileType ,filePath: newFilePath};
const newFileType = MY_CREATE;
const newFilePath = "/我的创作";
const newQueryParams = {
...currentQueryParams,
fileType: newFileType,
filePath: newFilePath,
};
// 使用 this.$router.push() 导航到当前路由,并传递新的查询参数
this.$router.push({ query: newQueryParams });
......@@ -30,4 +36,3 @@ export default {
},
};
</script>
<style lang="scss"></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>
<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">
<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>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.currentPage"
:limit.sync="queryParams.pageCount"
@pagination="getList"
/>
</div>
</template>
<script>
import { getMyShareList, removeShare } from "@/api/user/share";
import { shareStatusConstant } from "../constant";
import store from '@/store'
const myUserId = store.user.userInfo.id
export default {
name: "myShare",
dicts: ["share_type", "share_status"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
shareIdsArr: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
shareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
currentPage: 1,
pageCount: 10,
fileName: "", //文件名称
shareStatus: "", //分享状态
shareTo:myUserId,//分享人
},
// 分享状态常量
shareStatusConstant,
// 批量取消的弹窗可见性
multiCancelVisible: false,
shareIdsArr: [],
};
},
created() {
this.getList();
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.shareIdsArr = selection.map((item) => item.shareId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
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);
},
},
};
</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
>
<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"
style="margin-right: 16px"
@click="handleCancelShare(scope.row.shareId)"
>
<svg-icon icon-class="revoke"> </svg-icon>取消分享
</el-link>
<el-link
type="primary"
icon="el-icon-view"
@click="handleOpenFile(scope.row)"
>
预览
</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"
/>
<el-dialog
title="批量取消"
:visible.sync="multiCancelVisible"
width="400px"
>
<div class="multi-verify">
<div class="text">
一共选择了{{ shareIdsArr.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";
export default {
name: "myShare",
dicts: ["share_type", "share_status"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
shareIdsArr: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
shareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
currentPage: 1,
pageCount: 10,
fileName: "", //文件名称
shareStatus: "", //分享状态
},
// 分享状态常量
shareStatusConstant,
// 批量取消的弹窗可见性
multiCancelVisible: false,
shareIdsArr: [],
};
},
computed: {
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";
}
};
},
},
created() {
this.getList();
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.shareIdsArr = selection.map((item) => item.shareId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
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;
},
// 提交批量取消分享
handleSubmitMultiRemoveShare() {
const fileIds = this.shareIdsArr.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>
<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 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
>
<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"
style="margin-right: 16px"
@click="handleCancelShare(scope.row.shareId)"
>
<svg-icon icon-class="revoke"> </svg-icon>取消分享
</el-link>
<el-link
type="primary"
icon="el-icon-view"
@click="handleOpenFile(scope.row)"
>
预览
</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"
/>
<el-dialog
title="批量取消"
:visible.sync="multiCancelVisible"
width="400px"
>
<div class="multi-verify">
<div class="text">
一共选择了{{ shareIdsArr.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>
<el-tabs>
<el-tab-pane label="别人分享给我的"> <ShareFrom /></el-tab-pane>
<el-tab-pane label="我分享的">
<ShareTo />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { getMyShareList, removeShare } from "@/api/user/share";
import { shareStatusConstant } from "./constant";
import ShareTo from "./components/shareTo";
import ShareFrom from "./components/shareFrom";
export default {
name: "myShare",
dicts: ["share_type", "share_status"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
shareIdsArr: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
shareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
currentPage: 1,
pageCount: 10,
fileName: "", //文件名称
shareStatus: "", //分享状态
},
// 分享状态常量
shareStatusConstant,
// 批量取消的弹窗可见性
multiCancelVisible: false,
shareIdsArr: [],
};
},
computed: {
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";
}
};
},
},
created() {
this.getList();
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.shareIdsArr = selection.map((item) => item.shareId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
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;
},
// 提交批量取消分享
handleSubmitMultiRemoveShare() {
const fileIds = this.shareIdsArr.join(",");
this.handleCancelShare(fileIds);
this.handleCloseMultiRemoveShare();
},
// 关闭批量取消分享
handleCloseMultiRemoveShare() {
this.multiCancelVisible = false;
},
// 点击打开文件
handleOpenFile(file) {
this.$file.handleFileNameClickNew(file);
},
components: {
ShareTo,
ShareFrom,
},
};
</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>
......@@ -35,8 +35,8 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://222.85.214.245:9600`,
// target: `http://172.24.100.56:9600`,
// target: `http://222.85.214.245:9600`,
target: `http://172.24.100.246:9600`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论