Commit ed9efaa1 authored by 涂伟's avatar 涂伟

fix: '卡片维保配置预览功能完成'

parent 5fd356a5
...@@ -34,6 +34,7 @@ import { ...@@ -34,6 +34,7 @@ import {
LoadingOutlined, LoadingOutlined,
UploadOutlined, UploadOutlined,
EyeOutlined, EyeOutlined,
CloseOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import FileViewer from 'react-file-viewer'; import FileViewer from 'react-file-viewer';
...@@ -71,11 +72,8 @@ const OptionEditModal = props => { ...@@ -71,11 +72,8 @@ const OptionEditModal = props => {
const [loading, setLoading] = useState(false); // 上传按钮loading const [loading, setLoading] = useState(false); // 上传按钮loading
const [previewVisible, setPreviewVisible] = useState(false); // 预览文件弹窗 const [previewVisible, setPreviewVisible] = useState(false); // 预览文件弹窗
const [fileType, setFileType] = useState('pdf'); // 预览文件类型 const [fileType, setFileType] = useState(''); // 预览文件类型
const [fileUrl, setFileUrl] = useState( const [fileUrl, setFileUrl] = useState(''); // 预览文件路径 // 'http://192.168.10.167:8088/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=520d9de3-b69b-42c0-bb65-f198a30d0cd4\\%E5%B7%A5%E5%8D%95%E6%97%B6%E9%99%90%E9%85%8D%E7%BD%AE.pdf',
'',
// 'http://192.168.10.167:8088/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=520d9de3-b69b-42c0-bb65-f198a30d0cd4\\%E5%B7%A5%E5%8D%95%E6%97%B6%E9%99%90%E9%85%8D%E7%BD%AE.pdf',
); // 预览文件路径
const [form] = Form.useForm(); const [form] = Form.useForm();
const [formAdd] = Form.useForm(); const [formAdd] = Form.useForm();
...@@ -90,24 +88,6 @@ const OptionEditModal = props => { ...@@ -90,24 +88,6 @@ const OptionEditModal = props => {
useEffect(() => {}, []); useEffect(() => {}, []);
// 获取关联事件数据
// const getEventData = () => {
// GetCM_Event_LoadEventTable().then(res => {
// if (res.code === 0) {
// let aa = [];
// let bb = [];
// res.data.map(i => {
// i.root.map(j => {
// aa.push(j.name);
// bb.push(j);
// });
// });
// setKeepAllData(bb);
// setEventData(aa);
// }
// });
// };
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
let data = validate; let data = validate;
...@@ -131,10 +111,6 @@ const OptionEditModal = props => { ...@@ -131,10 +111,6 @@ const OptionEditModal = props => {
}); });
}); });
}; };
// const inputType1 = e => {
// setType1(e.target.value);
// form.setFieldsValue({ businessType: e.target.value });
// };
// 字段配置 // 字段配置
const deployField = val => { const deployField = val => {
...@@ -268,7 +244,6 @@ const OptionEditModal = props => { ...@@ -268,7 +244,6 @@ const OptionEditModal = props => {
setFileList(newFileList); setFileList(newFileList);
}; };
const beforeUpload = (file, fileList) => { const beforeUpload = (file, fileList) => {
console.log(file);
const isJpgOrPng = const isJpgOrPng =
file.type === 'image/jpeg' || file.type === 'image/jpeg' ||
file.type === 'image/png' || file.type === 'image/png' ||
...@@ -292,12 +267,10 @@ const OptionEditModal = props => { ...@@ -292,12 +267,10 @@ const OptionEditModal = props => {
}; };
const setInputValue = (e, item, index) => { const setInputValue = (e, item, index) => {
let list = JSON.parse(JSON.stringify(standList)); let list = JSON.parse(JSON.stringify(standList));
let obj = item;
list[index].name = e.currentTarget.value; list[index].name = e.currentTarget.value;
setStandList(list); setStandList(list);
}; };
const uprops = { const uprops = {
// action: `${window.location.origin}/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`,
action: `${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`, action: `${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`,
// action: `http://192.168.10.167:8088/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`, // action: `http://192.168.10.167:8088/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`,
multiple: true, multiple: true,
...@@ -318,11 +291,6 @@ const OptionEditModal = props => { ...@@ -318,11 +291,6 @@ const OptionEditModal = props => {
const preview = item => { const preview = item => {
setFileType(item.type); setFileType(item.type);
// setFileUrl(
// `${`${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=`}${
// item.pdfUrl
// }`,
// );
setFileUrl( setFileUrl(
`${`${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=`}${ `${`${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=`}${
item.pdfUrl item.pdfUrl
...@@ -570,6 +538,7 @@ const OptionEditModal = props => { ...@@ -570,6 +538,7 @@ const OptionEditModal = props => {
{standList?.length {standList?.length
? standList.map((item, index) => ( ? standList.map((item, index) => (
<div <div
key={index}
style={{ style={{
display: 'flex', display: 'flex',
alignItems: 'flex-start', alignItems: 'flex-start',
...@@ -584,7 +553,7 @@ const OptionEditModal = props => { ...@@ -584,7 +553,7 @@ const OptionEditModal = props => {
setInputValue(e, item, index); setInputValue(e, item, index);
}} }}
/> />
<div> <div className={styles.uploadBtn}>
<Upload <Upload
{...uprops} {...uprops}
onChange={value => handleChange(value, item, index)} onChange={value => handleChange(value, item, index)}
...@@ -598,7 +567,7 @@ const OptionEditModal = props => { ...@@ -598,7 +567,7 @@ const OptionEditModal = props => {
style={{ marginLeft: '3px', width: '96px' }} style={{ marginLeft: '3px', width: '96px' }}
icon={<UploadOutlined />} icon={<UploadOutlined />}
> >
已上传 {item.pdfUrl.split('\\')[1]}
</Button> </Button>
) : ( ) : (
<Button <Button
...@@ -643,17 +612,18 @@ const OptionEditModal = props => { ...@@ -643,17 +612,18 @@ const OptionEditModal = props => {
fieldData={fieldData} fieldData={fieldData}
fieldName={fieldName} fieldName={fieldName}
/> />
<Modal {/* <div>
visible={previewVisible} <FileViewer fileType={fileType} filePath={fileUrl} key={fileUrl} />
title="文件预览" </div> */}
width="850px" <div className={styles.mask} style={{ display: previewVisible ? 'block' : 'none' }}>
footer={null} <div className={styles.fileTitle}>
onCancel={() => setPreviewVisible(false)} <div>文件预览</div>
bodyStyle={{ height: '600px', overflow: 'hidden', overflowY: 'scroll' }} <CloseOutlined onClick={() => setPreviewVisible(false)} />
// style={{ overflow: 'auto' }} </div>
> <div className={styles.content}>
<FileViewer fileType={fileType} filePath={fileUrl} /> <FileViewer fileType={fileType} filePath={fileUrl} key={fileUrl} />
</Modal> </div>
</div>
</Drawer> </Drawer>
); );
}; };
......
...@@ -248,7 +248,6 @@ const maintenance = () => { ...@@ -248,7 +248,6 @@ const maintenance = () => {
useEffect(() => { useEffect(() => {
setTreeLoading(true); setTreeLoading(true);
console.log(activeName, 'activeNameactiveNameactiveName');
if (activeName === 'template') { if (activeName === 'template') {
CM_XWBPlan_DataList().then(res => { CM_XWBPlan_DataList().then(res => {
setTreeLoading(false); setTreeLoading(false);
...@@ -614,7 +613,8 @@ const maintenance = () => { ...@@ -614,7 +613,8 @@ const maintenance = () => {
}), }),
align: 'center', align: 'center',
render: record => { render: record => {
if (record) { let arr = JSON.parse(record || '[]');
if (arr.length) {
return <Tag color="success">已上传</Tag>; return <Tag color="success">已上传</Tag>;
} else { } else {
return <Tag color="processing">未上传</Tag>; return <Tag color="processing">未上传</Tag>;
......
.feedBack { .feedBack {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
>div { >div {
width: 51%; width: 51%;
} }
}
.uploadBtn {
:global {
.ant-btn-default {
display: flex;
align-items: center;
>span:last-child {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
width: 54px;
}
}
}
}
:global {
// .photo-viewer-container {
// width: 100%!important;
// height: 100%!important;
// }
// .pg-viewer-wrapper img {
// width: 100%!important;
// height: 100%!important;
// }
}
.mask{
width: 60%;
height: 80%;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
background-color: #000;
opacity: 1;
// color:#f00;
z-index: 999;
.content {
height: 80%;
width: 100%;
overflow-y: auto;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
text-align: center;
padding: 0 2px;
}
}
// .content{
// position: fixed;
// height: 80%;
// width: 50%;
// left: 50%;
// top:50%;
// background-color: #fff;
// transform: translate(-50%,-50%);
// display: flex;
// justify-content: center;
// overflow-y: auto;
// margin: 70px auto;
// }
.fileTitle {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
background: white;
padding: 6px 15px;
font-size: 16px;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment