Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-scene
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d91fbd6a
authored
Nov 03, 2023
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改tip显示
1 parent
03661189
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
162 additions
and
151 deletions
src/views/leadManage/leadInto.vue
src/views/leadManage/leadInto.vue
View file @
d91fbd6
<
template
>
<GLDialog
mode=
"small"
title=
"设备录入"
cancelText=
"确定"
:okText=
"curStatus==1 ? '确认导入': '导出失败记录'"
:before-close=
"handleCancel"
@
onCancel=
"handleCancel"
@
onOk=
"handleOk"
:visible
.
sync=
"showFuncIntro"
:hasFooter=
"true"
>
<div
v-if=
"curStatus==1"
class=
"file-wrap"
>
<p
class=
"tip"
>
正在批量导入数据,请勿关闭!
</p>
<div
class=
"upload-box"
>
<label
class=
"label"
for=
""
>
Excel文件:
</label>
<el-button
size=
"small"
icon=
"el-icon-plus"
@
click=
"selectFile"
>
上传文件
</el-button>
<input
type=
"file"
style=
"opacity: 0;width: 0;height: 0;"
ref=
"file"
accept=
"*"
@
change=
"uploadFile"
/>
<span
class=
"download-text"
@
click=
"downLoadTmpl"
>
下载模板
</span>
</div>
<span
class=
"file-name"
v-if=
"fileUrl"
>
{{
fileName
}}
</span>
</div>
<div
v-if=
"curStatus==2"
class=
"data-wrap"
>
<div
class=
"data-box"
>
<p
class=
"num"
>
{{
checkInfo
.
success
||
0
}}
</p>
<p
class=
"title"
>
有效数据
</p>
</div>
<div
class=
"line"
></div>
<div
class=
"data-box"
>
<p
class=
"num fail"
>
{{
checkInfo
.
error
||
0
}}
</p>
<p
class=
"title"
>
异常数据
</p>
</div>
</div>
</GLDialog>
<GLDialog
mode=
"small"
title=
"设备录入"
cancelText=
"确定"
:okText=
"curStatus == 1 ? '确认导入' : '导出失败记录'"
:before-close=
"handleCancel"
@
onCancel=
"handleCancel"
@
onOk=
"handleOk"
:visible
.
sync=
"showFuncIntro"
:hasFooter=
"true"
>
<div
v-if=
"curStatus == 1"
class=
"file-wrap"
>
<p
class=
"tip"
>
<span
v-if=
"showTip"
>
正在批量导入数据,请勿关闭!
</span>
</p>
<div
class=
"upload-box"
>
<label
class=
"label"
for=
""
>
Excel文件:
</label>
<el-button
size=
"small"
icon=
"el-icon-plus"
@
click=
"selectFile"
>
上传文件
</el-button>
<input
type=
"file"
style=
"opacity: 0;width: 0;height: 0;"
ref=
"file"
accept=
"*"
@
change=
"uploadFile"
/>
<span
class=
"download-text"
@
click=
"downLoadTmpl"
>
下载模板
</span>
</div>
<span
class=
"file-name"
v-if=
"fileUrl"
>
{{
fileName
}}
</span>
</div>
<div
v-if=
"curStatus == 2"
class=
"data-wrap"
>
<div
class=
"data-box"
>
<p
class=
"num"
>
{{
checkInfo
.
success
||
0
}}
</p>
<p
class=
"title"
>
有效数据
</p>
</div>
<div
class=
"line"
></div>
<div
class=
"data-box"
>
<p
class=
"num fail"
>
{{
checkInfo
.
error
||
0
}}
</p>
<p
class=
"title"
>
异常数据
</p>
</div>
</div>
</GLDialog>
</
template
>
<
script
>
import
util
from
'@/utils/util'
...
...
@@ -29,155 +33,162 @@ export default {
name
:
'leadManage'
,
data
()
{
return
{
showFuncIntro
:
true
,
fileUrl
:
''
,
fileName
:
''
,
curStatus
:
1
,
checkInfo
:
{}
showTip
:
false
,
showFuncIntro
:
true
,
fileUrl
:
''
,
fileName
:
''
,
curStatus
:
1
,
checkInfo
:
{}
}
},
created
()
{
},
mounted
()
{
},
created
()
{},
mounted
()
{},
methods
:
{
handleOk
(){
if
(
this
.
curStatus
==
1
)
{
if
(
!
this
.
fileUrl
)
return
this
.
$message
.
error
(
'请上传文件'
)
this
.
$apis
.
sendRepair
.
importDeviceInfoApi
({
url
:
this
.
fileUrl
}).
then
(
res
=>
{
if
(
res
)
{
this
.
checkInfo
=
res
this
.
curStatus
=
2
}
})
}
else
{
if
(
this
.
checkInfo
.
checkFlag
)
return
this
.
$message
.
warn
(
'无失败记录'
)
util
.
exportFn
(
this
.
checkInfo
.
errUrl
)
}
handleOk
()
{
if
(
this
.
curStatus
==
1
)
{
if
(
!
this
.
fileUrl
)
return
this
.
$message
.
error
(
'请上传文件'
)
this
.
$apis
.
sendRepair
.
importDeviceInfoApi
({
url
:
this
.
fileUrl
}).
then
(
res
=>
{
if
(
res
)
{
this
.
checkInfo
=
res
this
.
curStatus
=
2
}
})
}
else
{
if
(
this
.
checkInfo
.
checkFlag
)
return
this
.
$message
.
warn
(
'无失败记录'
)
util
.
exportFn
(
this
.
checkInfo
.
errUrl
)
}
},
downLoadTmpl
(){
const
url
=
this
.
$tmplUrl
if
(
!
url
)
return
this
.
$message
.
error
(
'请配置模板链接'
)
util
.
exportFn
(
url
)
downLoadTmpl
()
{
const
url
=
this
.
$tmplUrl
if
(
!
url
)
return
this
.
$message
.
error
(
'请配置模板链接'
)
util
.
exportFn
(
url
)
},
handleCancel
(){
this
.
fileUrl
=
''
this
.
fileName
=
''
this
.
curStatus
=
1
this
.
checkInfo
=
{}
this
.
$emit
(
'closeDialogFn'
)
handleCancel
()
{
this
.
fileUrl
=
''
this
.
fileName
=
''
this
.
curStatus
=
1
this
.
checkInfo
=
{}
this
.
$emit
(
'closeDialogFn'
)
},
selectFile
(){
this
.
$refs
.
file
.
click
()
selectFile
()
{
this
.
$refs
.
file
.
click
()
},
uploadFile
(
e
)
{
const
file
=
e
.
srcElement
.
files
[
0
]
let
AllImgExt
=
'.xlsx|.xls'
//文件格式判断
let
extName
=
file
.
name
.
substring
(
file
.
name
.
lastIndexOf
(
'.'
)).
toLowerCase
()
if
(
AllImgExt
.
indexOf
(
extName
)
<
0
)
{
this
.
$message
({
type
:
'error'
,
message
:
'请选择xlsx、xls文件'
,
customClass
:
'customMessageClass'
})
this
.
$refs
.
file
.
value
=
''
return
false
}
const
reader
=
new
FileReader
()
reader
.
readAsDataURL
(
file
)
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'Loading'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.3)'
const
file
=
e
.
srcElement
.
files
[
0
]
let
AllImgExt
=
'.xlsx|.xls'
//文件格式判断
let
extName
=
file
.
name
.
substring
(
file
.
name
.
lastIndexOf
(
'.'
)).
toLowerCase
()
if
(
AllImgExt
.
indexOf
(
extName
)
<
0
)
{
this
.
$message
({
type
:
'error'
,
message
:
'请选择xlsx、xls文件'
,
customClass
:
'customMessageClass'
})
reader
.
onload
=
event
=>
{
const
imgFile
=
event
.
target
.
result
const
arrBase64
=
imgFile
.
split
(
','
)
const
fileName
=
file
.
name
.
split
(
'.'
)
//fileUrl: 文件名 + @ + base64拼接
const
fileUrl
=
fileName
.
pop
()
+
'@'
+
arrBase64
[
1
]
this
.
$apis
.
common
.
pictureUpload
({
file
:
fileUrl
}).
then
(
res
=>
{
this
.
$refs
.
file
.
value
=
''
return
false
}
this
.
showTip
=
true
const
reader
=
new
FileReader
()
reader
.
readAsDataURL
(
file
)
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'Loading'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.3)'
})
reader
.
onload
=
event
=>
{
const
imgFile
=
event
.
target
.
result
const
arrBase64
=
imgFile
.
split
(
','
)
const
fileName
=
file
.
name
.
split
(
'.'
)
//fileUrl: 文件名 + @ + base64拼接
const
fileUrl
=
fileName
.
pop
()
+
'@'
+
arrBase64
[
1
]
this
.
$apis
.
common
.
pictureUpload
({
file
:
fileUrl
})
.
then
(
res
=>
{
loading
.
close
()
if
(
res
){
this
.
fileName
=
file
.
name
this
.
fileUrl
=
res
this
.
showTip
=
false
if
(
res
)
{
this
.
fileName
=
file
.
name
this
.
fileUrl
=
res
}
}).
catch
(
err
=>
{
})
.
catch
(
err
=>
{
loading
.
close
()
this
.
showTip
=
false
})
}
}
,
}
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.file-wrap
{
.tip{
font-family
:
PingFangSC-Regular
;
font-weight
:
400
;
font-size
:
16px
;
color
:
#FF4D4F
;
line-height
:
22px
;
text-align
:
center
;
margin
:
12px
0
20px
;
}
.upload-box
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
4px
;
.label{
font-size
:
14px
;
width
:
154px
;
text-align
:
right
;
color
:
#333333
;
text-align
:
right
;
display
:
inline-block
;
}
.download-text
{
color
:
#5850FF
;
cursor
:
pointer
;
margin-left
:
7px
;
}
.file-wrap
{
.tip
{
font-family
:
PingFangSC-Regular
;
font-weight
:
400
;
font-size
:
16px
;
color
:
#ff4d4f
;
line-height
:
22px
;
text-align
:
center
;
display
:
block
;
height
:
30px
;
margin
:
12px
0
20px
;
}
.upload-box
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
4px
;
.label
{
font-size
:
14px
;
width
:
154px
;
text-align
:
right
;
color
:
#333333
;
text-align
:
right
;
display
:
inline-block
;
}
.
file-name
{
margin-left
:
154px
;
font-size
:
12px
;
color
:
#333
;
.
download-text
{
color
:
#5850ff
;
cursor
:
pointer
;
margin-left
:
7px
;
}
}
.file-name
{
margin-left
:
154px
;
font-size
:
12px
;
color
:
#333
;
}
}
.data-wrap
{
display
:
flex
;
justify-content
:
center
;
margin-top
:
50px
;
.line{
width
:
1px
;
height
:
56px
;
background
:
#E8E8EA
;
.data-wrap
{
display
:
flex
;
justify-content
:
center
;
margin-top
:
50px
;
.line
{
width
:
1px
;
height
:
56px
;
background
:
#e8e8ea
;
}
.data-box
{
width
:
200px
;
height
:
56px
;
.num
{
font-family
:
Helvetica-Bold
;
font-weight
:
700
;
font-size
:
26px
;
color
:
#2cca74
;
text-align
:
center
;
line-height
:
32px
;
}
.data-box
{
width
:
200px
;
height
:
56px
;
.num{
font-family
:
Helvetica-Bold
;
font-weight
:
700
;
font-size
:
26px
;
color
:
#2CCA74
;
text-align
:
center
;
line-height
:
32px
;
}
.fail
{
color
:
#EB4E4E
;
}
.title
{
font-family
:
PingFangSC-Regular
;
font-weight
:
400
;
font-size
:
14px
;
margin-top
:
4px
;
line-height
:
20px
;
color
:
#333333
;
text-align
:
center
;
}
.fail
{
color
:
#eb4e4e
;
}
.title
{
font-family
:
PingFangSC-Regular
;
font-weight
:
400
;
font-size
:
14px
;
margin-top
:
4px
;
line-height
:
20px
;
color
:
#333333
;
text-align
:
center
;
}
}
}
</
style
>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment