shaogen1995 2 years ago
parent
commit
ba9f0b1583

+ 15 - 8
src/pages/A1Project/A1Inner/index.tsx

@@ -9,7 +9,7 @@ import styles from "./index.module.scss";
 import { Button, Cascader, Input, Select, Table, Tooltip } from "antd";
 import { useSelector } from "react-redux";
 import { RootState } from "@/store";
-import { A1_APIIgetList } from "@/store/action/A1Project";
+import { A1_APIIdowns, A1_APIIgetList } from "@/store/action/A1Project";
 import { A1ItableType } from "@/types";
 import { authFilesLookFu, urlChangeFu } from "@/utils/authFilesLook";
 import A1IRemove from "./A1IRemove";
@@ -28,10 +28,11 @@ type FromType = {
 
 type Props = {
   projectId: number;
-  myTitle:string
+  myTitle: string;
+  projectName: string;
 };
 
-function A1Inner({ projectId,myTitle }: Props) {
+function A1Inner({ projectId, myTitle, projectName }: Props) {
   // 表单数据
   const [fromData, setFromData] = useState<FromType>({
     searchKey: "",
@@ -95,9 +96,15 @@ function A1Inner({ projectId,myTitle }: Props) {
 
   // 点击批量下载
   const downSelectFu = useCallback(async () => {
-    // 清空选中
-    setSelectedRowKeys([]);
-  }, []);
+    const res = await A1_APIIdowns(selectedRowKeys.join(","));
+
+    if (res.code === 0) {
+      // console.log(123,res.data);
+      urlChangeFu(res.data, true, undefined, projectName + "(内)");
+      // 清空选中
+      setSelectedRowKeys([]);
+    }
+  }, [projectName, selectedRowKeys]);
 
   // 删除的弹窗数据
   const [delInfo, setDelInfo] = useState({ id: 0, name: "" });
@@ -108,7 +115,7 @@ function A1Inner({ projectId,myTitle }: Props) {
 
     const txt = num === 0 ? "待审批" : num === 1 ? "审批通过" : "审批驳回";
 
-    const dom = item.auditDesc ? (
+    const dom = item.auditDesc&&num !== 0 ? (
       <Tooltip title={item.auditDesc}>
         <div
           className="iconHoverTit A1ItablauidtBox"
@@ -170,7 +177,7 @@ function A1Inner({ projectId,myTitle }: Props) {
       },
       {
         title: "上传时间",
-        dataIndex: "createTime",
+        dataIndex: "updateTime",
       },
       {
         title: "审批状态",

+ 1 - 0
src/pages/A1Project/A1Look/index.tsx

@@ -110,6 +110,7 @@ function A1Look({ pageType, closeFu, tabType, lookTit }: Props) {
           <A1Inner
             projectId={pageType.id}
             myTitle={myTitle.split(" - ") ? myTitle.split(" - ")[0] : ""}
+            projectName={myTitle}
           />
         ) : topType === 4 ? (
           <A1User projectId={pageType.id} />

+ 17 - 8
src/pages/A4Role/A4Auth/A4AuRR2.tsx

@@ -1,21 +1,32 @@
-import { RootState } from "@/store";
 import { Button, Checkbox, Empty } from "antd";
 import { useCallback, useEffect, useState } from "react";
-import { useSelector } from "react-redux";
 import { forwardRef, useImperativeHandle } from "react";
 import { A4_APIgetRoleFile } from "@/store/action/A4Role";
 import { A4getRoleFileType } from "@/types";
 
+type ArrAllType = {
+  hasPerm: boolean;
+  id: number;
+  name: string;
+};
+
 type Props = {
   ref: any;
   mId: number;
 };
 
 function A4AuRR2({ mId }: Props, ref: any) {
+  const [arrAll, setArrAll] = useState<ArrAllType[]>([]);
+
   const getInfoFu = useCallback(async (id: number) => {
     const res = await A4_APIgetRoleFile(id);
     if (res.code === 0) {
       const arr: A4getRoleFileType[] = res.data;
+
+      // 所有
+      setArrAll(arr);
+
+      // 选中的 id 集合
       const arr1 = arr.filter((v) => v.hasPerm).map((v) => v.id);
       setCheckArr(arr1);
     }
@@ -25,8 +36,6 @@ function A4AuRR2({ mId }: Props, ref: any) {
     if (mId) getInfoFu(mId);
   }, [getInfoFu, mId]);
 
-  const arr = useSelector((state: RootState) => state.A2Dict.A2Tab2Arr);
-
   const [checkArr, setCheckArr] = useState([] as number[]);
 
   const onChangeFu = useCallback(
@@ -56,19 +65,19 @@ function A4AuRR2({ mId }: Props, ref: any) {
     <div className="A4AuRR2">
       <div className="A4ATit">
         内控文件权限 &emsp;{" "}
-        {arr.length > 1 ? (
+        {arrAll.length > 1 ? (
           <Button
             type="primary"
-            onClick={() => setCheckArr(arr.map((v) => v.id))}
+            onClick={() => setCheckArr(arrAll.map((v) => v.id))}
           >
             全选
           </Button>
         ) : null}
       </div>
 
-      {arr.length ? (
+      {arrAll.length ? (
         <div className="A4AR2Row">
-          {arr.map((v) => (
+          {arrAll.map((v) => (
             <Checkbox
               key={v.id}
               checked={checkArr.includes(v.id)}

+ 16 - 3
src/pages/A7Recycled/index.module.scss

@@ -1,5 +1,18 @@
-.A7Recycled{
-  :global{
-    
+.A7Recycled {
+  :global {
+    .A7Top {
+      border-radius: 10px;
+      padding: 20px 15px;
+      background-color: #fff;
+      display: flex;
+
+      .A7TopRow {
+        margin-right: 20px;
+      }
+
+      .A7TopBtn{
+        margin-left: 180px;
+      }
+    }
   }
 }

+ 116 - 5
src/pages/A7Recycled/index.tsx

@@ -1,12 +1,123 @@
-import React from "react";
+import React, { useCallback, useEffect, useRef, useState } from "react";
 import styles from "./index.module.scss";
- function A7Recycled() {
-  
+import { Button, DatePicker, Input, Popconfirm } from "antd";
+import { useDispatch } from "react-redux";
+import { A7_APIgetList } from "@/store/action/A7Recycled";
+
+const { RangePicker } = DatePicker;
+
+function A7Recycled() {
+  const dispatch = useDispatch();
+
+  const [fromData, setFromData] = useState({
+    searchKey: "",
+    userId: "",
+    startTime: "",
+    endTime: "",
+    sizeMin: "",
+    sizeMax: "",
+    pageNum: 1,
+    pageSize: 10,
+  });
+
+  // 输入框的定时器
+  const tableTime = useRef(-1);
+
+  const getListFu = useCallback(() => {
+    clearTimeout(tableTime.current);
+
+    tableTime.current = window.setTimeout(() => {
+      const obj = {
+        ...fromData,
+        sizeMin: fromData.sizeMin ? Number(fromData.sizeMin) : null,
+        sizeMax: fromData.sizeMax ? Number(fromData.sizeMax) : null,
+      };
+
+      console.log("---", obj);
+
+      // dispatch(A7_APIgetList(obj));
+    }, 500);
+  }, [dispatch, fromData]);
+
+  useEffect(() => {
+    getListFu();
+  }, [getListFu]);
+
+  // 输入框的输入
+  const tabInputChangeFu = useCallback(
+    (e: React.ChangeEvent<HTMLInputElement>, key: "searchKey" | "userId") => {
+      setFromData({
+        ...fromData,
+        [key]: e.target.value,
+        pageNum: 1,
+      });
+    },
+    [fromData]
+  );
+
+  // 时间选择器改变
+  const timeChange = (date: any, dateString: any) => {
+    let startTime = "";
+    let endTime = "";
+    if (dateString[0] && dateString[1]) {
+      startTime = dateString[0] + " 00:00:00";
+      endTime = dateString[1] + " 23:59:59";
+    }
+    setFromData({ ...fromData, startTime, endTime, pageNum: 1 });
+  };
+
+  // 点击删除
+  const delById = useCallback((ids: string) => {}, []);
+
   return (
     <div className={styles.A7Recycled}>
-      <h1>A7Recycled</h1>
+      <div className="pageTitle">回收站&emsp;当前文件占用内存:</div>
+      <div className="A7Top">
+        <div className="A7TopRow">
+          <span>文件名称:</span>
+          <Input
+            maxLength={30}
+            style={{ width: 200 }}
+            placeholder="请输入内容,最多30字"
+            allowClear
+            onChange={(e) => tabInputChangeFu(e, "searchKey")}
+          />
+        </div>
+
+        <div className="A7TopRow">
+          <span>删除人:</span>
+          <Input
+            maxLength={10}
+            style={{ width: 200 }}
+            placeholder="请输入内容,最多10字"
+            allowClear
+            onChange={(e) => tabInputChangeFu(e, "userId")}
+          />
+        </div>
+
+        <div className="A7TopRow">
+          <span>删除日期:</span>
+          <RangePicker onChange={timeChange} />
+        </div>
+
+        <div className="A7TopBtn">
+          <Popconfirm
+            title="此次为物理删除,无法找回。请谨慎操作"
+            okText="删除"
+            cancelText="取消"
+            onConfirm={() => delById("123")}
+            okButtonProps={{ loading: false }}
+          >
+            <Button type="primary" danger>
+              批量删除
+            </Button>
+          </Popconfirm>
+          &emsp;
+          <Button type="primary">批量恢复</Button>
+        </div>
+      </div>
     </div>
-  )
+  );
 }
 
 const MemoA7Recycled = React.memo(A7Recycled);

+ 11 - 3
src/store/action/A1Project.ts

@@ -44,6 +44,13 @@ export const A1_APIgetDownList = (id: number) => {
   return http.get(`cms/inside/download/echoList/${id}`);
 };
 
+/**
+ * 下载列表点击确定(外层)
+ */
+
+
+
+
 // --------------------------  项目文件  --------------------------
 /**
  * 项目文件---------获取 左侧一级 写死目录
@@ -194,9 +201,10 @@ export const A1_APIIupBtnOk = (projectId: number, data: any) => {
   return http.post(`cms/inside/update/${projectId}`, data);
 };
 
+
 /**
- * 内控文件---------回显已上传的文件
+ * 内控文件---------批量下载
  */
-export const A1_APIIupIsList = (projectId: number) => {
-  return http.get(`cms/inside/download/echoList/${projectId}`);
+export const A1_APIIdowns = (ids:string) => {
+  return http.get(`cms/inside/download/${ids}`);
 };

+ 22 - 19
src/store/action/A4Role.ts

@@ -52,30 +52,33 @@ export const getRoleInfoByIdAPI = (id: number) => {
 export const A4_APIgetRoleAll = () => {
   return async (dispatch: AppDispatch) => {
     const res = await http.get("sys/resource/getTreePermissions");
-    // 数据扁平化处理,且过滤掉没有权限的数据
-    const tempArr: A4RolleAllType[] = res.data;
 
-    const arrRes: string[] = [];
+    if (res.code === 0) {
+      // 数据扁平化处理,且过滤掉没有权限的数据
+      const tempArr: A4RolleAllType[] = res.data;
+
+      const arrRes: string[] = [];
 
-    tempArr.forEach((v1) => {
-      if (v1.authority) {
-        arrRes.push(v1.id);
-        if (v1.children && v1.children.length) {
-          v1.children.forEach((v2) => {
-            if (v2.authority) {
-              arrRes.push(v2.id);
-              if (v2.children && v2.children.length) {
-                v2.children.forEach((v3) => {
-                  if (v3.authority) arrRes.push(v3.id);
-                });
+      tempArr.forEach((v1) => {
+        if (v1.authority) {
+          arrRes.push(v1.id);
+          if (v1.children && v1.children.length) {
+            v1.children.forEach((v2) => {
+              if (v2.authority) {
+                arrRes.push(v2.id);
+                if (v2.children && v2.children.length) {
+                  v2.children.forEach((v3) => {
+                    if (v3.authority) arrRes.push(v3.id);
+                  });
+                }
               }
-            }
-          });
+            });
+          }
         }
-      }
-    });
+      });
 
-    dispatch({ type: "A4RoleAll/getInfo", payload: arrRes });
+      dispatch({ type: "A4RoleAll/getInfo", payload: arrRes });
+    }
   };
 };
 

+ 17 - 0
src/store/action/A7Recycled.ts

@@ -0,0 +1,17 @@
+import http from "@/utils/http";
+import { AppDispatch } from "..";
+/**
+ * 获取列表
+ */
+export const A7_APIgetList = (data: any) => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post("cms/recycle/pageList", data);
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total,
+      };
+      dispatch({ type: "A7/getList", payload: obj });
+    }
+  };
+};

+ 27 - 0
src/store/reducer/A7Recycled.ts

@@ -0,0 +1,27 @@
+import { A7tableType } from "@/types";
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as A7tableType[],
+    total: 0,
+  },
+};
+
+// 定义 action 类型
+type Props = {
+  type: "A7/getList";
+  payload: { list: A7tableType[]; total: number };
+};
+
+// 频道 reducer
+export default function logReducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case "A7/getList":
+      return { ...state, tableInfo: action.payload };
+    default:
+      return state;
+  }
+}

+ 2 - 0
src/store/reducer/index.ts

@@ -9,6 +9,7 @@ import A3User from "./A3User";
 import A4Role from "./A4Role";
 import A5Section from "./A5Section";
 import A6Log from "./A6Log";
+import A7Recycled from "./A7Recycled";
 
 // 合并 reducer
 const rootReducer = combineReducers({
@@ -19,6 +20,7 @@ const rootReducer = combineReducers({
   A4Role,
   A5Section,
   A6Log,
+  A7Recycled
 });
 
 // 默认导出

+ 11 - 0
src/types/api/A7Recycled.d.ts

@@ -0,0 +1,11 @@
+export type A7tableType ={
+	attrName: string;
+	creatorName: string;
+	description: string;
+	fileName: string;
+	fileSize: string;
+	id: number;
+	insideId: number;
+	name: string;
+	num: string;
+}

+ 1 - 0
src/types/index.d.ts

@@ -4,3 +4,4 @@ export * from './api/A3User'
 export * from './api/A4Role'
 export * from './api/A5Section'
 export * from './api/A6Log'
+export * from './api/A7Recycled'