Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
卡
卡车调度系统
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
caicaicai
卡车调度系统
Commits
e70097de
Commit
e70097de
authored
Apr 15, 2022
by
caicaicai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
6f25f3bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
239 deletions
+106
-239
.env.development
.env.development
+3
-3
Map.vue
src/components/mars3d/Map.vue
+24
-203
index.vue
src/views/system/shift/index.vue
+79
-33
No files found.
.env.development
View file @
e70097de
...
@@ -2,10 +2,10 @@ ENV = 'development'
...
@@ -2,10 +2,10 @@ ENV = 'development'
# 接口地址
# 接口地址
#VUE_APP_BASE_API = 'http://localhost:8000'
#VUE_APP_BASE_API = 'http://localhost:8000'
VUE_APP_BASE_API = 'http://
192.168.0.110:8001
'
VUE_APP_BASE_API = 'http://
8.143.203.103:9090
'
VUE_APP_WS_API = 'ws://192.168.0.111:8001/webSocket'
VUE_APP_WS_API = 'ws://192.168.0.111:8001/webSocket'
VUE_APP_LOCAL_API = 'http://
192.168.0.110:8001
'
VUE_APP_LOCAL_API = 'http://
8.143.203.103:9090
'
VUE_APP_LOCAL_API2 = 'http://
192.168.0.110:8001
'
VUE_APP_LOCAL_API2 = 'http://
8.143.203.103:9090
'
# 是否启用 babel-plugin-dynamic-import-node插件
# 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true
VUE_CLI_BABEL_TRANSPILE_MODULES = true
src/components/mars3d/Map.vue
View file @
e70097de
...
@@ -2,13 +2,6 @@
...
@@ -2,13 +2,6 @@
<div
style=
"wight:100%;height:100%;"
>
<div
style=
"wight:100%;height:100%;"
>
<div
:id=
"`mars3d-container$
{mapKey}`"
<div
:id=
"`mars3d-container$
{mapKey}`"
:class="['mars3d-container', customClass, { 'mars3d-container-compare-rh' : compare }]">
</div>
:class="['mars3d-container', customClass, { 'mars3d-container-compare-rh' : compare }]">
</div>
<!--
<div
class=
"infoview"
>
<el-button
type=
"primary"
@
click=
"btnStartDraw()"
>
设置围栏
</el-button>
<el-button
type=
"primary"
@
click=
"uploaded()"
>
上传围栏
</el-button>
<div
style=
"display: inline-block;color:red;font-weight:bolder;"
>
每次只允许上传一个围栏,并且围栏必须是封闭图形
</div>
</div>
-->
</div>
</div>
</
template
>
</
template
>
...
@@ -157,35 +150,6 @@ export default {
...
@@ -157,35 +150,6 @@ export default {
that
.
zuobianData
=
data1
that
.
zuobianData
=
data1
//console.log("zuobianData",that.zuobianData);
//console.log("zuobianData",that.zuobianData);
//console.log("weilanName",that.weilanName);
//console.log("weilanName",that.weilanName);
//后台获取数据——获取历史轨迹
this
.
getlishiguijiFn
();
}
})
},
//后台获取数据——获取历史轨迹
getlishiguijiFn
()
{
let
that
=
this
;
HttpReq
.
truckDispatching
.
getAllHistroyCarTrajectoryQuery
({
name
:
that
.
deviceId
}).
then
((
res
)
=>
{
//console.log('获取历史轨迹',res);
if
(
res
.
code
==
200
){
let
obj1
=
{};
let
array1
=
[];
res
.
data
.
line
.
forEach
((
item
,
index
)
=>
{
let
array2
=
[];
array2
.
push
(
item
.
location
.
x
);
array2
.
push
(
item
.
location
.
y
);
array2
.
push
(
'
500
'
);
array1
.
push
(
array2
);
})
obj1
.
name
=
res
.
data
.
name
;
obj1
.
arrays
=
array1
;
let
hisCenterData
=
[...
that
.
historyTrajectoryData
];
hisCenterData
.
push
(
obj1
);
that
.
historyTrajectoryData
=
[...
hisCenterData
];
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
appendToBody
)
{
if
(
this
.
appendToBody
)
{
document
.
body
.
appendChild
(
this
.
$el
)
document
.
body
.
appendChild
(
this
.
$el
)
...
@@ -198,60 +162,21 @@ export default {
...
@@ -198,60 +162,21 @@ export default {
})
})
}
}
})
})
}
}
})
})
},
},
//上传围栏数据
//后台获取数据——获取实时位置
uploaded
(){
getlishiguijiFn
()
{
let
newData
=
[...
this
.
toJavaCoordinates
];
let
that
=
this
;
newData
.
pop
();
HttpReq
.
truckDispatching
.
getCarTrajectoryQuery
().
then
((
res
)
=>
{
if
(
this
.
toJavaCoordinates
.
length
==
0
){
if
(
res
.
code
==
200
){
this
.
$message
({
that
.
historyTrajectoryData
=
res
.
data
;
type
:
'
warning
'
,
}
message
:
'
请绘制电子围栏
'
})
});
}
else
{
this
.
$prompt
(
'
电子围栏名称不得为空且不能与之前围栏名称重复
'
,
'
请输入电子围栏名称
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
inputErrorMessage
:
'
输入不能为空
'
,
inputValidator
:
(
value
)
=>
{
// 点击按钮时,对文本框里面的值进行验证
if
(
!
value
)
{
return
'
输入不能为空
'
;
}
},
}).
then
(({
value
})
=>
{
let
allObj
=
{};
allObj
.
name
=
value
;
allObj
.
zuobiao
=
newData
;
this
.
toJavaCoordinates
=
[];
console
.
log
(
allObj
);
//发送添加电子围栏请求
HttpReq
.
truckDispatching
.
screenMapSetUpAdd
(
allObj
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
){
this
.
$notify
({
title
:
'
上传电子围栏成功!
'
,
type
:
'
success
'
,
duration
:
2500
});
}
else
{
this
.
$notify
({
title
:
res
.
msg
,
type
:
'
error
'
,
duration
:
2500
})
}
}).
catch
(
function
(
error
)
{
});
}).
catch
(()
=>
{
this
.
$message
({
type
:
'
info
'
,
message
:
'
取消输入
'
});
});
}
},
},
//创建地图
//创建地图
initMars3d
(
options
)
{
initMars3d
(
options
)
{
let
that
=
this
;
let
that
=
this
;
...
@@ -271,81 +196,22 @@ export default {
...
@@ -271,81 +196,22 @@ export default {
//围栏回显
//围栏回显
that
.
zuobianData
.
forEach
(
function
(
item
,
index
){
that
.
zuobianData
.
forEach
(
function
(
item
,
index
){
console
.
log
(
item
);
//
console.log(item);
var
graphicLayer
=
new
mars3d
.
layer
.
GraphicLayer
();
var
graphicLayer
=
new
mars3d
.
layer
.
GraphicLayer
();
map
.
addLayer
(
graphicLayer
);
map
.
addLayer
(
graphicLayer
);
initLayerManager
(
graphicLayer
,
that
.
weilanName
[
index
]);
initLayerManager
(
graphicLayer
,
that
.
weilanName
[
index
]);
that
.
addGraphic_01
(
graphicLayer
,
item
,
that
.
weilanName
[
index
]);
that
.
addGraphic_01
(
graphicLayer
,
item
,
that
.
weilanName
[
index
]);
})
})
//历史轨迹回放
//实时位置
// that.historyTrajectoryData.forEach(function(item,index){
// var graphicLayer2 = new mars3d.layer.GraphicLayer();
// map.addLayer(graphicLayer2);
// var itemText = `
<
table
style
=
"
width: auto;
"
>
//
<
tr
>
//
<
th
scope
=
"
col
"
colspan
=
"
2
"
style
=
"
text-align:center;font-size:15px;
"
>
卡车号码:
$
{
item
.
name
}
<
/th
>
//
<
/tr
>
//
<
tr
>
//
<
td
>
名称:卡车二
<
/td
>
//
<
/tr
>
//
<
/table>`
;
// initGraphicManager(graphicLayer2,itemText);
// that.addGraphic_02(graphicLayer2,item.arrays,item.name);
// })
//创建矢量数据图层2
var
graphicLayer1
=
new
mars3d
.
layer
.
GraphicLayer
();
map
.
addLayer
(
graphicLayer1
);
var
itemText
=
`<table style="width: auto;">
<tr>
<th scope="col" colspan="2" style="text-align:center;font-size:15px;">卡车号码:鲁K12345</th>
</tr>
<tr>
<td>名称:卡车一</td>
</tr>
</table>`
;
initGraphicManager
(
graphicLayer1
,
itemText
);
//that.addGraphic_02(graphicLayer1,this.persons,'卡车一');
//创建矢量数据图层4
var
graphicLayer4
=
new
mars3d
.
layer
.
GraphicLayer
();
var
graphicLayer4
=
new
mars3d
.
layer
.
GraphicLayer
();
map
.
addLayer
(
graphicLayer4
)
map
.
addLayer
(
graphicLayer4
)
that
.
addDemoGraphics
(
graphicLayer4
);
//that.addDemoGraphics(graphicLayer4);
// 抛出事件
// 抛出事件
this
.
$emit
(
'
onload
'
,
map
)
this
.
$emit
(
'
onload
'
,
map
)
},
},
//围栏设置
btnStartDraw
(){
this
.
toJavaCoordinates
=
[];
let
that
=
this
;
var
graphicLayer3
=
new
mars3d
.
layer
.
GraphicLayer
();
graphicLayer3
.
on
(
mars3d
.
EventType
.
click
,
function
(
event
)
{
var
mpt
=
mars3d
.
LatLngPoint
.
fromCartesian
(
event
.
cartesian
);
that
.
toJavaCoordinates
.
push
(
mpt
.
toString
().
split
(
'
,
'
));
console
.
log
(
that
.
toJavaCoordinates
);
});
map
.
addLayer
(
graphicLayer3
);
initLayerManager
(
graphicLayer3
);
graphicLayer3
.
startDraw
({
type
:
"
polyline
"
,
style
:
{
color
:
"
red
"
,
width
:
5
,
clampToGround
:
false
,
label
:
{
text
:
"
围栏区域
"
,
font_size
:
18
,
color
:
"
#ffffff
"
,
distanceDisplayCondition
:
true
,
distanceDisplayCondition_far
:
500000
,
distanceDisplayCondition_near
:
0
,
},
},
});
},
//围栏回显
//围栏回显
addGraphic_01
(
graphicLayer
,
positions
,
weilanName
){
addGraphic_01
(
graphicLayer
,
positions
,
weilanName
){
let
graphic
=
new
mars3d
.
graphic
.
PolygonEntity
({
let
graphic
=
new
mars3d
.
graphic
.
PolygonEntity
({
...
@@ -368,54 +234,6 @@ export default {
...
@@ -368,54 +234,6 @@ export default {
});
});
graphicLayer
.
addGraphic
(
graphic
);
//还可以另外一种写法: graphic.addTo(graphicLayer)
graphicLayer
.
addGraphic
(
graphic
);
//还可以另外一种写法: graphic.addTo(graphicLayer)
},
},
//车辆轨迹
addGraphic_02
(
graphicLayer1
,
positions
,
truckName
)
{
var
property
=
new
Cesium
.
SampledPositionProperty
();
var
tempTime
;
//起点
tempTime
=
map
.
clock
.
currentTime
;
//开始时间
property
.
addSample
(
tempTime
,
Cesium
.
Cartesian3
.
fromDegrees
(
positions
[
0
][
0
],
positions
[
0
][
1
],
positions
[
0
][
2
]));
for
(
let
i
=
1
;
i
<
positions
.
length
;
i
++
){
tempTime
=
Cesium
.
JulianDate
.
addSeconds
(
tempTime
,
120
,
new
Cesium
.
JulianDate
());
property
.
addSample
(
tempTime
,
Cesium
.
Cartesian3
.
fromDegrees
(
positions
[
i
][
0
],
positions
[
i
][
1
],
positions
[
i
][
2
],));
}
var
graphic
=
new
mars3d
.
graphic
.
PathEntity
({
position
:
property
,
style
:
{
width
:
3
,
color
:
"
#8a2e3b
"
,
opacity
:
1.0
,
leadTime
:
0
,
// 前方的路线不显示
//高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
highlight
:
{
type
:
mars3d
.
EventType
.
click
,
color
:
"
#ff0000
"
,
},
},
label
:
{
text
:
truckName
,
font_size
:
19
,
font_family
:
"
楷体
"
,
color
:
Cesium
.
Color
.
AZURE
,
outline
:
true
,
outlineColor
:
Cesium
.
Color
.
BLACK
,
outlineWidth
:
2
,
horizontalOrigin
:
Cesium
.
HorizontalOrigin
.
CENTER
,
verticalOrigin
:
Cesium
.
VerticalOrigin
.
BOTTOM
,
pixelOffset
:
new
Cesium
.
Cartesian2
(
10
,
-
25
),
//偏移量
},
model
:
{
url
:
"
//data.mars3d.cn/gltf/mars/car/tufangche.glb
"
,
scale
:
0.1
,
minimumPixelSize
:
50
,
},
});
graphicLayer1
.
addGraphic
(
graphic
);
//还可以另外一种写法: graphic.addTo(graphicLayer)
},
getSampledPositionProperty
(
points
){
getSampledPositionProperty
(
points
){
let
property
=
new
Cesium
.
SampledPositionProperty
();
let
property
=
new
Cesium
.
SampledPositionProperty
();
let
start
=
this
.
map
.
clock
.
currentTime
;
let
start
=
this
.
map
.
clock
.
currentTime
;
...
@@ -427,8 +245,10 @@ export default {
...
@@ -427,8 +245,10 @@ export default {
}
}
return
property
;
return
property
;
},
},
//实时位置
addDemoGraphics
(
graphicLayer4
)
{
addDemoGraphics
(
graphicLayer4
)
{
let
that
=
this
;
let
that
=
this
;
for
(
let
i
=
0
;
i
<
1
;
i
++
)
{
for
(
let
i
=
0
;
i
<
1
;
i
++
)
{
const
graphic
=
new
mars3d
.
graphic
.
ModelPrimitive
({
const
graphic
=
new
mars3d
.
graphic
.
ModelPrimitive
({
style
:
{
style
:
{
...
@@ -478,11 +298,12 @@ export default {
...
@@ -478,11 +298,12 @@ export default {
},
},
// 取区域内的随机点
// 取区域内的随机点
randomPoint
()
{
randomPoint
()
{
const
jd
=
this
.
random
(
117.130666
*
1000
,
117.130241
*
1000
)
/
1000
this
.
getlishiguijiFn
()
const
wd
=
this
.
random
(
36.655207
*
1000
,
36.665207
*
1000
)
/
1000
// const jd = this.random(117.130666 * 1000, 117.130241 * 1000) / 1000
console
.
log
(
"
jd
"
,
jd
);
// const wd = this.random(36.655207 * 1000, 36.665207 * 1000) / 1000
console
.
log
(
"
wd
"
,
wd
);
// console.log("jd",jd);
return
Cesium
.
Cartesian3
.
fromDegrees
(
jd
,
wd
,
500
)
// console.log("wd",wd);
// return Cesium.Cartesian3.fromDegrees(jd, wd, 500)
},
},
random
(
min
,
max
)
{
random
(
min
,
max
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
+
1
)
+
min
)
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
+
1
)
+
min
)
...
...
src/views/system/shift/index.vue
View file @
e70097de
...
@@ -21,8 +21,8 @@
...
@@ -21,8 +21,8 @@
<div
class=
"content"
>
<div
class=
"content"
>
<el-table
:data=
"tableData"
v-loading=
"loading"
border
style=
"width:auto"
:row-class-name=
"tableRowClassName"
>
<el-table
:data=
"tableData"
v-loading=
"loading"
border
style=
"width:auto"
:row-class-name=
"tableRowClassName"
>
<el-table-column
prop=
"banci"
label=
"班次"
align=
"center"
></el-table-column>
<el-table-column
prop=
"banci"
label=
"班次"
align=
"center"
></el-table-column>
<el-table-column
prop=
"startTime"
label=
"开始时间"
align=
"center"
></el-table-column>
<el-table-column
prop=
"startTime"
label=
"开始时间"
align=
"center"
:formatter=
"currentTime1"
></el-table-column>
<el-table-column
prop=
"endTime"
label=
"结束时间"
align=
"center"
></el-table-column>
<el-table-column
prop=
"endTime"
label=
"结束时间"
align=
"center"
:formatter=
"currentTime2"
></el-table-column>
<el-table-column
label=
"操作"
align=
"center"
fixed=
"right"
>
<el-table-column
label=
"操作"
align=
"center"
fixed=
"right"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<el-button
size=
"mini"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"toEdit(scope.row)"
></el-button>
<el-button
size=
"mini"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"toEdit(scope.row)"
></el-button>
...
@@ -45,10 +45,10 @@
...
@@ -45,10 +45,10 @@
<el-input
v-model=
"form.item.banci"
style=
"width:220px;"
placeholder=
"请输入班次"
/>
<el-input
v-model=
"form.item.banci"
style=
"width:220px;"
placeholder=
"请输入班次"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"开始时间"
prop=
"startTime"
>
<el-form-item
label=
"开始时间"
prop=
"startTime"
>
<el-
time-picker
v-model=
"form.item.startTime"
placeholder=
"任意时间点"
></el-tim
e-picker>
<el-
date-picker
type=
"datetime"
v-model=
"form.item.startTime"
placeholder=
"任意时间点"
></el-dat
e-picker>
</el-form-item>
</el-form-item>
<el-form-item
label=
"结束时间"
prop=
"endTime"
>
<el-form-item
label=
"结束时间"
prop=
"endTime"
>
<el-
time-picker
v-model=
"form.item.endTime"
placeholder=
"任意时间点"
></el-tim
e-picker>
<el-
date-picker
type=
"datetime"
v-model=
"form.item.endTime"
placeholder=
"任意时间点"
></el-dat
e-picker>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
@@ -77,8 +77,8 @@ export default {
...
@@ -77,8 +77,8 @@ export default {
tableData
:
[],
tableData
:
[],
form
:
{
form
:
{
title
:
'
新增班次
'
,
title
:
'
新增班次
'
,
visible
:
false
,
visible
:
false
,
reqType
:
'
add
'
,
reqType
:
'
add
'
,
status
:{
cu
:
0
},
status
:{
cu
:
0
},
item
:{},
item
:{},
},
},
...
@@ -158,8 +158,8 @@ export default {
...
@@ -158,8 +158,8 @@ export default {
this
.
form
.
status
.
cu
=
0
;
this
.
form
.
status
.
cu
=
0
;
this
.
form
.
visible
=
true
;
this
.
form
.
visible
=
true
;
this
.
form
.
item
=
{...
item
};
this
.
form
.
item
=
{...
item
};
this
.
form
.
item
.
startTime
=
''
;
this
.
form
.
item
.
startTime
=
''
;
this
.
form
.
item
.
endTime
=
''
;
this
.
form
.
item
.
endTime
=
''
;
this
.
form
.
reqType
=
'
edit
'
;
this
.
form
.
reqType
=
'
edit
'
;
this
.
ShiftId
=
this
.
form
.
item
.
id
;
this
.
ShiftId
=
this
.
form
.
item
.
id
;
},
},
...
@@ -202,8 +202,8 @@ export default {
...
@@ -202,8 +202,8 @@ export default {
//新增班次
//新增班次
reqAddItem
(
form
,
item
){
reqAddItem
(
form
,
item
){
let
lastData
=
{...
item
};
let
lastData
=
{...
item
};
lastData
.
startTime
=
this
.
currentTime
(
lastData
.
startTime
)
;
lastData
.
startTime
=
lastData
.
startTime
;
lastData
.
endTime
=
this
.
currentTime
(
lastData
.
endTime
)
;
lastData
.
endTime
=
lastData
.
endTime
;
HttpReq
.
truckDispatching
.
shiftAdd
(
lastData
).
then
((
res
)
=>
{
HttpReq
.
truckDispatching
.
shiftAdd
(
lastData
).
then
((
res
)
=>
{
form
.
visible
=
false
;
form
.
visible
=
false
;
if
(
res
.
code
==
200
){
if
(
res
.
code
==
200
){
...
@@ -227,8 +227,8 @@ export default {
...
@@ -227,8 +227,8 @@ export default {
//修改班次
//修改班次
reqUpdateItem
(
form
,
item
){
reqUpdateItem
(
form
,
item
){
let
lastData
=
{...
item
};
let
lastData
=
{...
item
};
lastData
.
startTime
=
this
.
currentTime
(
lastData
.
startTime
)
;
lastData
.
startTime
=
lastData
.
startTime
;
lastData
.
endTime
=
this
.
currentTime
(
lastData
.
endTime
)
;
lastData
.
endTime
=
lastData
.
endTime
;
lastData
.
id
=
this
.
ShiftId
;
lastData
.
id
=
this
.
ShiftId
;
HttpReq
.
truckDispatching
.
shiftUpdate
(
lastData
).
then
((
res
)
=>
{
HttpReq
.
truckDispatching
.
shiftUpdate
(
lastData
).
then
((
res
)
=>
{
form
.
visible
=
false
;
form
.
visible
=
false
;
...
@@ -269,27 +269,73 @@ export default {
...
@@ -269,27 +269,73 @@ export default {
this
.
loadData
();
this
.
loadData
();
})
})
},
},
//转换时间
//转换时间
currentTime
(
time
){
currentTime1
(
row
){
var
date
=
new
Date
(
time
);
var
date
=
new
Date
(
row
.
startTime
);
var
hours
=
date
.
getHours
();
//小时 ,返回 Date 对象的小时 (0 ~ 23)
var
year
=
date
.
getFullYear
();
//年 ,从 Date 对象以四位数字返回年份
var
minutes
=
date
.
getMinutes
();
//分钟 ,返回 Date 对象的分钟 (0 ~ 59)
var
month
=
date
.
getMonth
()
+
1
;
//月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
var
seconds
=
date
.
getSeconds
();
//秒 ,返回 Date 对象的秒数 (0 ~ 59)
var
day
=
date
.
getDate
();
//日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
//修改小时格式
var
hours
=
date
.
getHours
();
//小时 ,返回 Date 对象的小时 (0 ~ 23)
if
(
hours
>=
0
&&
hours
<=
9
)
{
var
minutes
=
date
.
getMinutes
();
//分钟 ,返回 Date 对象的分钟 (0 ~ 59)
hours
=
"
0
"
+
hours
;
var
seconds
=
date
.
getSeconds
();
//秒 ,返回 Date 对象的秒数 (0 ~ 59)
}
//修改月份格式
//修改分钟格式
if
(
month
>=
1
&&
month
<=
9
)
{
if
(
minutes
>=
0
&&
minutes
<=
9
)
{
month
=
"
0
"
+
month
;
minutes
=
"
0
"
+
minutes
;
}
}
//修改日期格式
//修改秒格式
if
(
day
>=
0
&&
day
<=
9
)
{
if
(
seconds
>=
0
&&
seconds
<=
9
)
{
day
=
"
0
"
+
day
;
seconds
=
"
0
"
+
seconds
;
}
}
//修改小时格式
let
currentFormatDate
=
hours
+
"
:
"
+
minutes
+
"
:
"
+
seconds
;
if
(
hours
>=
0
&&
hours
<=
9
)
{
return
currentFormatDate
;
hours
=
"
0
"
+
hours
;
},
}
//修改分钟格式
if
(
minutes
>=
0
&&
minutes
<=
9
)
{
minutes
=
"
0
"
+
minutes
;
}
//修改秒格式
if
(
seconds
>=
0
&&
seconds
<=
9
)
{
seconds
=
"
0
"
+
seconds
;
}
//获取当前系统时间 格式(yyyy-mm-dd hh:mm:ss)
let
currentFormatDate
=
year
+
"
-
"
+
month
+
"
-
"
+
day
+
"
"
+
hours
+
"
:
"
+
minutes
+
"
:
"
+
seconds
;
//console.log(currentFormatDate);
return
currentFormatDate
;
},
currentTime2
(
row
){
var
date
=
new
Date
(
row
.
endTime
);
var
year
=
date
.
getFullYear
();
//年 ,从 Date 对象以四位数字返回年份
var
month
=
date
.
getMonth
()
+
1
;
//月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
var
day
=
date
.
getDate
();
//日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
var
hours
=
date
.
getHours
();
//小时 ,返回 Date 对象的小时 (0 ~ 23)
var
minutes
=
date
.
getMinutes
();
//分钟 ,返回 Date 对象的分钟 (0 ~ 59)
var
seconds
=
date
.
getSeconds
();
//秒 ,返回 Date 对象的秒数 (0 ~ 59)
//修改月份格式
if
(
month
>=
1
&&
month
<=
9
)
{
month
=
"
0
"
+
month
;
}
//修改日期格式
if
(
day
>=
0
&&
day
<=
9
)
{
day
=
"
0
"
+
day
;
}
//修改小时格式
if
(
hours
>=
0
&&
hours
<=
9
)
{
hours
=
"
0
"
+
hours
;
}
//修改分钟格式
if
(
minutes
>=
0
&&
minutes
<=
9
)
{
minutes
=
"
0
"
+
minutes
;
}
//修改秒格式
if
(
seconds
>=
0
&&
seconds
<=
9
)
{
seconds
=
"
0
"
+
seconds
;
}
//获取当前系统时间 格式(yyyy-mm-dd hh:mm:ss)
let
currentFormatDate
=
year
+
"
-
"
+
month
+
"
-
"
+
day
+
"
"
+
hours
+
"
:
"
+
minutes
+
"
:
"
+
seconds
;
//console.log(currentFormatDate);
return
currentFormatDate
;
},
}
}
}
}
</
script
>
</
script
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment