|
@@ -16,8 +16,8 @@ import { useDispatch, useSelector } from "react-redux";
|
|
|
import { RootState } from "@/store";
|
|
|
import {
|
|
|
A1_APIOgetList,
|
|
|
- A2_APIOdel,
|
|
|
- A2_APIOdownload,
|
|
|
+ A1_APIOdel,
|
|
|
+ A1_APIOdownload,
|
|
|
} from "@/store/action/A1Project";
|
|
|
import { MessageFu } from "@/utils/message";
|
|
|
import A1OupFile from "./A1OupFile";
|
|
@@ -25,9 +25,10 @@ import { authFilesLookFu, urlChangeFu } from "@/utils/authFilesLook";
|
|
|
|
|
|
type Props = {
|
|
|
projectId: number;
|
|
|
+ projectName: string;
|
|
|
};
|
|
|
|
|
|
-function A1Outer({ projectId }: Props) {
|
|
|
+function A1Outer({ projectId, projectName }: Props) {
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
// 从仓库获取左侧写死列表 和 展示列表
|
|
@@ -122,7 +123,7 @@ function A1Outer({ projectId }: Props) {
|
|
|
// 点击表格里面的删除
|
|
|
const delById = useCallback(
|
|
|
async (id: number) => {
|
|
|
- const res = await A2_APIOdel(id);
|
|
|
+ const res = await A1_APIOdel(id);
|
|
|
if (res.code === 0) {
|
|
|
MessageFu.success("删除成功!");
|
|
|
getListFu();
|
|
@@ -132,17 +133,22 @@ function A1Outer({ projectId }: Props) {
|
|
|
);
|
|
|
|
|
|
// 点击表格里面的 文件夹 的下载
|
|
|
- const downFilesFu = useCallback((id: number) => {
|
|
|
- console.log("ssss,点击文件夹的下载", id);
|
|
|
+ const downFilesFu = useCallback(async (id: number, name: string) => {
|
|
|
+ const res = await A1_APIOdownload(id);
|
|
|
+ if (res.code === 0) {
|
|
|
+ urlChangeFu(res.data, true, undefined, name);
|
|
|
+ }
|
|
|
}, []);
|
|
|
|
|
|
// 点击批量下载
|
|
|
const downSelectFu = useCallback(async () => {
|
|
|
- const res = await A2_APIOdownload(selectedRowKeys.join(","));
|
|
|
+ const res = await A1_APIOdownload(selectedRowKeys.join(","));
|
|
|
if (res.code === 0) {
|
|
|
- console.log("批量下载", res);
|
|
|
+ urlChangeFu(res.data, true, undefined, projectName);
|
|
|
+ // 清空选中
|
|
|
+ setSelectedRowKeys([]);
|
|
|
}
|
|
|
- }, [selectedRowKeys]);
|
|
|
+ }, [projectName, selectedRowKeys]);
|
|
|
|
|
|
// 点击-批量上传
|
|
|
const [upFileId, setUpFileId] = useState(0);
|
|
@@ -196,7 +202,7 @@ function A1Outer({ projectId }: Props) {
|
|
|
<Button
|
|
|
size="small"
|
|
|
type="text"
|
|
|
- onClick={() => downFilesFu(item.id)}
|
|
|
+ onClick={() => downFilesFu(item.id, item.name)}
|
|
|
>
|
|
|
下载
|
|
|
</Button>
|
|
@@ -244,8 +250,21 @@ function A1Outer({ projectId }: Props) {
|
|
|
|
|
|
// 当前位置
|
|
|
const nowLoc = useMemo(() => {
|
|
|
- return tab1.name + (tab2.id ? ` / ${tab2.name}` : "");
|
|
|
- }, [tab1.name, tab2.id, tab2.name]);
|
|
|
+ return {
|
|
|
+ tag: (
|
|
|
+ <>
|
|
|
+ <span
|
|
|
+ className="A1OnowLocRow"
|
|
|
+ onClick={() => cutTab1Fu(tab1.id, tab1.name)}
|
|
|
+ >
|
|
|
+ {tab1.name}
|
|
|
+ </span>
|
|
|
+ {tab2.id ? <span> / {tab2.name}</span> : null}
|
|
|
+ </>
|
|
|
+ ),
|
|
|
+ txt: tab1.name + (tab2.id ? ` / ${tab2.name}` : ""),
|
|
|
+ };
|
|
|
+ }, [cutTab1Fu, tab1.id, tab1.name, tab2.id, tab2.name]);
|
|
|
|
|
|
return (
|
|
|
<div className={styles.A1Outer}>
|
|
@@ -260,7 +279,7 @@ function A1Outer({ projectId }: Props) {
|
|
|
onChange={(e) => searchKeyChange(e)}
|
|
|
/>
|
|
|
  
|
|
|
- <span className="A1OnowLoc">当前位置:{nowLoc}</span>
|
|
|
+ <span className="A1OnowLoc">当前位置:{nowLoc.tag}</span>
|
|
|
</div>
|
|
|
<div className="A1Otop2">
|
|
|
{tab2.id ? null : (
|
|
@@ -370,7 +389,7 @@ function A1Outer({ projectId }: Props) {
|
|
|
<A1OupFile
|
|
|
myUrl={baseURL + "cms/item/upload"}
|
|
|
fromData={{ parentId: upFileId, projectId }}
|
|
|
- nowLoc={nowLoc}
|
|
|
+ nowLoc={nowLoc.txt}
|
|
|
closeFu={() => setUpFileId(0)}
|
|
|
upFileFu={() => getListFu()}
|
|
|
/>
|