Commit 49acd331 authored by zhangwenshuai's avatar zhangwenshuai

merge

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