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
49acd331
Commit
49acd331
authored
Sep 10, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
63f649ae
51991b73
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
18 deletions
+40
-18
index.tsx
components/apolloTable/component/base/extra/upload/index.tsx
+12
-3
preview.tsx
...nents/apolloTable/component/base/extra/upload/preview.tsx
+1
-3
utils.ts
components/apolloTable/component/base/extra/upload/utils.ts
+1
-1
index.less
components/apolloTable/editFormV3/index.less
+5
-0
index.tsx
components/apolloTable/editFormV3/index.tsx
+21
-11
No files found.
components/apolloTable/component/base/extra/upload/index.tsx
View file @
49acd331
...
@@ -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-Z
0-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
,
...
...
components/apolloTable/component/base/extra/upload/preview.tsx
View file @
49acd331
...
@@ -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
});
...
...
components/apolloTable/component/base/extra/upload/utils.ts
View file @
49acd331
...
@@ -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
;
...
...
components/apolloTable/editFormV3/index.less
View file @
49acd331
...
@@ -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;
}
}
}
}
}
}
...
...
components/apolloTable/editFormV3/index.tsx
View file @
49acd331
...
@@ -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
()
}
}
>
...
...
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