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 个修改的文件
包含
59 行增加
和
44 行删除
+59
-44
ImportUtil.js
one_stop_public/App/ImportUtil.js
+59
-44
没有找到文件。
one_stop_public/App/ImportUtil.js
浏览文件 @
7cf71dcb
...
@@ -15,10 +15,11 @@ import ButtonDiy from './ButtonDiy/ButtonDiy';
...
@@ -15,10 +15,11 @@ import ButtonDiy from './ButtonDiy/ButtonDiy';
import
config
from
'@/webPublic/one_stop_public/config'
;
import
config
from
'@/webPublic/one_stop_public/config'
;
import
{
connect
}
from
'dva'
;
import
{
connect
}
from
'dva'
;
const
Step
=
Steps
.
Step
;
const
Step
=
Steps
.
Step
;
const
TabPane
=
Tabs
.
TabPane
;
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
})
=>
({
@
connect
(({
DataObj
,
loading
})
=>
({
DataObj
,
DataObj
,
...
@@ -32,7 +33,7 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -32,7 +33,7 @@ export default class ImportUtil extends React.PureComponent {
this
.
state
=
{
this
.
state
=
{
ch
:
false
,
ch
:
false
,
currentKey
:
"1"
,
currentKey
:
'1'
,
visible
:
false
,
visible
:
false
,
current
:
0
,
current
:
0
,
isShow
:
true
,
isShow
:
true
,
...
@@ -119,8 +120,8 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -119,8 +120,8 @@ export default class ImportUtil extends React.PureComponent {
if
(
this
.
props
.
callback
)
{
if
(
this
.
props
.
callback
)
{
this
.
props
.
callback
();
this
.
props
.
callback
();
}
}
}
}
,
})
})
;
}
}
...
@@ -142,8 +143,8 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -142,8 +143,8 @@ export default class ImportUtil extends React.PureComponent {
});
});
this
.
queryFile
(
res
.
cacheKey
);
this
.
queryFile
(
res
.
cacheKey
);
}
}
,
})
})
;
};
};
...
@@ -163,7 +164,7 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -163,7 +164,7 @@ export default class ImportUtil extends React.PureComponent {
sucData
:
res
.
pass
,
sucData
:
res
.
pass
,
errData
:
res
.
noPass
,
errData
:
res
.
noPass
,
column
:
res
.
column
column
:
res
.
column
,
});
});
if
(
res
.
noPass
&&
res
.
noPass
.
length
==
0
)
{
if
(
res
.
noPass
&&
res
.
noPass
.
length
==
0
)
{
...
@@ -171,50 +172,51 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -171,50 +172,51 @@ export default class ImportUtil extends React.PureComponent {
if
(
res
.
pass
.
length
==
0
)
{
if
(
res
.
pass
.
length
==
0
)
{
message
.
error
(
'当前没有验证成功的数据,无法导入。'
);
message
.
error
(
'当前没有验证成功的数据,无法导入。'
);
this
.
setState
({
this
.
setState
({
currentKey
:
"1"
,
currentKey
:
'1'
,
ch
:
!
this
.
state
.
ch
,
ch
:
!
this
.
state
.
ch
,
isNextDisabled
:
true
isNextDisabled
:
true
,
});
});
}
else
{
}
else
{
message
.
success
(
'所有数据验证通过,请确认后点击下一步。'
);
message
.
success
(
'所有数据验证通过,请确认后点击下一步。'
);
this
.
setState
({
this
.
setState
({
currentKey
:
"2"
,
currentKey
:
'2'
,
ch
:
!
this
.
state
.
ch
,
ch
:
!
this
.
state
.
ch
,
isNextDisabled
:
false
isNextDisabled
:
false
,
});
});
}
}
}
else
{
}
else
{
message
.
error
(
'当前存在未验证通过的数据,请按错误提示检测更正导入文件'
);
message
.
error
(
'当前存在未验证通过的数据,请按错误提示检测更正导入文件'
);
this
.
setState
({
this
.
setState
({
currentKey
:
"1"
,
currentKey
:
'1'
,
ch
:
!
this
.
state
.
ch
,
ch
:
!
this
.
state
.
ch
,
isNextDisabled
:
true
isNextDisabled
:
true
,
});
});
}
}
}
}
,
})
})
;
};
};
changePane
=
(
activeKey
)
=>
{
changePane
=
(
activeKey
)
=>
{
this
.
setState
({
currentKey
:
activeKey
})
this
.
setState
({
currentKey
:
activeKey
})
;
}
}
;
exportError
=
(
column
,
dataSource
)
=>
{
exportError
=
(
column
,
dataSource
)
=>
{
if
(
exportExcel
==
null
)
{
if
(
exportExcel
==
null
)
{
message
.
info
(
"当前终端暂不支持此功能"
)
message
.
info
(
'当前终端暂不支持此功能'
);
return
return
;
}
}
var
_headers
=
[]
var
_headers
=
[]
;
for
(
var
i
=
0
;
i
<
column
.
length
;
i
++
)
{
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
++
)
{
for
(
var
j
=
0
;
j
<
dataSource
.
length
;
j
++
)
{
dataSource
[
j
].
index
=
j
+
1
dataSource
[
j
].
index
=
j
+
1
;
}
}
exportExcel
(
_headers
,
dataSource
);
exportExcel
(
_headers
,
dataSource
);
}
};
render
()
{
render
()
{
const
props
=
{
const
props
=
{
...
@@ -235,7 +237,6 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -235,7 +237,6 @@ export default class ImportUtil extends React.PureComponent {
let
x
=
info
.
file
.
response
;
let
x
=
info
.
file
.
response
;
this
.
getCachKey
(
x
);
this
.
getCachKey
(
x
);
}
else
if
(
info
.
file
.
status
===
'error'
)
{
}
else
if
(
info
.
file
.
status
===
'error'
)
{
...
@@ -255,20 +256,26 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -255,20 +256,26 @@ export default class ImportUtil extends React.PureComponent {
}];
}];
const
{
current
}
=
this
.
state
;
const
{
current
}
=
this
.
state
;
const
{
name
,
loading
}
=
this
.
props
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
]
:
[]
const
column1
=
this
.
state
.
column
?
[{
var
column2
=
this
.
state
.
column
?
[...
this
.
state
.
column
]
:
[]
title
:
'序号'
,
if
(
column1
.
length
>
1
)
column1
[
1
].
render
=
(
val
)
=>
<
span
style
=
{{
color
:
"red"
}}
>
{
val
}
<
/span
>
dataIndex
:
'index'
,
fixed
:
'left'
,
column2
.
splice
(
0
,
1
)
width
:
50
,
column2
=
[{
title
:
"序号"
,
fixed
:
"left"
,
width
:
50
,
render
:
(
v
,
r
,
i
)
=>
i
+
1
},
...
column2
]
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
(
return
(
<
span
>
<
span
>
<
ButtonDiy
name
=
{
name
||
'批量导入'
}
<
ButtonDiy
name
=
{
name
||
'批量导入'
}
type
=
'default'
type
=
'default'
className
=
'defaultBlue'
className
=
'defaultBlue'
handleClick
=
{
this
.
showModal
}
/
>
handleClick
=
{
this
.
showModal
}
/
>
<
Modal
<
Modal
visible
=
{
this
.
state
.
visible
}
visible
=
{
this
.
state
.
visible
}
onOk
=
{
this
.
handleOk
}
onOk
=
{
this
.
handleOk
}
...
@@ -277,7 +284,7 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -277,7 +284,7 @@ export default class ImportUtil extends React.PureComponent {
onCancel
=
{
this
.
handleCancel
}
onCancel
=
{
this
.
handleCancel
}
title
=
{
null
}
title
=
{
null
}
footer
=
{
null
}
footer
=
{
null
}
width
=
{
"80%"
}
width
=
{
'80%'
}
>
>
<
div
className
=
{
styles
.
nomal
}
>
<
div
className
=
{
styles
.
nomal
}
>
...
@@ -288,7 +295,7 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -288,7 +295,7 @@ export default class ImportUtil extends React.PureComponent {
<
Steps
current
=
{
current
}
>
<
Steps
current
=
{
current
}
>
{
steps
.
map
(
item
=>
{
steps
.
map
(
item
=>
<
Step
key
=
{
item
.
title
}
<
Step
key
=
{
item
.
title
}
title
=
{
item
.
title
}
/>
)
}
title
=
{
item
.
title
}
/>
)
}
<
/Steps
>
<
/Steps
>
<
div
className
=
"steps-content"
>
<
div
className
=
"steps-content"
>
{
steps
[
this
.
state
.
current
].
content
}
{
steps
[
this
.
state
.
current
].
content
}
...
@@ -297,14 +304,19 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -297,14 +304,19 @@ export default class ImportUtil extends React.PureComponent {
{
{
(
this
.
state
.
current
<
steps
.
length
-
1
&&
this
.
state
.
current
!==
0
)
(
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
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
>
<
/div
>
...
@@ -322,7 +334,7 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -322,7 +334,7 @@ export default class ImportUtil extends React.PureComponent {
<
div
className
=
{
styles
.
buttonDown
}
>
<
div
className
=
{
styles
.
buttonDown
}
>
<
Upload
{...
props
}
>
<
Upload
{...
props
}
>
<
Button
>
<
Button
>
<
Icon
type
=
"upload"
/>
点击上传
<
Icon
type
=
"upload"
/>
点击上传
<
/Button
>
<
/Button
>
<
/Upload
>
<
/Upload
>
<
Button
href
=
{
this
.
state
.
exportTemplateUrl
}
<
Button
href
=
{
this
.
state
.
exportTemplateUrl
}
...
@@ -333,7 +345,7 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -333,7 +345,7 @@ export default class ImportUtil extends React.PureComponent {
<
/div>
:
<
/div>
:
<
Upload
{...
props
}
>
<
Upload
{...
props
}
>
<
Button
>
<
Button
>
<
Icon
type
=
"upload"
/>
<
Icon
type
=
"upload"
/>
重新上传
重新上传
<
/Button
>
<
/Button
>
<
/Upload
>
<
/Upload
>
...
@@ -350,21 +362,24 @@ export default class ImportUtil extends React.PureComponent {
...
@@ -350,21 +362,24 @@ export default class ImportUtil extends React.PureComponent {
<
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"
>
<
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"
>
{
this
.
state
.
errData
&&
this
.
state
.
errData
.
length
==
0
?
''
:
<
Button
style
=
{{
marginTop
:
5
,
marginBottom
:
5
}}
type
=
"danger"
onClick
=
{
this
.
exportError
.
bind
(
this
,
column1
,
this
.
state
.
errData
)}
>
导出错误信息
<
/Button
>
<
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"
<
Table
columns
=
{
column1
}
size
=
"small"
style
=
{{
overflow
:
'auto'
}}
style
=
{{
overflow
:
'auto'
}}
dataSource
=
{
this
.
state
.
errData
}
dataSource
=
{
this
.
state
.
errData
}
bordered
=
{
true
}
/></
TabPane
>
}
bordered
=
{
true
}
/></
TabPane
>
}
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
"green"
}}
>
验证成功列表
<
/span>} key="2"
>
<
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"
<
Table
columns
=
{
column2
}
size
=
"small"
style
=
{{
overflow
:
'auto'
}}
style
=
{{
overflow
:
'auto'
}}
dataSource
=
{
this
.
state
.
sucData
}
dataSource
=
{
this
.
state
.
sucData
}
bordered
=
{
true
}
/></
TabPane
>
bordered
=
{
true
}
/></
TabPane
>
<
/Tabs
>
<
/Tabs
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论