|
|
|
@ -1,11 +1,14 @@
|
|
|
|
|
import { Button, Checkbox, HTMLTable } from "@blueprintjs/core";
|
|
|
|
|
import { Button, Checkbox, HTMLTable, Intent } from "@blueprintjs/core";
|
|
|
|
|
import { observable } from "mobx";
|
|
|
|
|
import { observer } from "mobx-react";
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { app } from "../../ApplicationServices/Application";
|
|
|
|
|
import { StoreageKeys } from "../../Common/StoreageKeys";
|
|
|
|
|
import { FileServer } from "../../DatabaseServices/FileServer";
|
|
|
|
|
import { userConfig } from "../../Editor/UserConfig";
|
|
|
|
|
import { BoardModalType } from "../../UI/Components/Board/BoardModalType";
|
|
|
|
|
import { ModalState } from "../../UI/Components/Modal/ModalInterface";
|
|
|
|
|
import { AppToaster } from "../../UI/Components/Toaster";
|
|
|
|
|
import { userConfigStore } from "../../UI/Store/UserConfigStore";
|
|
|
|
|
import { HistoryProp } from "./OperLogsModal";
|
|
|
|
|
|
|
|
|
@ -95,6 +98,12 @@ export class OpenHistoryList extends React.Component<HistoryProp, {}>
|
|
|
|
|
_LastOper = "";
|
|
|
|
|
_Data = this.props.data;
|
|
|
|
|
@observable _CanOpen: boolean = false;
|
|
|
|
|
constructor(props)
|
|
|
|
|
{
|
|
|
|
|
super(props);
|
|
|
|
|
if (this.props.newFileId)
|
|
|
|
|
this._CanOpen = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render()
|
|
|
|
|
{
|
|
|
|
@ -109,7 +118,13 @@ export class OpenHistoryList extends React.Component<HistoryProp, {}>
|
|
|
|
|
label="只显示能还原记录"
|
|
|
|
|
style={{ position: 'absolute', right: "10px", fontSize: "12px", top: "15px" }}
|
|
|
|
|
checked={this._CanOpen}
|
|
|
|
|
onClick={(e) => { this._Index = 0, this._LastOper = "", this._CanOpen = !this._CanOpen; e.currentTarget.blur(); }}
|
|
|
|
|
onClick={(e) =>
|
|
|
|
|
{
|
|
|
|
|
this._Index = 0;
|
|
|
|
|
this._LastOper = "";
|
|
|
|
|
this._CanOpen = !this._CanOpen;
|
|
|
|
|
e.currentTarget.blur();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</th>
|
|
|
|
|
</tr>
|
|
|
|
@ -125,6 +140,7 @@ export class OpenHistoryList extends React.Component<HistoryProp, {}>
|
|
|
|
|
|
|
|
|
|
_AllDataList = () =>
|
|
|
|
|
{
|
|
|
|
|
let count = 0;
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
{
|
|
|
|
@ -134,6 +150,11 @@ export class OpenHistoryList extends React.Component<HistoryProp, {}>
|
|
|
|
|
if (this._LastOper === "打开")
|
|
|
|
|
return;
|
|
|
|
|
this._LastOper = d.oper_type_name;
|
|
|
|
|
|
|
|
|
|
if (d.oper_type_name === "修改")
|
|
|
|
|
count++;
|
|
|
|
|
if (this.props.newFileId && count > 5) return;
|
|
|
|
|
|
|
|
|
|
return <tr key={d.oper_date}>
|
|
|
|
|
<td>{d.oper_type_name}</td>
|
|
|
|
|
<td
|
|
|
|
@ -160,13 +181,16 @@ export class OpenHistoryList extends React.Component<HistoryProp, {}>
|
|
|
|
|
|
|
|
|
|
_CanOpenDataList = () =>
|
|
|
|
|
{
|
|
|
|
|
let count = 0;
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
{
|
|
|
|
|
this._Data.map(d =>
|
|
|
|
|
this._Data.map((d, i) =>
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
count++;
|
|
|
|
|
if (this.props.newFileId && count > 5) return;
|
|
|
|
|
return <tr>
|
|
|
|
|
<td>{d.oper_type_name}</td>
|
|
|
|
|
<td
|
|
|
|
@ -188,10 +212,8 @@ export class OpenHistoryList extends React.Component<HistoryProp, {}>
|
|
|
|
|
text="打开"
|
|
|
|
|
onClick={(e) =>
|
|
|
|
|
{
|
|
|
|
|
this.props.OnClickOpenFile(this.props.userName, this.props.fileId, this.props.files, e.currentTarget.value);
|
|
|
|
|
if (this.props.isNotToaster)
|
|
|
|
|
app.Editor.ModalManage.m_PromisRes({ Status: ModalState.Ok });
|
|
|
|
|
app.Editor.ModalManage.Destory();
|
|
|
|
|
let index = e.currentTarget.value;
|
|
|
|
|
this.handleOpen(index);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</td>
|
|
|
|
@ -201,6 +223,43 @@ export class OpenHistoryList extends React.Component<HistoryProp, {}>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
handleOpen = async (index: number) =>
|
|
|
|
|
{
|
|
|
|
|
const { fileId, newFileId, files, userName } = this.props;
|
|
|
|
|
let status: boolean = true;
|
|
|
|
|
if (newFileId)
|
|
|
|
|
{
|
|
|
|
|
let server = FileServer.GetInstance();
|
|
|
|
|
if (fileId != newFileId)
|
|
|
|
|
{
|
|
|
|
|
server._CurrentFilePath = "";
|
|
|
|
|
server.m_CurFileId = newFileId;
|
|
|
|
|
let info = await server.GetFileInfo(newFileId);
|
|
|
|
|
server.CurrentFileMd5 = info.code;
|
|
|
|
|
if (info.name)
|
|
|
|
|
server.currentFileInfo.name = info.name;
|
|
|
|
|
localStorage.setItem(StoreageKeys.LastOpenFileId, info.file_id || "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
status = await this.props.OnClickOpenFile(userName, newFileId, files, index);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
status = await this.props.OnClickOpenFile(userName, fileId, files, index);
|
|
|
|
|
}
|
|
|
|
|
if (!status)
|
|
|
|
|
{
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
message: "打开图纸失败,请尝试打开其他历史记录图纸",
|
|
|
|
|
timeout: 3000,
|
|
|
|
|
intent: Intent.DANGER,
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this.props.isNotToaster)
|
|
|
|
|
app.Editor.ModalManage.m_PromisRes({ Status: ModalState.Ok });
|
|
|
|
|
app.Editor.ModalManage.Destory();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_ButtonEl(name: string, oper_date: string, file_date: string): React.ReactElement<any>
|
|
|
|
|
{
|
|
|
|
@ -210,12 +269,10 @@ export class OpenHistoryList extends React.Component<HistoryProp, {}>
|
|
|
|
|
className="histroyBtn"
|
|
|
|
|
value={this._Index++}
|
|
|
|
|
text="打开"
|
|
|
|
|
onClick={(e) =>
|
|
|
|
|
onClick={async (e) =>
|
|
|
|
|
{
|
|
|
|
|
this.props.OnClickOpenFile(this.props.userName, this.props.fileId, this.props.files, e.currentTarget.value);
|
|
|
|
|
if (this.props.isNotToaster)
|
|
|
|
|
app.Editor.ModalManage.m_PromisRes({ Status: ModalState.Ok });
|
|
|
|
|
app.Editor.ModalManage.Destory();
|
|
|
|
|
let index = e.currentTarget.value;
|
|
|
|
|
this.handleOpen(index);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|