Browse Source

问题修改

dev
wenlele 2 years ago
parent
commit
026ff346bc
  1. 6
      api/app/lib/controllers/means/index.js
  2. 59
      web/client/src/sections/means/containers/devOpsStandard.jsx
  3. 59
      web/client/src/sections/means/containers/faultInformation.jsx
  4. 51
      web/client/src/sections/means/containers/projectMeans.jsx
  5. 51
      web/client/src/sections/means/containers/repairFQA.jsx

6
api/app/lib/controllers/means/index.js

@ -106,13 +106,17 @@ async function addFile (ctx, next) {
async function folderFileList (ctx, next) { async function folderFileList (ctx, next) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { fileId, limit, page } = ctx.query; const { fileId, limit, page, keyword } = ctx.query;
let options = { where: {}, } let options = { where: {}, }
if (JSON.parse(fileId).length) { if (JSON.parse(fileId).length) {
options.where.fileId = { $in: JSON.parse(fileId) } options.where.fileId = { $in: JSON.parse(fileId) }
} }
if (keyword) {
options.where.name = { $ilike: `%${keyword}%` }
}
if (limit) { if (limit) {
options.limit = Number(limit) options.limit = Number(limit)
} }

59
web/client/src/sections/means/containers/devOpsStandard.jsx

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from 'react'; import React, { useEffect, useState, useMemo } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui'; import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui';
import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle } from '@douyinfe/semi-icons'; import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle, IconSearch } from '@douyinfe/semi-icons';
import SimpleBar from 'simplebar-react'; import SimpleBar from 'simplebar-react';
import FileModal from '../components/fileModal'; import FileModal from '../components/fileModal';
import moment from 'moment'; import moment from 'moment';
@ -29,12 +29,12 @@ const Rest = (props) => {
const [videoModalV, setVideoModalV] = useState(false); const [videoModalV, setVideoModalV] = useState(false);
const [videoUrl, setvideoUrl] = useState(null); const [videoUrl, setvideoUrl] = useState(null);
const [hint, setHint] = useState(false); const [hint, setHint] = useState(false);
const [fileLists, setFileLists] = useState([]) const [fileSearch, setFileSearch] = useState([]) //
useEffect(() => { useEffect(() => {
dispatch(install.getProjectPoms({ global: 4 })).then((res => { dispatch(install.getProjectPoms({ global: 1 })).then((res => {
if (res.success) { if (res.success) {
let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name })) let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name }))
setPomsList(data) setPomsList(data)
@ -56,6 +56,9 @@ const Rest = (props) => {
setShowPomsList(data) setShowPomsList(data)
setPepProjectId(data[0]?.pepProjectId) setPepProjectId(data[0]?.pepProjectId)
fileList(data[0]?.pepProjectId) fileList(data[0]?.pepProjectId)
setDataSource([])
setFileId('')
setFileSearch('')
}, [projectSearch]) }, [projectSearch])
useEffect(() => { useEffect(() => {
@ -69,25 +72,29 @@ const Rest = (props) => {
setShowPomsList(data) setShowPomsList(data)
setPepProjectId(data[0]?.pepProjectId) setPepProjectId(data[0]?.pepProjectId)
fileList(data[0]?.pepProjectId) fileList(data[0]?.pepProjectId)
setDataSource([])
setFileId('')
setFileSearch('')
}, [overallProjectId]) }, [overallProjectId])
useEffect(() => { useEffect(() => {
if (fileId) { if (fileId) {
filfolderFileListe() filfolderFileListe()
setQuery({ limit: 10, page: 0 }) setQuery({ limit: 10, page: 0 })
setFileSearch('')
} }
}, [fileId]) }, [fileId])
const fileList = (id) => { const fileList = (id) => {
dispatch(means.fileList({ projectId: id, type: 1 })).then((res => { dispatch(means.fileList({ projectId: id, type: 4 })).then((res => {
if (res.success) { if (res.success) {
let data = res.payload.data let data = res.payload.data
let oneLevel = res.payload.data?.filter(f => !f.higherFileId) || [] let oneLevel = res.payload.data?.filter(f => !f.higherFileId) || []
setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id }))) setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id })))
dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => { dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => {
if (s.success) { if (s.success) {
setFileLists(s.payload.data?.rows) // setFileLists(s.payload.data?.rows)
settreeData(listErgodic(oneLevel, data, s.payload.data?.rows)) settreeData(listErgodic(oneLevel, data, s.payload.data?.rows))
} }
})) }))
@ -113,7 +120,7 @@ const Rest = (props) => {
} }
treeDataList(treeData) treeDataList(treeData)
let datas = params || query let datas = params || query
dispatch(means.folderFileList({ fileId: JSON.stringify(fileIds), ...datas })).then((res => { dispatch(means.folderFileList({ keyword: fileSearch, fileId: JSON.stringify(fileIds), ...datas, })).then((res => {
if (res.success) { if (res.success) {
setDataSource(res.payload.data?.rows || []) setDataSource(res.payload.data?.rows || [])
setCount(res.payload.data?.count) setCount(res.payload.data?.count)
@ -277,6 +284,8 @@ const Rest = (props) => {
onClick={() => { onClick={() => {
setPepProjectId(v.pepProjectId) setPepProjectId(v.pepProjectId)
fileList(v.pepProjectId) fileList(v.pepProjectId)
setDataSource([])
setFileId('')
}}> }}>
<img src="/assets/images/icon/project-icon.png" style={{ width: 14, marginRight: 8 }} /> <img src="/assets/images/icon/project-icon.png" style={{ width: 14, marginRight: 8 }} />
<div style={{ fontSize: 14, width: 152, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> {v.pepProjectName}</div> <div style={{ fontSize: 14, width: 152, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> {v.pepProjectName}</div>
@ -301,7 +310,7 @@ const Rest = (props) => {
editData={editData} editData={editData}
higherFile={higherFile} higherFile={higherFile}
pepProjectId={pepProjectId} pepProjectId={pepProjectId}
type={4} type={1}
close={() => { close={() => {
setIsFileModal(false) setIsFileModal(false)
setEditData({}) setEditData({})
@ -315,10 +324,11 @@ const Rest = (props) => {
<Tree <Tree
treeData={treeData} treeData={treeData}
defaultExpandAll defaultExpandAll
// labelEllipsis={true} value={fileId}
// style={style} // style={style}
onSelect={(selectedKey, selected, selectedNode) => { onSelect={(selectedKey, selected, selectedNode) => {
setFileId(selectedKey) setFileId(selectedKey)
setFileSearch('')
}} }}
/> />
</SimpleBar> </SimpleBar>
@ -329,13 +339,27 @@ const Rest = (props) => {
flex: 1, height: '100%', flex: 1, height: '100%',
// border: '1px solid rgb(24 22 22)' // border: '1px solid rgb(24 22 22)'
}}> }}>
<div style={{ margin: '20px 0 10px 10px', display: 'flex', alignItems: 'center' }}> <div style={{ margin: '20px 0 10px 10px', display: 'flex', alignItems: 'center', width: 'calc(100% - 20px)' }}>
<Button theme='solid' type='primary' style={{ width: 80, background: '#005ABD', marginRight: 10 }} onClick={() => { <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}>
if (higherFile?.filter(c => c.value == fileId)?.length) { <div style={{ display: 'flex', alignItems: 'center' }}>
setUploadModal(true) <Button theme='solid' type='primary' style={{ width: 80, background: '#005ABD', marginRight: 10 }} onClick={() => {
} if (higherFile?.filter(c => c.value == fileId)?.length) {
}}> 上传 </Button> setUploadModal(true)
<div style={{ display: 'flex' }}>当前文件夹{higherFile?.filter(c => c.value == fileId)[0]?.name || <div style={{ color: '#c31515' }}>请选择文件夹</div>}</div> }
}}> 上传 </Button>
<div style={{ display: 'flex' }}>当前文件夹{higherFile?.filter(c => c.value == fileId)[0]?.name || <div style={{ color: '#c31515' }}>请选择文件夹</div>}</div>
</div>
<Input placeholder='请输入文件名称'
style={{ width: 220 }}
suffix={<IconSearch />}
value={fileSearch}
onChange={v => {
setFileSearch(v)
filfolderFileListe({ keyword: v, limit: 10, page: 0 })
setQuery({ limit: 10, page: 0 })
}} />
</div>
{uploadModal ? {uploadModal ?
<Modal <Modal
title={'上传文件'} title={'上传文件'}
@ -370,7 +394,7 @@ const Rest = (props) => {
style={{ display: 'inline-block' }} style={{ display: 'inline-block' }}
action="/_upload/attachments" action="/_upload/attachments"
accept={'.txt, .doc, .docx, .xls, .xlsx, .pdf, .png, .jpg, .rar, .zip'} accept={'.txt, .doc, .docx, .xls, .xlsx, .pdf, .png, .jpg, .rar, .zip'}
limit={1} limit={4}
maxSize={51200} maxSize={51200}
onRemove={() => { onRemove={() => {
setUploadData({}) setUploadData({})
@ -441,6 +465,7 @@ const Rest = (props) => {
total={count} total={count}
showSizeChanger showSizeChanger
currentPage={(query?.page || 0) + 1} currentPage={(query?.page || 0) + 1}
pageSize={query?.limit || 10}
pageSizeOpts={[10, 20, 50]} pageSizeOpts={[10, 20, 50]}
onChange={(currentPage, pageSize) => { onChange={(currentPage, pageSize) => {
setQuery({ limit: pageSize, page: currentPage - 1 }); setQuery({ limit: pageSize, page: currentPage - 1 });

59
web/client/src/sections/means/containers/faultInformation.jsx

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from 'react'; import React, { useEffect, useState, useMemo } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui'; import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui';
import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle } from '@douyinfe/semi-icons'; import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle, IconSearch } from '@douyinfe/semi-icons';
import SimpleBar from 'simplebar-react'; import SimpleBar from 'simplebar-react';
import FileModal from '../components/fileModal'; import FileModal from '../components/fileModal';
import moment from 'moment'; import moment from 'moment';
@ -29,12 +29,12 @@ const Rest = (props) => {
const [videoModalV, setVideoModalV] = useState(false); const [videoModalV, setVideoModalV] = useState(false);
const [videoUrl, setvideoUrl] = useState(null); const [videoUrl, setvideoUrl] = useState(null);
const [hint, setHint] = useState(false); const [hint, setHint] = useState(false);
const [fileLists, setFileLists] = useState([]) const [fileSearch, setFileSearch] = useState([]) //
useEffect(() => { useEffect(() => {
dispatch(install.getProjectPoms({ global: 3 })).then((res => { dispatch(install.getProjectPoms({ global: 1 })).then((res => {
if (res.success) { if (res.success) {
let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name })) let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name }))
setPomsList(data) setPomsList(data)
@ -56,6 +56,9 @@ const Rest = (props) => {
setShowPomsList(data) setShowPomsList(data)
setPepProjectId(data[0]?.pepProjectId) setPepProjectId(data[0]?.pepProjectId)
fileList(data[0]?.pepProjectId) fileList(data[0]?.pepProjectId)
setDataSource([])
setFileId('')
setFileSearch('')
}, [projectSearch]) }, [projectSearch])
useEffect(() => { useEffect(() => {
@ -69,25 +72,29 @@ const Rest = (props) => {
setShowPomsList(data) setShowPomsList(data)
setPepProjectId(data[0]?.pepProjectId) setPepProjectId(data[0]?.pepProjectId)
fileList(data[0]?.pepProjectId) fileList(data[0]?.pepProjectId)
setDataSource([])
setFileId('')
setFileSearch('')
}, [overallProjectId]) }, [overallProjectId])
useEffect(() => { useEffect(() => {
if (fileId) { if (fileId) {
filfolderFileListe() filfolderFileListe()
setQuery({ limit: 10, page: 0 }) setQuery({ limit: 10, page: 0 })
setFileSearch('')
} }
}, [fileId]) }, [fileId])
const fileList = (id) => { const fileList = (id) => {
dispatch(means.fileList({ projectId: id, type: 1 })).then((res => { dispatch(means.fileList({ projectId: id, type: 3 })).then((res => {
if (res.success) { if (res.success) {
let data = res.payload.data let data = res.payload.data
let oneLevel = res.payload.data?.filter(f => !f.higherFileId) || [] let oneLevel = res.payload.data?.filter(f => !f.higherFileId) || []
setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id }))) setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id })))
dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => { dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => {
if (s.success) { if (s.success) {
setFileLists(s.payload.data?.rows) // setFileLists(s.payload.data?.rows)
settreeData(listErgodic(oneLevel, data, s.payload.data?.rows)) settreeData(listErgodic(oneLevel, data, s.payload.data?.rows))
} }
})) }))
@ -113,7 +120,7 @@ const Rest = (props) => {
} }
treeDataList(treeData) treeDataList(treeData)
let datas = params || query let datas = params || query
dispatch(means.folderFileList({ fileId: JSON.stringify(fileIds), ...datas })).then((res => { dispatch(means.folderFileList({ keyword: fileSearch, fileId: JSON.stringify(fileIds), ...datas, })).then((res => {
if (res.success) { if (res.success) {
setDataSource(res.payload.data?.rows || []) setDataSource(res.payload.data?.rows || [])
setCount(res.payload.data?.count) setCount(res.payload.data?.count)
@ -277,6 +284,8 @@ const Rest = (props) => {
onClick={() => { onClick={() => {
setPepProjectId(v.pepProjectId) setPepProjectId(v.pepProjectId)
fileList(v.pepProjectId) fileList(v.pepProjectId)
setDataSource([])
setFileId('')
}}> }}>
<img src="/assets/images/icon/project-icon.png" style={{ width: 14, marginRight: 8 }} /> <img src="/assets/images/icon/project-icon.png" style={{ width: 14, marginRight: 8 }} />
<div style={{ fontSize: 14, width: 152, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> {v.pepProjectName}</div> <div style={{ fontSize: 14, width: 152, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> {v.pepProjectName}</div>
@ -301,7 +310,7 @@ const Rest = (props) => {
editData={editData} editData={editData}
higherFile={higherFile} higherFile={higherFile}
pepProjectId={pepProjectId} pepProjectId={pepProjectId}
type={3} type={1}
close={() => { close={() => {
setIsFileModal(false) setIsFileModal(false)
setEditData({}) setEditData({})
@ -315,10 +324,11 @@ const Rest = (props) => {
<Tree <Tree
treeData={treeData} treeData={treeData}
defaultExpandAll defaultExpandAll
// labelEllipsis={true} value={fileId}
// style={style} // style={style}
onSelect={(selectedKey, selected, selectedNode) => { onSelect={(selectedKey, selected, selectedNode) => {
setFileId(selectedKey) setFileId(selectedKey)
setFileSearch('')
}} }}
/> />
</SimpleBar> </SimpleBar>
@ -329,13 +339,27 @@ const Rest = (props) => {
flex: 1, height: '100%', flex: 1, height: '100%',
// border: '1px solid rgb(24 22 22)' // border: '1px solid rgb(24 22 22)'
}}> }}>
<div style={{ margin: '20px 0 10px 10px', display: 'flex', alignItems: 'center' }}> <div style={{ margin: '20px 0 10px 10px', display: 'flex', alignItems: 'center', width: 'calc(100% - 20px)' }}>
<Button theme='solid' type='primary' style={{ width: 80, background: '#005ABD', marginRight: 10 }} onClick={() => { <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}>
if (higherFile?.filter(c => c.value == fileId)?.length) { <div style={{ display: 'flex', alignItems: 'center' }}>
setUploadModal(true) <Button theme='solid' type='primary' style={{ width: 80, background: '#005ABD', marginRight: 10 }} onClick={() => {
} if (higherFile?.filter(c => c.value == fileId)?.length) {
}}> 上传 </Button> setUploadModal(true)
<div style={{ display: 'flex' }}>当前文件夹{higherFile?.filter(c => c.value == fileId)[0]?.name || <div style={{ color: '#c31515' }}>请选择文件夹</div>}</div> }
}}> 上传 </Button>
<div style={{ display: 'flex' }}>当前文件夹{higherFile?.filter(c => c.value == fileId)[0]?.name || <div style={{ color: '#c31515' }}>请选择文件夹</div>}</div>
</div>
<Input placeholder='请输入文件名称'
style={{ width: 220 }}
suffix={<IconSearch />}
value={fileSearch}
onChange={v => {
setFileSearch(v)
filfolderFileListe({ keyword: v, limit: 10, page: 0 })
setQuery({ limit: 10, page: 0 })
}} />
</div>
{uploadModal ? {uploadModal ?
<Modal <Modal
title={'上传文件'} title={'上传文件'}
@ -370,7 +394,7 @@ const Rest = (props) => {
style={{ display: 'inline-block' }} style={{ display: 'inline-block' }}
action="/_upload/attachments" action="/_upload/attachments"
accept={'.txt, .doc, .docx, .xls, .xlsx, .pdf, .png, .jpg, .rar, .zip'} accept={'.txt, .doc, .docx, .xls, .xlsx, .pdf, .png, .jpg, .rar, .zip'}
limit={1} limit={3}
maxSize={51200} maxSize={51200}
onRemove={() => { onRemove={() => {
setUploadData({}) setUploadData({})
@ -441,6 +465,7 @@ const Rest = (props) => {
total={count} total={count}
showSizeChanger showSizeChanger
currentPage={(query?.page || 0) + 1} currentPage={(query?.page || 0) + 1}
pageSize={query?.limit || 10}
pageSizeOpts={[10, 20, 50]} pageSizeOpts={[10, 20, 50]}
onChange={(currentPage, pageSize) => { onChange={(currentPage, pageSize) => {
setQuery({ limit: pageSize, page: currentPage - 1 }); setQuery({ limit: pageSize, page: currentPage - 1 });

51
web/client/src/sections/means/containers/projectMeans.jsx

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from 'react'; import React, { useEffect, useState, useMemo } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui'; import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui';
import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle } from '@douyinfe/semi-icons'; import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle, IconSearch } from '@douyinfe/semi-icons';
import SimpleBar from 'simplebar-react'; import SimpleBar from 'simplebar-react';
import FileModal from '../components/fileModal'; import FileModal from '../components/fileModal';
import moment from 'moment'; import moment from 'moment';
@ -29,7 +29,7 @@ const Rest = (props) => {
const [videoModalV, setVideoModalV] = useState(false); const [videoModalV, setVideoModalV] = useState(false);
const [videoUrl, setvideoUrl] = useState(null); const [videoUrl, setvideoUrl] = useState(null);
const [hint, setHint] = useState(false); const [hint, setHint] = useState(false);
const [fileLists, setFileLists] = useState([]) const [fileSearch, setFileSearch] = useState([]) //
@ -56,6 +56,9 @@ const Rest = (props) => {
setShowPomsList(data) setShowPomsList(data)
setPepProjectId(data[0]?.pepProjectId) setPepProjectId(data[0]?.pepProjectId)
fileList(data[0]?.pepProjectId) fileList(data[0]?.pepProjectId)
setDataSource([])
setFileId('')
setFileSearch('')
}, [projectSearch]) }, [projectSearch])
useEffect(() => { useEffect(() => {
@ -69,17 +72,21 @@ const Rest = (props) => {
setShowPomsList(data) setShowPomsList(data)
setPepProjectId(data[0]?.pepProjectId) setPepProjectId(data[0]?.pepProjectId)
fileList(data[0]?.pepProjectId) fileList(data[0]?.pepProjectId)
setDataSource([])
setFileId('')
setFileSearch('')
}, [overallProjectId]) }, [overallProjectId])
useEffect(() => { useEffect(() => {
if (fileId) { if (fileId) {
filfolderFileListe() filfolderFileListe()
setQuery({ limit: 10, page: 0 }) setQuery({ limit: 10, page: 0 })
setFileSearch('')
} }
}, [fileId]) }, [fileId])
const fileList = (id) => { const fileList = (id) => {
dispatch(means.fileList({ projectId: id, type: 1 })).then((res => { dispatch(means.fileList({ projectId: id, type: 1 })).then((res => {
if (res.success) { if (res.success) {
let data = res.payload.data let data = res.payload.data
@ -87,7 +94,7 @@ const Rest = (props) => {
setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id }))) setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id })))
dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => { dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => {
if (s.success) { if (s.success) {
setFileLists(s.payload.data?.rows) // setFileLists(s.payload.data?.rows)
settreeData(listErgodic(oneLevel, data, s.payload.data?.rows)) settreeData(listErgodic(oneLevel, data, s.payload.data?.rows))
} }
})) }))
@ -113,7 +120,7 @@ const Rest = (props) => {
} }
treeDataList(treeData) treeDataList(treeData)
let datas = params || query let datas = params || query
dispatch(means.folderFileList({ fileId: JSON.stringify(fileIds), ...datas })).then((res => { dispatch(means.folderFileList({ keyword: fileSearch, fileId: JSON.stringify(fileIds), ...datas, })).then((res => {
if (res.success) { if (res.success) {
setDataSource(res.payload.data?.rows || []) setDataSource(res.payload.data?.rows || [])
setCount(res.payload.data?.count) setCount(res.payload.data?.count)
@ -277,6 +284,8 @@ const Rest = (props) => {
onClick={() => { onClick={() => {
setPepProjectId(v.pepProjectId) setPepProjectId(v.pepProjectId)
fileList(v.pepProjectId) fileList(v.pepProjectId)
setDataSource([])
setFileId('')
}}> }}>
<img src="/assets/images/icon/project-icon.png" style={{ width: 14, marginRight: 8 }} /> <img src="/assets/images/icon/project-icon.png" style={{ width: 14, marginRight: 8 }} />
<div style={{ fontSize: 14, width: 152, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> {v.pepProjectName}</div> <div style={{ fontSize: 14, width: 152, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> {v.pepProjectName}</div>
@ -315,10 +324,11 @@ const Rest = (props) => {
<Tree <Tree
treeData={treeData} treeData={treeData}
defaultExpandAll defaultExpandAll
// labelEllipsis={true} value={fileId}
// style={style} // style={style}
onSelect={(selectedKey, selected, selectedNode) => { onSelect={(selectedKey, selected, selectedNode) => {
setFileId(selectedKey) setFileId(selectedKey)
setFileSearch('')
}} }}
/> />
</SimpleBar> </SimpleBar>
@ -329,13 +339,27 @@ const Rest = (props) => {
flex: 1, height: '100%', flex: 1, height: '100%',
// border: '1px solid rgb(24 22 22)' // border: '1px solid rgb(24 22 22)'
}}> }}>
<div style={{ margin: '20px 0 10px 10px', display: 'flex', alignItems: 'center' }}> <div style={{ margin: '20px 0 10px 10px', display: 'flex', alignItems: 'center', width: 'calc(100% - 20px)' }}>
<Button theme='solid' type='primary' style={{ width: 80, background: '#005ABD', marginRight: 10 }} onClick={() => { <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}>
if (higherFile?.filter(c => c.value == fileId)?.length) { <div style={{ display: 'flex', alignItems: 'center' }}>
setUploadModal(true) <Button theme='solid' type='primary' style={{ width: 80, background: '#005ABD', marginRight: 10 }} onClick={() => {
} if (higherFile?.filter(c => c.value == fileId)?.length) {
}}> 上传 </Button> setUploadModal(true)
<div style={{ display: 'flex' }}>当前文件夹{higherFile?.filter(c => c.value == fileId)[0]?.name || <div style={{ color: '#c31515' }}>请选择文件夹</div>}</div> }
}}> 上传 </Button>
<div style={{ display: 'flex' }}>当前文件夹{higherFile?.filter(c => c.value == fileId)[0]?.name || <div style={{ color: '#c31515' }}>请选择文件夹</div>}</div>
</div>
<Input placeholder='请输入文件名称'
style={{ width: 220 }}
suffix={<IconSearch />}
value={fileSearch}
onChange={v => {
setFileSearch(v)
filfolderFileListe({ keyword: v, limit: 10, page: 0 })
setQuery({ limit: 10, page: 0 })
}} />
</div>
{uploadModal ? {uploadModal ?
<Modal <Modal
title={'上传文件'} title={'上传文件'}
@ -441,6 +465,7 @@ const Rest = (props) => {
total={count} total={count}
showSizeChanger showSizeChanger
currentPage={(query?.page || 0) + 1} currentPage={(query?.page || 0) + 1}
pageSize={query?.limit || 10}
pageSizeOpts={[10, 20, 50]} pageSizeOpts={[10, 20, 50]}
onChange={(currentPage, pageSize) => { onChange={(currentPage, pageSize) => {
setQuery({ limit: pageSize, page: currentPage - 1 }); setQuery({ limit: pageSize, page: currentPage - 1 });

51
web/client/src/sections/means/containers/repairFQA.jsx

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from 'react'; import React, { useEffect, useState, useMemo } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui'; import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui';
import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle } from '@douyinfe/semi-icons'; import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle, IconSearch } from '@douyinfe/semi-icons';
import SimpleBar from 'simplebar-react'; import SimpleBar from 'simplebar-react';
import FileModal from '../components/fileModal'; import FileModal from '../components/fileModal';
import moment from 'moment'; import moment from 'moment';
@ -29,7 +29,7 @@ const Rest = (props) => {
const [videoModalV, setVideoModalV] = useState(false); const [videoModalV, setVideoModalV] = useState(false);
const [videoUrl, setvideoUrl] = useState(null); const [videoUrl, setvideoUrl] = useState(null);
const [hint, setHint] = useState(false); const [hint, setHint] = useState(false);
const [fileLists, setFileLists] = useState([]) const [fileSearch, setFileSearch] = useState([]) //
@ -56,6 +56,9 @@ const Rest = (props) => {
setShowPomsList(data) setShowPomsList(data)
setPepProjectId(data[0]?.pepProjectId) setPepProjectId(data[0]?.pepProjectId)
fileList(data[0]?.pepProjectId) fileList(data[0]?.pepProjectId)
setDataSource([])
setFileId('')
setFileSearch('')
}, [projectSearch]) }, [projectSearch])
useEffect(() => { useEffect(() => {
@ -69,17 +72,21 @@ const Rest = (props) => {
setShowPomsList(data) setShowPomsList(data)
setPepProjectId(data[0]?.pepProjectId) setPepProjectId(data[0]?.pepProjectId)
fileList(data[0]?.pepProjectId) fileList(data[0]?.pepProjectId)
setDataSource([])
setFileId('')
setFileSearch('')
}, [overallProjectId]) }, [overallProjectId])
useEffect(() => { useEffect(() => {
if (fileId) { if (fileId) {
filfolderFileListe() filfolderFileListe()
setQuery({ limit: 10, page: 0 }) setQuery({ limit: 10, page: 0 })
setFileSearch('')
} }
}, [fileId]) }, [fileId])
const fileList = (id) => { const fileList = (id) => {
dispatch(means.fileList({ projectId: id, type: 2 })).then((res => { dispatch(means.fileList({ projectId: id, type: 2 })).then((res => {
if (res.success) { if (res.success) {
let data = res.payload.data let data = res.payload.data
@ -87,7 +94,7 @@ const Rest = (props) => {
setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id }))) setHigherFile(data?.map(d => ({ name: d.fileName, value: d.id })))
dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => { dispatch(means.folderFileList({ fileId: JSON.stringify(data?.map(d => d.id)) })).then((s => {
if (s.success) { if (s.success) {
setFileLists(s.payload.data?.rows) // setFileLists(s.payload.data?.rows)
settreeData(listErgodic(oneLevel, data, s.payload.data?.rows)) settreeData(listErgodic(oneLevel, data, s.payload.data?.rows))
} }
})) }))
@ -113,7 +120,7 @@ const Rest = (props) => {
} }
treeDataList(treeData) treeDataList(treeData)
let datas = params || query let datas = params || query
dispatch(means.folderFileList({ fileId: JSON.stringify(fileIds), ...datas })).then((res => { dispatch(means.folderFileList({ keyword: fileSearch, fileId: JSON.stringify(fileIds), ...datas, })).then((res => {
if (res.success) { if (res.success) {
setDataSource(res.payload.data?.rows || []) setDataSource(res.payload.data?.rows || [])
setCount(res.payload.data?.count) setCount(res.payload.data?.count)
@ -277,6 +284,8 @@ const Rest = (props) => {
onClick={() => { onClick={() => {
setPepProjectId(v.pepProjectId) setPepProjectId(v.pepProjectId)
fileList(v.pepProjectId) fileList(v.pepProjectId)
setDataSource([])
setFileId('')
}}> }}>
<img src="/assets/images/icon/project-icon.png" style={{ width: 14, marginRight: 8 }} /> <img src="/assets/images/icon/project-icon.png" style={{ width: 14, marginRight: 8 }} />
<div style={{ fontSize: 14, width: 152, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> {v.pepProjectName}</div> <div style={{ fontSize: 14, width: 152, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> {v.pepProjectName}</div>
@ -315,10 +324,11 @@ const Rest = (props) => {
<Tree <Tree
treeData={treeData} treeData={treeData}
defaultExpandAll defaultExpandAll
// labelEllipsis={true} value={fileId}
// style={style} // style={style}
onSelect={(selectedKey, selected, selectedNode) => { onSelect={(selectedKey, selected, selectedNode) => {
setFileId(selectedKey) setFileId(selectedKey)
setFileSearch('')
}} }}
/> />
</SimpleBar> </SimpleBar>
@ -329,13 +339,27 @@ const Rest = (props) => {
flex: 1, height: '100%', flex: 1, height: '100%',
// border: '1px solid rgb(24 22 22)' // border: '1px solid rgb(24 22 22)'
}}> }}>
<div style={{ margin: '20px 0 10px 10px', display: 'flex', alignItems: 'center' }}> <div style={{ margin: '20px 0 10px 10px', display: 'flex', alignItems: 'center', width: 'calc(100% - 20px)' }}>
<Button theme='solid' type='primary' style={{ width: 80, background: '#005ABD', marginRight: 10 }} onClick={() => { <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}>
if (higherFile?.filter(c => c.value == fileId)?.length) { <div style={{ display: 'flex', alignItems: 'center' }}>
setUploadModal(true) <Button theme='solid' type='primary' style={{ width: 80, background: '#005ABD', marginRight: 10 }} onClick={() => {
} if (higherFile?.filter(c => c.value == fileId)?.length) {
}}> 上传 </Button> setUploadModal(true)
<div style={{ display: 'flex' }}>当前文件夹{higherFile?.filter(c => c.value == fileId)[0]?.name || <div style={{ color: '#c31515' }}>请选择文件夹</div>}</div> }
}}> 上传 </Button>
<div style={{ display: 'flex' }}>当前文件夹{higherFile?.filter(c => c.value == fileId)[0]?.name || <div style={{ color: '#c31515' }}>请选择文件夹</div>}</div>
</div>
<Input placeholder='请输入文件名称'
style={{ width: 220 }}
suffix={<IconSearch />}
value={fileSearch}
onChange={v => {
setFileSearch(v)
filfolderFileListe({ keyword: v, limit: 10, page: 0 })
setQuery({ limit: 10, page: 0 })
}} />
</div>
{uploadModal ? {uploadModal ?
<Modal <Modal
title={'上传文件'} title={'上传文件'}
@ -441,6 +465,7 @@ const Rest = (props) => {
total={count} total={count}
showSizeChanger showSizeChanger
currentPage={(query?.page || 0) + 1} currentPage={(query?.page || 0) + 1}
pageSize={query?.limit || 10}
pageSizeOpts={[10, 20, 50]} pageSizeOpts={[10, 20, 50]}
onChange={(currentPage, pageSize) => { onChange={(currentPage, pageSize) => {
setQuery({ limit: pageSize, page: currentPage - 1 }); setQuery({ limit: pageSize, page: currentPage - 1 });

Loading…
Cancel
Save