Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
7cf71dcb
提交
7cf71dcb
authored
11月 03, 2020
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
导入按钮样式修改..
在宝鸡的环境里面 下一步的 文字显示不出来
上级
f6761176
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
81 行增加
和
66 行删除
+81
-66
ImportUtil.js
one_stop_public/App/ImportUtil.js
+81
-66
没有找到文件。
one_stop_public/App/ImportUtil.js
浏览文件 @
7cf71dcb
...
...
@@ -15,10 +15,11 @@ import ButtonDiy from './ButtonDiy/ButtonDiy';
import
config
from
'@/webPublic/one_stop_public/config'
;
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
,
...
...
@@ -32,7 +33,7 @@ export default class ImportUtil extends React.PureComponent {
this
.
state
=
{
ch
:
false
,
currentKey
:
"1"
,
currentKey
:
'1'
,
visible
:
false
,
current
:
0
,
isShow
:
true
,
...
...
@@ -119,8 +120,8 @@ export default class ImportUtil extends React.PureComponent {
if
(
this
.
props
.
callback
)
{
this
.
props
.
callback
();
}
}
})
}
,
})
;
}
...
...
@@ -142,8 +143,8 @@ export default class ImportUtil extends React.PureComponent {
});
this
.
queryFile
(
res
.
cacheKey
);
}
})
}
,
})
;
};
...
...
@@ -163,7 +164,7 @@ export default class ImportUtil extends React.PureComponent {
sucData
:
res
.
pass
,
errData
:
res
.
noPass
,
column
:
res
.
column
column
:
res
.
column
,
});
if
(
res
.
noPass
&&
res
.
noPass
.
length
==
0
)
{
...
...
@@ -171,50 +172,51 @@ export default class ImportUtil extends React.PureComponent {
if
(
res
.
pass
.
length
==
0
)
{
message
.
error
(
'当前没有验证成功的数据,无法导入。'
);
this
.
setState
({
currentKey
:
"1"
,
currentKey
:
'1'
,
ch
:
!
this
.
state
.
ch
,
isNextDisabled
:
true
isNextDisabled
:
true
,
});
}
else
{
message
.
success
(
'所有数据验证通过,请确认后点击下一步。'
);
this
.
setState
({
currentKey
:
"2"
,
currentKey
:
'2'
,
ch
:
!
this
.
state
.
ch
,
isNextDisabled
:
false
isNextDisabled
:
false
,
});
}
}
else
{
message
.
error
(
'当前存在未验证通过的数据,请按错误提示检测更正导入文件'
);
this
.
setState
({
currentKey
:
"1"
,
currentKey
:
'1'
,
ch
:
!
this
.
state
.
ch
,
isNextDisabled
:
true
isNextDisabled
:
true
,
});
}
}
})
}
,
})
;
};
changePane
=
(
activeKey
)
=>
{
this
.
setState
({
currentKey
:
activeKey
})
}
this
.
setState
({
currentKey
:
activeKey
})
;
}
;
exportError
=
(
column
,
dataSource
)
=>
{
if
(
exportExcel
==
null
)
{
message
.
info
(
"当前终端暂不支持此功能"
)
return
message
.
info
(
'当前终端暂不支持此功能'
);
return
;
}
var
_headers
=
[]
var
_headers
=
[]
;
for
(
var
i
=
0
;
i
<
column
.
length
;
i
++
)
{
_headers
.
push
({
k
:
column
[
i
].
dataIndex
,
v
:
column
[
i
].
title
})
_headers
.
push
({
k
:
column
[
i
].
dataIndex
,
v
:
column
[
i
].
title
})
;
}
for
(
var
j
=
0
;
j
<
dataSource
.
length
;
j
++
)
{
dataSource
[
j
].
index
=
j
+
1
dataSource
[
j
].
index
=
j
+
1
;
}
exportExcel
(
_headers
,
dataSource
);
}
};
render
()
{
const
props
=
{
...
...
@@ -235,7 +237,6 @@ export default class ImportUtil extends React.PureComponent {
let
x
=
info
.
file
.
response
;
this
.
getCachKey
(
x
);
}
else
if
(
info
.
file
.
status
===
'error'
)
{
...
...
@@ -250,25 +251,31 @@ export default class ImportUtil extends React.PureComponent {
},
{
title
:
'数据导入'
,
},
{
title
:
'导入完成'
,
}];
{
title
:
'导入完成'
,
}];
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
>
column2
.
splice
(
0
,
1
)
column2
=
[{
title
:
"序号"
,
fixed
:
"left"
,
width
:
50
,
render
:
(
v
,
r
,
i
)
=>
i
+
1
},
...
column2
]
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
];
return
(
<
span
>
<
ButtonDiy
name
=
{
name
||
'批量导入'
}
type
=
'default'
className
=
'defaultBlue'
handleClick
=
{
this
.
showModal
}
/
>
type
=
'default'
className
=
'defaultBlue'
handleClick
=
{
this
.
showModal
}
/
>
<
Modal
visible
=
{
this
.
state
.
visible
}
onOk
=
{
this
.
handleOk
}
...
...
@@ -277,7 +284,7 @@ export default class ImportUtil extends React.PureComponent {
onCancel
=
{
this
.
handleCancel
}
title
=
{
null
}
footer
=
{
null
}
width
=
{
"80%"
}
width
=
{
'80%'
}
>
<
div
className
=
{
styles
.
nomal
}
>
...
...
@@ -288,7 +295,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 +304,19 @@ 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,49 +334,52 @@ export default class ImportUtil extends React.PureComponent {
<
div
className
=
{
styles
.
buttonDown
}
>
<
Upload
{...
props
}
>
<
Button
>
<
Icon
type
=
"upload"
/>
点击上传
<
/Button
>
<
Icon
type
=
"upload"
/>
点击上传
<
/Button
>
<
/Upload
>
<
Button
href
=
{
this
.
state
.
exportTemplateUrl
}
target
=
"_blank"
type
=
"danger"
>
target
=
"_blank"
type
=
"danger"
>
下载模板
<
/Button
>
<
/Button
>
<
/div>
:
<
Upload
{...
props
}
>
<
Button
>
<
Icon
type
=
"upload"
/>
重新上传
<
/Button
>
<
Icon
type
=
"upload"
/>
重新上传
<
/Button
>
<
/Upload
>
}
{
this
.
state
.
isShow
?
<
div
className
=
{
styles
.
attentionItem
}
>
<
p
>
导入事项
<
/p
>
<
p
>
1
.
导入操作一次只能上传
1
个
EXCEL
文件。
<
/p
>
<
p
>
2
.
导入文件最大文件大小上传
1
GB
。
<
/p
>
<
p
>
3
.
只能上传
EXCEL
文件
(
XLS
,
XLSX
)
默认支持
EXCEL
2003
和
EXCEL
2007
。
<
/p
>
<
p
>
4
.
请将
EXCEL
文件的所有单元格格式设置为“文本”格式
<
/p
>
<
/div>
:
<
p
>
导入事项
<
/p
>
<
p
>
1
.
导入操作一次只能上传
1
个
EXCEL
文件。
<
/p
>
<
p
>
2
.
导入文件最大文件大小上传
1
GB
。
<
/p
>
<
p
>
3
.
只能上传
EXCEL
文件
(
XLS
,
XLSX
)
默认支持
EXCEL
2003
和
EXCEL
2007
。
<
/p
>
<
p
>
4
.
请将
EXCEL
文件的所有单元格格式设置为“文本”格式
<
/p
>
<
/div>
:
<
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'
}}
dataSource
=
{
this
.
state
.
errData
}
bordered
=
{
true
}
/></
TabPane
>
}
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
"green"
}}
>
验证成功列表
<
/span>} key="2"
>
<
Table
columns
=
{
column1
}
size
=
"small"
style
=
{{
overflow
:
'auto'
}}
dataSource
=
{
this
.
state
.
errData
}
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'
}}
dataSource
=
{
this
.
state
.
sucData
}
bordered
=
{
true
}
/></
TabPane
>
style
=
{{
overflow
:
'auto'
}}
dataSource
=
{
this
.
state
.
sucData
}
bordered
=
{
true
}
/></
TabPane
>
<
/Tabs
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论