Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
micro_app
gk
Commits
7cfd95c8
Commit
7cfd95c8
authored
Jul 16, 2021
by
duandi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
智能步道功能添加,项目打包配置修改
parent
f84952e9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
702 additions
and
16 deletions
+702
-16
pom.xml
pom.xml
+18
-1
CmptCheckPointDis.java
...om/dlbridge/jadp/plugins/cmpt/bean/CmptCheckPointDis.java
+28
-0
CmptCheckPointDisMapper.java
...jadp/plugins/cmpt/dao/mapper/CmptCheckPointDisMapper.java
+19
-0
CmptCheckPointDisMapper.xml
.../jadp/plugins/cmpt/dao/mapper/CmptCheckPointDisMapper.xml
+68
-0
CmptCheckPointDisService.java
...e/jadp/plugins/cmpt/service/CmptCheckPointDisService.java
+41
-0
RoadController.java
...va/com/dlbridge/jadp/plugins/cmpt/web/RoadController.java
+21
-0
GeetestLib.java
...in/java/com/dlbridge/jadp/plugins/geetest/GeetestLib.java
+351
-0
application-dev.properties
src/main/resources/application-dev.properties
+3
-3
bootstrap.yml
src/main/resources/bootstrap.yml
+5
-5
sdk-java-3.3.2.jar
src/main/webapp/WEB-INF/lib/sdk-java-3.3.2.jar
+0
-0
road.jsp
src/main/webapp/WEB-INF/views/cmpt/road.jsp
+59
-4
score_review.jsp
src/main/webapp/WEB-INF/views/cmpt/score_review.jsp
+1
-0
road.css
src/main/webapp/static/cmpt/road.css
+3
-2
road-new.js
src/main/webapp/static/js/road-new.js
+85
-1
No files found.
pom.xml
View file @
7cfd95c8
...
...
@@ -372,6 +372,8 @@
<groupId>
com.qiyuesuo.sdk
</groupId>
<artifactId>
sdk-java
</artifactId>
<version>
3.3.2
</version>
<scope>
system
</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/sdk-java-3.3.2.jar
</systemPath>
</dependency>
<dependency>
<groupId>
com.neusoft.shg3.service
</groupId>
...
...
@@ -409,10 +411,18 @@
<build>
<finalName>
gksite
</finalName>
<resources>
<resource>
<directory>
src/main/resources
</directory>
<includes>
<include>
**/*.*
</include>
</includes>
</resource>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.xml
</include>
<include>
**/*.properties
</include>
<include>
**/*.yml
</include>
</includes>
</resource>
<resource>
...
...
@@ -420,6 +430,13 @@
<!--注意此次必须要放在此目录下才能被访问到 -->
<targetPath>
META-INF/resources
</targetPath>
</resource>
<resource>
<directory>
src/main/webapp/WEB-INF/lib
</directory>
<targetPath>
/BOOT-INF/lib/
</targetPath>
<includes>
<include>
**/*.jar
</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
...
...
@@ -441,4 +458,4 @@
</plugins>
</build>
</project>
\ No newline at end of file
</project>
src/main/java/com/dlbridge/jadp/plugins/cmpt/bean/CmptCheckPointDis.java
0 → 100644
View file @
7cfd95c8
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
bean
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
CmptCheckPointDis
{
private
Integer
id
;
private
Integer
cmptId
;
private
Integer
roadId
;
private
String
disPoint
;
private
String
disPointName
;
private
Integer
distance
;
private
String
isDelete
;
private
Date
createTime
;
private
Date
updateTime
;
}
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/CmptCheckPointDisMapper.java
0 → 100644
View file @
7cfd95c8
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
dao
.
mapper
;
import
com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis
;
import
java.util.List
;
public
interface
CmptCheckPointDisMapper
{
List
<
CmptCheckPointDis
>
queryList
(
CmptCheckPointDis
cmptCheckPointDis
);
void
save
(
CmptCheckPointDis
cmptCheckPointDis
);
void
update
(
CmptCheckPointDis
cmptCheckPointDis
);
void
deleteByRoadId
(
Integer
roadId
);
int
isExistByRoadAndPoint
(
CmptCheckPointDis
cmptCheckPointDis
);
}
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/CmptCheckPointDisMapper.xml
0 → 100644
View file @
7cfd95c8
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptCheckPointDisMapper"
>
<resultMap
id=
"baseMap"
type=
"com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"cmptId"
property=
"cmptId"
/>
<result
column=
"roadId"
property=
"roadId"
/>
<result
column=
"dis_point"
property=
"disPoint"
/>
<result
column=
"dis_point_name"
property=
"disPointName"
/>
<result
column=
"distance"
property=
"distance"
/>
<result
column=
"is_delete"
property=
"isDelete"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<select
id=
"queryList"
parameterType=
"com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis"
resultMap=
"baseMap"
>
select d.id ,
d.cmptId,
d.roadId,
d.dis_point,
d.distance,
d.is_delete,
d.create_time,
d.update_time,
(select GROUP_CONCAT(t.name order by t.checkpoint_id SEPARATOR '-') from gk_cmpt_score_checkpoint t where t.checkpoint_id in (CAST(SUBSTRING_INDEX(d.dis_point,'-',1) AS SIGNED),CAST(SUBSTRING_INDEX(d.dis_point,'-',-1) AS SIGNED)) ) as dis_point_name
from gk_cmpt_checkpoint_dis d
<where>
<if
test=
"id != null"
>
and id = #{id}
</if>
<if
test=
"cmptId != null"
>
and cmptId = #{cmptId}
</if>
<if
test=
"roadId != null"
>
and roadId = #{roadId}
</if>
<if
test=
"disPoint != null and disPoint != ''"
>
and dis_point = #{disPoint}
</if>
<if
test=
"distance != null"
>
and distance = #{distance}
</if>
<if
test=
"isDelete != null and isDelete != ''"
>
and is_delete = #{isDelete}
</if>
</where>
</select>
<update
id=
"update"
parameterType=
"com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis"
>
update gk_cmpt_checkpoint_dis set distance = #{distance}, update_time = now()
where roadId = #{roadId}
and dis_point = #{disPoint}
and is_delete = '0'
</update>
<update
id=
"save"
parameterType=
"com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis"
>
insert into gk_cmpt_checkpoint_dis values (null, #{cmptId}, #{roadId}, #{disPoint} , #{distance}, '0', now(), null)
</update>
<delete
id=
"deleteByRoadId"
parameterType=
"int"
>
update gk_cmpt_checkpoint_dis set is_delete = '1'
where roadId = #{roadId}
</delete>
<select
id=
"isExistByRoadAndPoint"
parameterType=
"com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis"
resultType=
"int"
>
select count(1) from gk_cmpt_checkpoint_dis where is_delete= '0' and roadId = #{roadId} and dis_point = #{disPoint}
</select>
</mapper>
src/main/java/com/dlbridge/jadp/plugins/cmpt/service/CmptCheckPointDisService.java
0 → 100644
View file @
7cfd95c8
package
com
.
dlbridge
.
jadp
.
plugins
.
cmpt
.
service
;
import
com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis
;
import
com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptCheckPointDisMapper
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* 智能步道接口
*/
@Service
@Log4j2
public
class
CmptCheckPointDisService
{
@Resource
private
CmptCheckPointDisMapper
cmptCheckPointDisMapper
;
public
List
<
CmptCheckPointDis
>
queryList
(
CmptCheckPointDis
cmptCheckPointDis
)
{
cmptCheckPointDis
.
setIsDelete
(
"0"
);
return
cmptCheckPointDisMapper
.
queryList
(
cmptCheckPointDis
);
}
public
void
saveOrUpdate
(
List
<
CmptCheckPointDis
>
list
)
{
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
for
(
CmptCheckPointDis
item:
list
)
{
if
(
cmptCheckPointDisMapper
.
isExistByRoadAndPoint
(
item
)>
0
)
{
// 存在
cmptCheckPointDisMapper
.
update
(
item
);
}
else
{
cmptCheckPointDisMapper
.
save
(
item
);
}
}
}
}
public
void
deleteByRoad
(
Integer
roadId
)
{
cmptCheckPointDisMapper
.
deleteByRoadId
(
roadId
);
}
}
src/main/java/com/dlbridge/jadp/plugins/cmpt/web/RoadController.java
View file @
7cfd95c8
...
...
@@ -5,9 +5,11 @@ import com.alibaba.fastjson.JSONObject;
import
com.dlbridge.feign.GeexekScoreService
;
import
com.dlbridge.feign.bean.CmptScoreCheckpoint
;
import
com.dlbridge.jadp.common.interceptor.PageView
;
import
com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis
;
import
com.dlbridge.jadp.plugins.cmpt.bean.Road
;
import
com.dlbridge.jadp.plugins.cmpt.bean.RoadGpsPoint
;
import
com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt
;
import
com.dlbridge.jadp.plugins.cmpt.service.CmptCheckPointDisService
;
import
com.dlbridge.jadp.plugins.cmpt.service.CmptService
;
import
com.dlbridge.jadp.plugins.cmpt.service.RoadService
;
import
com.neusoft.www.utils.web.Result
;
...
...
@@ -39,6 +41,9 @@ public class RoadController {
@Resource
GeexekScoreService
geexekScoreService
;
@Resource
private
CmptCheckPointDisService
cmptCheckPointDisService
;
@RequestMapping
(
"index/{cmptId}"
)
@PageView
public
ModelAndView
index
(
@PathVariable
(
"cmptId"
)
Integer
cmptId
,
ModelAndView
mv
)
{
...
...
@@ -100,6 +105,8 @@ public class RoadController {
}
geexekScoreService
.
batchInsert
(
list
);
int
count
=
roadService
.
saveOrUpdate
(
road
);
// 删除智能步道数据
cmptCheckPointDisService
.
deleteByRoad
(
road
.
getRoadId
());
return
Result
.
success
().
setContent
(
road
);
}
...
...
@@ -131,4 +138,18 @@ public class RoadController {
return
Result
.
success
().
setContent
(
gps
);
}
@RequestMapping
(
"getCpDis/{roadId}"
)
@ResponseBody
public
Result
getCpDis
(
@PathVariable
(
"roadId"
)
Integer
roadId
)
{
CmptCheckPointDis
cmptCheckPointDis
=
new
CmptCheckPointDis
();
cmptCheckPointDis
.
setRoadId
(
roadId
);
return
Result
.
success
().
setContent
(
cmptCheckPointDisService
.
queryList
(
cmptCheckPointDis
));
}
@RequestMapping
(
"saveCpDis"
)
@ResponseBody
public
Result
saveCpDis
(
@RequestBody
ArrayList
<
CmptCheckPointDis
>
cpDisList
)
{
cmptCheckPointDisService
.
saveOrUpdate
(
cpDisList
);
return
Result
.
success
();
}
}
src/main/java/com/dlbridge/jadp/plugins/geetest/GeetestLib.java
0 → 100644
View file @
7cfd95c8
This diff is collapsed.
Click to expand it.
src/main/resources/application-dev.properties
View file @
7cfd95c8
...
...
@@ -48,7 +48,7 @@ spring.data.web.pageable.max-page-size=100
weixin.micro.appid
=
wx96ce27826f39cdb3
weixin.micro.secret
=
11bfc4902e7c992b57a2cdcfeded623f
geexek.user.url
=
https://test.geexek.com.cn/
geexek.cmpt.url
=
http
s
://testtimerbackend.geexek.cn/
geexek.cmpt.url
=
http://testtimerbackend.geexek.cn/
geexek.shamus.url
=
http://shamus.geexek.com.cn/
timer.url
=
http://testtimer.geexek.cn/
...
...
@@ -98,7 +98,7 @@ spring.cloud.sentinel.skip-keys=cmptId
spring.cloud.sentinel.exclude-urls
=
/static/**,**.css,**.js
## nacos 地址
spring.cloud.sentinel.datasource.ds.nacos.server-addr
=
192.168.
0.100
:8848
spring.cloud.sentinel.datasource.ds.nacos.server-addr
=
192.168.
31.133
:8848
spring.cloud.sentinel.datasource.ds.nacos.dataId
=
micro-gksite-sentinel
spring.cloud.sentinel.datasource.ds.nacos.data-type
=
json
spring.cloud.sentinel.datasource.ds.nacos.groupId
=
dev
...
...
@@ -116,4 +116,4 @@ lock.accessSecret=W6PysadsbPppDfts18ukZBUJ2GPkQZ
lock.categoryId
=
2816977402314363323
lock.companyReceiver
=
18201908070
upload.rmi
=
rmi://172.16.214.236:9125/RMIUpload
\ No newline at end of file
upload.rmi
=
rmi://172.16.214.236:9125/RMIUpload
src/main/resources/bootstrap.yml
View file @
7cfd95c8
...
...
@@ -4,11 +4,11 @@ spring:
cloud
:
nacos
:
config
:
server-addr
:
http://192.168.
0.100
:8848
server-addr
:
http://192.168.
31.133
:8848
file-extension
:
properties
group
:
dev
namespace
:
187c2f4d-80c2-4a67-b4e5-319d5c9151d1
server-addr
:
http://192.168.
0.100
:8848
server-addr
:
http://192.168.
31.133
:8848
discovery
:
group
:
dev
namespace
:
187c2f4d-80c2-4a67-b4e5-319d5c9151d1
...
...
@@ -18,11 +18,11 @@ spring:
cloud
:
nacos
:
config
:
server-addr
:
http://192.168.
0.100
:8848
server-addr
:
http://192.168.
31.133
:8848
file-extension
:
properties
group
:
dev
namespace
:
187c2f4d-80c2-4a67-b4e5-319d5c9151d1
server-addr
:
http://192.168.
0.100
:8848
server-addr
:
http://192.168.
31.133
:8848
discovery
:
group
:
dev
namespace
:
187c2f4d-80c2-4a67-b4e5-319d5c9151d1
...
...
@@ -53,4 +53,4 @@ spring:
server-addr
:
http://172.16.214.237:9848,http://172.16.214.241:9848,http://172.16.214.242:9848
discovery
:
group
:
production
namespace
:
1bc7c9a2-3cd3-4223-bf3d-17c10a8a501b
\ No newline at end of file
namespace
:
1bc7c9a2-3cd3-4223-bf3d-17c10a8a501b
src/main/webapp/WEB-INF/lib/sdk-java-3.3.2.jar
0 → 100644
View file @
7cfd95c8
File added
src/main/webapp/WEB-INF/views/cmpt/road.jsp
View file @
7cfd95c8
...
...
@@ -32,7 +32,18 @@
<script
type=
"text/javascript"
src=
"${ctxStatic}/leaflet/label.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
src=
"${ctxStatic}/layer/layer.js"
></script>
<link
rel=
"stylesheet"
href=
"${ctxStatic}/layer/skin/layer.css"
>
<script
src=
"${ctxStatic}/newdermon/vendor/bootstrap/js/bootstrap.js"
></script>
</head>
<style
type=
"text/css"
>
.editCpDis-box
{
display
:
flex
;
justify-content
:
space-around
;
margin
:
8px
;
}
.dis-name
{
line-height
:
2rem
;
}
</style>
<body>
<jsp:include
page=
"../common/header.jsp"
></jsp:include>
<div
class=
"page-content d-flex align-items-stretch main-body"
>
...
...
@@ -92,12 +103,15 @@
</div>
<div
class=
"map-title"
>
<div
class=
"flex flex-column"
>
<input
type=
"hidden"
id=
"roadId"
>
<span
id=
"roadName"
></span>
<span
id=
"gpsName"
></span>
</div>
<span
class=
"btn right upload"
>
载入路线
</span>
<input
type=
"file"
id=
"route-file"
style=
"display: none;"
onchange=
"uploadFile(this)"
>
<div
class=
"right"
>
<button
type=
"button"
class=
"btn upload"
>
载入路线
</button>
<input
type=
"file"
id=
"route-file"
style=
"display: none;"
onchange=
"uploadFile(this)"
>
<button
type=
"button"
id=
"editCpDisBtn"
class=
"btn"
data-toggle=
"modal"
data-target=
"#editCpDis"
style=
"display: none;"
>
点位距离设置
</button>
</div>
</div>
<div
id=
"map"
class=
"map"
></div>
...
...
@@ -128,7 +142,48 @@
</div>
</div>
<div
class=
"modal fade"
id=
"editCpDis"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"editCpDisLabel"
style=
"z-index: 9999999;"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
style=
"display: block;"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<h4
class=
"modal-title"
id=
"editCpDisLabel"
>
间距设置(单位:KM)
</h4>
</div>
<div
class=
"modal-body"
>
<div
id=
"editCpDis-list"
>
<%-- <div class="editCpDis-box">--%>
<%-- <div class="dis-name">--%>
<%-- 计时点1-计时点2--%>
<%-- </div>--%>
<%-- <div class="dis-input">--%>
<%-- <input type="number" name="" placeholder="单位:M" step="1" class="form-control"/>--%>
<%-- </div>--%>
<%-- </div>--%>
<%-- <div class="editCpDis-box">--%>
<%-- <div class="dis-name">--%>
<%-- 计时点1-计时--%>
<%-- </div>--%>
<%-- <div class="dis-input">--%>
<%-- <input type="number" name="" placeholder="单位:M" step="1" class="form-control"/>--%>
<%-- </div>--%>
<%-- </div>--%>
<%-- <div class="editCpDis-box">--%>
<%-- <div class="dis-name">--%>
<%-- 计时点1-计时点2121121--%>
<%-- </div>--%>
<%-- <div class="dis-input">--%>
<%-- <input type="number" name="" placeholder="单位:M" step="1" class="form-control"/>--%>
<%-- </div>--%>
<%-- </div>--%>
</div>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
关闭
</button>
<button
type=
"button"
class=
"btn btn-primary"
onclick=
"saveCpDis()"
>
保存
</button>
</div>
</div>
</div>
</div>
</body>
<script
type=
"text/javascript"
src=
"${ctxStatic}/js/road-new.js"
></script>
</html>
src/main/webapp/WEB-INF/views/cmpt/score_review.jsp
View file @
7cfd95c8
...
...
@@ -99,6 +99,7 @@
<option
value=
"1"
selected
>
提交成绩
</option>
<option
value=
"2"
>
扫码打卡
</option>
<option
value=
"3"
>
自动打卡
</option>
<option
value=
"6"
>
智能步道
</option>
</select>
<span
class=
"down-arrow"
></span>
</div>
...
...
src/main/webapp/static/cmpt/road.css
View file @
7cfd95c8
...
...
@@ -268,7 +268,8 @@
/* cursor: pointer;*/
/*}*/
.cp-div
{
width
:
48px
;
width
:
max-content
;
min-width
:
48px
;
height
:
26px
;
background-color
:
#e54b3b
;
border-radius
:
5px
;
...
...
@@ -277,4 +278,4 @@
text-align
:
center
;
line-height
:
26px
;
overflow
:
hidden
;
}
\ No newline at end of file
}
src/main/webapp/static/js/road-new.js
View file @
7cfd95c8
...
...
@@ -66,6 +66,7 @@ $(document).ready(function () {
success
:
function
(
data
)
{
if
(
data
.
code
==
200
){
layer
.
msg
(
'保存成功'
,
{
icon
:
1
,
time
:
1500
});
getPath
(
$
(
"#roadId"
).
val
());
}
},
error
:
function
()
{
layer
.
msg
(
'操作失败'
,
{
icon
:
5
,
time
:
1500
});
...
...
@@ -102,6 +103,7 @@ $(document).ready(function () {
}
$
(
'.map-container'
).
css
(
'transform'
,
'none'
);
$
(
'.map-container'
).
attr
(
'data-id'
,
id
);
$
(
'#roadId'
).
val
(
id
);
$
(
'.force'
).
hide
();
/*$.ajax({
url: '/gk/road/save',
...
...
@@ -153,7 +155,7 @@ $(document).ready(function () {
function
uploadFile
(
obj
)
{
var
reads
=
new
FileReader
();
logoFile
=
obj
.
files
[
0
];
var
dataId
=
$
(
obj
).
parent
().
parent
().
attr
(
'data-id'
);
var
dataId
=
$
(
obj
).
parent
().
parent
().
parent
().
attr
(
'data-id'
);
reads
.
readAsDataURL
(
logoFile
);
reads
.
onload
=
function
(
e
)
{
//将处理完的图片文件上传到阿里云服务器
...
...
@@ -317,6 +319,10 @@ function getPlaceMakers(roadId) {
if
(
data
.
code
==
200
){
$
(
'.markers .marker'
).
remove
();
$
(
'.markers-edit .marker'
).
remove
();
// 智能步道
$
(
"#editCpDisBtn"
).
css
(
"display"
,
"none"
);
var
editCpDisHtml
=
""
;
if
(
data
.
content
.
length
==
0
){
layer
.
msg
(
"没有标记点,请导入有标记点的路线,以免影响您的后续使用!"
);
return
...
...
@@ -337,7 +343,85 @@ function getPlaceMakers(roadId) {
'<input data-before="'
+
e
.
name
+
'" type="text" value="'
+
e
.
name
+
'">'
+
'<input type="number" value="'
+
((
e
.
distance
===
''
||
e
.
distance
==
null
)?
"0"
:
Number
(
e
.
distance
/
1000
).
toFixed
(
3
))
+
'" placeholder="单位:KM">'
+
'<input type="checkbox" '
+
(
e
.
isTime
?
"checked=checked"
:
""
)
+
'></div>'
);
for
(
let
j
=
0
;
j
<
data
.
content
.
length
;
j
++
)
{
if
(
j
>
i
)
{
editCpDisHtml
+=
'<div class="editCpDis-box" road-id="'
+
roadId
+
'">'
+
' <div class="dis-name">'
+
e
.
name
+
'-'
+
data
.
content
[
j
].
name
+
' </div>'
+
' <div class="dis-input">'
+
' <input type="number" name="'
+
e
.
checkpointId
+
'-'
+
data
.
content
[
j
].
checkpointId
+
'" placeholder="单位:KM" step="0.1" class="form-control"/>'
+
' </div>'
+
' </div>'
;
}
}
});
// 初始化智能步道数据
initCpDis
(
editCpDisHtml
,
roadId
);
}
}
})
}
// 查询智能步道数据
function
initCpDis
(
initHtml
,
roadId
)
{
$
.
ajax
({
url
:
'/gk/road/getCpDis/'
+
roadId
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
){
if
(
data
.
content
.
length
<=
0
)
{
// 无数据,初始化
$
(
"#editCpDisBtn"
).
css
(
"display"
,
"inline-block"
);
$
(
"#editCpDis-list"
).
html
(
initHtml
);
}
else
{
var
editCpDisHtml
=
""
;
$
.
each
(
data
.
content
,
function
(
i
,
e
)
{
editCpDisHtml
+=
'<div class="editCpDis-box" road-id="'
+
roadId
+
'">'
+
' <div class="dis-name">'
+
e
.
disPointName
+
' </div>'
+
' <div class="dis-input">'
+
' <input type="number" name="'
+
e
.
disPoint
+
'" placeholder="单位:KM" step="0.1" class="form-control" value="'
+
((
e
.
distance
===
''
||
e
.
distance
==
null
)?
"0"
:
Number
(
e
.
distance
/
1000
).
toFixed
(
3
))
+
'"/>'
+
' </div>'
+
' </div>'
;
});
$
(
"#editCpDisBtn"
).
css
(
"display"
,
"inline-block"
);
$
(
"#editCpDis-list"
).
html
(
editCpDisHtml
);
}
}
}
})
}
// 保存智能步道数据
function
saveCpDis
()
{
// 封装数据
var
arr
=
[];
var
cmptId
=
getCmptId
();
$
.
each
(
$
(
".editCpDis-box"
),
function
(
index
,
item
)
{
var
roadId
=
$
(
item
).
attr
(
"road-id"
);
var
disPoint
=
$
(
item
).
find
(
"input"
).
attr
(
'name'
);
var
distance
=
$
(
item
).
find
(
"input"
).
val
()?
$
(
item
).
find
(
"input"
).
val
():
0
;
var
obj
=
{
cmptId
:
cmptId
,
roadId
:
roadId
,
disPoint
:
disPoint
,
distance
:
distance
*
1000
};
arr
.
push
(
obj
);
})
if
(
arr
.
length
<=
0
)
{
layer
.
msg
(
"没有标记点,请导入有标记点的路线,以免影响您的后续使用!"
);
return
}
$
.
ajax
({
url
:
'/gk/road/saveCpDis'
,
contentType
:
'application/json;charset=UTF-8'
,
method
:
'post'
,
data
:
JSON
.
stringify
(
arr
),
traditional
:
true
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
){
layer
.
msg
(
"保存成功"
);
$
(
"#editCpDis"
).
modal
(
"hide"
);
}
else
{
layer
.
msg
(
"保存失败,请稍候重试"
);
}
}
})
...
...
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