Commit 49acd331 authored by zhangwenshuai's avatar zhangwenshuai

merge

parents 63f649ae 51991b73
...@@ -11,7 +11,9 @@ message.config({ ...@@ -11,7 +11,9 @@ message.config({
}); });
const UploadCom = (props) => { const UploadCom = (props) => {
const { onChange, CDN_HOST, getFormat, setFormat, data, maxLength, disabled } = props; const {
onChange, CDN_HOST, getFormat, setFormat, data, maxLength, disabled,
} = props;
const selfProps = antiAssign(props, ['onChange', 'CDN_HOST', 'data']); const selfProps = antiAssign(props, ['onChange', 'CDN_HOST', 'data']);
const getFormatFileList = (fileList = []) => { const getFormatFileList = (fileList = []) => {
if (!fileList) { if (!fileList) {
...@@ -30,6 +32,7 @@ const UploadCom = (props) => { ...@@ -30,6 +32,7 @@ const UploadCom = (props) => {
value: item.value, value: item.value,
size: item.size, size: item.size,
uid: item.value, uid: item.value,
status: 'done',
...checkoutFileType(item.value), ...checkoutFileType(item.value),
}; };
}); });
...@@ -48,6 +51,7 @@ const UploadCom = (props) => { ...@@ -48,6 +51,7 @@ const UploadCom = (props) => {
name: file.name, name: file.name,
value: url, value: url,
size: file.size, size: file.size,
status: 'done',
...checkoutFileType(url), ...checkoutFileType(url),
}; };
}; };
...@@ -106,9 +110,9 @@ const UploadCom = (props) => { ...@@ -106,9 +110,9 @@ const UploadCom = (props) => {
const previewFile = (file) => { const previewFile = (file) => {
return new Promise((res, rej) => { return new Promise((res, rej) => {
const obj = checkoutFileType(file.name); const obj = checkoutFileType(file.name);
const typeArr = file.name.match(/\.[a-zA-Z]+$/); const typeArr = file.name.match(/\.[a-zA-Z0-9]+$/);
const type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : ''; const type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : '';
if (!['png', 'gif', 'bmp', 'jpg', 'jpeg'].includes(type)) { if (!['png', 'gif', 'bmp', 'jpg', 'jpeg', 'heic'].includes(type)) {
res(obj.thumbUrl); res(obj.thumbUrl);
} }
}); });
...@@ -125,6 +129,10 @@ const UploadCom = (props) => { ...@@ -125,6 +129,10 @@ const UploadCom = (props) => {
onSaveFileList(newFileList); onSaveFileList(newFileList);
}; };
const onDownload = (file) => {
window.open(file.value);
};
const beforeUpload = async () => { const beforeUpload = async () => {
await getToken(); await getToken();
return true; return true;
...@@ -144,6 +152,7 @@ const UploadCom = (props) => { ...@@ -144,6 +152,7 @@ const UploadCom = (props) => {
onRemove={onRemove} onRemove={onRemove}
previewFile={previewFile} previewFile={previewFile}
onPreview={onPreview} onPreview={onPreview}
onDownload={onDownload}
showUploadList={{ showUploadList={{
showPreviewIcon: true, showPreviewIcon: true,
showRemoveIcon: true, showRemoveIcon: true,
......
...@@ -10,14 +10,12 @@ export default class uploadDetail extends React.Component { ...@@ -10,14 +10,12 @@ export default class uploadDetail extends React.Component {
}; };
onPreview = (url:string, name:string) => { onPreview = (url:string, name:string) => {
console.log('name: ', name);
console.log('url: ', url);
const nameTypeArr = name.match(/\.[a-zA-Z0-9]+$/); const nameTypeArr = name.match(/\.[a-zA-Z0-9]+$/);
const urlTypeArr = url.match(/\.[a-zA-Z0-9]+$/); const urlTypeArr = url.match(/\.[a-zA-Z0-9]+$/);
const typeArr = nameTypeArr || urlTypeArr; const typeArr = nameTypeArr || urlTypeArr;
let type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : ''; let type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : '';
type = type.toLowerCase(); type = type.toLowerCase();
if (['png', 'gif', 'bmp', 'jpg', 'jpeg'].includes(type)) { if (['png', 'gif', 'bmp', 'jpg', 'jpeg', 'heic'].includes(type)) {
this.setState({ showDialog: true, type: 'image', url }); this.setState({ showDialog: true, type: 'image', url });
} else if (['doc', 'docx', 'document', 'xls', 'xlsx', 'ppt', 'pptx'].includes(type)) { } else if (['doc', 'docx', 'document', 'xls', 'xlsx', 'ppt', 'pptx'].includes(type)) {
this.setState({ showDialog: true, type: 'office', url }); this.setState({ showDialog: true, type: 'office', url });
......
...@@ -4,7 +4,7 @@ export const checkoutFileType = (url = '') => { ...@@ -4,7 +4,7 @@ export const checkoutFileType = (url = '') => {
const typeArr = url.match(/\.[a-zA-Z0-9]+$/); const typeArr = url.match(/\.[a-zA-Z0-9]+$/);
let type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : ''; let type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : '';
type = type.toLowerCase(); type = type.toLowerCase();
if (type === 'png' || type === 'jpg' || type === 'gif' || type === 'bmp' || type === 'jpeg') { if (type === 'png' || type === 'jpg' || type === 'gif' || type === 'bmp' || type === 'jpeg' || type === 'heic') {
return { thumbUrl: `${url}?imageView2/1/w/120/h/120`, fileType: type }; return { thumbUrl: `${url}?imageView2/1/w/120/h/120`, fileType: type };
} }
return fileType[type] ? fileType[type] : fileType.other; return fileType[type] ? fileType[type] : fileType.other;
......
...@@ -41,6 +41,11 @@ ...@@ -41,6 +41,11 @@
.itemTitle { .itemTitle {
margin-left: @marginSm; margin-left: @marginSm;
color: @textPrimaryColor; color: @textPrimaryColor;
margin-right: 2px;
}
.remarkIcon{
color: #AEB4BA;
cursor: pointer;
} }
} }
} }
......
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
* 失去焦点:onBlurFn * 失去焦点:onBlurFn
* */ * */
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Form, Button, message } from 'antd'; import { Form, Button, message, Tooltip } from 'antd';
import _ from 'lodash'; import _ from 'lodash';
import IconFont from '@/submodule/components/IconFont/IconFont';
import { emptyModel } from '../component/base/_utils/setFormatter'; import { emptyModel } from '../component/base/_utils/setFormatter';
import { defaultLocale } from '../locale'; import { defaultLocale } from '../locale';
import { config } from '../component/base/config'; import { config } from '../component/base/config';
...@@ -33,7 +34,9 @@ class FormWrap extends Component { ...@@ -33,7 +34,9 @@ class FormWrap extends Component {
handleSubmit = (e) => { handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const { rowId, form, handleSubmit, data, rowData, detailType } = this.props; const {
rowId, form, handleSubmit, data, rowData, detailType,
} = this.props;
form.validateFieldsAndScroll((err, values) => { form.validateFieldsAndScroll((err, values) => {
if (!err) { if (!err) {
const newValues: any[] = []; const newValues: any[] = [];
...@@ -86,6 +89,11 @@ class FormWrap extends Component { ...@@ -86,6 +89,11 @@ class FormWrap extends Component {
<span className={s.titleContainer}> <span className={s.titleContainer}>
{/* icon && <div className={s.colIcon}>{icon}</div> */} {/* icon && <div className={s.colIcon}>{icon}</div> */}
<span className={s.itemTitle}>{item.columnChsName}</span> <span className={s.itemTitle}>{item.columnChsName}</span>
{item.columnAttrObj?.remark && (
<Tooltip title={item.columnAttrObj?.remark}>
<IconFont type="iconwenhao" className={s.remarkIcon} />
</Tooltip>
)}
</span> </span>
); );
}; };
...@@ -94,12 +102,12 @@ class FormWrap extends Component { ...@@ -94,12 +102,12 @@ class FormWrap extends Component {
// 可输可选组件清空时数据格式有问题,单独处理一下 // 可输可选组件清空时数据格式有问题,单独处理一下
if (item.requiredFlag && Number(item.columnType) === 15 && typeof value === 'object') { if (item.requiredFlag && Number(item.columnType) === 15 && typeof value === 'object') {
if ( if (
!value.label && !value.label
value.label !== 0 && && value.label !== 0
!value.text && && !value.text
value.text !== 0 && && value.text !== 0
!value.value && && !value.value
value.value !== 0 && value.value !== 0
) { ) {
return callback('必填项不能为空'); return callback('必填项不能为空');
} }
...@@ -139,8 +147,8 @@ class FormWrap extends Component { ...@@ -139,8 +147,8 @@ class FormWrap extends Component {
const disabled = readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag); const disabled = readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag);
const emitChange = (changedValue: any, optionValue: any) => { const emitChange = (changedValue: any, optionValue: any) => {
let temp: any[] = []; let temp: any[] = [];
value && value
value.map((item: any) => { && value.map((item: any) => {
temp.push({ text: item.text, value: item.value }); temp.push({ text: item.text, value: item.value });
}); });
if (temp.length === 0) { if (temp.length === 0) {
...@@ -232,7 +240,9 @@ class FormWrap extends Component { ...@@ -232,7 +240,9 @@ class FormWrap extends Component {
}; };
render() { render() {
const { loading, isShowDelBtn, data, btnWrapStyle, name, colsNum, delLabel, hideOperateBtn } = this.props; const {
loading, isShowDelBtn, data, btnWrapStyle, name, colsNum, delLabel, hideOperateBtn,
} = this.props;
return ( return (
<Provider value={{ locale: this.getContext() }}> <Provider value={{ locale: this.getContext() }}>
......
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