|
|
@ -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 = <div className='dd' title={v.fileName} style={{ width: '100%', display: 'flex', }}> |
|
|
|
<div style={{ width: '100%', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{v.fileName}</div> |
|
|
|
<IconEditStroked className='tip' style={{ color: '#827777c7' }} onClick={() => { |
|
|
@ -140,10 +142,10 @@ const Rest = (props) => { |
|
|
|
<Popconfirm |
|
|
|
title={(fileData || list?.children?.length) ? '请删除该文件下的文件或文件夹' : "是否确认删除文件夹?"} |
|
|
|
onConfirm={() => { |
|
|
|
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) |
|
|
|
} |
|
|
|
})) |
|
|
|
} |
|
|
|