|
@@ -12,12 +12,18 @@ import { A2_APIdel, A2_APIgetList, A2_APIsort } from "@/store/action/A2Country";
|
|
import { A2TableType } from "@/types";
|
|
import { A2TableType } from "@/types";
|
|
import { ExclamationCircleFilled } from "@ant-design/icons";
|
|
import { ExclamationCircleFilled } from "@ant-design/icons";
|
|
import { forwardRef, useImperativeHandle } from "react";
|
|
import { forwardRef, useImperativeHandle } from "react";
|
|
|
|
+import classNames from "classnames";
|
|
|
|
|
|
// 表格拖动排序-----------------
|
|
// 表格拖动排序-----------------
|
|
import { DndProvider, useDrag, useDrop } from "react-dnd";
|
|
import { DndProvider, useDrag, useDrop } from "react-dnd";
|
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
import { MessageFu } from "@/utils/message";
|
|
import { MessageFu } from "@/utils/message";
|
|
import ImageLazy from "../ImageLazy";
|
|
import ImageLazy from "../ImageLazy";
|
|
|
|
+import { A3_APIgetList } from "@/store/action/A3History";
|
|
|
|
+import { A6_APIgetList } from "@/store/action/A6Custom";
|
|
|
|
+import { A7_APIgetList } from "@/store/action/A7Project";
|
|
|
|
+import { A4_APIgetList } from "@/store/action/A4Craft";
|
|
|
|
+import { A5_APIgetList } from "@/store/action/A5Maestro";
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
setEditId: (id: number, flag: boolean) => void; //点击新增/编辑/查看
|
|
setEditId: (id: number, flag: boolean) => void; //点击新增/编辑/查看
|
|
@@ -41,6 +47,11 @@ function ZA_Table({ myType, setEditId, tableInfo }: Props, ref: any) {
|
|
|
|
|
|
const getListFu = useCallback(() => {
|
|
const getListFu = useCallback(() => {
|
|
if (myType === "national") dispatch(A2_APIgetList(getData));
|
|
if (myType === "national") dispatch(A2_APIgetList(getData));
|
|
|
|
+ else if (myType === "history") dispatch(A3_APIgetList(getData));
|
|
|
|
+ else if (myType === "custom") dispatch(A6_APIgetList(getData));
|
|
|
|
+ else if (myType === "project") dispatch(A7_APIgetList(getData));
|
|
|
|
+ else if (myType === "craft") dispatch(A4_APIgetList(getData));
|
|
|
|
+ else if (myType === 'master') dispatch(A5_APIgetList(getData));
|
|
}, [dispatch, getData, myType]);
|
|
}, [dispatch, getData, myType]);
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -104,7 +115,10 @@ function ZA_Table({ myType, setEditId, tableInfo }: Props, ref: any) {
|
|
<div className="moveTit">
|
|
<div className="moveTit">
|
|
序号
|
|
序号
|
|
<Tooltip title="按住鼠标可拖动表格调整顺序">
|
|
<Tooltip title="按住鼠标可拖动表格调整顺序">
|
|
- <div className="inco" hidden={tableInfo.list.length < 2}>
|
|
|
|
|
|
+ <div
|
|
|
|
+ className="inco"
|
|
|
|
+ hidden={tableInfo.list.length < 2 || myType === "craft"}
|
|
|
|
+ >
|
|
<ExclamationCircleFilled />
|
|
<ExclamationCircleFilled />
|
|
</div>
|
|
</div>
|
|
</Tooltip>
|
|
</Tooltip>
|
|
@@ -167,7 +181,12 @@ function ZA_Table({ myType, setEditId, tableInfo }: Props, ref: any) {
|
|
cancelText="取消"
|
|
cancelText="取消"
|
|
onConfirm={() => delTableFu(item.id!)}
|
|
onConfirm={() => delTableFu(item.id!)}
|
|
>
|
|
>
|
|
- <Button size="small" type="text" danger>
|
|
|
|
|
|
+ <Button
|
|
|
|
+ size="small"
|
|
|
|
+ type="text"
|
|
|
|
+ danger
|
|
|
|
+ hidden={myType === "craft"}
|
|
|
|
+ >
|
|
删除
|
|
删除
|
|
</Button>
|
|
</Button>
|
|
</Popconfirm>
|
|
</Popconfirm>
|
|
@@ -220,7 +239,7 @@ function ZA_Table({ myType, setEditId, tableInfo }: Props, ref: any) {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
drop: (item: { index: number }) => {
|
|
drop: (item: { index: number }) => {
|
|
- if (moveRow) moveRow(item.index, index);
|
|
|
|
|
|
+ if (moveRow && myType !== "craft") moveRow(item.index, index);
|
|
},
|
|
},
|
|
});
|
|
});
|
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -242,7 +261,7 @@ function ZA_Table({ myType, setEditId, tableInfo }: Props, ref: any) {
|
|
/>
|
|
/>
|
|
);
|
|
);
|
|
},
|
|
},
|
|
- []
|
|
|
|
|
|
+ [myType]
|
|
);
|
|
);
|
|
|
|
|
|
const components = {
|
|
const components = {
|
|
@@ -262,7 +281,6 @@ function ZA_Table({ myType, setEditId, tableInfo }: Props, ref: any) {
|
|
let resUrl = "block";
|
|
let resUrl = "block";
|
|
|
|
|
|
if (myType === "master") resUrl = "master";
|
|
if (myType === "master") resUrl = "master";
|
|
- else if (myType === "craft") resUrl = "craft";
|
|
|
|
|
|
|
|
const res = await A2_APIsort(beforeId, afterId, resUrl);
|
|
const res = await A2_APIsort(beforeId, afterId, resUrl);
|
|
|
|
|
|
@@ -278,7 +296,12 @@ function ZA_Table({ myType, setEditId, tableInfo }: Props, ref: any) {
|
|
}));
|
|
}));
|
|
|
|
|
|
return (
|
|
return (
|
|
- <div className={styles.ZA_Table}>
|
|
|
|
|
|
+ <div
|
|
|
|
+ className={classNames(
|
|
|
|
+ styles.ZA_Table,
|
|
|
|
+ myType === "craft" ? styles.ZA_Table2 : ""
|
|
|
|
+ )}
|
|
|
|
+ >
|
|
{/* 顶部搜索 */}
|
|
{/* 顶部搜索 */}
|
|
<div className="top">
|
|
<div className="top">
|
|
<span>标题:</span>
|
|
<span>标题:</span>
|
|
@@ -293,7 +316,11 @@ function ZA_Table({ myType, setEditId, tableInfo }: Props, ref: any) {
|
|
  
|
|
  
|
|
<Button onClick={resetSelectFu}>重置</Button>
|
|
<Button onClick={resetSelectFu}>重置</Button>
|
|
  
|
|
  
|
|
- <Button type="primary" onClick={() => setEditId(-1, false)}>
|
|
|
|
|
|
+ <Button
|
|
|
|
+ type="primary"
|
|
|
|
+ onClick={() => setEditId(-1, false)}
|
|
|
|
+ hidden={myType === "craft"}
|
|
|
|
+ >
|
|
新增
|
|
新增
|
|
</Button>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
@@ -306,15 +333,19 @@ function ZA_Table({ myType, setEditId, tableInfo }: Props, ref: any) {
|
|
dataSource={tableInfo.list}
|
|
dataSource={tableInfo.list}
|
|
components={components}
|
|
components={components}
|
|
rowKey="id"
|
|
rowKey="id"
|
|
- pagination={{
|
|
|
|
- showQuickJumper: true,
|
|
|
|
- position: ["bottomCenter"],
|
|
|
|
- showSizeChanger: true,
|
|
|
|
- current: getData.pageNum,
|
|
|
|
- pageSize: getData.pageSize,
|
|
|
|
- total: tableInfo.total,
|
|
|
|
- onChange: paginationChange(),
|
|
|
|
- }}
|
|
|
|
|
|
+ pagination={
|
|
|
|
+ myType === "craft"
|
|
|
|
+ ? false
|
|
|
|
+ : {
|
|
|
|
+ showQuickJumper: true,
|
|
|
|
+ position: ["bottomCenter"],
|
|
|
|
+ showSizeChanger: true,
|
|
|
|
+ current: getData.pageNum,
|
|
|
|
+ pageSize: getData.pageSize,
|
|
|
|
+ total: tableInfo.total,
|
|
|
|
+ onChange: paginationChange(),
|
|
|
|
+ }
|
|
|
|
+ }
|
|
onRow={(_, index) => {
|
|
onRow={(_, index) => {
|
|
const attr = {
|
|
const attr = {
|
|
index,
|
|
index,
|