Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-charge
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 51819eae
authored
Feb 28, 2024
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
联调完成
1 parent
cd8bfcf6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
325 additions
and
35 deletions
src/api/modules/parkingSpace.js
src/utils/util.js
src/views/parkingPlace/index.vue
src/views/parkingPlace/status.vue
src/api/modules/parkingSpace.js
View file @
51819ea
...
...
@@ -104,6 +104,17 @@ const saveParkingSpacePicApi = params => {
})
}
const
importParkingSpaceApi
=
params
=>
{
params
.
method
=
'marketing.api.charge.parkingSpace.import'
return
http
({
url
:
URL
,
method
:
'post'
,
data
:
params
,
sign
:
true
,
returnAll
:
true
})
}
// 车位标记
const
addFlagparkingSpace
=
params
=>
{
params
.
method
=
'marketing.api.charge.parkingSpace.addFlag'
...
...
@@ -124,5 +135,6 @@ export default {
getRadarListApi
,
delParkingSpaceApi
,
updateParkingSpaceApi
,
saveParkingSpacePicApi
saveParkingSpacePicApi
,
importParkingSpaceApi
}
src/utils/util.js
View file @
51819ea
...
...
@@ -211,4 +211,41 @@ util.formatSeconds = function(value) {
}
return
result
}
util
.
getDateRange
=
function
(
val
)
{
let
list
=
[]
let
today
=
new
Date
()
//枚举查看 dateList
switch
(
val
)
{
case
1
:
var
yesterday
=
new
Date
(
today
)
yesterday
.
setDate
(
today
.
getDate
()
-
1
)
list
=
[
yesterday
,
yesterday
]
break
case
2
:
var
firstDay
=
new
Date
(
today
)
var
_dayOfWeek
=
today
.
getDay
()
firstDay
.
setDate
(
today
.
getDate
()
-
_dayOfWeek
+
1
)
list
=
[
firstDay
,
today
]
break
case
3
:
var
lastWeekFirstDay
=
new
Date
(
today
)
var
lastWeekLastDay
=
new
Date
(
today
)
var
dayOfWeek
=
today
.
getDay
()
var
diff
=
dayOfWeek
+
7
lastWeekFirstDay
.
setDate
(
today
.
getDate
()
-
diff
+
1
)
lastWeekLastDay
.
setDate
(
today
.
getDate
()
-
diff
+
7
)
list
=
[
lastWeekFirstDay
,
lastWeekLastDay
]
break
case
4
:
var
_firstDay
=
new
Date
(
today
.
getFullYear
(),
today
.
getMonth
(),
1
)
list
=
[
_firstDay
,
today
]
break
case
5
:
var
lastMonthFirstDay
=
new
Date
(
today
.
getFullYear
(),
today
.
getMonth
()
-
1
,
1
)
var
lastMonthLastDay
=
new
Date
(
today
.
getFullYear
(),
today
.
getMonth
(),
0
)
list
=
[
lastMonthFirstDay
,
lastMonthLastDay
]
break
}
return
list
}
export
default
util
src/views/parkingPlace/index.vue
View file @
51819ea
...
...
@@ -9,7 +9,7 @@
<span>
车位详情
</span>
</div>
<div>
<el-button
type=
"primary"
plain
size=
"small"
@
click=
"
openNoticeDialog
"
>
批量导入
</el-button>
<el-button
type=
"primary"
plain
size=
"small"
@
click=
"
batchExport
"
>
批量导入
</el-button>
<el-button
size=
"small"
@
click=
"handleExport"
>
导出
</el-button>
</div>
</div>
...
...
@@ -49,6 +49,40 @@
</div>
</div>
</GLDialog>
<GLDialog
title=
"批量操作"
:visible
.
sync=
"isBatch"
mode=
"mid"
:before-close=
"cancelImport"
@
onCancel=
"cancelImport"
>
<template
v-if=
"!batchForm.isUpload"
>
<el-form
:model=
"batchForm"
label-width=
"154px"
>
<el-form-item
label=
"导入文件:"
>
<div
class=
"link"
>
<div
class=
"upload-btn"
>
<el-button
size=
"small"
>
<i
class=
"el-icon-plus"
></i>
上传文件
</el-button>
<input
type=
"file"
style=
"opacity: 0"
ref=
"file"
accept=
"*"
@
change=
"uploadFile"
/>
</div>
<a
href=
"https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/红包链接.xlsx"
target=
"_blank"
>
下载模板
</a>
</div>
</el-form-item>
<div
class=
"tip"
>
支持扩展名:xlsx、xls
</div>
</el-form>
</
template
>
<div
v-else
class=
"file-info"
>
<div
class=
"success"
>
{{ batchForm.successCount || 0 }}
<div>
成功记录
</div>
</div>
<div
class=
"line"
></div>
<div
class=
"error"
>
{{ batchForm.failCount }}
<div>
失败记录
</div>
</div>
</div>
<span
slot=
"footer"
>
<el-button
size=
"small"
@
click=
"cancelImport"
>
{{ batchForm.isUpload ? '确定' : '取消' }}
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSaveImport"
>
{{ batchForm.isUpload ? '导出失败记录' : '确认' }}
</el-button>
</span>
</GLDialog>
</div>
</template>
...
...
@@ -58,22 +92,30 @@ const DEVICE_STATUS_ENUM = { 0: { color: '#999999', name: '未激活' }, 1: { co
const
UPLOAD_LIST
=
[
{
label
:
'停车场入口'
,
key
:
0
,
id
:
''
,
parkingSpaceId
:
''
,
type
:
0
,
url
:
[]
},
{
label
:
'车位所在楼层'
,
key
:
1
,
id
:
''
,
parkingSpaceId
:
''
,
type
:
1
,
url
:
[]
},
{
label
:
'车位实景'
,
key
:
2
,
id
:
''
,
parkingSpaceId
:
''
,
type
:
2
,
url
:
[]
},
{
label
:
'充电桩实景'
,
key
:
3
,
id
:
''
,
parkingSpaceId
:
''
,
type
:
3
,
url
:
[]
}
]
...
...
@@ -91,6 +133,14 @@ export default {
return
{
parkingPlaceVisible
:
false
,
uploadVisible
:
false
,
isBatch
:
false
,
batchForm
:
{
isUpload
:
false
,
successCount
:
0
,
failCount
:
0
,
exportUrl
:
''
,
exportName
:
''
},
url
:
'url'
,
parkingStatusEnum
:
PARKING_STATUS_ENUM
,
deviceStatusEnum
:
DEVICE_STATUS_ENUM
,
...
...
@@ -144,18 +194,6 @@ export default {
listeners
:
{
click
:
row
=>
this
.
sign
(
row
.
scope
)
}
},
{
type
:
'el-button'
,
name
:
row
=>
{
return
'关联雷达'
},
attrs
:
{
type
:
'text'
},
listeners
:
{
click
:
row
=>
this
.
del
(
row
.
scope
)
}
}
],
basicForm
:
{
...
...
@@ -199,31 +237,38 @@ export default {
{
label
:
'停车场区域'
,
name
:
'parkingArea'
,
type
:
'input'
type
:
'input'
,
maxlength
:
50
},
{
label
:
'所在楼层'
,
name
:
'parkingFloor'
,
type
:
'input'
type
:
'input'
,
maxlength
:
50
},
{
label
:
'楼栋'
,
name
:
'parkingBuilding'
,
type
:
'input'
type
:
'input'
,
maxlength
:
50
},
{
itemSlot
:
'secondTitleSlot'
,
title
:
'车位信息'
title
:
'车位信息'
,
maxlength
:
50
},
{
label
:
'车位编号'
,
name
:
'parkingNumber'
,
type
:
'input'
type
:
'input'
,
maxlength
:
50
},
{
label
:
'车位备注'
,
name
:
'parkingRemark'
,
type
:
'input'
type
:
'input'
,
inputType
:
'textarea'
,
maxlength
:
200
},
{
itemSlot
:
'thirdTitleSlot'
,
...
...
@@ -386,22 +431,130 @@ export default {
},
mounted
()
{},
methods
:
{
handleSaveImport
()
{
if
(
this
.
batchForm
.
isUpload
)
{
this
.
handleExportError
()
return
}
else
if
(
!
this
.
batchForm
.
exportUrl
)
{
this
.
$message
.
error
(
'请上传文件'
)
}
let
params
=
{
exportUrl
:
this
.
batchForm
.
exportUrl
,
exportName
:
this
.
batchForm
.
exportName
}
this
.
$apis
.
parkingSpace
.
importParkingSpaceApi
(
params
)
.
then
(
res
=>
{
console
.
log
(
res
,
'exporres'
)
this
.
$message
({
message
:
res
.
code
==
'0'
?
'导入成功'
:
res
.
message
,
type
:
res
.
code
==
'0'
?
'success'
:
'error'
})
if
(
res
.
code
==
0
)
{
const
data
=
res
?.
data
||
{}
this
.
batchForm
.
isUpload
=
true
this
.
batchForm
.
successCount
=
data
.
totalCount
this
.
batchForm
.
failCount
=
data
.
failCount
this
.
batchForm
.
errorUrl
=
data
.
errorUrl
}
else
{
this
.
$message
({
message
:
res
.
message
,
type
:
'error'
})
}
})
.
finally
(()
=>
{
this
.
$refs
.
file
.
value
=
''
})
},
uploadFile
(
e
,
item
)
{
const
file
=
e
.
srcElement
.
files
[
0
]
let
AllImgExt
=
'.xls|.xlsx'
let
extName
=
file
.
name
.
substring
(
file
.
name
.
lastIndexOf
(
'.'
)).
toLowerCase
()
if
(
AllImgExt
.
indexOf
(
extName
)
===
-
1
)
{
this
.
$message
.
error
(
'上传格式不正确'
)
return
false
}
const
size
=
file
.
size
/
1024
/
1024
// if (size > 8) {
// this.$message.error('单文件体积需小于8M')
// return
// }
const
reader
=
new
FileReader
()
reader
.
readAsDataURL
(
file
)
reader
.
onload
=
event
=>
{
const
imgFile
=
event
.
target
.
result
const
arrBase64
=
imgFile
.
split
(
','
)
const
splitStr
=
file
.
name
.
split
(
'.'
)
const
fileUrl
=
splitStr
[
splitStr
.
length
-
1
]
+
'@'
+
arrBase64
[
1
]
this
.
$apis
.
common
.
pictureUpload
({
file
:
fileUrl
}).
then
(
res
=>
{
if
(
res
)
{
this
.
batchForm
.
exportName
=
file
.
name
this
.
batchForm
.
exportUrl
=
res
this
.
handleSaveImport
()
}
this
.
$refs
.
file
.
value
=
''
})
}
},
handleExportError
()
{
if
(
this
.
batchForm
.
errorUrl
)
{
//如果有错误导入记录
util
.
exportFn
(
this
.
batchForm
.
errorUrl
.
replace
(
/https
?
:/
,
''
))
}
else
{
this
.
$message
({
message
:
'暂无错误数据'
,
type
:
'error'
})
}
},
cancelImport
()
{
this
.
isBatch
=
false
if
(
this
.
batchForm
.
successCount
)
{
this
.
searchTable
()
this
.
getRadarList
()
}
this
.
batchForm
=
{
isUpload
:
false
,
successCount
:
0
,
failCount
:
0
,
exportUrl
:
''
,
exportName
:
''
}
},
batchExport
()
{
this
.
isBatch
=
true
},
//车位标记
sign
(
row
){
this
.
$router
.
push
(
`/parkingPlace/sign/
${
row
.
id
}
`
)
sign
(
row
)
{
this
.
$router
.
push
(
`/parkingPlace/sign/
${
row
.
id
}
`
)
},
openUploadDialog
(
row
)
{
this
.
curId
=
row
.
id
row
.
parkingSpaceImgList
?.
forEach
(
item
=>
{
this
.
uploadList
.
forEach
(
ele
=>
{
if
(
ele
.
type
==
item
.
type
)
{
ele
.
parkingSpaceId
=
item
.
parkingSpaceId
ele
.
id
=
item
.
id
if
(
item
.
url
)
ele
.
url
=
[
item
.
url
]
}
})
})
this
.
uploadVisible
=
true
},
uploadOk
()
{
let
picList
=
[]
this
.
uploadList
.
forEach
(
item
=>
{
if
(
item
.
url
[
0
])
{
picList
.
push
(
{
type
:
item
.
key
,
let
obj
=
{
type
:
item
.
type
,
url
:
item
.
url
[
0
]
})
}
if
(
item
.
id
)
{
obj
.
parkingSpaceId
=
item
.
parkingSpaceId
obj
.
id
=
item
.
id
}
picList
.
push
(
obj
)
}
})
if
(
!
picList
?.
length
)
return
this
.
$message
.
error
(
'请上传图片'
)
...
...
@@ -480,12 +633,14 @@ export default {
if
(
valid
)
{
let
params
=
{
...
this
.
basicForm
}
if
(
!
params
.
id
)
delete
params
.
id
this
.
$apis
.
parkingSpace
.
addParkingSpaceApi
(
params
).
then
(
res
=>
{
let
_api
=
params
.
id
?
'updateParkingSpaceApi'
:
'addParkingSpaceApi'
this
.
$apis
.
parkingSpace
[
_api
](
params
).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
)
{
this
.
$message
.
success
(
`
${
params
.
id
?
'修改'
:
'添加'
}
成功`
)
this
.
handleCancel
()
this
.
searchTable
()
this
.
getRadarList
()
}
})
}
...
...
@@ -634,4 +789,69 @@ export default {
}
}
}
.link
{
display
:
flex
;
//
align-items
:
flex-start
;
.upload-btn
{
position
:
relative
;
width
:
110px
;
height
:
32px
;
.el-button--small
{
width
:
100%
;
height
:
100%
;
}
input
{
cursor
:
pointer
;
position
:
absolute
;
height
:
100%
;
width
:
100%
;
top
:
0px
;
left
:
0px
;
font-size
:
0px
;
}
}
a
{
margin-left
:
8px
;
color
:
#5850ff
;
font-size
:
12px
;
cursor
:
pointer
;
margin-top
:
5px
;
}
}
.file-info
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
margin
:
70px
120px
;
.success
{
font-weight
:
700
;
font-size
:
26px
;
color
:
#2cca74
;
text-align
:
center
;
}
.line
{
width
:
1px
;
height
:
56px
;
background
:
#e8e8ea
;
}
.error
{
font-weight
:
700
;
font-size
:
26px
;
color
:
#eb4e4e
;
text-align
:
center
;
}
div
{
font-size
:
14px
;
color
:
#333333
;
text-align
:
center
;
font-weight
:
500
;
margin-top
:
4px
;
}
}
.tip
{
font-size
:
14px
;
color
:
#999999
;
margin-left
:
154px
;
margin-top
:
-20px
;
}
</
style
>
src/views/parkingPlace/status.vue
View file @
51819ea
...
...
@@ -4,7 +4,7 @@
<div
class=
"pageContent"
>
<GLCombiForm
class=
"search-wrap"
:rowNumber=
"1"
:formObj=
"searchForm"
:formData=
"searchFormList"
@
handleOk=
"searchTable"
@
handleRest=
"resetTable"
>
<div
class=
"date-select-wrap"
slot=
"dateSelectSlot"
slot-scope=
"scope"
>
<div
:class=
"['date-item',
{ 'seleted-item': searchForm.curDate == item.value }]" v-for="(item, index) in scope.scope.dateList" :key="index">
{{
item
.
name
}}
</div>
<div
:class=
"['date-item',
{ 'seleted-item': searchForm.curDate == item.value }]" v-for="(item, index) in scope.scope.dateList"
@click="selectDate(item.value)"
:key="index">
{{
item
.
name
}}
</div>
</div>
<div
slot=
"inputSlot"
>
<el-input
placeholder=
"请输入完整车位编号"
v-model
.
trim=
"searchForm.parkingNumber"
:clearable=
"true"
type=
"text"
></el-input>
...
...
@@ -58,19 +58,23 @@ export default {
},
{
name
:
'昨日'
,
value
:
'1'
value
:
1
},
{
name
:
'本周'
,
value
:
'2'
value
:
2
},
{
name
:
'上周'
,
value
:
'3'
value
:
3
},
{
name
:
'本月'
,
value
:
'4'
value
:
4
},
{
name
:
'上月'
,
value
:
5
}
]
},
...
...
@@ -146,6 +150,14 @@ export default {
}
}
},
// watch: {
// 'searchForm.searchDate': {
// handler(newValue, oldValue) {
// this.searchForm.curDate = ''
// },
// deep: true
// }
// },
created
()
{},
mounted
()
{},
methods
:
{
...
...
@@ -169,11 +181,20 @@ export default {
this
.
realSearchForm
=
{}
this
.
searchTable
()
},
selectDate
(
val
)
{
this
.
searchForm
.
searchDate
=
[]
this
.
searchForm
.
curDate
=
val
},
getParams
()
{
var
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
searchForm
))
if
(
this
.
searchForm
.
searchDate
.
length
)
{
params
.
startTime
=
new
Date
(
this
.
searchForm
.
searchDate
[
0
]).
toLocaleDateString
().
replace
(
/
\/
/g
,
'-'
)
+
' 00:00:00'
params
.
endTime
=
new
Date
(
this
.
searchForm
.
searchDate
[
1
]).
toLocaleDateString
().
replace
(
/
\/
/g
,
'-'
)
+
' 23:59:59'
}
else
if
(
this
.
searchForm
.
curDate
)
{
const
list
=
util
.
getDateRange
(
this
.
searchForm
.
curDate
)
params
.
startTime
=
dayjs
(
list
[
0
]).
format
(
'YYYY-MM-DD'
)
+
' 00:00:00'
params
.
endTime
=
dayjs
(
list
[
1
]).
format
(
'YYYY-MM-DD'
)
+
' 23:59:59'
}
delete
params
.
searchDate
return
params
...
...
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