From a1c37a695645b6e254a60be7a480d9da24278e3b Mon Sep 17 00:00:00 2001 From: wenlele Date: Thu, 18 May 2023 15:10:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../means/containers/devOpsStandard.jsx | 30 ++++++++++--------- .../means/containers/faultInformation.jsx | 30 ++++++++++--------- .../means/containers/projectMeans.jsx | 26 ++++++++-------- .../sections/means/containers/repairFQA.jsx | 26 ++++++++-------- 4 files changed, 60 insertions(+), 52 deletions(-) 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) } })) }