matter list delete option soft or hard.

This commit is contained in:
Simba
2021-01-04 22:06:27 +08:00
parent 9bd725fc8e
commit e2ad3d1caf
6 changed files with 94 additions and 13 deletions
+2 -1
View File
@@ -142,7 +142,8 @@ let LangEn = {
recycleBin: "Recycle bin",
deleted: "Deleted",
unCompatibleBrowser: "The current browser does not support it. Please try choose another one",
canIUse: "To see if the current browser supports it"
canIUse: "To see if the current browser supports it",
intoRecycleBin: "Into the recycle bin"
},
router: {
allFiles: "All Files",
+2 -1
View File
@@ -142,7 +142,8 @@ let LangZh = {
recycleBin: "回收站",
deleted: "已删除",
unCompatibleBrowser: "当前浏览器不支持,请切换浏览器尝试",
canIUse: "查看当前浏览器是否支持,点击跳转"
canIUse: "查看当前浏览器是否支持,点击跳转",
intoRecycleBin: "放入回收站"
},
router: {
allFiles: "全部文件",
+11 -6
View File
@@ -39,6 +39,7 @@ import { UserRole } from "../../common/model/user/UserRole";
import StringUtil from "../../common/util/StringUtil";
import MoveBatchModal from "./widget/MoveBatchModal";
import ShareOperationModal from "./widget/ShareOperationModal";
import MatterDeleteModal from "./widget/MatterDeleteModal";
import Share from "../../common/model/share/Share";
import ShareDialogModal from "../share/widget/ShareDialogModal";
import BreadcrumbModel from "../../common/model/base/option/BreadcrumbModel";
@@ -225,17 +226,21 @@ export default class List extends TankComponent<IProps, IState> {
};
deleteBatch = () => {
Modal.confirm({
title: Lang.t("actionDeleteConfirm"),
icon: <ExclamationCircleFilled twoToneColor="#FFDC00" />,
onOk: () => {
const uuids = this.selectedMatters.map((i) => i.uuid).toString();
const uuids = this.selectedMatters.map((i) => i.uuid).toString();
MatterDeleteModal.open(
() => {
this.matter.httpSoftDeleteBatch(uuids, () => {
MessageBoxUtil.success(Lang.t("operationSuccess"));
this.refresh();
});
},
});
() => {
this.matter.httpDeleteBatch(uuids, () => {
MessageBoxUtil.success(Lang.t("operationSuccess"));
this.refresh();
});
}
);
};
downloadZip = () => {
@@ -0,0 +1,5 @@
.delete-modal {
.ant-modal-body {
padding-bottom: 0;
}
}
@@ -0,0 +1,64 @@
import React from "react";
import TankComponent from "../../../common/component/TankComponent";
import { Modal, Button } from "antd";
import Lang from "../../../common/model/global/Lang";
import "./MatterDeleteModal.less";
interface IProps {
onSoftDel: () => void;
onHardDel: () => void;
onClose: () => void;
}
interface IState {}
export default class MatterDeleteModal extends TankComponent<IProps, IState> {
constructor(props: IProps) {
super(props);
}
static open(onSoftDel: () => void, onHardDel: () => void) {
let modal = Modal.warning({
className: "delete-modal",
title: Lang.t("delete"),
okCancel: false,
okButtonProps: {
className: "display-none",
},
content: (
<MatterDeleteModal
onSoftDel={() => {
onSoftDel();
modal.destroy();
}}
onHardDel={() => {
onHardDel();
modal.destroy();
}}
onClose={() => {
modal.destroy();
}}
/>
),
});
}
render() {
return (
<div className="matter-delete-modal">
<p>{Lang.t("actionDeleteConfirm")}</p>
<div className="mt30 text-right">
<Button className="mr10" onClick={this.props.onClose}>
{Lang.t("cancel")}
</Button>
<Button type="primary" className="mr10" onClick={this.props.onSoftDel}>
{Lang.t("matter.intoRecycleBin")}
</Button>
<Button type="primary" danger onClick={this.props.onHardDel}>
{Lang.t("delete")}
</Button>
</div>
</div>
);
}
}
+10 -5
View File
@@ -27,6 +27,7 @@ import { CheckboxChangeEvent } from "antd/es/checkbox";
import SafeUtil from "../../../common/util/SafeUtil";
import ClipboardUtil from "../../../common/util/ClipboardUtil";
import Lang from "../../../common/model/global/Lang";
import MatterDeleteModal from "./MatterDeleteModal";
interface IProps {
matter: Matter;
@@ -93,16 +94,20 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
};
deleteMatter = () => {
Modal.confirm({
title: Lang.t("actionDeleteConfirm"),
icon: <ExclamationCircleFilled twoToneColor="#FFDC00" />,
onOk: () => {
MatterDeleteModal.open(
() => {
this.props.matter.httpSoftDelete(() => {
MessageBoxUtil.success(Lang.t("operationSuccess"));
this.props.onDeleteSuccess!();
});
},
});
() => {
this.props.matter.httpDelete(() => {
MessageBoxUtil.success(Lang.t("operationSuccess"));
this.props.onDeleteSuccess!();
});
}
);
};
hardDeleteMatter = () => {