Commit b93137dc authored by zhangwenshuai's avatar zhangwenshuai

update apolloTable upload

parent c1601ee7
......@@ -11,7 +11,12 @@ export const ApolloLinkDetail = (props: LinkProps) => {
{value.map((item, i) => {
return (
<div key={i}>
<a href={item.value} style={{ textDecoration: 'underline' }} rel="noopener noreferrer">
<a
target="_blank"
href={item.value}
style={{ textDecoration: 'underline' }}
rel="noopener noreferrer"
>
{item.text || item.value}
</a>
</div>
......
......@@ -11,6 +11,9 @@ export const ApolloUpload = (props: ApolloUploadProps) => {
const selfProps = antiAssign(props, ['onChange', 'value']);
if (isMultiple) {
selfProps.multiple = true;
} else {
selfProps.multiple = false;
selfProps.maxLength = 1;
}
const [value, setValue] = useState(props.value || []);
const changeValue = (value) => {
......
......@@ -12,7 +12,7 @@ message.config({
});
const UploadCom = (props) => {
const { onChange, CDN_HOST, getFormat, setFormat, data, domain } = props;
const { onChange, CDN_HOST, getFormat, setFormat, data, domain, maxLength } = props;
const selfProps = antiAssign(props, ['onChange', 'CDN_HOST', 'data']);
const getFormatFileList = (fileList = []) => {
if (!fileList) {
......@@ -88,6 +88,9 @@ const UploadCom = (props) => {
const changeFileList = ({ file, fileList }) => {
let newList = fileList;
if (maxLength) {
newList = fileList.slice(-maxLength);
}
if (file.status === 'done' && file.response) {
const itemObj = setFormatFile(file);
newList = fileList.map((item) => {
......
......@@ -18,18 +18,24 @@ const formatTags = (columns: ColumnProps[], tags: any[]) => {
return item.columnName === tag.colName;
});
if (!colConfig) return;
const { componentAttr } = config[colConfig.columnType];
const { operator = [], columnType } = colConfig;
const { componentAttr, getFormatter } = config[columnType];
const newProps = {
...(componentAttr || {}),
...(colConfig.columnAttrObj || {}),
};
const transferColumn = transferAttr(columnType, newProps);
const value = tag.colValues
let value = tag.colValues
.map((item: any) => {
return item.text;
})
.join(',');
if (Number(columnType) === 11 && getFormatter) {
value = getFormatter(tag.colValues, transferColumn);
if (value.format) {
value = value.format(transferColumn.format);
}
}
const op =
operator.find((item: any) => {
return item.id === tag.operationCode;
......
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