|
@@ -1,5 +1,5 @@
|
|
|
import React, { useState } from "react";
|
|
|
-import { ProCard, ProTable, PageContainer } from "@ant-design/pro-components";
|
|
|
+import { ProTable, PageContainer } from "@ant-design/pro-components";
|
|
|
import {
|
|
|
Card,
|
|
|
Col,
|
|
@@ -9,22 +9,36 @@ import {
|
|
|
Breadcrumb,
|
|
|
Empty,
|
|
|
Pagination,
|
|
|
+ Modal,
|
|
|
+ Tree,
|
|
|
+ Dropdown,
|
|
|
} from "antd";
|
|
|
import { useRequest } from "umi";
|
|
|
import { AppstoreOutlined, MenuOutlined } from "@ant-design/icons";
|
|
|
import { FlowchartMindMapList } from "@/api/systemDesigner";
|
|
|
import ProjectCard from "./ProjectCard";
|
|
|
+import { graphOptions } from "./data";
|
|
|
+import { GraphType } from "@/enum";
|
|
|
|
|
|
export default function All() {
|
|
|
const [display, setDisplay] = useState("card");
|
|
|
const [dataSource, setDataSource] = useState<any[]>([]);
|
|
|
const [total, setTotal] = useState(0);
|
|
|
+ const [searchName, setSearchName] = useState("");
|
|
|
+ const [currentPage, setCurrentPage] = useState(1);
|
|
|
+ const [open, setOpen] = useState(false);
|
|
|
|
|
|
const { loading, run, refresh } = useRequest(FlowchartMindMapList, {
|
|
|
defaultParams: [
|
|
|
{
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 10,
|
|
|
+ currentPage,
|
|
|
+ pageSize: 12,
|
|
|
+ filters: [
|
|
|
+ {
|
|
|
+ name: "name",
|
|
|
+ value: searchName,
|
|
|
+ },
|
|
|
+ ],
|
|
|
},
|
|
|
],
|
|
|
onSuccess: (res) => {
|
|
@@ -33,20 +47,79 @@ export default function All() {
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+ const FolderIcon = function () {
|
|
|
+ return (
|
|
|
+ <svg className="icon" aria-hidden="true">
|
|
|
+ <use xlinkHref="#icon-weibiaoti-_huabanfuben"></use>
|
|
|
+ </svg>
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
+ const folderTreeData = [
|
|
|
+ {
|
|
|
+ key: "1",
|
|
|
+ title: (
|
|
|
+ <span>
|
|
|
+ 我的文件<span className="text-12px color-#999">(当前)</span>
|
|
|
+ </span>
|
|
|
+ ),
|
|
|
+ icon: <FolderIcon />,
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ key: "1-1",
|
|
|
+ title: "文件夹1",
|
|
|
+ icon: <FolderIcon />,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
// 打开文件夹
|
|
|
const handleOpenFolder = () => {};
|
|
|
|
|
|
+ // 搜索文件
|
|
|
+ const handleSearch = () => {
|
|
|
+ setCurrentPage(1);
|
|
|
+ run({
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 12,
|
|
|
+ filters: [
|
|
|
+ {
|
|
|
+ name: "name",
|
|
|
+ value: searchName,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 搜索图形类型
|
|
|
+ const setSearchGraphType = (type: GraphType) => {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleOpenFolderModal = (id: string) => {
|
|
|
+ setOpen(true);
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<PageContainer
|
|
|
extra={[
|
|
|
- <Button
|
|
|
- key="1"
|
|
|
- onClick={() => {
|
|
|
- setDisplay(display === "card" ? "list" : "card");
|
|
|
- }}
|
|
|
- icon={<i className="iconfont icon-shaixuan" />}
|
|
|
- />,
|
|
|
+ <Dropdown key="1" menu={{ items: graphOptions.map(item => {
|
|
|
+ return {
|
|
|
+ key: item.key,
|
|
|
+ label: item.label,
|
|
|
+ value: item.value,
|
|
|
+ onClick: () => {
|
|
|
+ setSearchGraphType(item.value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }) }}>
|
|
|
+ <Button
|
|
|
+ key="1"
|
|
|
+ icon={<i className="iconfont icon-shaixuan" />}
|
|
|
+ />
|
|
|
+ </Dropdown>,
|
|
|
<Button
|
|
|
key="2"
|
|
|
onClick={() => {
|
|
@@ -59,126 +132,163 @@ export default function All() {
|
|
|
<Input
|
|
|
placeholder="搜索文件/文件夹"
|
|
|
prefix={<i className="iconfont icon-chazhao" />}
|
|
|
+ value={searchName}
|
|
|
+ onChange={(e) => {
|
|
|
+ setSearchName(e.target.value);
|
|
|
+ }}
|
|
|
+ onPressEnter={handleSearch}
|
|
|
/>
|
|
|
}
|
|
|
footer={[]}
|
|
|
>
|
|
|
- {/* <ProCard
|
|
|
- style={{
|
|
|
- height: "calc(100vh - 140px)",
|
|
|
- minHeight: 800,
|
|
|
- overflow: "auto",
|
|
|
- }}
|
|
|
- > */}
|
|
|
- <Breadcrumb
|
|
|
- items={[
|
|
|
+ <Breadcrumb
|
|
|
+ items={[
|
|
|
+ {
|
|
|
+ title: "我的文件",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "文件夹",
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ ></Breadcrumb>
|
|
|
+ {display === "card" ? (
|
|
|
+ <>
|
|
|
+ <div className="text-12px color-#999 my-8px">文件夹</div>
|
|
|
+ <div className="flex gap-12px flex-wrap">
|
|
|
+ {new Array(2).fill(0).map((item, index) => {
|
|
|
+ return (
|
|
|
+ <Card
|
|
|
+ hoverable
|
|
|
+ bordered
|
|
|
+ className="w-240px"
|
|
|
+ onClick={() => handleOpenFolder()}
|
|
|
+ key={index}
|
|
|
+ >
|
|
|
+ <Card.Meta
|
|
|
+ title={
|
|
|
+ <span>
|
|
|
+ <svg className="icon" aria-hidden="true">
|
|
|
+ <use xlinkHref="#icon-weibiaoti-_huabanfuben"></use>
|
|
|
+ </svg>
|
|
|
+ <span className="ml-8px">文件夹</span>
|
|
|
+ </span>
|
|
|
+ }
|
|
|
+ />
|
|
|
+ </Card>
|
|
|
+ );
|
|
|
+ })}
|
|
|
+ </div>
|
|
|
+ <div className="text-12px color-#999 my-8px">文件</div>
|
|
|
+ <Row gutter={[8, 16]}>
|
|
|
+ {dataSource.map((item, index) => {
|
|
|
+ return (
|
|
|
+ <Col xs={12} sm={8} md={6} lg={6} xl={6} xxl={6} key={index}>
|
|
|
+ <ProjectCard
|
|
|
+ record={item}
|
|
|
+ onFresh={refresh}
|
|
|
+ onDelete={refresh}
|
|
|
+ onChangeLocation={handleOpenFolderModal}
|
|
|
+ />
|
|
|
+ </Col>
|
|
|
+ );
|
|
|
+ })}
|
|
|
+ </Row>
|
|
|
+ <div className="flex justify-end py-16px">
|
|
|
+ <Pagination
|
|
|
+ total={total}
|
|
|
+ current={currentPage}
|
|
|
+ pageSize={12}
|
|
|
+ pageSizeOptions={["12", "24", "36"]}
|
|
|
+ onChange={(page, pageSize) => {
|
|
|
+ setCurrentPage(page);
|
|
|
+ run({
|
|
|
+ currentPage: page,
|
|
|
+ pageSize: pageSize,
|
|
|
+ filters: [
|
|
|
+ {
|
|
|
+ name: "name",
|
|
|
+ value: searchName,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ hideOnSinglePage
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ {dataSource.length == 0 ? <Empty description="暂无数据" /> : null}
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <ProTable
|
|
|
+ loading={loading}
|
|
|
+ columns={[
|
|
|
+ {
|
|
|
+ title: "名称",
|
|
|
+ dataIndex: "name",
|
|
|
+ },
|
|
|
{
|
|
|
- title: "我的文件",
|
|
|
+ title: "类型",
|
|
|
+ dataIndex: "type",
|
|
|
},
|
|
|
{
|
|
|
- title: "文件夹",
|
|
|
+ title: "修改时间",
|
|
|
+ dataIndex: "updatedTime",
|
|
|
+ sorter: (a, b) => a.updateTime - b.updateTime,
|
|
|
},
|
|
|
]}
|
|
|
- ></Breadcrumb>
|
|
|
- {display === "card" ? (
|
|
|
- <>
|
|
|
- <div className="text-12px color-#999 my-8px">文件夹</div>
|
|
|
- <div className="flex gap-12px flex-wrap">
|
|
|
- {new Array(2).fill(0).map((item, index) => {
|
|
|
- return (
|
|
|
- <Card
|
|
|
- hoverable
|
|
|
- bordered
|
|
|
- className="w-240px"
|
|
|
- onClick={() => handleOpenFolder()}
|
|
|
- key={index}
|
|
|
- >
|
|
|
- <Card.Meta
|
|
|
- title={
|
|
|
- <span>
|
|
|
- <svg className="icon" aria-hidden="true">
|
|
|
- <use xlinkHref="#icon-weibiaoti-_huabanfuben"></use>
|
|
|
- </svg>
|
|
|
- <span className="ml-8px">文件夹</span>
|
|
|
- </span>
|
|
|
- }
|
|
|
- />
|
|
|
- </Card>
|
|
|
- );
|
|
|
- })}
|
|
|
- </div>
|
|
|
- <div className="text-12px color-#999 my-8px">文件</div>
|
|
|
- <Row gutter={[8, 16]}>
|
|
|
- {dataSource.map((item, index) => {
|
|
|
- return (
|
|
|
- <Col
|
|
|
- xs={12}
|
|
|
- sm={8}
|
|
|
- md={6}
|
|
|
- lg={6}
|
|
|
- xl={6}
|
|
|
- xxl={6}
|
|
|
- key={index}
|
|
|
- >
|
|
|
- <ProjectCard record={item} onFresh={refresh} onDelete={refresh}/>
|
|
|
- </Col>
|
|
|
- );
|
|
|
- })}
|
|
|
- </Row>
|
|
|
- <div className="flex justify-end py-16px">
|
|
|
- <Pagination
|
|
|
- total={total}
|
|
|
- defaultCurrent={1}
|
|
|
- pageSize={10}
|
|
|
- pageSizeOptions={["10", "20", "30"]}
|
|
|
- onChange={(page, pageSize) => {
|
|
|
- run({
|
|
|
- currentPage: page,
|
|
|
- pageSize: pageSize,
|
|
|
- });
|
|
|
- }}
|
|
|
- hideOnSinglePage
|
|
|
- />
|
|
|
- </div>
|
|
|
- {dataSource.length == 0 ? <Empty description="暂无数据" /> : null}
|
|
|
- </>
|
|
|
- ) : (
|
|
|
- <ProTable
|
|
|
- loading={loading}
|
|
|
- columns={[
|
|
|
- {
|
|
|
- title: "名称",
|
|
|
- dataIndex: "name",
|
|
|
- },
|
|
|
- {
|
|
|
- title: "类型",
|
|
|
- dataIndex: "type",
|
|
|
- },
|
|
|
- {
|
|
|
- title: "修改时间",
|
|
|
- dataIndex: "updatedTime",
|
|
|
- sorter: (a, b) => a.updateTime - b.updateTime,
|
|
|
- },
|
|
|
- ]}
|
|
|
- dataSource={dataSource}
|
|
|
- rowKey={"id"}
|
|
|
- search={false}
|
|
|
- pagination={{
|
|
|
- total: total,
|
|
|
- pageSize: 10,
|
|
|
- defaultCurrent: 1,
|
|
|
- pageSizeOptions: ["10", "20", "30"],
|
|
|
- onChange: (page, pageSize) => {
|
|
|
- run({
|
|
|
- currentPage: page,
|
|
|
- pageSize: pageSize,
|
|
|
- });
|
|
|
- },
|
|
|
- }}
|
|
|
- />
|
|
|
- )}
|
|
|
- {/* </ProCard> */}
|
|
|
+ dataSource={dataSource}
|
|
|
+ rowKey={"id"}
|
|
|
+ search={false}
|
|
|
+ pagination={{
|
|
|
+ total: total,
|
|
|
+ pageSize: 12,
|
|
|
+ current: currentPage,
|
|
|
+ pageSizeOptions: ["12", "24", "36"],
|
|
|
+ onChange: (page, pageSize) => {
|
|
|
+ setCurrentPage(page);
|
|
|
+ run({
|
|
|
+ currentPage: page,
|
|
|
+ pageSize: pageSize,
|
|
|
+ filters: [
|
|
|
+ {
|
|
|
+ name: "name",
|
|
|
+ value: searchName,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ },
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )}
|
|
|
</PageContainer>
|
|
|
+
|
|
|
+ <Modal
|
|
|
+ title="移动/复制到"
|
|
|
+ width={440}
|
|
|
+ open={open}
|
|
|
+ onCancel={() => setOpen(false)}
|
|
|
+ centered
|
|
|
+ footer={
|
|
|
+ <div>
|
|
|
+ <Button className="m-r-8px" onClick={() => setOpen(false)}>
|
|
|
+ 取消
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ className="m-r-8px"
|
|
|
+ type="primary"
|
|
|
+ onClick={() => setOpen(false)}
|
|
|
+ >
|
|
|
+ 移动
|
|
|
+ </Button>
|
|
|
+ <Button type="primary" onClick={() => setOpen(false)}>
|
|
|
+ 复制
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <div className="min-h-300px">
|
|
|
+ <Tree treeData={folderTreeData} showIcon blockNode />
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
</>
|
|
|
);
|
|
|
}
|