shaogen1995 2 years ago
parent
commit
bd6b9be9f1

+ 2 - 2
src/pages/A2Dict/A2Tab1/A2Tab1Add/index.tsx

@@ -19,7 +19,7 @@ function A2Tab1Add({ info, closeFu, addFu }: Props) {
 
   // 点击提交
   const btnOkFu = useCallback(async () => {
-    if (!name) return MessageFu.warning("字典不能为空!");
+    if (!name) return MessageFu.warning("字典名称不能为空!");
 
     const obj = {
       ...info,
@@ -63,7 +63,7 @@ function A2Tab1Add({ info, closeFu, addFu }: Props) {
     >
       <div className="A2TableAddMain">
         <div className="A2TableAddRow">
-          <span className="rowSpan">字典值:</span>
+          <span className="bs rowSpan">字典名称:</span>
           <div className="inputBox">
             <Input
               disabled={info.name === "未分类"}

+ 1 - 1
src/pages/A2Dict/A2Tab1/A2Table1.tsx

@@ -56,7 +56,7 @@ function A2Table1({ editFu, upTaleFu, type }: Props) {
           item.name !== "未分类" ? index + 1 : "-",
       },
       {
-        title: "字典",
+        title: "字典名称",
         dataIndex: "name",
       },
       {

+ 4 - 4
src/pages/A2Dict/A2Tab1/A2Table3.tsx

@@ -92,7 +92,7 @@ function A2Table3({ editFu, upTaleFu, myType }: Props) {
   const columns = useMemo(() => {
     return [
       {
-        title: <>&emsp;&nbsp;{myType === "字典" ? "字典" : "部门名称"}</>,
+        title: <>&emsp;&nbsp;{myType === "字典" ? "字典名称" : "部门名称"}</>,
         dataIndex: "name",
       },
       {
@@ -128,11 +128,11 @@ function A2Table3({ editFu, upTaleFu, myType }: Props) {
                     id: "-1",
                     parentId: item.id,
                     name: item.name,
-                    level: item.level,
+                    level: item.level + 1,
                   } as A5TableType)
                 }
               >
-                新增子部门
+                {myType === "字典" ? "新增子阶段" : "新增子部门"}
               </Button>
             ) : null}
 
@@ -184,7 +184,7 @@ function A2Table3({ editFu, upTaleFu, myType }: Props) {
       {tableList.length ? (
         <Table
           size={myType === "字典" ? "small" : "large"}
-          scroll={{ y: myType === "字典" ? 750 : "null" }}
+          scroll={{ y: myType === "字典" ? "auto" : 750 }}
           dataSource={tableList}
           columns={columns}
           rowKey="id"

+ 6 - 3
src/pages/A2Dict/A2Tab1/index.module.scss

@@ -2,6 +2,8 @@
   :global {
 
     .A2tableBox {
+      border-top: 1px solid var(--themeColor);
+      padding-top: 15px;
       margin-bottom: 20px;
 
       .A2tableBoxBtn {
@@ -18,9 +20,10 @@
       }
 
       #A2Table3 {
-        .ant-table-cell-with-append {
-          display: flex;
-          justify-content: start;
+        .ant-table-body {
+          overflow-y: auto !important;
+
+
         }
       }
     }

+ 11 - 0
src/pages/A2Dict/A2Tab1/index.tsx

@@ -8,6 +8,7 @@ import { A2Tab1_1 } from "@/types/api/A2Dict";
 import A2Tab1Add from "./A2Tab1Add";
 import A2Table3 from "./A2Table3";
 import { A5TableType } from "@/types";
+import A5Add from "@/pages/A5Section/A5Add";
 function A2Tab1() {
   const dispatch = useDispatch();
 
@@ -93,6 +94,16 @@ function A2Tab1() {
           addFu={() => getListFu1()}
         />
       ) : null}
+
+      {/* 新增和编辑 阶段*/}
+      {addInfo2.id ? (
+        <A5Add
+          myType="字典"
+          info={addInfo2}
+          closeFu={() => setAddInfo2({} as A5TableType)}
+          addFu={() => getListFu2()}
+        />
+      ) : null}
     </div>
   );
 }

+ 83 - 0
src/pages/A2Dict/A2Tab2/A2Tab2Add/A2Tab2AddTable.tsx

@@ -0,0 +1,83 @@
+import React, { useCallback, useEffect, useMemo, useState } from "react";
+import { A5TableType } from "@/types";
+import { Radio, Table } from "antd";
+import { forwardRef, useImperativeHandle } from "react";
+
+type Props = {
+  data: A5TableType[];
+  type: "部门" | "阶段";
+  valAc: string;
+  ref: any;
+};
+
+function A2Tab2AddTable({ data, type, valAc }: Props, ref: any) {
+  const [value, setValue] = useState("");
+
+  useEffect(() => {
+    if (valAc) setValue(valAc);
+  }, [valAc]);
+
+  const kongGeFu = useCallback((level: 1 | 2 | 3 | 4, name: string) => {
+    let arr = "";
+    for (let i = 1; i < level; i++) {
+      arr += "&emsp;";
+    }
+    return arr + name;
+  }, []);
+
+  const A2Tab2AddTableResFu = useCallback(() => {
+    return value;
+  }, [value]);
+
+  // 可以让父组件调用子组件的方法
+  useImperativeHandle(ref, () => ({
+    A2Tab2AddTableResFu,
+  }));
+
+  const columns = useMemo(() => {
+    return [
+      {
+        width: 150,
+        title: "单选",
+        render: (item: A5TableType) => {
+          if (item.children) return null;
+          else
+            return (
+              <Radio
+                value={item.id}
+                checked={item.id === value}
+                onChange={(e) => setValue(e.target.value)}
+              ></Radio>
+            );
+        },
+      },
+      {
+        title: `${type}名称`,
+        render: (item: A5TableType) => (
+          <span
+            dangerouslySetInnerHTML={{
+              __html: kongGeFu(item.level, item.name),
+            }}
+          ></span>
+        ),
+      },
+    ];
+  }, [kongGeFu, type, value]);
+
+  return (
+    <>
+      {data.length ? (
+        <Table
+          size="small"
+          dataSource={data}
+          columns={columns}
+          rowKey="id"
+          pagination={false}
+          expandable={{ defaultExpandAllRows: true }}
+        />
+      ) : null}
+    </>
+  );
+}
+
+export default forwardRef(A2Tab2AddTable);

+ 77 - 0
src/pages/A2Dict/A2Tab2/A2Tab2Add/index.module.scss

@@ -0,0 +1,77 @@
+.A2Tab2Add {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+
+    .ant-modal {
+      width: 800px !important;
+    }
+
+    .A2Tab2AddMain {
+      margin-top: 10px;
+      border-top: 1px solid #999999;
+      padding-top: 25px;
+      max-height: 650px;
+      overflow-y: auto;
+
+      .A2Tab2AddRow {
+        margin-bottom: 20px;
+        position: relative;
+        display: flex;
+        padding: 0 24px 0 0px;
+        text-align: right;
+
+        .rowSpan {
+          display: inline-block;
+          width: 80px;
+          line-height: 32px;
+
+          &>span {
+            position: relative;
+            top: 2px;
+            color: #ff4d4f;
+          }
+        }
+
+        .bs {
+          &::before {
+            content: '*';
+            position: absolute;
+            top: 2px;
+            left: 1px;
+            z-index: 10;
+            color: #ff4d4f;
+          }
+        }
+
+        .inputBox {
+          width: calc(100% - 90px);
+
+          // 针对树表格
+          .ant-table-row-expand-icon {
+            display: none !important;
+          }
+
+        }
+
+        .A2Tab2AddRowRigth {
+          padding-top: 4px;
+          width: calc(100% - 90px);
+          text-align: left;
+
+          .A2T2row3 {
+            padding-top: 10px;
+            padding-left: 96px;
+          }
+        }
+
+      }
+
+      .A2Tab2AddMBtn {
+        margin-top: 30px;
+        text-align: center;
+      }
+    }
+  }
+}

+ 211 - 0
src/pages/A2Dict/A2Tab2/A2Tab2Add/index.tsx

@@ -0,0 +1,211 @@
+import React, { useCallback, useEffect, useRef, useState } from "react";
+import styles from "./index.module.scss";
+import { Button, Checkbox, Input, Modal, Popconfirm, Radio } from "antd";
+import { A2Tab2Type } from "@/types/api/A2Dict";
+import TextArea from "antd/es/input/TextArea";
+import { MessageFu } from "@/utils/message";
+import A2Tab2AddTable from "./A2Tab2AddTable";
+import { RootState } from "@/store";
+import { useSelector } from "react-redux";
+
+const row3ArrData = [
+  { id: 1, name: "所有格式" },
+  { id: 2, name: "指定格式" },
+];
+
+type Props = {
+  info: A2Tab2Type;
+  closeFu: () => void;
+  addFu: () => void;
+};
+
+function A2Tab2Add({ info, closeFu, addFu }: Props) {
+  // 文件名称
+  const [name, setName] = useState("");
+
+  // 文件说明
+  const [description, setDescription] = useState("");
+
+  // 支持格式
+  const [row3, setRow3] = useState<"所有格式" | "指定格式">("所有格式");
+
+  const [row3Arr, setRow3Arr] = useState([
+    {
+      id: 1,
+      done: true,
+      label: "pdf",
+    },
+    {
+      id: 2,
+      done: true,
+      label: "gif",
+    },
+  ]);
+
+  const row3OnChangeFu = useCallback(
+    (val: boolean, id: number) => {
+      if (row3Arr.filter((v) => v.done).length <= 1 && !val)
+        return MessageFu.warning("至少指定一种格式!");
+
+      setRow3Arr(
+        row3Arr.map((v) => ({
+          ...v,
+          done: v.id === id ? val : v.done,
+        }))
+      );
+    },
+    [row3Arr]
+  );
+
+  // 责任部门
+  const arr1 = useSelector((state: RootState) => state.A5Section.tableList);
+
+  const [row4Id, setRow4Id] = useState("");
+
+  const row4Ref = useRef<any>(null);
+
+  // 所属阶段
+  const arr2 = useSelector((state: RootState) => state.A2Dict.A2Tab1_2Arr);
+
+  const [row5Id, setRow5Id] = useState("");
+
+  const row5Ref = useRef<any>(null);
+
+  //  如果是编辑
+  useEffect(() => {
+    if (info.id !== -1) {
+      setName(info.name);
+      setDescription(info.description);
+    }
+  }, [info]);
+
+  // 点击提交
+  const btnOkFu = useCallback(() => {
+    if (!name) return MessageFu.warning("文件名称不能为空!");
+
+    if (row3 === "指定格式") {
+      console.log(
+        "-------",
+        row3Arr.filter((v) => v.done)
+      );
+    }
+
+    const id3 = row4Ref.current.A2Tab2AddTableResFu();
+    const id4 = row5Ref.current.A2Tab2AddTableResFu();
+
+    if (!id3) return MessageFu.warning("请选择责任部门!");
+    if (!id4) return MessageFu.warning("请选择所属阶段!");
+  }, [name, row3, row3Arr]);
+
+  return (
+    <Modal
+      wrapClassName={styles.A2Tab2Add}
+      destroyOnClose
+      open={true}
+      title={info.id === -1 ? "新增内控文件" : "编辑内控文件"}
+      footer={
+        [] // 设置footer为空,去掉 取消 确定默认按钮
+      }
+    >
+      <div className="A2Tab2AddMain">
+        <div className="A2Tab2AddRow">
+          <span className="bs rowSpan">文件名称:</span>
+          <div className="inputBox">
+            <Input
+              disabled={info.name === "未分类"}
+              maxLength={10}
+              value={name}
+              onChange={(e) => setName(e.target.value.replace(/\s+/g, ""))}
+              showCount
+              placeholder="请输入内容,不能重复"
+            />
+          </div>
+        </div>
+
+        <div className="A2Tab2AddRow">
+          <span className="rowSpan">文件说明:</span>
+          <div className="inputBox">
+            <TextArea
+              rows={4}
+              placeholder="请输入内容"
+              maxLength={100}
+              showCount
+              value={description}
+              onChange={(e) =>
+                setDescription(e.target.value.replace(/\s+/g, ""))
+              }
+            />
+          </div>
+        </div>
+
+        <div className="A2Tab2AddRow">
+          <span className="bs rowSpan">支持格式:</span>
+          <div className="A2Tab2AddRowRigth">
+            <Radio.Group onChange={(e) => setRow3(e.target.value)} value={row3}>
+              {row3ArrData.map((v) => (
+                <Radio value={v.name} key={v.id}>
+                  {v.name}
+                </Radio>
+              ))}
+            </Radio.Group>
+            <div className="A2T2row3" hidden={row3 === "所有格式"}>
+              {row3Arr.map((v) => (
+                <Checkbox
+                  key={v.id}
+                  onChange={(e) => row3OnChangeFu(e.target.checked, v.id)}
+                  checked={v.done}
+                >
+                  {v.label}
+                </Checkbox>
+              ))}
+            </div>
+          </div>
+        </div>
+
+        <div className="A2Tab2AddRow">
+          <span className="bs rowSpan">责任部门:</span>
+          <div className="inputBox">
+            <A2Tab2AddTable
+              data={arr1}
+              type="部门"
+              valAc={row4Id}
+              ref={row4Ref}
+            />
+          </div>
+        </div>
+
+        <div className="A2Tab2AddRow">
+          <span className="bs rowSpan">所属阶段:</span>
+          <div className="inputBox">
+            <A2Tab2AddTable
+              data={arr2}
+              type="阶段"
+              valAc={row5Id}
+              ref={row5Ref}
+            />
+          </div>
+        </div>
+
+        <div className="A2Tab2AddMBtn">
+          <Popconfirm
+            title="放弃编辑后,信息将不会保存!"
+            okText="放弃"
+            cancelText="取消"
+            onConfirm={closeFu}
+            okButtonProps={{ loading: false }}
+          >
+            <Button>取消</Button>
+          </Popconfirm>
+          &emsp;
+          <Button type="primary" onClick={btnOkFu}>
+            提交
+          </Button>
+        </div>
+      </div>
+    </Modal>
+  );
+}
+
+const MemoA2Tab2Add = React.memo(A2Tab2Add);
+
+export default MemoA2Tab2Add;

+ 24 - 0
src/pages/A2Dict/A2Tab2/index.module.scss

@@ -0,0 +1,24 @@
+.A2Tab2 {
+  position: relative;
+
+  :global {
+
+    .A2Tab2AddBtnClick{
+      position: absolute;
+      z-index: 20;
+      right: 30px;
+      top:10px;
+    }
+
+    .ant-table-body {
+      height: 685px;
+      overflow-y: auto !important;
+
+      .ant-table-row {
+        .ant-table-cell {
+          padding: 10px;
+        }
+      }
+    }
+  }
+}

+ 121 - 0
src/pages/A2Dict/A2Tab2/index.tsx

@@ -0,0 +1,121 @@
+import React, { useCallback, useEffect, useMemo, useState } from "react";
+import styles from "./index.module.scss";
+import { useDispatch, useSelector } from "react-redux";
+import { A2_APIdelFile, A2_APIgetListFile } from "@/store/action/A2Dict";
+import { Button, Popconfirm, Table } from "antd";
+import { RootState } from "@/store";
+import { A2Tab2Type } from "@/types/api/A2Dict";
+import A2Tab2Add from "./A2Tab2Add";
+import { MessageFu } from "@/utils/message";
+function A2Tab2() {
+  const dispatch = useDispatch();
+
+  const getListFu = useCallback(() => {
+    dispatch(A2_APIgetListFile());
+  }, [dispatch]);
+
+  useEffect(() => {
+    getListFu();
+  }, [getListFu]);
+
+  const tableList = useSelector((state: RootState) => state.A2Dict.A2Tab2Arr);
+
+  // 点击删除
+  const delById = useCallback(
+    async (id: number) => {
+      const res = await A2_APIdelFile(id);
+      if (res.code === 0) {
+        MessageFu.success("删除成功!");
+        getListFu();
+      }
+    },
+    [getListFu]
+  );
+
+  const columns = useMemo(() => {
+    return [
+      {
+        title: "文件名称",
+        dataIndex: "name",
+      },
+      {
+        title: "文件说明",
+        render: (item: A2Tab2Type) =>
+          item.description ? (
+            item.description.length >= 30 ? (
+              <span style={{ cursor: "pointer" }} title={item.description}>
+                {item.description.substring(0, 30) + "..."}
+              </span>
+            ) : (
+              item.description
+            )
+          ) : (
+            "(空)"
+          ),
+      },
+      {
+        title: "责任部门",
+        dataIndex: "dept",
+      },
+      {
+        title: "操作",
+        render: (item: A2Tab2Type) => (
+          <>
+            <Button size="small" type="text" onClick={() => setAddInfo(item)}>
+              编辑
+            </Button>
+            {item.name !== "未分类" ? (
+              <Popconfirm
+                title="删除后无法恢复,是否删除?"
+                okText="删除"
+                cancelText="取消"
+                onConfirm={() => delById(item.id)}
+                okButtonProps={{ loading: false }}
+              >
+                <Button size="small" type="text" danger>
+                  删除
+                </Button>
+              </Popconfirm>
+            ) : null}
+          </>
+        ),
+      },
+    ];
+  }, [delById]);
+
+  // 新增和编辑的 数据
+  const [addInfo, setAddInfo] = useState({} as A2Tab2Type);
+
+  return (
+    <div className={styles.A2Tab2}>
+      <div className="A2Tab2AddBtnClick">
+        <Button
+          type="primary"
+          onClick={() => setAddInfo({ id: -1 } as A2Tab2Type)}
+        >
+          新增
+        </Button>
+      </div>
+
+      <Table
+        scroll={{ y: 685 }}
+        dataSource={tableList}
+        columns={columns}
+        rowKey="id"
+        pagination={false}
+      />
+
+      {addInfo.id ? (
+        <A2Tab2Add
+          info={addInfo}
+          closeFu={() => setAddInfo({} as A2Tab2Type)}
+          addFu={() => getListFu()}
+        />
+      ) : null}
+    </div>
+  );
+}
+
+const MemoA2Tab2 = React.memo(A2Tab2);
+
+export default MemoA2Tab2;

+ 1 - 1
src/pages/A2Dict/index.module.scss

@@ -13,8 +13,8 @@
         width: 100%;
         height: 100%;
         overflow-y: auto;
-
       }
+
     }
   }
 }

+ 8 - 5
src/pages/A2Dict/index.tsx

@@ -2,10 +2,11 @@ import React, { useState } from "react";
 import styles from "./index.module.scss";
 import { Button } from "antd";
 import A2Tab1 from "./A2Tab1";
+import A2Tab2 from "./A2Tab2";
 
 const topBtnArr = [
   { id: 1, name: "项目属性" },
-  { id: 2, name: "项目文件属性" },
+  { id: 2, name: "内控文件属性" },
 ];
 
 function A2Dict() {
@@ -24,12 +25,14 @@ function A2Dict() {
             {v.name}
           </Button>
         ))}
-        &emsp;&emsp;注:删除字典值时,与该字典值关联的数据都将关联到“未分类”
+        {acId === 1 ? (
+          <>
+            &emsp;&emsp;注:删除字典名称时,与该字典名称关联的数据都将关联到“未分类”
+          </>
+        ) : null}
       </div>
 
-      <div className="A2Main">
-        {acId===1?<A2Tab1 />:null}
-      </div>
+      <div className="A2Main">{acId === 1 ? <A2Tab1 /> : <A2Tab2 />}</div>
     </div>
   );
 }

+ 21 - 11
src/pages/A5Section/A5Add/index.tsx

@@ -5,14 +5,22 @@ import { A5TableType } from "@/types";
 import TextArea from "antd/es/input/TextArea";
 import { MessageFu } from "@/utils/message";
 import { A5_APIadd } from "@/store/action/A5Section";
+import { A2_APIadd1 } from "@/store/action/A2Dict";
 
 type Props = {
   info: A5TableType;
   closeFu: () => void;
   addFu: () => void;
+  myType?: "字典";
 };
 
-function A5Add({ info, closeFu, addFu }: Props) {
+function A5Add({ info, closeFu, addFu, myType }: Props) {
+  const txtRes = useMemo(() => {
+    let txt = "部门";
+    if (myType === "字典") txt = "字典";
+    return txt;
+  }, [myType]);
+
   const [name, setName] = useState("");
 
   const [description, setDescription] = useState("");
@@ -27,37 +35,39 @@ function A5Add({ info, closeFu, addFu }: Props) {
 
   // 点击提交
   const btnOkFu = useCallback(async () => {
-    if (!name) return MessageFu.warning("部门名称不能为空!");
+    if (!name) return MessageFu.warning(`${txtRes}名称不能为空!`);
 
     const obj = {
       ...info,
       id: info.id === "-1" ? null : info.id,
-      level: info.level ? info.level+1 : 1,
+      level: info.level ? info.level : 1,
       name,
       description,
+      type: myType === "字典" ? "stage" : null,
     };
 
-    const res = await A5_APIadd(obj);
+    const res =
+      myType === "字典" ? await A2_APIadd1(obj) : await A5_APIadd(obj);
 
     if (res.code === 0) {
       MessageFu.success(info.id === "-1" ? "新增成功!" : "编辑成功!");
       addFu();
       closeFu();
     }
-  }, [addFu, closeFu, description, info, name]);
+  }, [addFu, closeFu, description, info, myType, name, txtRes]);
 
   // 标题的动态显示
   const A5Tilele = useMemo(() => {
     let txt = "";
     if (info.id === "-1") {
-      txt = "新增部门";
-      if (info.parentId && info.name) txt = `新增 ${info.name} 子部门`;
+      txt = `新增${txtRes}`;
+      if (info.parentId && info.name) txt = `新增 ${info.name} 子${txtRes}`;
     } else {
-      txt = "编辑部门";
+      txt = `编辑${txtRes}`;
       if (info.parentId && info.name) txt = `编辑 ${info.name}`;
     }
     return txt;
-  }, [info.id, info.name, info.parentId]);
+  }, [info.id, info.name, info.parentId, txtRes]);
 
   return (
     <Modal
@@ -71,7 +81,7 @@ function A5Add({ info, closeFu, addFu }: Props) {
     >
       <div className="A5AddMain">
         <div className="A5AddRow">
-          <span className="bs rowSpan">部门名称:</span>
+          <span className="bs rowSpan">{txtRes}名称:</span>
           <div className="inputBox">
             <Input
               disabled={info.name === "未分类"}
@@ -85,7 +95,7 @@ function A5Add({ info, closeFu, addFu }: Props) {
         </div>
 
         <div className="A5AddRow">
-          <span className="rowSpan">部门说明:</span>
+          <span className="rowSpan">{txtRes}说明:</span>
           <div className="inputBox">
             <TextArea
               rows={4}

+ 2 - 2
src/pages/A5Section/index.module.scss

@@ -8,8 +8,8 @@
 
       .A5Top {
         position: absolute;
-        top: -60px;
-        left: 190px;
+        top: 10px;
+        right: 30px;
         z-index: 101;
       }
 

+ 9 - 180
src/pages/A5Section/index.tsx

@@ -1,11 +1,9 @@
-import React, { useCallback, useEffect, useMemo, useState } from "react";
+import React, { useCallback, useEffect, useState } from "react";
 import styles from "./index.module.scss";
-import { Button, Popconfirm, Table } from "antd";
-import { useDispatch, useSelector } from "react-redux";
-import { A5_APIdel, A5_APIgetList, A5_APIsort } from "@/store/action/A5Section";
-import { RootState } from "@/store";
+import { Button } from "antd";
+import { useDispatch } from "react-redux";
+import { A5_APIgetList } from "@/store/action/A5Section";
 import { A5TableType } from "@/types";
-import { MessageFu } from "@/utils/message";
 import A5Add from "./A5Add";
 import A2Table3 from "../A2Dict/A2Tab1/A2Table3";
 
@@ -20,165 +18,6 @@ function A5Section() {
     getListFu();
   }, [getListFu]);
 
-  // 获取表格数据
-  const tableList = useSelector(
-    (state: RootState) => state.A5Section.tableList
-  );
-
-  // 树型数组扁平化
-  const arrAllArr = useMemo(() => {
-    const arr: A5TableType[] = [...tableList];
-    const arr1: A5TableType[] = [];
-    arr.forEach((v) => {
-      arr1.push(v);
-      if (v.children && v.children.length) {
-        v.children.forEach((v2) => {
-          arr1.push(v2);
-          if (v2.children && v2.children.length) {
-            v2.children.forEach((v3) => {
-              arr1.push(v3);
-              if (v3.children && v3.children.length) {
-                v3.children.forEach((v4) => {
-                  arr1.push(v4);
-                });
-              }
-            });
-          }
-        });
-      }
-    });
-    return arr1;
-  }, [tableList]);
-
-  // 拿到当前点击 级别的 数组
-  const sonArrFu = useCallback(
-    (fId: string) => {
-      const arr: A5TableType[] = arrAllArr.filter(
-        (v) => v.parentId === fId && v.name !== "未分类"
-      );
-      return arr;
-    },
-    [arrAllArr]
-  );
-
-  // 点击删除
-  const delById = useCallback(
-    async (id: string) => {
-      const res = await A5_APIdel(id);
-      if (res.code === 0) {
-        MessageFu.success("删除成功!");
-        getListFu();
-      }
-    },
-    [getListFu]
-  );
-
-  // 点击 上移 和下移
-  const sortMoveFu = useCallback(
-    async (flag: 1 | -1, index: number, oldId: string, fId: string) => {
-      const arr = sonArrFu(fId);
-      const newId = arr[index + flag].id;
-
-      const res = await A5_APIsort(oldId, newId);
-
-      if (res.code === 0) {
-        getListFu();
-        MessageFu.success("排序修改成功!");
-      }
-    },
-    [getListFu, sonArrFu]
-  );
-
-  const columns = useMemo(() => {
-    return [
-      {
-        title: <>&emsp;&nbsp;部门名称</>,
-        dataIndex: "name",
-      },
-      {
-        title: "说明",
-        render: (item: A5TableType) =>
-          item.description ? (
-            item.description.length >= 30 ? (
-              <span style={{ cursor: "pointer" }} title={item.description}>
-                {item.description.substring(0, 30) + "..."}
-              </span>
-            ) : (
-              item.description
-            )
-          ) : (
-            "(空)"
-          ),
-      },
-      {
-        title: "同级排序",
-        render: (item: A5TableType, _: any, index: number) =>
-          item.name === "未分类" ? "-" : item.level + "级 - " + (index + 1),
-      },
-      {
-        title: "操作",
-        render: (item: A5TableType, _: any, index: number) => (
-          <>
-            {item.level < 4 && item.name !== "未分类" ? (
-              <Button
-                size="small"
-                type="text"
-                onClick={() =>
-                  setAddInfo({
-                    id: "-1",
-                    parentId: item.id,
-                    name: item.name,
-                    level: item.level,
-                  } as A5TableType)
-                }
-              >
-                新增子部门
-              </Button>
-            ) : null}
-
-            <Button size="small" type="text" onClick={() => setAddInfo(item)}>
-              编辑
-            </Button>
-            {index !== 0 && item.name !== "未分类" ? (
-              <Button
-                size="small"
-                type="text"
-                onClick={() => sortMoveFu(-1, index, item.id, item.parentId)}
-              >
-                上移
-              </Button>
-            ) : null}
-
-            {sonArrFu(item.parentId).length - 1 !== index &&
-            item.name !== "未分类" ? (
-              <Button
-                size="small"
-                type="text"
-                onClick={() => sortMoveFu(1, index, item.id, item.parentId)}
-              >
-                下移
-              </Button>
-            ) : null}
-
-            {item.name !== "未分类" ? (
-              <Popconfirm
-                title="删除后无法恢复,是否删除?"
-                okText="删除"
-                cancelText="取消"
-                onConfirm={() => delById(item.id)}
-                okButtonProps={{ loading: false }}
-              >
-                <Button size="small" type="text" danger>
-                  删除
-                </Button>
-              </Popconfirm>
-            ) : null}
-          </>
-        ),
-      },
-    ];
-  }, [delById, sonArrFu, sortMoveFu]);
-
   // 新增和编辑
   const [addInfo, setAddInfo] = useState({} as A5TableType);
 
@@ -199,21 +38,11 @@ function A5Section() {
 
         {/* 表格主体 */}
         <div className="A5tableBox">
-        <A2Table3
-          editFu={(item) => setAddInfo2(item)}
-          upTaleFu={() => getListFu2()}
-          myType='字典'
-        />
-          {tableList.length ? (
-            <Table
-              scroll={{ y: 750 }}
-              dataSource={tableList}
-              columns={columns}
-              rowKey="id"
-              pagination={false}
-              expandable={{ defaultExpandAllRows: true }}
-            />
-          ) : null}
+          <A2Table3
+            editFu={(item) => setAddInfo(item)}
+            upTaleFu={() => getListFu()}
+            myType="部门"
+          />
         </div>
       </div>
 

+ 11 - 0
src/pages/Layout/index.tsx

@@ -20,10 +20,21 @@ import { getTokenInfo, removeTokenInfo } from "@/utils/storage";
 import { MessageFu } from "@/utils/message";
 import { RouterType } from "@/types";
 import logoImg from "@/assets/img/logo.png";
+import { useDispatch } from "react-redux";
+import { A5_APIgetList } from "@/store/action/A5Section";
 
 const NotFound = React.lazy(() => import("@/components/NotFound"));
 
 function Layout() {
+
+  const dispatch =useDispatch()
+
+  useEffect(()=>{
+    // 进页面获取 部门 列表 信息
+    dispatch(A5_APIgetList())
+  },[dispatch])
+
+
   const listTemp = useMemo(() => {
     const arr: RouterType = [
       {

+ 20 - 0
src/store/action/A2Dict.ts

@@ -78,3 +78,23 @@ export const A2_APIdel = (id: number | string) => {
 export const A2_APIsort = (id1: number | string, id2: number | string) => {
   return http.get(`cms/dict/sort/${id1}/${id2}`);
 };
+
+/**
+ * 获取 内控文件属性列表
+ */
+export const A2_APIgetListFile = () => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.get("cms/attribute/getList");
+
+    if (res.code === 0) {
+      dispatch({ type: "A2/getInfo2", payload: res.data });
+    }
+  };
+};
+
+/**
+ * 删除 内控文件属性
+ */
+export const A2_APIdelFile = (id: number) => {
+  return http.get(`cms/attribute/remove/${id}`);
+};

+ 1 - 1
src/store/action/A5Section.ts

@@ -35,7 +35,7 @@ export const A5_APIgetList = () => {
 };
 
 /**
- * 获取部门管理树型数据
+ * 排序
  */
 export const A5_APIsort = (id1: string, id2: string) => {
   return http.get(`sys/dept/sort/${id1}/${id2}`);

+ 10 - 2
src/store/reducer/A2Dict.ts

@@ -1,5 +1,5 @@
 import { A5TableType } from "@/types";
-import { A2Tab1Type } from "@/types/api/A2Dict";
+import { A2Tab1Type, A2Tab2Type } from "@/types/api/A2Dict";
 
 // 初始化状态
 const initState = {
@@ -9,13 +9,18 @@ const initState = {
     job: [],
   } as A2Tab1Type,
 
+  // 阶段
   A2Tab1_2Arr: [] as A5TableType[],
+
+  // -------内控文件属性----------
+  A2Tab2Arr: [] as A2Tab2Type[],
 };
 
 // 定义 action 类型
 type Props =
   | { type: "A2/getInfo1_1"; payload: A2Tab1Type }
-  | { type: "A2/getInfo1_2"; payload: A5TableType[] };
+  | { type: "A2/getInfo1_2"; payload: A5TableType[] }
+  | { type: "A2/getInfo2"; payload: A2Tab2Type[] };
 
 // 频道 reducer
 export default function A2Reducer(state = initState, action: Props) {
@@ -25,6 +30,9 @@ export default function A2Reducer(state = initState, action: Props) {
       return { ...state, A2Tab1_1Obj: action.payload };
     case "A2/getInfo1_2":
       return { ...state, A2Tab1_2Arr: action.payload };
+    // 内控文件属性
+    case "A2/getInfo2":
+      return { ...state, A2Tab2Arr: action.payload };
     default:
       return state;
   }

+ 16 - 1
src/types/api/A2Dict.d.ts

@@ -8,7 +8,7 @@ export type A2Tab1_1 = {
   name: string;
   parentId: number;
   sort: number;
-  type: "status" | "job"
+  type: "status" | "job";
   updateTime: string;
 };
 
@@ -16,3 +16,18 @@ export type A2Tab1Type = {
   status: A2Tab1_1[];
   job: A2Tab1_1[];
 };
+
+export type A2Tab2Type = {
+  createTime: string;
+  creatorId?: any;
+  creatorName: string;
+  dept: string;
+  description: string;
+  formatType: string;
+  id: number;
+  name: string;
+  stage: string;
+  suffix: string;
+  type: string;
+  updateTime: string;
+};