mirror of
https://github.com/eyebluecn/tank-front
synced 2024-04-21 12:31:55 +00:00
add delete batch add soft delete batch api change
This commit is contained in:
@@ -216,8 +216,8 @@ export default class Matter extends BaseEntity {
|
||||
}
|
||||
|
||||
static httpSoftDeleteBatch(
|
||||
spaceUuid: string,
|
||||
uuids: string,
|
||||
spaceUuid: string,
|
||||
successCallback?: any,
|
||||
errorCallback?: any
|
||||
) {
|
||||
@@ -244,12 +244,13 @@ export default class Matter extends BaseEntity {
|
||||
|
||||
static httpDeleteBatch(
|
||||
uuids: string,
|
||||
spaceUuid: string,
|
||||
successCallback?: any,
|
||||
errorCallback?: any
|
||||
) {
|
||||
new HttpBase().httpPost(
|
||||
Matter.URL_MATTER_DELETE_BATCH,
|
||||
{ uuids: uuids },
|
||||
{ uuids, spaceUuid },
|
||||
function (response: any) {
|
||||
typeof successCallback === 'function' && successCallback(response);
|
||||
},
|
||||
|
||||
@@ -120,7 +120,7 @@ export default class List extends TankComponent<IProps, IState> {
|
||||
icon: <ExclamationCircleFilled twoToneColor="#FFDC00" />,
|
||||
onOk: () => {
|
||||
const uuids = this.selectedMatters.map((i) => i.uuid).toString();
|
||||
Matter.httpDeleteBatch(uuids, () => {
|
||||
Matter.httpDeleteBatch(uuids, this.user.spaceUuid!, () => {
|
||||
MessageBoxUtil.success(Lang.t('operationSuccess'));
|
||||
this.refresh();
|
||||
});
|
||||
|
||||
@@ -229,15 +229,16 @@ export default class List extends TankComponent<IProps, IState> {
|
||||
deleteBatch() {
|
||||
const uuids = this.selectedMatters.map((i) => i.uuid).toString();
|
||||
MatterDeleteModal.open(
|
||||
!!this.props.spaceUuid,
|
||||
() => {
|
||||
Matter.httpSoftDeleteBatch(this.getSpaceUuid()!, uuids, () => {
|
||||
Matter.httpSoftDeleteBatch(uuids, this.getSpaceUuid()!, () => {
|
||||
MessageBoxUtil.success(Lang.t('operationSuccess'));
|
||||
Capacity.instance?.refresh();
|
||||
this.refresh();
|
||||
});
|
||||
},
|
||||
() => {
|
||||
Matter.httpDeleteBatch(uuids, () => {
|
||||
Matter.httpDeleteBatch(uuids, this.getSpaceUuid()!, () => {
|
||||
MessageBoxUtil.success(Lang.t('operationSuccess'));
|
||||
Capacity.instance?.refresh();
|
||||
this.refresh();
|
||||
@@ -692,6 +693,7 @@ export default class List extends TankComponent<IProps, IState> {
|
||||
key={matter.uuid!}
|
||||
director={director}
|
||||
matter={matter}
|
||||
isSpace={!!this.props.spaceUuid}
|
||||
onGoToDirectory={(id) => this.goToDirectory(id)}
|
||||
onDeleteSuccess={() => this.delete()}
|
||||
onCheckMatter={(m) => this.checkMatter(m)}
|
||||
|
||||
@@ -8,6 +8,7 @@ import './MatterDeleteModal.less';
|
||||
import Preference from '../../../common/model/preference/Preference';
|
||||
|
||||
interface IProps {
|
||||
isSpace: boolean; // 是否是空间,空间下暂不展示放入回收站逻辑
|
||||
onSoftDel: () => void;
|
||||
onHardDel: () => void;
|
||||
onClose: () => void;
|
||||
@@ -22,7 +23,7 @@ export default class MatterDeleteModal extends TankComponent<IProps, IState> {
|
||||
|
||||
static preference: Preference = Moon.getSingleton().preference;
|
||||
|
||||
static open(onSoftDel: () => void, onHardDel: () => void) {
|
||||
static open(isSpace: boolean, onSoftDel: () => void, onHardDel: () => void) {
|
||||
let modal = Modal.warning({
|
||||
className: 'delete-modal',
|
||||
title: Lang.t('delete'),
|
||||
@@ -33,6 +34,7 @@ export default class MatterDeleteModal extends TankComponent<IProps, IState> {
|
||||
},
|
||||
content: (
|
||||
<MatterDeleteModal
|
||||
isSpace={isSpace}
|
||||
onSoftDel={() => {
|
||||
onSoftDel();
|
||||
modal.destroy();
|
||||
@@ -60,15 +62,16 @@ export default class MatterDeleteModal extends TankComponent<IProps, IState> {
|
||||
<Button type="primary" danger onClick={this.props.onHardDel}>
|
||||
{Lang.t('deleteDirectly')}
|
||||
</Button>
|
||||
{MatterDeleteModal.preference.getRecycleBinStatus() && (
|
||||
<Button
|
||||
type="primary"
|
||||
className="ml10"
|
||||
onClick={this.props.onSoftDel}
|
||||
>
|
||||
{Lang.t('matter.intoRecycleBin')}
|
||||
</Button>
|
||||
)}
|
||||
{!this.props.isSpace &&
|
||||
MatterDeleteModal.preference.getRecycleBinStatus() && (
|
||||
<Button
|
||||
type="primary"
|
||||
className="ml10"
|
||||
onClick={this.props.onSoftDel}
|
||||
>
|
||||
{Lang.t('matter.intoRecycleBin')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -32,6 +32,7 @@ import MatterDeleteModal from './MatterDeleteModal';
|
||||
interface IProps {
|
||||
matter: Matter;
|
||||
recycleMode?: boolean; // 回收站模式,默认false,简化相关操作,不可进入文件夹里
|
||||
isSpace?: boolean; // 是否共享空间下
|
||||
director?: Director;
|
||||
onCreateDirectoryCallback?: () => any;
|
||||
onDeleteSuccess?: () => any;
|
||||
@@ -95,6 +96,7 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
|
||||
deleteMatter() {
|
||||
MatterDeleteModal.open(
|
||||
!!this.props.isSpace,
|
||||
() => {
|
||||
this.props.matter.httpSoftDelete(() => {
|
||||
MessageBoxUtil.success(Lang.t('operationSuccess'));
|
||||
|
||||
Reference in New Issue
Block a user