|
|
@ -9,6 +9,7 @@ import { DirUrl, FileUrls, MaterialUrls, SendTemplateUrl, TemplateUrls, ToplineU
|
|
|
|
import { KeyBoard, MouseKey } from '../../../Common/KeyEnum';
|
|
|
|
import { KeyBoard, MouseKey } from '../../../Common/KeyEnum';
|
|
|
|
import { DirectoryId, PostJson, RequestStatus } from '../../../Common/Request';
|
|
|
|
import { DirectoryId, PostJson, RequestStatus } from '../../../Common/Request';
|
|
|
|
import { isNum } from '../../../Common/Utils';
|
|
|
|
import { isNum } from '../../../Common/Utils';
|
|
|
|
|
|
|
|
import { IFileInfo } from '../../../DatabaseServices/FileServer';
|
|
|
|
import { AppConfirm } from '../Common/Confirm';
|
|
|
|
import { AppConfirm } from '../Common/Confirm';
|
|
|
|
import { AppToaster } from '../Toaster';
|
|
|
|
import { AppToaster } from '../Toaster';
|
|
|
|
import { HandleDirComponent } from './HandleDirComponent';
|
|
|
|
import { HandleDirComponent } from './HandleDirComponent';
|
|
|
@ -50,6 +51,13 @@ interface ICommonPanelProps
|
|
|
|
loadCacheDirKey?: string;
|
|
|
|
loadCacheDirKey?: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface IDir
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dir_id: string;
|
|
|
|
|
|
|
|
dir_name: string;
|
|
|
|
|
|
|
|
childs: IDir[];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum EOrderType
|
|
|
|
enum EOrderType
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ByCreate = "create_date desc",
|
|
|
|
ByCreate = "create_date desc",
|
|
|
@ -366,6 +374,8 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
copy: this.copy,
|
|
|
|
copy: this.copy,
|
|
|
|
paste: this.paste,
|
|
|
|
paste: this.paste,
|
|
|
|
copyIds: this.copyIds,
|
|
|
|
copyIds: this.copyIds,
|
|
|
|
|
|
|
|
searchStr: this.state.searchStr,
|
|
|
|
|
|
|
|
searchDir: this.state.searchDir,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -826,12 +836,22 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
query.dir_id = DirectoryId.None;
|
|
|
|
query.dir_id = DirectoryId.None;
|
|
|
|
|
|
|
|
|
|
|
|
let data = await PostJson(this.props.getUrl, query);
|
|
|
|
let data = await PostJson(this.props.getUrl, query);
|
|
|
|
|
|
|
|
|
|
|
|
if (data.err_code === RequestStatus.Ok && Number(data.count))
|
|
|
|
if (data.err_code === RequestStatus.Ok && Number(data.count))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (this.props.defaultDirId === DirectoryId.TemplateDir && this.state.searchStr) //模板列表 搜索的data值 路径处理
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let dataList: any[] = data.modules || [];
|
|
|
|
|
|
|
|
await this.AddPathByFileInfos(dataList);
|
|
|
|
|
|
|
|
observable(this.dataList).replace(dataList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let dataList: any[] = data.images || data.materials || data.toplines || data.files || data.modules || [];
|
|
|
|
let dataList: any[] = data.images || data.materials || data.toplines || data.files || data.modules || [];
|
|
|
|
dataList.forEach(d => d.isChecked = false);
|
|
|
|
dataList.forEach(d => d.isChecked = false);
|
|
|
|
this.dataList.replace(dataList);
|
|
|
|
this.dataList.replace(dataList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
this.dataList.length = 0;
|
|
|
|
this.dataList.length = 0;
|
|
|
|
this.pageData.count = parseInt(data.count);
|
|
|
|
this.pageData.count = parseInt(data.count);
|
|
|
@ -839,6 +859,63 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
this.setState({ isSelectAll: false });
|
|
|
|
this.setState({ isSelectAll: false });
|
|
|
|
this.loading = false;
|
|
|
|
this.loading = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//模板列表搜索返回的数据获取相对应目录路径--- 开始 ---
|
|
|
|
|
|
|
|
private async AddPathByFileInfos(files: IFileInfo[])
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (files.length === 0) return;
|
|
|
|
|
|
|
|
let data = await PostJson(DirUrl.query, { dir_type: this.props.defaultDirId });
|
|
|
|
|
|
|
|
if (data.err_code === RequestStatus.Ok && data.dirs)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let dirs = data.dirs;
|
|
|
|
|
|
|
|
for (let file of files)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let info = this.getPath(dirs, file);
|
|
|
|
|
|
|
|
file.path = info.pathString;
|
|
|
|
|
|
|
|
file.pathNum = info.pathNum;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private getPath(dirs: IDir[], file: IFileInfo)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let pathNum: number[] = [];
|
|
|
|
|
|
|
|
let pathString = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (file.dir_id === this.props.defaultDirId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
pathString: "/",
|
|
|
|
|
|
|
|
pathNum: [],
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (let i = 0; i < dirs.length; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
const dir = dirs[i];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dir.dir_id === file.dir_id)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pathNum.push(i);
|
|
|
|
|
|
|
|
pathString += dir.dir_name + "/";
|
|
|
|
|
|
|
|
return { pathString, pathNum };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dir.childs.length > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let data = this.getPath(dir.childs, file);
|
|
|
|
|
|
|
|
if (data.pathNum.length > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pathNum.push(i);
|
|
|
|
|
|
|
|
pathString += dir.dir_name + "/";
|
|
|
|
|
|
|
|
pathNum.push(...data.pathNum);
|
|
|
|
|
|
|
|
pathString += data.pathString;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return { pathString, pathNum };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//模板列表搜索返回的数据获取相对应目录路径--- 结束 ---
|
|
|
|
private getSelectDataIds = () =>
|
|
|
|
private getSelectDataIds = () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (this.state.isSelectAll)
|
|
|
|
if (this.state.isSelectAll)
|
|
|
@ -879,7 +956,6 @@ export class CommonPanel extends React.Component<ICommonPanelProps, ICommonPanel
|
|
|
|
if (this.props.delete)
|
|
|
|
if (this.props.delete)
|
|
|
|
this.props.delete(query);
|
|
|
|
this.props.delete(query);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//点击节点容器的动作
|
|
|
|
//点击节点容器的动作
|
|
|
|
private handleTreeMouseDown = (e: MouseEvent) =>
|
|
|
|
private handleTreeMouseDown = (e: MouseEvent) =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|