提交 d675289b authored 作者: 徐立's avatar 徐立

修改回调函数

上级 acf8adb6
......@@ -86,7 +86,7 @@ export default class idnex extends Component {
})
}
handleDraft = () => {
let {dispatch, id, radioValue} = this.props;
let {dispatch, id, radioValue,draftCallback} = this.props;
this.setState({
isLoading:true
},() => {
......@@ -105,6 +105,9 @@ export default class idnex extends Component {
this.setState({ // 存在草稿后保存草稿Id 后续修改在这草稿Id上处理
draftId: val.id
})
if(this.props?.draftCallback){
this.props.draftCallback(val)
}
openToast('success', '保存成功', '草稿保存成功');
} else {
openToast('error', '保存失败', '请尝试');
......
......@@ -16,6 +16,8 @@ import SumbitButton from '@/webPublic/one_stop_public/AffairButton/SumbitButton'
draftId = {'草稿Id'} // 可不传 不传为发起全新 传后修改草稿
openDraftButton = {true} // 开启保存草稿按钮
DraftButtonText = '草稿按钮文本' // 草稿按钮内置文本
callback = '提交按钮回调函数' // 提交按钮回调函数
draftCallback = {'草稿按钮回调函数'} // 草稿按钮回调函数
/>
```
......
......@@ -2,8 +2,8 @@
* web端文件预览功能
*/
import React, { Component } from 'react';
import { Modal,Icon,Tooltip } from 'antd';
// import FileViewer from 'react-file-viewer';
import { Modal,Icon,Tooltip,Popconfirm } from 'antd';
import FileViewer from 'react-file-viewer';
export default class index extends Component {
constructor(props){
super(props)
......@@ -28,6 +28,13 @@ export default class index extends Component {
visible: false,
});
};
download = () => {
let {
path,
pathName
} = this.props
window.open(path,'_blank')
}
render() {
let {
path,
......@@ -42,6 +49,10 @@ export default class index extends Component {
|| pathName?.indexOf('.mp3') !== -1
|| pathName?.indexOf('.mp4') !== -1
|| pathName?.indexOf('.csv') !== -1
|| pathName?.indexOf('.png') !== -1
|| pathName?.indexOf('.jpeg') !== -1
|| pathName?.indexOf('.gif') !== -1
|| pathName?.indexOf('.bmp') !== -1
let type;
if(pathName?.indexOf('.pdf') !== -1){
isShow = true
......@@ -58,38 +69,44 @@ export default class index extends Component {
} else if(pathName?.indexOf('.csv') !== -1){
isShow = true
type = 'csv'
} else if(pathName?.indexOf('.png') !== -1){
isShow = true
type = 'png'
} else if(pathName?.indexOf('.gif') !== -1){
isShow = true
type = 'gif'
} else if(pathName?.indexOf('.bmp') !== -1){
isShow = true
type = 'bmp'
} else {
isShow = false
}
return (
<span>
<span
>
<Popconfirm
title="该附件支持预览,是否预览?"
onConfirm={this.download}
onCancel={this.showModal}
okText="下载"
cancelText="预览"
>
<a
target="_blank"
href={path}>
{pathName}
</a>
{
isShow?
<Tooltip
title={`预览${pathName}`}
>
<Icon
onClick={this.showModal}
style={{marginLeft:'12px'}}
type="security-scan" />
</Tooltip>
:null
}
</Popconfirm>
<Modal
title={pathName}
visible={visible}
width={1200}
destroyOnClose
onOk={this.handleOk}
onCancel={this.handleCancel}
>
{
type === 'pdf'||type==='ppt'?
type === 'pdf'?
<iframe
style={{
width:'100%',
......@@ -102,13 +119,13 @@ export default class index extends Component {
height:600,
}}
>
{/* <FileViewer
<FileViewer
fileType={type}
filePath={path}
// onError={this.onError}
// errorComponent={Error}
// unsupportedComponent={Error}
/> */}
/>
</div>
}
......
......@@ -64,7 +64,7 @@ const Bs64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
const base64 = baseX(Bs64)
import {Base16Encode} from "../Base16/index"
import { getToken } from '../utils/token';
// import FilePreview from '../filePreview';
import FilePreview from '../filePreview';
function getBase64(value){
return value?base64.encode(new Buffer(value)):null;
......@@ -1745,12 +1745,12 @@ export default class tableCom extends Component {
if (f.path.indexOf('.png') != -1 || f.path.indexOf('.jpg') != -1) {
return <img key={index2} style={{ width: 100, height: 100 }} src={queryApiActionPath() + f.path} />
}
// if(get === 'web'){
// return <li key={index2}><FilePreview
// path={queryApiActionPath() + f.path}
// pathName={f.name}
// /></li>
// }
if(get === 'web'){
return <li key={index2}><FilePreview
path={queryApiActionPath() + f.path}
pathName={f.name}
/></li>
}
return <li key={index2}><a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
......@@ -1766,6 +1766,12 @@ export default class tableCom extends Component {
if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) {
return <img key={index2} style={{ width: 100, height: 100 }} src={queryApiActionPath() + f.filePath} />
}
if(get === 'web'){
return <li key={index2}><FilePreview
path={queryApiActionPath() + f.path}
pathName={f.name}
/></li>
}
return <li key={index2}><a target="_blank" key={f.filePath} href={queryApiActionPath() + f.filePath}>
{f.fileName}
</a></li>
......
......@@ -20,6 +20,7 @@ react-native-uuid
path-to-regexp
prop-types
react-signature-canvas
react-file-viewer
```
##抽离注意
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论