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

修改回调函数

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