import React, { useState, useEffect, useMemo, useRef } from "react";
import AutoTable from "@/components/AutoTable";
import PremButton from "@/components/PremButton";
import useKeepAlive from "@/components/useKeepAlive";
import getcolumns from "./columns";
import { useRequest } from "ahooks";
import { doFetch } from "@/utils/doFetch";
function Taskmanage() {
let actionRef = useRef();
const [tabKey, setTabKey] = useState("1");
const { runAsync } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res.code == "0000") {
actionRef?.current?.reload();
}
},
});
const tabList = useMemo(() => {
return getcolumns();
}, [tabKey]);
const columns = useMemo(() => {
let defcolumn =
getcolumns().filter((it) => it.key == tabKey)[0]?.columns ?? [];
return tabKey === "2"
? defcolumn
: defcolumn.concat({
title: "操作",
valueType: "option",
width: 80,
render: (text, row, _, action) => rightExtra(text, row, _, action),
});
}, [tabKey]);
const pathconfig = useMemo(() => {
let defpath =
getcolumns().filter((it) => it.key == tabKey)[0]?.pathconfig ?? {};
return defpath;
}, [tabKey]);
const rightExtra = (text, row, _, action) => {
return [
(row.documentStatus == 0 || row.documentStatus == 1) && (