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 * @param {string} id 删除的id
*/ */
const deleteFile = (fileId) => { const deleteFile = (fileId) => {
console.log(fileId,fileList); console.log(fileId);
let filterFile = fileList.filter(item => item.fileId !== fileId); let filterFile = fileList.filter(item => item.response?.data?.fileId !== fileId);
setFileList(filterFile) setFileList(filterFile)
} }
useEffect(() => { useEffect(() => {
if (mode != 'save') { if (mode != 'save') {
const imgFile = record?.files?.map(o => ({ // const imgFile = record?.files?.map(o => ({
name: o.fileName, // name: o.name,
response: { // response: {
data: { // data: {
filePath: o.filePath, // filePath: o.filePath,
fileId: o.fileId // fileId: o.fileId
} // }
}, // },
})) // }))
setFileList(imgFile) setFileList(record?.files)
} }
}, [record, mode]) }, [record, mode])
@ -232,7 +232,6 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
</p> </p>
</Dragger> </Dragger>
} }
{JSON.stringify(fileList)}
<Row gutter={[16]}> <Row gutter={[16]}>
{ {
fileList.length > 0 && fileList.map(file => { fileList.length > 0 && fileList.map(file => {
@ -240,9 +239,9 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
<Col span={12}> <Col span={12}>
<div className="file-item" style={{ width: "75%",marginTop:5 }}> <div className="file-item" style={{ width: "75%",marginTop:5 }}>
<div className='file-description'> <div className='file-description'>
{file.name?.indexOf('.docx') > -1 ? {file?.fileName?.indexOf('.docx') > -1 ?
<div <div
onClick={() => { download(file.response?.data?.fileId) }} onClick={() => { download(file.fileId) }}
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
> >
<FileWordOutlined <FileWordOutlined
@ -250,35 +249,35 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
/> />
</div> </div>
: :
file.name?.indexOf('.pdf') > -1 ? file?.fileName?.indexOf('.pdf') > -1 ?
<div <div
onClick={() => { viewPdf(file.response?.data?.fileId) }} onClick={() => { viewPdf(file.fileId) }}
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
> >
<FilePdfOutlined style={{ fontSize: 40 }} /> <FilePdfOutlined style={{ fontSize: 40 }} />
</div> </div>
: :
file.name?.indexOf('.zip') > -1 ? file?.fileName?.indexOf('.zip') > -1 ?
<div <div
onClick={() => { download(file.response?.data?.fileId) }} onClick={() => { download(file.fileId) }}
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
> >
<FileZipOutlined style={{ fontSize: 40 }} /> <FileZipOutlined style={{ fontSize: 40 }} />
</div> </div>
: :
file.name?.indexOf('.xlsx') > -1 ? file?.fileName?.indexOf('.xlsx') > -1 ?
<div <div
onClick={() => { download(file.response?.data?.fileId) }} onClick={() => { download(file.fileId) }}
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
> >
<FileExcelOutlined style={{ fontSize: 40 }} /> <FileExcelOutlined style={{ fontSize: 40 }} />
</div> </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>
<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 /> <DeleteOutlined />
</div> </div>
</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 [fileListHj, setFileHj] = useState({'files3': [],'files4': [],'files5': [],'files6': [],'files7': []})
const [url, setUrl] = useState('') const [url, setUrl] = useState('')
const [isModal, setIsModal] = useState(false) const [isModal, setIsModal] = useState(false)
const [loading, setLoading] = useState(false)
const getInfo = () => { const getInfo = () => {
form.validateFields().then((values) => { form.validateFields().then((values) => {
getFormInfo({ ...fileListHj,...values, }) getFormInfo({ ...fileListHj,...values, })
@ -74,9 +72,8 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
// } // }
}, },
customRequest(e) { customRequest(e) {
setLoading(true);
httppostAddfile(uploadUrl, e).then(res => {
httppostAddfile(uploadUrl, e).then(res => {
if(fileListHj[keys]){ if(fileListHj[keys]){
fileListHj[keys].push(res.data) fileListHj[keys].push(res.data)
}else{ }else{
@ -85,8 +82,6 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
} }
setFileHj({ ...fileListHj }) setFileHj({ ...fileListHj })
setLoading(false);
}) })
} }
} }
@ -207,7 +202,7 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
</Row>))} </Row>))}
<div className="flex flex-end" style={{ marginTop: 10, justifyContent: "flex-end" }}> <div className="flex flex-end" style={{ marginTop: 10, justifyContent: "flex-end" }}>
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button> <Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button> <Button type="primary" onClick={getInfo}>确定</Button>
</div> </div>
</Form > </Form >

View File

@ -34,8 +34,6 @@ const items = [
const Page = ({ mode, onCrudSuccess,record,submit }) => { const Page = ({ mode, onCrudSuccess,record,submit }) => {
const [formData,setFormData] =useState({}) const [formData,setFormData] =useState({})
const [clqkDataConfig,setConfig] =useState([]) const [clqkDataConfig,setConfig] =useState([])
const [recordData,setRecord] =useState({})
// debugger; // debugger;
const [key, setKeys] = useState('1') 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 [fileListHj, setFileHj] = useState({'files3': [],'files4': [],'files5': [],'files6': [],'files7': []})
const [url, setUrl] = useState('') const [url, setUrl] = useState('')
const [isModal, setIsModal] = useState(false) const [isModal, setIsModal] = useState(false)
const [loading, setLoading] = useState(false)
const getInfo = () => { const getInfo = () => {
form.validateFields().then((values) => { form.validateFields().then((values) => {
getFormInfo({ ...values, ...fileListHj }) getFormInfo({ ...values, ...fileListHj })
@ -64,7 +62,6 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
// } // }
}, },
customRequest(e) { customRequest(e) {
setLoading(true);
httppostAddfile(uploadUrl, e).then(res => { httppostAddfile(uploadUrl, e).then(res => {
if(fileListHj[keys]){ if(fileListHj[keys]){
@ -75,7 +72,6 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
} }
setFileHj({ ...fileListHj }) setFileHj({ ...fileListHj })
setLoading(false);
}) })
} }
} }
@ -171,7 +167,7 @@ const Page = ({ uploadUrl, downloadUrl, type, getFormInfo, formJsonData }) => {
</Row>))} </Row>))}
<div className="flex flex-end" style={{ marginTop: 10, justifyContent: "flex-end" }}> <div className="flex flex-end" style={{ marginTop: 10, justifyContent: "flex-end" }}>
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button> <Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button> <Button type="primary" onClick={getInfo}>确定</Button>
</div> </div>
</Form > </Form >

View File

@ -20,8 +20,6 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
const [fileListUp, setFileLisUp] = useState([]) const [fileListUp, setFileLisUp] = useState([])
const [url, setUrl] = useState('') const [url, setUrl] = useState('')
const [isModal, setIsModal] = useState(false) 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) { customRequest(e) {
setLoading(true); setFileLisUp([...fileListUp, e.file])
httppostAddfile(uploadUrl, e).then(res => { httppostAddfile(uploadUrl, e).then(res => {
setLoading(false);
setFileList([...fileList, res.data]) setFileList([...fileList, res.data])
}) })
} }
@ -105,9 +102,9 @@ const FormZdy = ({ fileKey,typeName = "ddForm", formJson, getFormInfo, type, for
return null; return null;
} }
const preView = (item) => { const preView = (item) => {
if (checkMediaType(item.fileName) == 'pdf') { if (checkMediaType(item.name) == 'pdf') {
// window.open(baseUrl + item.previewUrl) // window.open(baseUrl + item.previewUrl)
setUrl(item.fileId) setUrl(item.previewUrl)
setIsModal(true) 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" }}> type !== 'view' && <div className="flex flex-end" style={{ marginTop: 10, justifyContent: "flex-end" }}>
<Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button> <Button type="" style={{ marginRight: 10 }} onClick={cancel}>取消</Button>
<Button type="primary" onClick={getInfo} loading={loading}>确定</Button> <Button type="primary" onClick={getInfo}>确定</Button>
</div> </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 > </div >

View File

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

View File

@ -273,7 +273,7 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
border: 0, border: 0,
marginTop: 20, 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> </Modal>
</> </>