fix:树中展示子任务
This commit is contained in:
parent
aa443207f4
commit
e01989fdfd
|
@ -14,7 +14,7 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
|||
const [resultDataTypeList, setResultDataTypeList] = useState<DataType[]>([]);
|
||||
const [loadingState,setLoadingState] =useState(true)
|
||||
|
||||
const leftUp:{name:string,operateType:string,value:string|number|boolean}[] = []
|
||||
|
||||
const data = useContext(LocalContext);
|
||||
console.log('data',data);
|
||||
// 如果有pid,在前端过滤(防止中间数据不满足条件,导致子数据丢失),
|
||||
|
@ -22,6 +22,7 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
|||
var pid = useSearchParams().get('pid');
|
||||
console.log('pid!=null',pid!=null);
|
||||
const refreshDate = (): void => {
|
||||
const leftUp:{name:string,operateType:string,value:string|number|boolean}[] = []
|
||||
setLoadingState(true)
|
||||
if (pid!=null) {
|
||||
leftUp.push({name:"pid",value:pid,operateType:"="},
|
||||
|
|
|
@ -173,6 +173,7 @@ export enum OPERATION_BUTTON_TYPE {
|
|||
UPDATE,
|
||||
DELETE,
|
||||
COMPLETE,
|
||||
SHOW_TREE,
|
||||
SHOW_FOUR,
|
||||
SHOW_CALENDAR,
|
||||
ADD,
|
||||
|
|
|
@ -110,6 +110,10 @@ class OperationButton extends React.Component<OperationButtonProps, OperationMod
|
|||
}}
|
||||
><a>完成任务</a></Popconfirm>,
|
||||
},
|
||||
{
|
||||
key: OPERATION_BUTTON_TYPE.SHOW_TREE,
|
||||
label: <Link href={"/task/project?pid=" + this.props.itemId}>树任务显示子任务</Link>,
|
||||
},
|
||||
{
|
||||
key: OPERATION_BUTTON_TYPE.SHOW_FOUR,
|
||||
label: <Link href={"/task/four?pid=" + this.props.itemId}>四象限显示子任务</Link>,
|
||||
|
|
|
@ -7,6 +7,7 @@ import '@/ui/task/TitleOperation.modules.css'
|
|||
import LocalContext from "@/ui/LocalContent";
|
||||
import {RequestDateType} from "@/ui/task/RequestDateType";
|
||||
import dayjs, {Dayjs} from "dayjs";
|
||||
import {useSearchParams} from "next/dist/client/components/navigation";
|
||||
|
||||
interface TitleOperationProps {
|
||||
setTaskState: (value: string) => void;
|
||||
|
@ -21,6 +22,7 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
|||
}: TitleOperationProps) => {
|
||||
const {replace} = useRouter();
|
||||
console.log('usePathname()', usePathname());
|
||||
console.log('useSearchParams()', useSearchParams().get('pid'));
|
||||
const data = useContext(LocalContext);
|
||||
const {RangePicker} = DatePicker;
|
||||
const expectStartTimeParseResult: RequestDateType[] = data.expectedStartTime.length > 0 ? JSON.parse(data.expectedStartTime) : [undefined, undefined]
|
||||
|
|
|
@ -18,6 +18,8 @@ import {DetailModelForm} from "@/ui/task/project/DetailModelForm";
|
|||
import OperationButton from "@/ui/task/OperationButton";
|
||||
import dayjs from "dayjs";
|
||||
import '@/ui/task/project/TreeTablePro.modules.css'
|
||||
import {useSearchParams} from "next/navigation";
|
||||
|
||||
|
||||
const TreeTablePro: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
|
@ -26,7 +28,10 @@ const TreeTablePro: React.FC = () => {
|
|||
const [filterChecked, setFilterChecked] = React.useState(true);
|
||||
const [current,setCurrent] = React.useState(1);
|
||||
const [pageSize,setPageSize] = React.useState(10);
|
||||
|
||||
const pid = useSearchParams().get('pid')?useSearchParams().get('pid'):'0';
|
||||
const { RangePicker } = DatePicker;
|
||||
console.log("TreeTablePro",useSearchParams().get('pid'))
|
||||
const columns: ProColumns<DataType>[] = [
|
||||
{
|
||||
key:'code',
|
||||
|
@ -145,6 +150,10 @@ const TreeTablePro: React.FC = () => {
|
|||
actionRef.current?.reload( false);
|
||||
}} /></>)
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
actionRef.current?.reload( false)
|
||||
},[useSearchParams()])
|
||||
return (
|
||||
<ProTable<DataType>
|
||||
columns={columns}
|
||||
|
@ -154,8 +163,9 @@ const TreeTablePro: React.FC = () => {
|
|||
console.log('request',params,params.keyword,sort, filter);
|
||||
const searchList=[]
|
||||
if (switchChecked) {
|
||||
searchList.push({name:'pid',value:'0',operateType:"="},{name:'tree',value:'TRUE',operateType:"TREE"})
|
||||
searchList.push({name:'tree',value:'TRUE',operateType:"TREE"})
|
||||
}
|
||||
searchList.push({name:"pid",value:pid,operateType:"="})
|
||||
if (filterChecked) {
|
||||
searchList.push({name:'tree',value:'TRUE',operateType:"TREE-FILTER"})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue