Commit ed9efaa1 authored by 涂伟's avatar 涂伟

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

parent 5fd356a5
......@@ -34,6 +34,7 @@ import {
LoadingOutlined,
UploadOutlined,
EyeOutlined,
CloseOutlined,
} from '@ant-design/icons';
import FileViewer from 'react-file-viewer';
......@@ -71,11 +72,8 @@ const OptionEditModal = props => {
const [loading, setLoading] = useState(false); // 上传按钮loading
const [previewVisible, setPreviewVisible] = useState(false); // 预览文件弹窗
const [fileType, setFileType] = useState('pdf'); // 预览文件类型
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',
); // 预览文件路径
const [fileType, setFileType] = 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',
const [form] = Form.useForm();
const [formAdd] = Form.useForm();
......@@ -90,24 +88,6 @@ const OptionEditModal = props => {
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 = () => {
form.validateFields().then(validate => {
let data = validate;
......@@ -131,10 +111,6 @@ const OptionEditModal = props => {
});
});
};
// const inputType1 = e => {
// setType1(e.target.value);
// form.setFieldsValue({ businessType: e.target.value });
// };
// 字段配置
const deployField = val => {
......@@ -268,7 +244,6 @@ const OptionEditModal = props => {
setFileList(newFileList);
};
const beforeUpload = (file, fileList) => {
console.log(file);
const isJpgOrPng =
file.type === 'image/jpeg' ||
file.type === 'image/png' ||
......@@ -292,12 +267,10 @@ const OptionEditModal = props => {
};
const setInputValue = (e, item, index) => {
let list = JSON.parse(JSON.stringify(standList));
let obj = item;
list[index].name = e.currentTarget.value;
setStandList(list);
};
const uprops = {
// action: `${window.location.origin}/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`,
action: `${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`,
// action: `http://192.168.10.167:8088/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`,
multiple: true,
......@@ -318,11 +291,6 @@ const OptionEditModal = props => {
const preview = item => {
setFileType(item.type);
// setFileUrl(
// `${`${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=`}${
// item.pdfUrl
// }`,
// );
setFileUrl(
`${`${window.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=`}${
item.pdfUrl
......@@ -570,6 +538,7 @@ const OptionEditModal = props => {
{standList?.length
? standList.map((item, index) => (
<div
key={index}
style={{
display: 'flex',
alignItems: 'flex-start',
......@@ -584,7 +553,7 @@ const OptionEditModal = props => {
setInputValue(e, item, index);
}}
/>
<div>
<div className={styles.uploadBtn}>
<Upload
{...uprops}
onChange={value => handleChange(value, item, index)}
......@@ -598,7 +567,7 @@ const OptionEditModal = props => {
style={{ marginLeft: '3px', width: '96px' }}
icon={<UploadOutlined />}
>
已上传
{item.pdfUrl.split('\\')[1]}
</Button>
) : (
<Button
......@@ -643,17 +612,18 @@ const OptionEditModal = props => {
fieldData={fieldData}
fieldName={fieldName}
/>
<Modal
visible={previewVisible}
title="文件预览"
width="850px"
footer={null}
onCancel={() => setPreviewVisible(false)}
bodyStyle={{ height: '600px', overflow: 'hidden', overflowY: 'scroll' }}
// style={{ overflow: 'auto' }}
>
<FileViewer fileType={fileType} filePath={fileUrl} />
</Modal>
{/* <div>
<FileViewer fileType={fileType} filePath={fileUrl} key={fileUrl} />
</div> */}
<div className={styles.mask} style={{ display: previewVisible ? 'block' : 'none' }}>
<div className={styles.fileTitle}>
<div>文件预览</div>
<CloseOutlined onClick={() => setPreviewVisible(false)} />
</div>
<div className={styles.content}>
<FileViewer fileType={fileType} filePath={fileUrl} key={fileUrl} />
</div>
</div>
</Drawer>
);
};
......
......@@ -248,7 +248,6 @@ const maintenance = () => {
useEffect(() => {
setTreeLoading(true);
console.log(activeName, 'activeNameactiveNameactiveName');
if (activeName === 'template') {
CM_XWBPlan_DataList().then(res => {
setTreeLoading(false);
......@@ -614,7 +613,8 @@ const maintenance = () => {
}),
align: 'center',
render: record => {
if (record) {
let arr = JSON.parse(record || '[]');
if (arr.length) {
return <Tag color="success">已上传</Tag>;
} else {
return <Tag color="processing">未上传</Tag>;
......
.feedBack {
display: flex;
display: flex;
flex-wrap: wrap;
>div {
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