diff --git a/web/client/src/sections/means/containers/devOpsStandard.jsx b/web/client/src/sections/means/containers/devOpsStandard.jsx index 5a55621..d707fe4 100644 --- a/web/client/src/sections/means/containers/devOpsStandard.jsx +++ b/web/client/src/sections/means/containers/devOpsStandard.jsx @@ -29,11 +29,12 @@ const Rest = (props) => { const [videoModalV, setVideoModalV] = useState(false); const [videoUrl, setvideoUrl] = useState(null); const [hint, setHint] = useState(false); + const [fileLists, setFileLists] = useState([]) useEffect(() => { - dispatch(install.getProjectPoms({ global: 1 })).then((res => { + dispatch(install.getProjectPoms({ global: 4 })).then((res => { if (res.success) { let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name })) setPomsList(data) @@ -78,12 +79,18 @@ const Rest = (props) => { }, [fileId]) const fileList = (id) => { - dispatch(means.fileList({ projectId: id, type: 4 })).then((res => { + + dispatch(means.fileList({ projectId: id, type: 1 })).then((res => { if (res.success) { let data = res.payload.data let oneLevel = res.payload.data?.filter(f => !f.higherFileId) || [] - settreeData(listErgodic(oneLevel, data)) setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id }))) + dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => { + if (s.success) { + setFileLists(s.payload.data?.rows) + settreeData(listErgodic(oneLevel, data, s.payload.data?.rows)) + } + })) } })) } @@ -114,23 +121,18 @@ const Rest = (props) => { })) } - const listErgodic = (level, datas) => { + const listErgodic = (level, datas, lists) => { let data = [] - level.map(v => { + level.map(async v => { let list = { value: v.id, key: v.id, } let childrenList = datas?.filter(c => c.higherFileId == list.value) if (childrenList?.length) { - list.children = listErgodic(childrenList, datas) + list.children = listErgodic(childrenList, datas, lists) } - let fileData - dispatch(means.folderFileList({ fileId: JSON.stringify([v.id]) })).then((res => { - if (res.success) { - fileData = res.payload.data?.rows?.length - } - })) + let fileData = lists?.filter(d => d.fileId == v.id)?.length list.label =
{v.fileName}
{ @@ -140,10 +142,10 @@ const Rest = (props) => { { - if (!fileData || !list?.children?.length) { + if (!fileData && !list?.children?.length) { dispatch(means.delFile(v.id)).then((res => { if (res.success) { - fileList(pepProjectId) + fileList(v.projectId) } })) } diff --git a/web/client/src/sections/means/containers/faultInformation.jsx b/web/client/src/sections/means/containers/faultInformation.jsx index 397b959..484dcbf 100644 --- a/web/client/src/sections/means/containers/faultInformation.jsx +++ b/web/client/src/sections/means/containers/faultInformation.jsx @@ -29,11 +29,12 @@ const Rest = (props) => { const [videoModalV, setVideoModalV] = useState(false); const [videoUrl, setvideoUrl] = useState(null); const [hint, setHint] = useState(false); + const [fileLists, setFileLists] = useState([]) useEffect(() => { - dispatch(install.getProjectPoms({ global: 1 })).then((res => { + dispatch(install.getProjectPoms({ global: 3 })).then((res => { if (res.success) { let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name })) setPomsList(data) @@ -78,12 +79,18 @@ const Rest = (props) => { }, [fileId]) const fileList = (id) => { - dispatch(means.fileList({ projectId: id, type: 3 })).then((res => { + + dispatch(means.fileList({ projectId: id, type: 1 })).then((res => { if (res.success) { let data = res.payload.data let oneLevel = res.payload.data?.filter(f => !f.higherFileId) || [] - settreeData(listErgodic(oneLevel, data)) setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id }))) + dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => { + if (s.success) { + setFileLists(s.payload.data?.rows) + settreeData(listErgodic(oneLevel, data, s.payload.data?.rows)) + } + })) } })) } @@ -114,23 +121,18 @@ const Rest = (props) => { })) } - const listErgodic = (level, datas) => { + const listErgodic = (level, datas, lists) => { let data = [] - level.map(v => { + level.map(async v => { let list = { value: v.id, key: v.id, } let childrenList = datas?.filter(c => c.higherFileId == list.value) if (childrenList?.length) { - list.children = listErgodic(childrenList, datas) + list.children = listErgodic(childrenList, datas, lists) } - let fileData - dispatch(means.folderFileList({ fileId: JSON.stringify([v.id]) })).then((res => { - if (res.success) { - fileData = res.payload.data?.rows?.length - } - })) + let fileData = lists?.filter(d => d.fileId == v.id)?.length list.label =
{v.fileName}
{ @@ -140,10 +142,10 @@ const Rest = (props) => { { - if (!fileData || !list?.children?.length) { + if (!fileData && !list?.children?.length) { dispatch(means.delFile(v.id)).then((res => { if (res.success) { - fileList(pepProjectId) + fileList(v.projectId) } })) } diff --git a/web/client/src/sections/means/containers/projectMeans.jsx b/web/client/src/sections/means/containers/projectMeans.jsx index dc80dd6..8e78da2 100644 --- a/web/client/src/sections/means/containers/projectMeans.jsx +++ b/web/client/src/sections/means/containers/projectMeans.jsx @@ -29,6 +29,7 @@ const Rest = (props) => { const [videoModalV, setVideoModalV] = useState(false); const [videoUrl, setvideoUrl] = useState(null); const [hint, setHint] = useState(false); + const [fileLists, setFileLists] = useState([]) @@ -78,12 +79,18 @@ const Rest = (props) => { }, [fileId]) const fileList = (id) => { + dispatch(means.fileList({ projectId: id, type: 1 })).then((res => { if (res.success) { let data = res.payload.data let oneLevel = res.payload.data?.filter(f => !f.higherFileId) || [] - settreeData(listErgodic(oneLevel, data)) setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id }))) + dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => { + if (s.success) { + setFileLists(s.payload.data?.rows) + settreeData(listErgodic(oneLevel, data, s.payload.data?.rows)) + } + })) } })) } @@ -114,23 +121,18 @@ const Rest = (props) => { })) } - const listErgodic = (level, datas) => { + const listErgodic = (level, datas, lists) => { let data = [] - level.map(v => { + level.map(async v => { let list = { value: v.id, key: v.id, } let childrenList = datas?.filter(c => c.higherFileId == list.value) if (childrenList?.length) { - list.children = listErgodic(childrenList, datas) + list.children = listErgodic(childrenList, datas, lists) } - let fileData - dispatch(means.folderFileList({ fileId: JSON.stringify([v.id]) })).then((res => { - if (res.success) { - fileData = res.payload.data?.rows?.length - } - })) + let fileData = lists?.filter(d => d.fileId == v.id)?.length list.label =
{v.fileName}
{ @@ -140,10 +142,10 @@ const Rest = (props) => { { - if (!fileData || !list?.children?.length) { + if (!fileData && !list?.children?.length) { dispatch(means.delFile(v.id)).then((res => { if (res.success) { - fileList(pepProjectId) + fileList(v.projectId) } })) } diff --git a/web/client/src/sections/means/containers/repairFQA.jsx b/web/client/src/sections/means/containers/repairFQA.jsx index 87abd9b..fbdeaff 100644 --- a/web/client/src/sections/means/containers/repairFQA.jsx +++ b/web/client/src/sections/means/containers/repairFQA.jsx @@ -29,6 +29,7 @@ const Rest = (props) => { const [videoModalV, setVideoModalV] = useState(false); const [videoUrl, setvideoUrl] = useState(null); const [hint, setHint] = useState(false); + const [fileLists, setFileLists] = useState([]) @@ -78,12 +79,18 @@ const Rest = (props) => { }, [fileId]) const fileList = (id) => { + dispatch(means.fileList({ projectId: id, type: 2 })).then((res => { if (res.success) { let data = res.payload.data let oneLevel = res.payload.data?.filter(f => !f.higherFileId) || [] - settreeData(listErgodic(oneLevel, data)) setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id }))) + dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => { + if (s.success) { + setFileLists(s.payload.data?.rows) + settreeData(listErgodic(oneLevel, data, s.payload.data?.rows)) + } + })) } })) } @@ -114,23 +121,18 @@ const Rest = (props) => { })) } - const listErgodic = (level, datas) => { + const listErgodic = (level, datas, lists) => { let data = [] - level.map(v => { + level.map(async v => { let list = { value: v.id, key: v.id, } let childrenList = datas?.filter(c => c.higherFileId == list.value) if (childrenList?.length) { - list.children = listErgodic(childrenList, datas) + list.children = listErgodic(childrenList, datas, lists) } - let fileData - dispatch(means.folderFileList({ fileId: JSON.stringify([v.id]) })).then((res => { - if (res.success) { - fileData = res.payload.data?.rows?.length - } - })) + let fileData = lists?.filter(d => d.fileId == v.id)?.length list.label =
{v.fileName}
{ @@ -140,10 +142,10 @@ const Rest = (props) => { { - if (!fileData || !list?.children?.length) { + if (!fileData && !list?.children?.length) { dispatch(means.delFile(v.id)).then((res => { if (res.success) { - fileList(pepProjectId) + fileList(v.projectId) } })) }