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

修复bug

上级 8fc4d7bb
......@@ -131,7 +131,8 @@ export default class ZdyTable extends Component {
currentFormKey:obj.init,
width: xxx.width,
isBorder: xxx.isBorder,
mapData,sqlData,defaultValues:val.unifiedServicePatternModel.defaultValues,
mapData,sqlData,
defaultValues:val.unifiedServicePatternModel.defaultValues,
appId: val.appId,
isReady:true,
formConfig:xxx,
......
/**
* web端文件预览功能
*/
import React, { Component } from 'react';
import { Modal,Icon,Tooltip } from 'antd';
// import FileViewer from 'react-file-viewer';
export default class index extends Component {
constructor(props){
super(props)
this.state = {
visible: false
}
}
showModal = () => {
this.setState({
visible: true,
});
};
handleOk = e => {
this.setState({
visible: false,
});
};
handleCancel = e => {
this.setState({
visible: false,
});
};
render() {
let {
path,
pathName
} = this.props
const {
visible,
} = this.state
let isShow = pathName?.indexOf('.pdf') !== -1
// || pathName?.indexOf('.doc') !== -1
|| pathName?.indexOf('.xls') !== -1
|| pathName?.indexOf('.mp3') !== -1
|| pathName?.indexOf('.mp4') !== -1
|| pathName?.indexOf('.csv') !== -1
let type;
if(pathName?.indexOf('.pdf') !== -1){
isShow = true
type = 'pdf'
} else if(pathName?.indexOf('.xlsx') !== -1){
isShow = true
type = 'xlsx'
} else if(pathName?.indexOf('.mp3') !== -1){
isShow = true
type = 'mp3'
} else if(pathName?.indexOf('.mp4') !== -1){
isShow = true
type = 'mp4'
} else if(pathName?.indexOf('.csv') !== -1){
isShow = true
type = 'csv'
} else {
isShow = false
}
return (
<span>
<a
target="_blank"
href={path}>
{pathName}
</a>
{
isShow?
<Tooltip
title={`预览${pathName}`}
>
<Icon
onClick={this.showModal}
style={{marginLeft:'12px'}}
type="security-scan" />
</Tooltip>
:null
}
<Modal
title={pathName}
visible={visible}
width={1200}
onOk={this.handleOk}
onCancel={this.handleCancel}
>
{
type === 'pdf'||type==='ppt'?
<iframe
style={{
width:'100%',
height:600
}}
src={path}
/>
:<div
style={{
height:600,
}}
>
{/* <FileViewer
fileType={type}
filePath={path}
// onError={this.onError}
// errorComponent={Error}
// unsupportedComponent={Error}
/> */}
</div>
}
</Modal>
</span>
)
}
}
......@@ -23,7 +23,7 @@ import {
Upload,
Form,
Table,
notification
notification,
} from 'antd';
import QRCode from 'qrcode.react';
import {
......@@ -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';
function getBase64(value){
return value?base64.encode(new Buffer(value)):null;
......@@ -1041,9 +1041,12 @@ export default class tableCom extends Component {
const value = fun1(obj,this.props.init, this.props.defaultValues, { clientType: this.props.get }, this.props.index, this.props.fatherCode,
{
moment: moment, sql: this.sqlUtil.bind(this, base52, json), message: message,router:router,
moment: moment,
sql: this.sqlUtil.bind(this, base52, json),
message: message,router:router,
setValues: this.setValues.bind(this, base52, json),
req: this.reqUtil.bind(this, base52, json), md5: md5,
req: this.reqUtil.bind(this, base52, json),
md5: md5,
render:this.getRender,base64:getBase64
},
......@@ -1065,7 +1068,6 @@ export default class tableCom extends Component {
} else if (json.comName == "Echart" || json.comName == "QRCode") {
this.setState({ option: value })
} else {
try {
this.props.form.setFieldsValue({ [base52]: value })
} catch{
......@@ -1628,7 +1630,6 @@ export default class tableCom extends Component {
break;
case 'Input':
cm = <span>{obj[dataColumn.base52]}</span>;
break;
......@@ -1740,8 +1741,15 @@ 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>
// }
return <li key={index2}><a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a></li>
})}
</ul>
......@@ -1762,7 +1770,7 @@ export default class tableCom extends Component {
);
}
} else {
cm = <span>暂无附件</span>
cm = <span style={{display:'inline-block',width:'100%',textAlign:'center'}}>暂无附件</span>
}
......@@ -1968,12 +1976,10 @@ export default class tableCom extends Component {
</MobileInputItem></div>)
break
}
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请输入' + title }],
})(<Input disabled={disabled} style={{ width: json.width }} placeholder={json.placeholder} />);
break;
case 'InputHidden':
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论