Commit 7625dfc2 by zhangleyuan

feat:联调云盘的文件的删除的操作

parent 4f7b45bf
......@@ -251,12 +251,12 @@ class CopyFileModal extends React.Component {
</Button>
]}
>
<div className='copy-header'>
{/* <div className='copy-header'>
<Radio.Group>
<Radio.Button value={'MYSELF'} onClick={() => this.getFileList('MYSELF')}>我的文件</Radio.Button>
<Radio.Button onClick={() => this.getFileList('COMMON')}>公共文件</Radio.Button>
</Radio.Group>
</div>
</div> */}
<div className='copy-body'>
{/* 面包屑 */}
<div className="bread-crumbs">
......
......@@ -25,10 +25,12 @@ import ManagingMembersModal from '@/bu-components/ManagingMembersModal';
import ScanFileModal from '../modal/ScanFileModal';
import CreateFolderModal from '../modal/CreateFolderModal';
import User from '@/common/js/user';
const DEL_FOLDER_URL_MAP = {
'MYSELF': 'public/hadesStore/delFolder',
'COMMON': 'public/apollo/delCommonFolder'
'COMMON': 'public/hadesStore/delFolder'
}
// 支持本地上传的文件类型
......@@ -290,29 +292,21 @@ class FolderList extends React.Component {
handleDeleteFolder = (folder) => {
const { currentRootDisk: { disk } } = this.props;
const { instId } = window.currentUserInstInfo;
// 判断此文件是否有关联的课次
Service.Hades('public/apollo/judgeRelation', {
instId,
folderIds: [folder.id],
}).then((res) => {
// 如果有关联的文件,二次弹窗确认
const hasRelative = !!res.result;
Modal.confirm({
title: '确认删除所选的文件吗?',
content: hasRelative ? '此文件已关联了课次,删除后,学员将不能查看到此文件。' : '删除后,数据将无法恢复。',
// icon: <span className="icon iconfont default-confirm-icon">&#xe6f4;</span>,
onOk: () => {
const { currentFolder } = this.state;
Service.Hades(DEL_FOLDER_URL_MAP[disk], {
instId,
ids: [folder.id],
}).then(() => {
message.success('删除成功');
this.props.onRefresh({ parentId: currentFolder.id || null });
})
}
});
})
Modal.confirm({
title: '确认删除所选的文件吗?',
content: '删除后,数据将无法恢复。',
onOk: () => {
const { currentFolder } = this.state;
Service.Hades(DEL_FOLDER_URL_MAP[disk], {
operatorId: User.getUserId(),
storeId: User.getStoreId(),
ids: [folder.id],
}).then(() => {
message.success('删除成功');
this.props.onRefresh({ parentId: currentFolder.id || null });
})
}
});
}
// 重命名
......@@ -328,34 +322,36 @@ class FolderList extends React.Component {
// 重命名完成或者取消重命名之后隐藏重命名弹窗
handleRenameDone = (folderName) => {
const { renameModalData, currentFolder } = this.state;
const { folderPathList } = this.props;
// 名称未修改不发送请求
if (folderName === renameModalData.folderName) {
this.setState({ renameModalData: {} });
return;
}
// 判断是否有同名文件
this.handleGetSameNameFiles(folderName).then((res) => {
if ((!!res) || (res && Object.keys(res).length)) {
if (!res.isLook && folderPathList.length === 1) {
message.warning('此目录下已存在同名文件,有疑问请联系机构校长');
} else {
message.warning('此目录下已存在同名文件');
}
return new Promise((resolve) => {
const { renameModalData, currentFolder } = this.state;
const { folderPathList } = this.props;
// 名称未修改不发送请求
if (folderName === renameModalData.folderName) {
this.setState({ renameModalData: {} });
return;
}
Service.Hades('public/hadesStore/renameFolder', {
id: renameModalData.id,
name: folderName
}).then(() => {
message.success('重命名成功');
this.setState({ renameModalData: {} });
this.props.onRefresh({ parentId: currentFolder.id || null });
})
});
// 判断是否有同名文件
this.handleGetSameNameFiles(folderName).then((res) => {
if ((!!res) || (res && Object.keys(res).length)) {
if (!res.isLook && folderPathList.length === 1) {
message.warning('此目录下已存在同名文件,有疑问请联系机构校长');
} else {
message.warning('此目录下已存在同名文件');
}
return;
}
Service.Hades('public/hadesStore/renameFolder', {
id: renameModalData.id,
name: folderName
}).then(() => {
message.success('重命名成功');
this.setState({ renameModalData: {} });
this.props.onRefresh({ parentId: currentFolder.id || null });
})
});
})
}
// 获取同名文件
......
......@@ -104,7 +104,7 @@ class CreateFolderModal extends React.Component {
placeholder="请输入文件夹名称"
style={{width: '400px'}}
onChange={this.handleChangeFolderName}
maxlength="50"
maxLength="50"
ref="folderNameInput"
/>
</Form.Item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment