From 87647ec5e3210eaae0daf86f71f44867f639fe51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=89?= <940119273@qq.com> Date: Mon, 27 Sep 2021 06:25:41 +0000 Subject: [PATCH] =?UTF-8?q?!1596=20=E4=BC=98=E5=8C=96:<=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97>=E6=89=93=E5=BC=80?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=97=B6=E5=BC=B9=E5=87=BA=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=EF=BC=8C=E5=8F=AF=E4=BB=A5=E5=9C=A8=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=85=8D=E7=BD=AE=E4=B8=AD=E8=AE=BE=E7=BD=AE=E5=BC=80?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Add-on/File/OpenHistoryBody.tsx | 207 ++++++++++++++++++ src/Add-on/File/OperLogsModal.tsx | 135 ++---------- src/Add-on/File/operLog.tsx | 106 ++++----- src/Common/CommandNames.ts | 2 +- src/DatabaseServices/FileServer.ts | 13 ++ src/Editor/CommandRegister.ts | 4 +- src/Editor/UserConfig.ts | 9 +- .../Modal/OptionModal/ConfigDialog.tsx | 7 + .../Modal/OptionModal/SystemConfig.tsx | 20 +- src/UI/Css/style.less | 51 +++-- 10 files changed, 341 insertions(+), 213 deletions(-) create mode 100644 src/Add-on/File/OpenHistoryBody.tsx diff --git a/src/Add-on/File/OpenHistoryBody.tsx b/src/Add-on/File/OpenHistoryBody.tsx new file mode 100644 index 000000000..d604b2caf --- /dev/null +++ b/src/Add-on/File/OpenHistoryBody.tsx @@ -0,0 +1,207 @@ +import { Button, Checkbox, HTMLTable } from "@blueprintjs/core"; +import { observable } from "mobx"; +import { observer } from "mobx-react"; +import React from "react"; +import { app } from "../../ApplicationServices/Application"; +import { userConfig } from "../../Editor/UserConfig"; +import { ModalState } from "../../UI/Components/Modal/ModalInterface"; +import { HistoryProp } from "./OperLogsModal"; + +@observer +export class OpenHistoryBody extends React.Component +{ + @observable time = this.props.time / 1000; + timer: NodeJS.Timeout; + isOnHover = false; + + componentDidMount() + { + let el = document.getElementById("HistoryFile"); + el.onmousemove = () => { this.isOnHover = true; }; + el.onmouseleave = () => { this.isOnHover = false; }; + + if (!this.timer) + this.timer = setInterval(() => + { + if (!this.isOnHover) + this.time--; + if (this.time <= 0) + { + clearInterval(this.timer); + this.timer = undefined; + this.props.Toaster.clear(); + } + }, 1000); + } + + componentWillUnmount() + { + this.time = undefined; + this.timer = undefined; + } + + render() + { + return ( +
+
+

历史编辑

+
+ +
+
+ { +
+ 可以使用OpenHistory命令打开历史记录 +
+ } + { + this.props.isOpenFile ?
+ userConfig.openHistoryList = !userConfig.openHistoryList} + /> +
: undefined + } +
+ {this.time} 秒后关闭 +
+ +
+ ); + } +} + +@observer +export class OpenHistoryList extends React.Component +{ + _Index = 0; + _LastOper = ""; + _Data = this.props.data; + @observable _CanOpen: boolean = false; + + render() + { + return ( + + + + 操作 + 用户名 + 日期 + { this._Index = 0, this._LastOper = "", this._CanOpen = !this._CanOpen; e.currentTarget.blur(); }} + /> + + + + + { + this._CanOpen ? this._CanOpenDataList() : this._AllDataList() + } + + + ); + } + + _AllDataList = () => + { + return ( + <> + { + this._Data.map(d => + { + if (d.oper_type_name === "打开") + if (this._LastOper === "打开") + return; + this._LastOper = d.oper_type_name; + return + {d.oper_type_name} + {d.oper_user} + + {d.oper_date} + {this._ButtonEl(d.oper_type_name, d.oper_date, this.props.files[this._Index])} + + ; + }) + } + + ); + }; + + _CanOpenDataList = () => + { + return ( + <> + { + this._Data.map(d => + { + if (d.oper_type_name !== "新建" && d.oper_type_name !== "修改") return; + if (!this._HasHistoryFile(d.oper_type_name, d.oper_date, this.props.files[this._Index])) return; + return + {d.oper_type_name} + {d.oper_user} + + {d.oper_date} +