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