shaogen1995 2 yıl önce
ebeveyn
işleme
669df8d674

+ 9 - 4
src/components/Z1upImgs/index.tsx

@@ -18,6 +18,7 @@ import classNames from "classnames";
 import { API_upFile } from "@/store/action/layout";
 import { API_upFile } from "@/store/action/layout";
 import { FileImgListType } from "@/types";
 import { FileImgListType } from "@/types";
 import { forwardRef, useImperativeHandle } from "react";
 import { forwardRef, useImperativeHandle } from "react";
+import { A1_APIremoveSure } from "@/store/action/A1Project";
 
 
 type Props = {
 type Props = {
   max: number; //最多传多少张图片
   max: number; //最多传多少张图片
@@ -55,7 +56,7 @@ function Z1upImgs(
   const [fileList, setFileList] = useState<FileImgListType[]>([]);
   const [fileList, setFileList] = useState<FileImgListType[]>([]);
 
 
   useEffect(() => {
   useEffect(() => {
-    if (lookData&&lookData.length>0) setFileList(lookData);
+    if (lookData && lookData.length > 0) setFileList(lookData);
   }, [lookData]);
   }, [lookData]);
 
 
   const myInput = useRef<HTMLInputElement>(null);
   const myInput = useRef<HTMLInputElement>(null);
@@ -109,9 +110,13 @@ function Z1upImgs(
 
 
   // 列表删除某一张图片
   // 列表删除某一张图片
   const delImgListFu = useCallback(
   const delImgListFu = useCallback(
-    (id: number) => {
-      const newItems = fileList.filter((v) => v.id !== id);
-      setFileList(newItems);
+    async (id: number) => {
+      const res = await A1_APIremoveSure([id + ""]);
+
+      if (res.code === 0) {
+        const newItems = fileList.filter((v) => v.id !== id);
+        setFileList(newItems);
+      }
     },
     },
     [fileList, setFileList]
     [fileList, setFileList]
   );
   );

+ 9 - 4
src/components/Z2upVideos/index.tsx

@@ -16,6 +16,7 @@ import { ReactSortable } from "react-sortablejs";
 import classNames from "classnames";
 import classNames from "classnames";
 import store from "@/store";
 import store from "@/store";
 import { baseURL } from "@/utils/http";
 import { baseURL } from "@/utils/http";
+import { A1_APIremoveSure } from "@/store/action/A1Project";
 
 
 type Props = {
 type Props = {
   max: number; //最多传多少个视频
   max: number; //最多传多少个视频
@@ -49,7 +50,7 @@ function Z2upVideos(
   const [fileList, setFileList] = useState<FileImgListType[]>([]);
   const [fileList, setFileList] = useState<FileImgListType[]>([]);
 
 
   useEffect(() => {
   useEffect(() => {
-    if (lookData&&lookData.length>0) setFileList(lookData);
+    if (lookData && lookData.length > 0) setFileList(lookData);
   }, [lookData]);
   }, [lookData]);
 
 
   const myInput = useRef<HTMLInputElement>(null);
   const myInput = useRef<HTMLInputElement>(null);
@@ -103,9 +104,13 @@ function Z2upVideos(
 
 
   // 列表删除某一个视频
   // 列表删除某一个视频
   const delImgListFu = useCallback(
   const delImgListFu = useCallback(
-    (id: number) => {
-      const newItems = fileList.filter((v) => v.id !== id);
-      setFileList(newItems);
+    async (id: number) => {
+      const res = await A1_APIremoveSure([id + ""]);
+
+      if (res.code === 0) {
+        const newItems = fileList.filter((v) => v.id !== id);
+        setFileList(newItems);
+      }
     },
     },
     [fileList, setFileList]
     [fileList, setFileList]
   );
   );

+ 9 - 5
src/components/Z3upFiles/index.tsx

@@ -15,6 +15,7 @@ import {
 import classNames from "classnames";
 import classNames from "classnames";
 import { baseURL } from "@/utils/http";
 import { baseURL } from "@/utils/http";
 import filesLookFu from "@/utils/filesLook";
 import filesLookFu from "@/utils/filesLook";
+import { A1_APIremoveSure } from "@/store/action/A1Project";
 
 
 type Props = {
 type Props = {
   max: number; //最多传多少个文件
   max: number; //最多传多少个文件
@@ -34,8 +35,7 @@ function Z3upFiles(
   const [fileList, setFileList] = useState<FileImgListType[]>([]);
   const [fileList, setFileList] = useState<FileImgListType[]>([]);
 
 
   useEffect(() => {
   useEffect(() => {
-    if (lookData&&lookData.length>0) setFileList(lookData);
-    
+    if (lookData && lookData.length > 0) setFileList(lookData);
   }, [lookData]);
   }, [lookData]);
 
 
   const myInput = useRef<HTMLInputElement>(null);
   const myInput = useRef<HTMLInputElement>(null);
@@ -78,9 +78,13 @@ function Z3upFiles(
 
 
   // 列表删除某一个文件
   // 列表删除某一个文件
   const delImgListFu = useCallback(
   const delImgListFu = useCallback(
-    (id: number) => {
-      const newItems = fileList.filter((v) => v.id !== id);
-      setFileList(newItems);
+    async (id: number) => {
+      const res = await A1_APIremoveSure([id + ""]);
+
+      if (res.code === 0) {
+        const newItems = fileList.filter((v) => v.id !== id);
+        setFileList(newItems);
+      }
     },
     },
     [fileList, setFileList]
     [fileList, setFileList]
   );
   );

+ 20 - 3
src/pages/A1Project/A1Inner/A1IupFile/index.tsx

@@ -19,7 +19,7 @@ import history from "@/utils/history";
 import React from "react";
 import React from "react";
 import { getTokenFu } from "@/utils/storage";
 import { getTokenFu } from "@/utils/storage";
 import { MessageFu } from "@/utils/message";
 import { MessageFu } from "@/utils/message";
-import { A1_APIIupBtnOk, A1_APIremoveSure } from "@/store/action/A1Project";
+import { A1_APIIupBtnOk, A1_APIremoveInn } from "@/store/action/A1Project";
 import { authFilesLookFu, urlChangeFu } from "@/utils/authFilesLook";
 import { authFilesLookFu, urlChangeFu } from "@/utils/authFilesLook";
 import { A2Tab2Type } from "@/types/api/A2Dict";
 import { A2Tab2Type } from "@/types/api/A2Dict";
 
 
@@ -230,7 +230,7 @@ function A1IupFile({
               // console.log("-----还没有发请求删除", info);
               // console.log("-----还没有发请求删除", info);
               const id = info.response.data.id;
               const id = info.response.data.id;
               // 已经上传完成,发请求删除
               // 已经上传完成,发请求删除
-              const res = await A1_APIremoveSure([id + ""]);
+              const res = await A1_APIremoveInn(id);
 
 
               if (res.code === 0) {
               if (res.code === 0) {
                 MessageFu.success("删除成功!");
                 MessageFu.success("删除成功!");
@@ -276,6 +276,23 @@ function A1IupFile({
     }
     }
   }, [closeFu, fileList, houzuiFu, projectId, upFileFu]);
   }, [closeFu, fileList, houzuiFu, projectId, upFileFu]);
 
 
+  // 点击取消 删除所有文件
+  const clickCloseFu = useCallback(async () => {
+    const arr: string[] = [];
+
+    fileList.forEach((v) => {
+      if (v.response && v.response.data) {
+        arr.push(v.response.data.id);
+      }
+    });
+
+    if (arr.length > 0) {
+      const res = await A1_APIremoveInn(arr.join(","));
+
+      if (res.code === 0) closeFu();
+    } else closeFu();
+  }, [closeFu, fileList]);
+
   return (
   return (
     <Modal
     <Modal
       wrapClassName={styles.A1IupFile}
       wrapClassName={styles.A1IupFile}
@@ -403,7 +420,7 @@ function A1IupFile({
           title="放弃编辑后,信息将不会保存!"
           title="放弃编辑后,信息将不会保存!"
           okText="放弃"
           okText="放弃"
           cancelText="取消"
           cancelText="取消"
-          onConfirm={closeFu}
+          onConfirm={clickCloseFu}
           okButtonProps={{ loading: false }}
           okButtonProps={{ loading: false }}
         >
         >
           <Button>取消</Button>
           <Button>取消</Button>

+ 20 - 3
src/pages/A1Project/A1Outer/A1OupFile/index.tsx

@@ -18,7 +18,7 @@ import history from "@/utils/history";
 import React from "react";
 import React from "react";
 import { getTokenFu } from "@/utils/storage";
 import { getTokenFu } from "@/utils/storage";
 import { MessageFu } from "@/utils/message";
 import { MessageFu } from "@/utils/message";
-import { A1_APIOupFileIds, A1_APIremoveSure } from "@/store/action/A1Project";
+import { A1_APIOupFileIds, A1_APIremoveOut } from "@/store/action/A1Project";
 import { authFilesLookFu, urlChangeFu } from "@/utils/authFilesLook";
 import { authFilesLookFu, urlChangeFu } from "@/utils/authFilesLook";
 
 
 const { Dragger } = Upload;
 const { Dragger } = Upload;
@@ -108,7 +108,7 @@ function A1OupFile({ myUrl, fromData, nowLoc, closeFu, upFileFu }: props) {
               // console.log("-----还没有发请求删除", info);
               // console.log("-----还没有发请求删除", info);
               const id = info.response.data.id;
               const id = info.response.data.id;
               // 已经上传完成,发请求删除
               // 已经上传完成,发请求删除
-              const res = await A1_APIremoveSure([id + ""]);
+              const res = await A1_APIremoveOut(id);
 
 
               if (res.code === 0) {
               if (res.code === 0) {
                 resolve(true);
                 resolve(true);
@@ -150,6 +150,23 @@ function A1OupFile({ myUrl, fromData, nowLoc, closeFu, upFileFu }: props) {
     }
     }
   }, [closeFu, fileList, upFileFu]);
   }, [closeFu, fileList, upFileFu]);
 
 
+  // 点击取消 删除所有文件
+  const clickCloseFu = useCallback(async () => {
+    const arr: string[] = [];
+
+    fileList.forEach((v) => {
+      if (v.response && v.response.data) {
+        arr.push(v.response.data.id);
+      }
+    });
+
+    if (arr.length > 0) {
+      const res = await A1_APIremoveOut(arr.join(","));
+
+      if (res.code === 0) closeFu();
+    } else closeFu();
+  }, [closeFu, fileList]);
+
   return (
   return (
     <Modal
     <Modal
       wrapClassName={styles.A1OupFile}
       wrapClassName={styles.A1OupFile}
@@ -225,7 +242,7 @@ function A1OupFile({ myUrl, fromData, nowLoc, closeFu, upFileFu }: props) {
           title="放弃编辑后,信息将不会保存!"
           title="放弃编辑后,信息将不会保存!"
           okText="放弃"
           okText="放弃"
           cancelText="取消"
           cancelText="取消"
-          onConfirm={closeFu}
+          onConfirm={clickCloseFu}
           okButtonProps={{ loading: false }}
           okButtonProps={{ loading: false }}
         >
         >
           <Button>取消</Button>
           <Button>取消</Button>

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

@@ -92,7 +92,9 @@ function A2Table1({ editFu, upTaleFu, type }: Props) {
             ) : null}
             ) : null}
 
 
             {index < tableArr.length - (type === "job" ? 4 : 2) &&
             {index < tableArr.length - (type === "job" ? 4 : 2) &&
-            item.name !== "未分类" ? (
+            item.name !== "未分类" &&
+            item.name !== "项目经理" &&
+            item.name !== "商务经理" ? (
               <Button
               <Button
                 size="small"
                 size="small"
                 type="text"
                 type="text"

+ 17 - 1
src/store/action/A1Project.ts

@@ -128,12 +128,28 @@ export const A1_APIOmove = (id: number, parentId: number) => {
 };
 };
 
 
 /**
 /**
- * 项目文件(内控文件)---------上传文件成功 还没有点确定 的时候的 真删除
+ * 项目介绍的删除
  */
  */
 export const A1_APIremoveSure = (fileIds: string[]) => {
 export const A1_APIremoveSure = (fileIds: string[]) => {
   return http.post("cms/dict/delFile", { fileIds });
   return http.post("cms/dict/delFile", { fileIds });
 };
 };
 
 
+/**
+ * 项目文件---------上传文件成功 还没有点确定 的时候的 真删除
+ */
+
+export const A1_APIremoveOut = (ids: string) => {
+  return http.post(`cms/item/delTemp?ids=${ids}`);
+};
+
+
+/**
+ * 内控文件---------上传文件成功 还没有点确定 的时候的 真删除
+ */
+export const A1_APIremoveInn = (ids: string) => {
+  return http.post(`cms/inside/delTemp?ids=${ids}`);
+};
+
 // --------------------------  项目成员  --------------------------
 // --------------------------  项目成员  --------------------------
 /**
 /**
  * 项目成员---------获取列表
  * 项目成员---------获取列表