Compare commits

..

No commits in common. "e713b3c8b9c0c4c1145ff42a93fa15e749a5c3db" and "eb4e287226b0fad911e9a0c0374b20737c4e204b" have entirely different histories.

7 changed files with 33 additions and 49 deletions

View File

@ -95,22 +95,22 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
* @param {string} id 删除的id
*/
const deleteFile = (fileId) => {
console.log(fileId,fileList);
let filterFile = fileList.filter(item => item.fileId !== fileId);
console.log(fileId);
let filterFile = fileList.filter(item => item.response?.data?.fileId !== fileId);
setFileList(filterFile)
}
useEffect(() => {
if (mode != 'save') {
const imgFile = record?.files?.map(o => ({
name: o.fileName,
response: {
data: {
filePath: o.filePath,
fileId: o.fileId
}
},
}))
setFileList(imgFile)
// const imgFile = record?.files?.map(o => ({
// name: o.name,
// response: {
// data: {
// filePath: o.filePath,
// fileId: o.fileId
// }
// },
// }))
setFileList(record?.files)
}
}, [record, mode])
@ -232,7 +232,6 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
</p>
</Dragger>
}
{JSON.stringify(fileList)}
<Row gutter={[16]}>
{
fileList.length > 0 && fileList.map(file => {
@ -240,9 +239,9 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
<Col span={12}>
<div className="file-item" style={{ width: "75%",marginTop:5 }}>
<div className='file-description'>
{file.name?.indexOf('.docx') > -1 ?
{file?.fileName?.indexOf('.docx') > -1 ?
<div
onClick={() => { download(file.response?.data?.fileId) }}
onClick={() => { download(file.fileId) }}
style={{ cursor: 'pointer' }}
>
<FileWordOutlined
@ -250,35 +249,35 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
/>
</div>
:
file.name?.indexOf('.pdf') > -1 ?
file?.fileName?.indexOf('.pdf') > -1 ?
<div
onClick={() => { viewPdf(file.response?.data?.fileId) }}
onClick={() => { viewPdf(file.fileId) }}
style={{ cursor: 'pointer' }}
>
<FilePdfOutlined style={{ fontSize: 40 }} />
</div>
:
file.name?.indexOf('.zip') > -1 ?
file?.fileName?.indexOf('.zip') > -1 ?
<div
onClick={() => { download(file.response?.data?.fileId) }}
onClick={() => { download(file.fileId) }}
style={{ cursor: 'pointer' }}
>
<FileZipOutlined style={{ fontSize: 40 }} />
</div>
:
file.name?.indexOf('.xlsx') > -1 ?
file?.fileName?.indexOf('.xlsx') > -1 ?
<div
onClick={() => { download(file.response?.data?.fileId) }}
onClick={() => { download(file.fileId) }}
style={{ cursor: 'pointer' }}
>
<FileExcelOutlined style={{ fontSize: 40 }} />
</div>
:
<Image width={60} src={url + file.response?.data?.filePath} alt='' />
<Image width={60} src={url + file.filePath} alt='' />
}
<span>{file.name}</span>
<span>{file?.fileName}</span>
</div>
<div className={mode == "view" ? 'delete-icon disable-icon' : 'delete-icon'} onClick={() => deleteFile(file.response?.data?.fileId)}>
<div className={mode == "view" ? 'delete-icon disable-icon' : 'delete-icon'} onClick={() => deleteFile(file.fileId)}>
<DeleteOutlined />
</div>
</div>

View File

@ -37,8 +37,6 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
const [fileListHj, setFileHj] = useState({'files3': [],'files4': [],'files5': [],'files6': [],'files7': []})
const [url, setUrl] = useState('')
const [isModal, setIsModal] = useState(false)
const [loading, setLoading] = useState(false)
const getInfo = () => {
form.validateFields().then((values) => {
getFormInfo({ ...fileListHj,...values, })
@ -74,9 +72,8 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
// }
},
customRequest(e) {
setLoading(true);
httppostAddfile(uploadUrl, e).then(res => {
httppostAddfile(uploadUrl, e).then(res => {
if(fileListHj[keys]){
fileListHj[keys].push(res.data)
}else{
@ -85,8 +82,6 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
}
setFileHj({ ...fileListHj })
setLoading(false);
})
}
}
@ -207,7 +202,7 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
</Row>))}
<div className="flex flex-end" style={{ marginTop: 10, justifyContent: "flex-end" }}>
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button>
<Button type="primary" onClick={getInfo}>确定</Button>
</div>
</Form >

View File

@ -34,8 +34,6 @@ const items = [
const Page = ({ mode, onCrudSuccess,record,submit }) => {
const [formData,setFormData] =useState({})
const [clqkDataConfig,setConfig] =useState([])
const [recordData,setRecord] =useState({})
// debugger;
const [key, setKeys] = useState('1')

View File

@ -26,8 +26,6 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
const [fileListHj, setFileHj] = useState({'files3': [],'files4': [],'files5': [],'files6': [],'files7': []})
const [url, setUrl] = useState('')
const [isModal, setIsModal] = useState(false)
const [loading, setLoading] = useState(false)
const getInfo = () => {
form.validateFields().then((values) => {
getFormInfo({ ...values, ...fileListHj })
@ -64,7 +62,6 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
// }
},
customRequest(e) {
setLoading(true);
httppostAddfile(uploadUrl, e).then(res => {
if(fileListHj[keys]){
@ -75,7 +72,6 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
}
setFileHj({ ...fileListHj })
setLoading(false);
})
}
}
@ -171,7 +167,7 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
</Row>))}
<div className="flex flex-end" style={{ marginTop: 10, justifyContent: "flex-end" }}>
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button>
<Button type="primary" onClick={getInfo}>确定</Button>
</div>
</Form >

View File

@ -20,8 +20,6 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
const [fileListUp, setFileLisUp] = useState([])
const [url, setUrl] = useState('')
const [isModal, setIsModal] = useState(false)
const [loading, setLoading] = useState(false)
//
@ -73,9 +71,8 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
}
},
customRequest(e) {
setLoading(true);
setFileLisUp([...fileListUp, e.file])
httppostAddfile(uploadUrl, e).then(res => {
setLoading(false);
setFileList([...fileList, res.data])
})
}
@ -105,9 +102,9 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
return null;
}
const preView = (item) => {
if (checkMediaType(item.fileName) == 'pdf') {
if (checkMediaType(item.name) == 'pdf') {
// window.open(baseUrl + item.previewUrl)
setUrl(item.fileId)
setUrl(item.previewUrl)
setIsModal(true)
}
@ -308,10 +305,10 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
{
type !== 'view' && <div className="flex flex-end" style={{ marginTop: 10, justifyContent: "flex-end" }}>
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button>
<Button type="primary" onClick={getInfo}>确定</Button>
</div>
}
<PdfView url={`${process.env.PUBLIC_URL}/static/pdf/web/viewer.html?file=${encodeURIComponent(`/gunshiApp/tsg/rescue/goods/file/download/${url}`)}`} isModal={isModal} setModalN={(e)=>setIsModal(e)}/>
<PdfView url={`${process.env.PUBLIC_URL}/static/pdf/web/viewer.html?file=${encodeURIComponent(`/gunshiApp/xyt/rescue/goods/file/download/${url}`)}`} isModal={isModal} setModalN={(e)=>setIsModal(e)}/>
</div >

View File

@ -26,7 +26,6 @@ const Pdf = ({ url,isModal,setModalN }) => {
onOk={handleOk}
footer={false}
onCancel={handleCancel}
style={{ marginTop: "-5%" }}
destroyOnClose>
<div style={{ padding: "0 10px" }}>
<iframe

View File

@ -103,7 +103,7 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
}
useEffect(() => {
if (mode != 'save') {
const imgFile = record?.files?.map(o => ({
const imgFile = record?.files?.map(o => ({
name: o.fileName,
response: {
data: {
@ -273,7 +273,7 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
border: 0,
marginTop: 20,
}}
src={`${process.env.PUBLIC_URL}/static/pdf/web/viewer.html?file=${encodeURIComponent(`/gunshiApp/tsg/projectEvents/file/download/${iframeSrc}`)}`}
src={`${process.env.PUBLIC_URL}/static/pdf/web/viewer.html?file=${encodeURIComponent(`/gunshiApp/xyt/projectEvents/file/download/${iframeSrc}`)}`}
/>
</Modal>
</>