Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
d02c9365
提交
d02c9365
authored
10月 20, 2020
作者:
xuli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加请求
上级
1bb62ce7
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
64 行增加
和
57 行删除
+64
-57
ImportUtil.js
one_stop_public/App/ImportUtil.js
+55
-55
queryConfig.js
one_stop_public/utils/queryConfig.js
+5
-0
request.js
one_stop_public/utils/request.js
+4
-2
没有找到文件。
one_stop_public/App/ImportUtil.js
浏览文件 @
d02c9365
...
...
@@ -18,7 +18,7 @@ import { connect } from 'dva';
const
Step
=
Steps
.
Step
;
const
TabPane
=
Tabs
.
TabPane
;
const
exportExcel
=
(
CLIENT_TYPE
==
"mobile"
)?
null
:
require
(
'xlsx-oc'
).
exportExcel
const
exportExcel
=
(
CLIENT_TYPE
==
"mobile"
)
?
null
:
require
(
'xlsx-oc'
).
exportExcel
@
connect
(({
DataObj
,
loading
})
=>
({
DataObj
,
...
...
@@ -28,11 +28,11 @@ export default class ImportUtil extends React.PureComponent {
constructor
(
props
)
{
super
(
props
);
const
exportTemplateUrl
=
encodeURI
(
`
${
config
.
httpServer
}
/DataObjApi/importTemplateDownload?objId=
${
this
.
props
.
objId
}
&name=
${
props
.
fileName
}
`
);
const
exportTemplateUrl
=
encodeURI
(
`
${
config
.
httpServer
}
/DataObjApi/importTemplateDownload?objId=
${
this
.
props
.
objId
}
&name=
${
props
.
fileName
}
`
);
this
.
state
=
{
ch
:
false
,
currentKey
:
"1"
,
ch
:
false
,
currentKey
:
"1"
,
visible
:
false
,
current
:
0
,
isShow
:
true
,
...
...
@@ -43,7 +43,7 @@ export default class ImportUtil extends React.PureComponent {
exportTemplateUrl
,
isNextDisabled
:
false
,
isNextDisabled
:
false
,
};
}
...
...
@@ -96,12 +96,12 @@ export default class ImportUtil extends React.PureComponent {
}
import
()
{
const
{
dispatch
,
importParams
}
=
this
.
props
;
const
{
dispatch
,
importParams
}
=
this
.
props
;
dispatch
({
type
:
'DataObj/importExecute'
,
payload
:
{
...(
importParams
||
{}),
cacheKey
:
this
.
state
.
filekey
,
...(
importParams
||
{}),
cacheKey
:
this
.
state
.
filekey
,
objId
:
this
.
props
.
objId
,
},
...
...
@@ -116,7 +116,7 @@ export default class ImportUtil extends React.PureComponent {
visible
:
false
,
});
if
(
this
.
props
.
callback
)
{
if
(
this
.
props
.
callback
)
{
this
.
props
.
callback
();
}
}
...
...
@@ -126,12 +126,12 @@ export default class ImportUtil extends React.PureComponent {
}
getCachKey
=
(
filePath
)
=>
{
const
{
dispatch
,
importParams
}
=
this
.
props
;
const
{
dispatch
,
importParams
}
=
this
.
props
;
dispatch
({
type
:
'DataObj/importAnalyse'
,
payload
:
{
...(
importParams
||
{}),
isLocal
:
false
,
...(
importParams
||
{}),
isLocal
:
false
,
filePath
,
objId
:
this
.
props
.
objId
,
},
...
...
@@ -148,11 +148,11 @@ export default class ImportUtil extends React.PureComponent {
};
queryFile
=
(
cacheKey
)
=>
{
const
{
dispatch
,
importParams
}
=
this
.
props
;
const
{
dispatch
,
importParams
}
=
this
.
props
;
dispatch
({
type
:
'DataObj/importDataQuery'
,
payload
:
{
...(
importParams
||
{}),
...(
importParams
||
{}),
cacheKey
,
objId
:
this
.
props
.
objId
,
},
...
...
@@ -165,29 +165,29 @@ export default class ImportUtil extends React.PureComponent {
errData
:
res
.
noPass
,
column
:
res
.
column
});
if
(
res
.
noPass
&&
res
.
noPass
.
length
==
0
)
{
if
(
res
.
noPass
&&
res
.
noPass
.
length
==
0
)
{
if
(
res
.
pass
.
length
==
0
)
{
if
(
res
.
pass
.
length
==
0
)
{
message
.
error
(
'当前没有验证成功的数据,无法导入。'
);
this
.
setState
({
currentKey
:
"1"
,
ch
:
!
this
.
state
.
ch
,
currentKey
:
"1"
,
ch
:
!
this
.
state
.
ch
,
isNextDisabled
:
true
});
}
else
{
message
.
success
(
'所有数据验证通过,请确认后点击下一步。'
);
this
.
setState
({
currentKey
:
"2"
,
ch
:
!
this
.
state
.
ch
,
currentKey
:
"2"
,
ch
:
!
this
.
state
.
ch
,
isNextDisabled
:
false
});
}
}
else
{
}
else
{
message
.
error
(
'当前存在未验证通过的数据,请按错误提示检测更正导入文件'
);
this
.
setState
({
currentKey
:
"1"
,
ch
:
!
this
.
state
.
ch
,
currentKey
:
"1"
,
ch
:
!
this
.
state
.
ch
,
isNextDisabled
:
true
});
}
...
...
@@ -195,21 +195,21 @@ export default class ImportUtil extends React.PureComponent {
}
})
};
changePane
=
(
activeKey
)
=>
{
this
.
setState
({
currentKey
:
activeKey
})
changePane
=
(
activeKey
)
=>
{
this
.
setState
({
currentKey
:
activeKey
})
}
exportError
=
(
column
,
dataSource
)
=>
{
exportError
=
(
column
,
dataSource
)
=>
{
if
(
exportExcel
==
null
)
{
if
(
exportExcel
==
null
)
{
message
.
info
(
"当前终端暂不支持此功能"
)
return
}
var
_headers
=
[]
for
(
var
i
=
0
;
i
<
column
.
length
;
i
++
)
{
_headers
.
push
({
k
:
column
[
i
].
dataIndex
,
v
:
column
[
i
].
title
})
for
(
var
i
=
0
;
i
<
column
.
length
;
i
++
)
{
_headers
.
push
({
k
:
column
[
i
].
dataIndex
,
v
:
column
[
i
].
title
})
}
for
(
var
j
=
0
;
j
<
dataSource
.
length
;
j
++
)
{
dataSource
[
j
].
index
=
j
+
1
for
(
var
j
=
0
;
j
<
dataSource
.
length
;
j
++
)
{
dataSource
[
j
].
index
=
j
+
1
}
exportExcel
(
_headers
,
dataSource
);
...
...
@@ -224,7 +224,7 @@ export default class ImportUtil extends React.PureComponent {
headers
:
{
authorization
:
'authorization-text'
,
},
accept
:
'.xlsx'
,
accept
:
'.xlsx'
,
showUploadList
:
false
,
onChange
:
(
info
)
=>
{
if
(
info
.
file
.
status
!==
'uploading'
)
{
...
...
@@ -255,20 +255,20 @@ export default class ImportUtil extends React.PureComponent {
}];
const
{
current
}
=
this
.
state
;
const
{
name
,
loading
}
=
this
.
props
const
column1
=
this
.
state
.
column
?[{
title
:
"序号"
,
dataIndex
:
"index"
,
fixed
:
"left"
,
width
:
50
,
render
:(
v
,
r
,
i
)
=>
i
+
1
},...
this
.
state
.
column
]:
[]
var
column2
=
this
.
state
.
column
?[...
this
.
state
.
column
]:
[]
if
(
column1
.
length
>
1
)
column1
[
1
].
render
=
(
val
)
=><
span
style
=
{{
color
:
"red"
}}
>
{
val
}
<
/span
>
const
{
name
,
loading
}
=
this
.
props
const
column1
=
this
.
state
.
column
?
[{
title
:
"序号"
,
dataIndex
:
"index"
,
fixed
:
"left"
,
width
:
50
,
render
:
(
v
,
r
,
i
)
=>
i
+
1
},
...
this
.
state
.
column
]
:
[]
var
column2
=
this
.
state
.
column
?
[...
this
.
state
.
column
]
:
[]
if
(
column1
.
length
>
1
)
column1
[
1
].
render
=
(
val
)
=>
<
span
style
=
{{
color
:
"red"
}}
>
{
val
}
<
/span
>
column2
.
splice
(
0
,
1
)
column2
=
[{
title
:
"序号"
,
fixed
:
"left"
,
width
:
50
,
render
:(
v
,
r
,
i
)
=>
i
+
1
},
...
column2
]
column2
.
splice
(
0
,
1
)
column2
=
[{
title
:
"序号"
,
fixed
:
"left"
,
width
:
50
,
render
:
(
v
,
r
,
i
)
=>
i
+
1
},
...
column2
]
return
(
<
span
>
<
ButtonDiy
name
=
{
name
||
'批量导入'
}
<
ButtonDiy
name
=
{
name
||
'批量导入'
}
type
=
'default'
className
=
'defaultBlue'
handleClick
=
{
this
.
showModal
}
/
>
handleClick
=
{
this
.
showModal
}
/
>
<
Modal
visible
=
{
this
.
state
.
visible
}
onOk
=
{
this
.
handleOk
}
...
...
@@ -288,7 +288,7 @@ export default class ImportUtil extends React.PureComponent {
<
Steps
current
=
{
current
}
>
{
steps
.
map
(
item
=>
<
Step
key
=
{
item
.
title
}
title
=
{
item
.
title
}
/>
)
}
title
=
{
item
.
title
}
/>
)
}
<
/Steps
>
<
div
className
=
"steps-content"
>
{
steps
[
this
.
state
.
current
].
content
}
...
...
@@ -297,14 +297,14 @@ export default class ImportUtil extends React.PureComponent {
{
(
this
.
state
.
current
<
steps
.
length
-
1
&&
this
.
state
.
current
!==
0
)
&&
<
ButtonDiy
name
=
{
this
.
state
.
current
==
3
?
"确认导入"
:
"下一步"
}
type
=
"primary"
disabled
=
{
this
.
state
.
current
!=
3
&&
this
.
state
.
isNextDisabled
}
className
=
'primaryBlue'
handleClick
=
{()
=>
this
.
next
()}
/
>
<
ButtonDiy
name
=
{
this
.
state
.
current
==
3
?
"确认导入"
:
"下一步"
}
type
=
"primary"
disabled
=
{
this
.
state
.
current
!=
3
&&
this
.
state
.
isNextDisabled
}
className
=
'primaryBlue'
handleClick
=
{()
=>
this
.
next
()}
/
>
}
{
this
.
state
.
current
>
0
&&
<
ButtonDiy
style
=
{{
marginLeft
:
8
}}
name
=
"上一步"
className
=
'defaultBlue'
handleClick
=
{()
=>
this
.
prev
()}
/
>
<
ButtonDiy
style
=
{{
marginLeft
:
8
}}
name
=
"上一步"
className
=
'defaultBlue'
handleClick
=
{()
=>
this
.
prev
()}
/
>
}
<
/div
>
...
...
@@ -322,10 +322,10 @@ export default class ImportUtil extends React.PureComponent {
<
div
className
=
{
styles
.
buttonDown
}
>
<
Upload
{...
props
}
>
<
Button
>
<
Icon
type
=
"upload"
/>
点击上传
<
Icon
type
=
"upload"
/>
点击上传
<
/Button
>
<
/Upload
>
<
Button
href
=
{
this
.
state
.
exportTemplateUrl
}
<
Button
href
=
{
this
.
state
.
exportTemplateUrl
}
target
=
"_blank"
type
=
"danger"
>
下载模板
...
...
@@ -333,7 +333,7 @@ export default class ImportUtil extends React.PureComponent {
<
/div>
:
<
Upload
{...
props
}
>
<
Button
>
<
Icon
type
=
"upload"
/>
<
Icon
type
=
"upload"
/>
重新上传
<
/Button
>
<
/Upload
>
...
...
@@ -347,24 +347,24 @@ export default class ImportUtil extends React.PureComponent {
<
p
>
3
.
只能上传
EXCEL
文件
(
XLS
,
XLSX
)
默认支持
EXCEL
2003
和
EXCEL
2007
。
<
/p
>
<
p
>
4
.
请将
EXCEL
文件的所有单元格格式设置为“文本”格式
<
/p
>
<
/div>
:
<
div
className
=
{
styles
.
error
}
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
{
styles
.
error
}
style
=
{{
marginTop
:
20
}}
>
<
Tabs
activeKey
=
{
this
.
state
.
currentKey
}
key
=
{
this
.
state
.
ch
}
onChange
=
{
this
.
changePane
}
type
=
"card"
>
{
this
.
state
.
errData
&&
this
.
state
.
errData
.
length
==
0
?
""
:
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
"red"
}}
>
验证错误列表
<
/span>} key="1"
>
<
Button
style
=
{{
marginTop
:
5
,
marginBottom
:
5
}}
type
=
"danger"
onClick
=
{
this
.
exportError
.
bind
(
this
,
column1
,
this
.
state
.
errData
)}
>
导出错误信息
<
/Button
>
{
this
.
state
.
errData
&&
this
.
state
.
errData
.
length
==
0
?
""
:
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
"red"
}}
>
验证错误列表
<
/span>} key="1"
>
<
Button
style
=
{{
marginTop
:
5
,
marginBottom
:
5
}}
type
=
"danger"
onClick
=
{
this
.
exportError
.
bind
(
this
,
column1
,
this
.
state
.
errData
)}
>
导出错误信息
<
/Button
>
<
Table
columns
=
{
column1
}
size
=
"small"
style
=
{{
overflow
:
'auto'
}}
style
=
{{
overflow
:
'auto'
}}
dataSource
=
{
this
.
state
.
errData
}
bordered
=
{
true
}
/></
TabPane
>
}
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
"green"
}}
>
验证成功列表
<
/span>} key="2">
bordered
=
{
true
}
/></
TabPane
>
}
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
"green"
}}
>
验证成功列表
<
/span>} key="2"
>
<
Button
style
=
{{
marginTop
:
5
,
marginBottom
:
5
}}
type
=
"primary"
onClick
=
{
this
.
exportError
.
bind
(
this
,
column2
,
this
.
state
.
sucData
)}
>
导出正确信息
<
/Button
>
<
Button
style
=
{{
marginTop
:
5
,
marginBottom
:
5
}}
type
=
"primary"
onClick
=
{
this
.
exportError
.
bind
(
this
,
column2
,
this
.
state
.
sucData
)}
>
导出正确信息
<
/Button
>
<
Table
columns
=
{
column2
}
size
=
"small"
style
=
{{
overflow
:
'auto'
}}
style
=
{{
overflow
:
'auto'
}}
dataSource
=
{
this
.
state
.
sucData
}
bordered
=
{
true
}
/></
TabPane
>
bordered
=
{
true
}
/></
TabPane
>
<
/Tabs
>
...
...
one_stop_public/utils/queryConfig.js
浏览文件 @
d02c9365
...
...
@@ -20,6 +20,11 @@ export const querySysCode = () => queryConfig("SYSCODE");
export
const
queryWsPath
=
()
=>
queryConfig
(
"WS_PATH"
);
/**
* @description 获取场景设计器定制后台地址
* */
export
const
queryDynamicActionPath
=
()
=>
queryConfig
(
"DYNAMIC_ACTION_PATH"
);
/**
* @description 获取服务端请求路径前戳
* */
...
...
one_stop_public/utils/request.js
浏览文件 @
d02c9365
...
...
@@ -5,7 +5,7 @@
import
{
extend
}
from
'umi-request'
;
import
{
notification
}
from
'antd'
;
import
{
getToken
}
from
'./token'
;
import
{
queryApiActionPath
,
queryOauthActionPath
,
queryPermActionPath
}
from
'./queryConfig'
;
import
{
queryApiActionPath
,
queryOauthActionPath
,
queryPermActionPath
,
queryDynamicActionPath
}
from
'./queryConfig'
;
import
{
openToast
}
from
'../location/Notification'
;
import
{
showToast
}
from
'../location/Toast'
;
import
{
offline
}
from
'../location/Toast'
;
...
...
@@ -33,7 +33,7 @@ const codeMessage = {
*
* return URL参数字符串
*/
const
objectToQuery
=
function
(
param
,
key
,
encode
)
{
const
objectToQuery
=
function
(
param
,
key
,
encode
)
{
if
(
param
==
null
)
return
''
;
var
paramStr
=
''
;
var
t
=
typeof
param
;
...
...
@@ -271,6 +271,8 @@ const createServerRequest = (config = {}) => {
return
setRequestConfig
(
config
);
};
export
const
dynamicRequest
=
createServerRequest
({
method
:
'POST'
,
prefix
:
queryDynamicActionPath
()
});
export
const
uaaRequest
=
createServerRequest
({
method
:
'POST'
,
prefix
:
queryOauthActionPath
()
});
export
const
permRequest
=
createServerRequest
({
method
:
'POST'
,
prefix
:
queryPermActionPath
()
});
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论