Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web_component
submodule
Commits
f8795e4f
Commit
f8795e4f
authored
Sep 10, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a44d57d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
18 deletions
+30
-18
Column.tsx
components/apolloTable/component/Column.tsx
+4
-2
index.tsx
components/apolloTable/component/base/extra/upload/index.tsx
+26
-16
No files found.
components/apolloTable/component/Column.tsx
View file @
f8795e4f
...
...
@@ -73,6 +73,7 @@ export default class TableColumn extends PureComponent<ColumnProps> {
showIndex
,
columnIndex
,
questionText
,
remark
,
rowSelection
,
icon
,
required
,
...
...
@@ -90,6 +91,7 @@ export default class TableColumn extends PureComponent<ColumnProps> {
marginLeft
=
`
${
leftMargin
+
70
}
px`
;
}
}
const
tip
=
remark
||
questionText
;
return
(
<
div
className=
{
s
.
colContainer
}
>
{
rowSelection
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
checkbox
}
>
{
this
.
getCheckbox
()
}
</
div
>
}
...
...
@@ -97,8 +99,8 @@ export default class TableColumn extends PureComponent<ColumnProps> {
{
icon
&&
<
div
className=
{
s
.
colIcon
}
>
{
icon
()
}
</
div
>
}
<
span
className=
{
required
?
classNames
(
s
.
colTitle
,
s
.
required
)
:
s
.
colTitle
}
>
{
columnChsName
}
{
questionText
&&
(
<
Tooltip
title=
{
questionText
}
>
{
tip
&&
(
<
Tooltip
title=
{
tip
}
>
<
div
className=
{
s
.
tipContainer
}
>
?
</
div
>
</
Tooltip
>
)
}
...
...
components/apolloTable/component/base/extra/upload/index.tsx
View file @
f8795e4f
...
...
@@ -10,11 +10,17 @@ message.config({
maxCount
:
1
,
});
const
UploadCom
=
(
props
)
=>
{
const
{
onChange
,
CDN_HOST
,
getFormat
,
setFormat
,
data
,
maxLength
,
disabled
,
}
=
props
;
const
selfProps
=
antiAssign
(
props
,
[
'onChange'
,
'CDN_HOST'
,
'data'
]);
const
UploadCom
=
(
props
:
any
)
=>
{
const
{
onChange
,
CDN_HOST
,
getFormat
,
setFormat
,
data
,
maxLength
,
disabled
,
fileSize
=
5
}
=
props
;
const
selfProps
=
antiAssign
(
props
,
[
'onChange'
,
'CDN_HOST'
,
'data'
,
'fileSize'
,
'maxLength'
,
'getFormat'
,
'setFormat'
,
]);
const
getFormatFileList
=
(
fileList
=
[])
=>
{
if
(
!
fileList
)
{
return
[];
...
...
@@ -37,7 +43,7 @@ const UploadCom = (props) => {
};
});
};
const
setFormatFile
=
(
file
)
=>
{
const
setFormatFile
=
(
file
:
any
)
=>
{
if
(
!
file
)
{
return
{};
}
...
...
@@ -68,7 +74,7 @@ const UploadCom = (props) => {
const
time
=
moment
().
format
(
'YYYYMMDDHHmmss'
);
return
time
+
rand6
+
suffix
;
};
const
[
extraData
,
setExtraData
]
=
useState
({});
const
[
extraData
,
setExtraData
]
=
useState
<
any
>
({});
// 七牛上传额外数据,token和key
const
getToken
=
async
()
=>
{
let
extData
=
data
||
{};
...
...
@@ -93,22 +99,22 @@ const UploadCom = (props) => {
}
};
const
changeFileList
=
({
file
,
fileList
})
=>
{
const
changeFileList
=
({
file
,
fileList
}
:
any
)
=>
{
let
newList
=
fileList
;
if
(
maxLength
)
{
newList
=
fileList
.
slice
(
-
maxLength
);
}
if
(
file
.
status
===
'done'
&&
file
.
response
)
{
const
itemObj
=
setFormatFile
(
file
);
newList
=
fileList
.
map
((
item
)
=>
{
newList
=
fileList
.
map
((
item
:
any
)
=>
{
return
item
.
uid
===
itemObj
.
uid
?
itemObj
:
item
;
});
onSaveFileList
(
newList
);
}
setFileList
(
newList
);
};
const
previewFile
=
(
file
)
=>
{
return
new
Promise
((
res
,
rej
)
=>
{
const
previewFile
=
(
file
:
any
)
=>
{
return
new
Promise
((
res
)
=>
{
const
obj
=
checkoutFileType
(
file
.
name
);
const
typeArr
=
file
.
name
.
match
(
/
\.[
a-zA-Z0-9
]
+$/
);
const
type
=
typeArr
&&
typeArr
[
0
]
?
typeArr
[
0
].
replace
(
'.'
,
''
)
:
''
;
...
...
@@ -117,23 +123,27 @@ const UploadCom = (props) => {
}
});
};
const
onPreview
=
(
file
)
=>
{
const
onPreview
=
(
file
:
any
)
=>
{
if
(
previewModel
.
current
&&
previewModel
.
current
.
onPreview
)
{
previewModel
.
current
.
onPreview
(
file
.
value
,
file
.
name
);
}
};
const
onRemove
=
(
file
)
=>
{
const
newFileList
=
fileList
.
filter
((
item
)
=>
{
const
onRemove
=
(
file
:
any
)
=>
{
const
newFileList
=
fileList
.
filter
((
item
:
any
)
=>
{
return
item
.
uid
!==
file
.
uid
;
});
onSaveFileList
(
newFileList
);
};
const
onDownload
=
(
file
)
=>
{
const
onDownload
=
(
file
:
any
)
=>
{
window
.
open
(
file
.
value
);
};
const
beforeUpload
=
async
()
=>
{
const
beforeUpload
=
async
(
file
:
any
)
=>
{
if
(
fileSize
&&
file
.
size
/
1000
>
fileSize
)
{
message
.
error
(
'文件太大了,请按要求重新上传'
);
return
Promise
.
reject
();
}
await
getToken
();
return
true
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment