Compare commits

...

2 Commits

Author SHA1 Message Date
LiuY
5c6289fe1d 摄像头管理 2023-11-16 11:26:25 +08:00
TS-QD1
5452a04d0f dev 2023-10-24 09:56:34 +08:00
11 changed files with 1772 additions and 0 deletions

View File

@ -0,0 +1,96 @@
package com.cm.population.controller.apis.camera;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.population.pojo.dtos.camera.CameraDTO;
import com.cm.population.pojo.vos.camera.CameraVO;
import com.cm.population.service.camera.ICameraService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 摄像头管理
* @author : LY
* @date :2023-11-14 17:53
* @description :
* @modyified By:
*/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "摄像头接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/camera")
public class CameraController extends AbstractController {
@Autowired
private ICameraService cameraService;
@ApiOperation(value = "新增摄像头信息", notes = "新增摄像头信息接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save")
@CheckRequestBodyAnnotation
public SuccessResult save(@RequestBody CameraVO cameraVO) throws Exception {
return cameraService.save(cameraVO);
}
@ApiOperation(value = "修改摄像头信息", notes = "修改摄像头信息接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "cityCameraId", value = "摄像头ID", paramType = "path"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update/{cityCameraId}")
@CheckRequestBodyAnnotation
public SuccessResult update(@PathVariable("cityCameraId") String cityCameraId, @RequestBody CameraVO cameraVO) throws Exception {
return cameraService.update(cityCameraId, cameraVO);
}
@ApiOperation(value = "摄像头详情(通过ID)", notes = "摄像头详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "cityCameraId", value = "摄像头ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get/{cityCameraId}")
public CameraDTO getCensusMsgById(@PathVariable("cityCameraId") String cityCameraId) throws SearchException {
return cameraService.get(cityCameraId);
}
@ApiOperation(value = "攝像头信息列表", notes = "攝像头信息列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list")
public List<CameraDTO> list() throws SearchException {
Map<String, Object> params = requestParams();
return cameraService.list(params);
}
@ApiOperation(value = "攝像头信息分页列表", notes = "攝像头信息分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage")
public SuccessResultList<List<CameraDTO>> listPage(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return cameraService.listPage(page);
}
}

View File

@ -0,0 +1,86 @@
package com.cm.population.dao.camera;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.population.pojo.dtos.camera.CameraDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @ClassName: ICameraDao
* @Description: 摄像头管理
* @Author: WenG
* @Date: 2020-11-16 11:20
* @Version: 1.0
**/
@Repository
public interface ICameraDao {
/**
* 新增攝像头
*
* @param params
* @throws SaveException
*/
void save(Map<String, Object> params) throws SaveException;
/**
* 删除攝像头
*
* @param params
* @throws RemoveException
*/
void remove(Map<String, Object> params) throws RemoveException;
/**
* 删除攝像头物理
*
* @param params
* @throws RemoveException
*/
void delete(Map<String, Object> params) throws RemoveException;
/**
* 修改攝像头
*
* @param params
* @throws UpdateException
*/
void update(Map<String, Object> params) throws UpdateException;
/**
* 攝像头详情
*
* @param params
* @return
* @throws SearchException
*/
CameraDTO get(Map<String, Object> params) throws SearchException;
/**
* 攝像头列表
*
* @param params
* @return
* @throws SearchException
*/
List<CameraDTO> list(Map<String, Object> params) throws SearchException;
/**
* 攝像头统计
*
* @param params
* @return
* @throws SearchException
*/
Integer count(Map<String, Object> params) throws SearchException;
}

View File

@ -0,0 +1,134 @@
package com.cm.population.pojo.dtos.camera;
import io.swagger.annotations.ApiModel;
/**
* 摄像头管理
* @author : LY
* @date :2023-11-14 18:01
* @description :
* @modyified By:
*/
@ApiModel
public class CameraDTO {
private String cityCameraId;
private String cameraName;
private String cameraStreetId;
private String cameraStreetName;
private String cameraCommunityId;
private String cameraCommunityName;
private String cameraDistrictId;
private String cameraDistrictName;
private String cameraLongitude;
private String cameraLatitude;
private String cameraAddress;
private String cameraRtspLink;
private String remark;
public String getCityCameraId() {
return cityCameraId;
}
public void setCityCameraId(String cityCameraId) {
this.cityCameraId = cityCameraId;
}
public String getCameraName() {
return cameraName;
}
public void setCameraName(String cameraName) {
this.cameraName = cameraName;
}
public String getCameraStreetId() {
return cameraStreetId;
}
public void setCameraStreetId(String cameraStreetId) {
this.cameraStreetId = cameraStreetId;
}
public String getCameraStreetName() {
return cameraStreetName;
}
public void setCameraStreetName(String cameraStreetName) {
this.cameraStreetName = cameraStreetName;
}
public String getCameraCommunityId() {
return cameraCommunityId;
}
public void setCameraCommunityId(String cameraCommunityId) {
this.cameraCommunityId = cameraCommunityId;
}
public String getCameraCommunityName() {
return cameraCommunityName;
}
public void setCameraCommunityName(String cameraCommunityName) {
this.cameraCommunityName = cameraCommunityName;
}
public String getCameraDistrictId() {
return cameraDistrictId;
}
public void setCameraDistrictId(String cameraDistrictId) {
this.cameraDistrictId = cameraDistrictId;
}
public String getCameraDistrictName() {
return cameraDistrictName;
}
public void setCameraDistrictName(String cameraDistrictName) {
this.cameraDistrictName = cameraDistrictName;
}
public String getCameraLongitude() {
return cameraLongitude;
}
public void setCameraLongitude(String cameraLongitude) {
this.cameraLongitude = cameraLongitude;
}
public String getCameraLatitude() {
return cameraLatitude;
}
public void setCameraLatitude(String cameraLatitude) {
this.cameraLatitude = cameraLatitude;
}
public String getCameraAddress() {
return cameraAddress;
}
public void setCameraAddress(String cameraAddress) {
this.cameraAddress = cameraAddress;
}
public String getCameraRtspLink() {
return cameraRtspLink;
}
public void setCameraRtspLink(String cameraRtspLink) {
this.cameraRtspLink = cameraRtspLink;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@ -0,0 +1,129 @@
package com.cm.population.pojo.vos.camera;
/**
* @author : LY
* @date :2023-11-16 9:22
* @description :
* @modyified By:
*/
public class CameraVO {
private String cityCameraId;
private String cameraName;
private String cameraStreetId;
private String cameraStreetName;
private String cameraCommunityId;
private String cameraCommunityName;
private String cameraDistrictId;
private String cameraDistrictName;
private String cameraLongitude;
private String cameraLatitude;
private String cameraAddress;
private String cameraRtspLink;
private String remark;
public String getCityCameraId() {
return cityCameraId;
}
public void setCityCameraId(String cityCameraId) {
this.cityCameraId = cityCameraId;
}
public String getCameraName() {
return cameraName;
}
public void setCameraName(String cameraName) {
this.cameraName = cameraName;
}
public String getCameraStreetId() {
return cameraStreetId;
}
public void setCameraStreetId(String cameraStreetId) {
this.cameraStreetId = cameraStreetId;
}
public String getCameraStreetName() {
return cameraStreetName;
}
public void setCameraStreetName(String cameraStreetName) {
this.cameraStreetName = cameraStreetName;
}
public String getCameraCommunityId() {
return cameraCommunityId;
}
public void setCameraCommunityId(String cameraCommunityId) {
this.cameraCommunityId = cameraCommunityId;
}
public String getCameraCommunityName() {
return cameraCommunityName;
}
public void setCameraCommunityName(String cameraCommunityName) {
this.cameraCommunityName = cameraCommunityName;
}
public String getCameraDistrictId() {
return cameraDistrictId;
}
public void setCameraDistrictId(String cameraDistrictId) {
this.cameraDistrictId = cameraDistrictId;
}
public String getCameraDistrictName() {
return cameraDistrictName;
}
public void setCameraDistrictName(String cameraDistrictName) {
this.cameraDistrictName = cameraDistrictName;
}
public String getCameraLongitude() {
return cameraLongitude;
}
public void setCameraLongitude(String cameraLongitude) {
this.cameraLongitude = cameraLongitude;
}
public String getCameraLatitude() {
return cameraLatitude;
}
public void setCameraLatitude(String cameraLatitude) {
this.cameraLatitude = cameraLatitude;
}
public String getCameraAddress() {
return cameraAddress;
}
public void setCameraAddress(String cameraAddress) {
this.cameraAddress = cameraAddress;
}
public String getCameraRtspLink() {
return cameraRtspLink;
}
public void setCameraRtspLink(String cameraRtspLink) {
this.cameraRtspLink = cameraRtspLink;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@ -0,0 +1,84 @@
package com.cm.population.service.camera;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.population.pojo.dtos.buildinghouseuser.BuildingHouseUserDTO;
import com.cm.population.pojo.dtos.camera.CameraDTO;
import com.cm.population.pojo.vos.camera.CameraVO;
import java.util.List;
import java.util.Map;
/**
* 摄像头管理
* @author : LY
* @date :2023-11-16 9:25
* @description :
* @modyified By:
*/
public interface ICameraService {
/**
* 保存摄像头
* @param cameraVO
* @throws Exception
*/
SuccessResult save(CameraVO cameraVO) throws Exception;
/**
* 修改摄像头
* @param cityCameraId
* @param cameraVO
*/
SuccessResult update(String cityCameraId, CameraVO cameraVO) throws Exception;
/**
* 获取摄像头详情
* @param cityCameraId
* @return
* @throws SearchException
*/
CameraDTO get(String cityCameraId) throws SearchException;
/**
* 获取摄像头列表
* @param params
* @return
*/
List<CameraDTO> list(Map<String, Object> params);
/**
* 摄像头分页列表
* @param page
* @return
*/
SuccessResultList<List<CameraDTO>> listPage(ListPage page) throws SearchException;
/**
* 删除摄像头
*
* @param ids id列表
* @return
*/
void remove(String token, List<String> ids);
/**
* 删除摄像头物理删除
*
* @param ids id列表
*/
void delete(List<String> ids) throws RemoveException;
}

View File

@ -0,0 +1,120 @@
package com.cm.population.service.camera.impl;
import com.cm.common.base.AbstractService;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.population.dao.camera.ICameraDao;
import com.cm.population.pojo.dtos.camera.CameraDTO;
import com.cm.population.pojo.vos.camera.CameraVO;
import com.cm.population.service.camera.ICameraService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 摄像头管理
* @author : LY
* @date :2023-11-16 9:25
* @description :
* @modyified By:
*/
@Service
public class CameraServiceImpl extends AbstractService implements ICameraService {
@Autowired
private ICameraDao cameraDao;
@Override
public SuccessResult save(CameraVO cameraVO) throws Exception {
this.saveReturnId(null, cameraVO);
return new SuccessResult();
}
@Override
public SuccessResult update(String cityCameraId, CameraVO cameraVO) throws Exception{
this.updateInfo(null, cityCameraId, cameraVO);
return new SuccessResult();
}
@Override
public CameraDTO get(String cityCameraId) throws SearchException {
Map<String, Object> params = super.getHashMap(1);
params.put("cityCameraId", cityCameraId);
return cameraDao.get(params);
}
@Override
public List<CameraDTO> list(Map<String, Object> params) {
return cameraDao.list(params);
}
@Override
public SuccessResultList<List<CameraDTO>> listPage(ListPage page) throws SearchException{
PageHelper.startPage(page.getPage(), page.getRows());
List<CameraDTO> list = cameraDao.list(page.getParams());
PageInfo<CameraDTO> pageInfo = new PageInfo<>(list);
return new SuccessResultList<>(list, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public void remove(String token, List<String> ids) {
Map<String, Object> params = getHashMap(3);
params.put("cityCameraIds", ids);
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
cameraDao.remove(params);
}
@Override
public void delete(List<String> ids) throws RemoveException {
Map<String, Object> params = getHashMap(3);
params.put("cityCameraIds", ids);
cameraDao.delete(params);
}
public String saveReturnId(String token, CameraVO cameraVO) throws Exception{
String cityCameraId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(cameraVO);
params.put("cityCameraId", cityCameraId);
if (token != null) {
setSaveInfo(token, params);
} else {
setSaveInfo(params);
}
cameraDao.save(params);
return cityCameraId;
}
public void updateInfo(String token, String cityCameraId, CameraVO cameraVO) throws Exception{
Map<String, Object> params = HashMapUtil.beanToMap(cameraVO);
params.put("cityCameraId", cityCameraId);
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
cameraDao.update(params);
}
}

View File

@ -0,0 +1,121 @@
server:
port: 7023
url: http://192.168.0.15:7023/population
title: population
servlet:
context-path: /population
spring:
thymeleaf:
prefix: classpath:/templates/
suffix: .html
mode: HTML5
encoding: UTF-8
cache: false
main:
allow-bean-definition-overriding: true
servlet:
multipart:
max-file-size: 1GB
max-request-size: 1GB
datasource:
druid:
url: jdbc:mysql://192.168.0.151:3306/db_btgxq_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false
db-type: mysql
driver-class-name: com.mysql.jdbc.Driver
username: root
password: root
initial-size: 2
min-idle: 2
max-active: 5
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 10
filter:
commons-log:
connection-logger-name: stat,wall,log4j
stat:
log-slow-sql: true
slow-sql-millis: 2000
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
use-global-data-source-stat: true
# 数据库
mybatis:
config-location: classpath:mybatis/mybatis-config.xml
mapper-locations: classpath*:mybatis/mapper/**/*.xml
# 文档
swagger:
title: 接口文档
description: 人口信息系统接口文档
service-url: https://baidu.com/
version: 1.0
swagger-base-package: com.cm
# 文件
file:
uploadPath: C:\Users\TS-QD1\Desktop\UploadFiles\
imageTypes: png,jpg,jpeg,gif,blob
videoTypes: mp4
audioTypes: mp3,wav,amr
fileTypes: doc,docx,xls,xlsx,ppt,pptx,txt,zip,rar,apk,pdf
maxFileCount: 6
# 安全
security:
oauth2:
oauth-server: http://192.168.0.15:7021/usercenter
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
client:
client-id: ba950215f6bb4d45bddd6cbcb87395e7
client-secret: WmlVZ2M4M2ZTeTdaS25OVlFwUExac3QrOU9kdHEybVgxSmhETTdFV2F5TW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
user-authorization-uri: ${security.oauth2.oauth-server}/oauth_client/authorize
access-token-uri: ${security.oauth2.oauth-server}/oauth_client/token
grant-type: authorization_code
resource:
jwt:
key-uri: ${security.oauth2.oauth-server}/oauth_client/token_key
token-info-uri: ${security.oauth2.oauth-server}/oauth_client/check_token
user-info-uri: ${security.oauth2.oauth-server}/user
authorization:
check-token-access: ${security.oauth2.oauth-server}/oauth_client/token_key
api-path:
user-center: ${security.oauth2.oauth-server}
# 访问控制
access-control:
pass-paths:
- /index.html
- /logout.html
- /default.html
- /assets/**
- /route/file/downloadfile/**
save-paths:
- /**/save*/**
- /**/add*/**
delete-paths:
- /**/delete*/**
- /**/remove*/**
update-paths:
- /**/update*/**
- /**/edit*/**
query-paths:
- /**/get*/**
- /**/query*/**
- /**/find*/**
- /**/list*/**
- /**/count*/**
# 日志
logging:
level:
root: error
com.cm: debug

View File

@ -0,0 +1,191 @@
<?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.cm.population.dao.camera.ICameraDao">
<resultMap id="cameraDTO" type="com.cm.population.pojo.dtos.camera.CameraDTO">
<result column="city_camera_id" property="cityCameraId"/>
<result column="camera_name" property="cameraName"/>
<result column="camera_street_id" property="cameraAreaId"/>
<result column="camera_street_name" property="cameraAreaName"/>
<result column="camera_community_id" property="cameraAreaId"/>
<result column="camera_community_name" property="cameraAreaName"/>
<result column="camera_district_id" property="cameraDistrictId"/>
<result column="camera_district_name" property="cameraDistrictName"/>
<result column="camera_longitude" property="cameraLongitude"/>
<result column="camera_latitude" property="cameraLatitude"/>
<result column="camera_address" property="cameraAddress"/>
<result column="camera_rtsp_link" property="cameraRtspLink"/>
<result column="remark" property="remark"/>
</resultMap>
<!-- 新增摄像头 -->
<insert id="save" parameterType="map">
INSERT INTO city_camera (
city_camera_id,
camera_name,
camera_street_id,
camera_street_name,
camera_community_id,
camera_community_name,
camera_longitude,
camera_latitude,
camera_address,
camera_rtsp_link,
remark,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) values (
#{cityCameraId},
#{cameraName},
#{cameraStreetId},
#{cameraStreetName},
#{cameraCommunityId},
#{cameraCommunityName},
#{cameraDistrictId},
#{cameraDistrictName},
#{cameraLongitude},
#{cameraLatitude},
#{cameraAddress},
#{cameraRtspLink},
#{remark},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除摄像头 -->
<update id="remove" parameterType="map">
UPDATE
city_camera
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
city_camera_id IN
<foreach collection="cityCameraIds" index="index" open="(" separator="," close=")">
#{cityCameraIds[${index}]}
</foreach>
</update>
<!-- 删除摄像头(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
city_camera
WHERE
city_camera_id = #{cityCameraId}
</update>
<!-- 摄像头修改 -->
<update id="update" parameterType="map">
UPDATE
city_camera
SET
<if test="cameraName != null and cameraName != ''">
camera_name = #{cameraName},
</if>
<if test="cameraStreetId != null and cameraStreetId != ''">
camera_street_id = #{cameraStreetId},
</if>
<if test="cameraStreetName != null and cameraStreetName != ''">
camera_street_name = #{cameraStreetName},
</if>
<if test="cameraCommunityId != null and cameraCommunityId != ''">
camera_community_id = #{cameraCommunityId},
</if>
<if test="cameraCommunityName != null and cameraCommunityName != ''">
camera_community_name = #{cameraCommunityName},
</if>
<if test="cameraDistrictId != null and cameraDistrictId != ''">
camera_district_id = #{cameraDistrictId},
</if>
<if test="cameraDistrictName != null and cameraDistrictName != ''">
camera_district_name = #{cameraDistrictName},
</if>
<if test="cameraLongitude != null and cameraLongitude != ''">
camera_longitude = #{cameraLongitude},
</if>
<if test="cameraLatitude != null and cameraLatitude != ''">
camera_latitude = #{cameraLatitude},
</if>
<if test="cameraAddress != null and cameraAddress != ''">
camera_address = #{cameraAddress},
</if>
<if test="cameraRtspLink != null and cameraRtspLink != ''">
camera_rtsp_link = #{cameraRtspLink},
</if>
remark = #{remark},
gmt_modified = #{gmtModified},
modifier = #{modifier}
WHERE
city_camera_id = #{cityCameraId}
</update>
<!-- 摄像头详情 -->
<select id="get" parameterType="map" resultMap="cameraDTO">
SELECT
city_camera_id,
camera_name,
camera_street_id,
camera_street_name,
camera_community_id,
camera_community_name,
camera_district_id,
camera_district_name,
camera_longitude,
camera_latitude,
camera_address,
camera_rtsp_link,
remark
FROM
city_camera
WHERE
city_camera_id = #{cityCameraId}
</select>
<!-- 摄像头列表 -->
<select id="list" parameterType="map" resultMap="cameraDTO">
SELECT
city_camera_id,
camera_name,
camera_street_id,
camera_street_name,
camera_community_id,
camera_community_name,
camera_district_id,
camera_district_name,
camera_longitude,
camera_latitude,
camera_address,
camera_rtsp_link,
remark
FROM
city_camera
WHERE
is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
camera_name LIKE CONCAT('%', #{keywords}, '%')
)
</if>
ORDER BY gmt_create DESC
</select>
<!-- 摄像头统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
city_camera
WHERE
city_camera_id = #{cityCameraId}
</select>
</mapper>

View File

@ -0,0 +1,250 @@
<!doctype html>
<html lang="en">
<head>
<base href="/population/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入姓名/身份证号等">
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增
</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
<i class="fa fa-lg fa-edit"></i> 编辑
</button>
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>
</div>
</script>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common','upload'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/camera/listpage';
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'cameraName', width: 150, title: '名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'cameraAreaName', width: 150, title: '所在区域', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'cameraDistrictName', width: 150, title: '所在小区', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'cameraAddress', width: 350, title: '详细地址', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'cameraRtspLink', width: 350, title: 'RTSP地址', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
]],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
}
});
}
// 重载表格
function reloadTable(currentPage) {
table.reload('dataTable', {
url: top.restAjax.path(tableUrl, []),
where: {
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val()
},
page: {
curr: currentPage
},
height: $win.height() - 90,
});
}
// 删除
function removeData(ids) {
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/camera/remove/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
initTable();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
// 事件 - 搜索
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/camera/save.html', []),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/camera/update.html?cityCameraId={cityCameraId}', [checkDatas[0].cityCameraId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['cityCameraId'];
}
removeData(ids);
}
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,239 @@
<!doctype html>
<html lang="en">
<head>
<base href="/population/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>新增内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm" id="dataForm">
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-block">
<input type="text" id="cameraName" name="cameraName" class="layui-input" value="" placeholder="请输入摄像头名称">
</div>
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">所在街道</label>
<div class="layui-input-block layui-form" id="streetSelectTemplateBox" lay-filter="streetSelectTemplateBox"></div>
<script id="streetSelectTemplate" type="text/html">
<select id="cameraStreetId" name="cameraStreetId" lay-filter="street" lay-verify="required" lay-search>
<option value="">请选择街道</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.id}}">{{item.name}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">所在社区</label>
<div class="layui-input-block">
<input type="hidden" id="cameraCommunityId" name="cameraCommunityId">
<input type="text" id="cameraCommunityName" name="cameraCommunityName" class="layui-input" value="" placeholder="请输入公民身份证进行检索">
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">所在小区</label>
<div class="layui-input-block">
<input type="hidden" id="cameraDistrictId" name="cameraDistrictId">
<input type="text" id="cameraDistrictName" name="cameraDistrictName" class="layui-input" value="" placeholder="请输入公民身份证进行检索">
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">RTSP地址</label>
<div class="layui-input-block">
<input type="text" id="cameraRtspLink" name="cameraRtspLink" class="layui-input" value="" placeholder="请输入RTSP地址">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">详细地址</label>
<div class="layui-input-block">
<input type="hidden" id="cameraLongitude" name="cameraLongitude">
<input type="hidden" id="cameraLatitude" name="cameraLatitude">
<input type="text" id="cameraAddress" name="cameraAddress" class="layui-input" value="" placeholder="请输入详细地址">
</div>
</div>
<div class="layui-row" id="mapDiv">
<div class="layui-col-sm12" style="padding: 0 0 10px 0px;">
<div id="mapContainer" style="width: 100%;height: 350px;"></div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<textarea type="text" id="remark" name="remark" class="layui-textarea" value="" placeholder="请输入备注"></textarea>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" id="submitBtn" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=oWU9RD4ihDHAafexgI6XOrTK8lDatRju"></script>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var wangEditor = window.wangEditor;
var wangEditorObj = {};
var viewerObj = {};
var baseInfoId;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 街道数据
function initStreetTemplate() {
top.restAjax.get(top.restAjax.path('api/residential/getStreetList', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('streetSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('streetSelectTemplateBox').innerHTML = html;
});
form.render('select', 'streetSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
//初始化百度地图
function initMap(longitude, latitude) {
map = new BMap.Map("mapContainer", {enableMapClick: false,});
var point = new BMap.Point(longitude, latitude);
map.centerAndZoom(point, 13);
map.disableDoubleClickZoom();
map.addControl(new BMap.NavigationControl());
map.addControl(new BMap.ScaleControl());
map.addControl(new BMap.OverviewMapControl());
map.addControl(new BMap.MapTypeControl());
map.enableScrollWheelZoom();//启用地图滚轮放大缩小
map.enableContinuousZoom();//开启缩放平滑
// 点击获取地址
var geocoder= new BMap.Geocoder();
mapMarkPoint(map, point);
map.addEventListener("click", function(e) {
map.clearOverlays();
$('#cameraLongitude').val(e.point.lng);
$('#cameraLatitude').val(e.point.lat);
point = new BMap.Point(e.point.lng, e.point.lat);
mapMarkPoint(map, point);
geocoder.getLocation(e.point, function(rs) {
$('#cameraAddress').val(rs.address);
});
});
}
function mapMarkPoint(map, point) {
var marker = new BMap.Marker(point);
map.addOverlay(marker);
}
// 初始化内容
function initData() {
initStreetTemplate();
initMap(109.9169990478825, 40.59520202810689);
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
valueFun(formData);
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
formData.field.baseId = baseInfoId;
top.restAjax.post(top.restAjax.path('api/censusmsg/savecensusmsg', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,322 @@
<!doctype html>
<html lang="en">
<head>
<base href="/population/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm" id="dataForm">
<div class="layui-row">
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">身份证</label>
<div class="layui-input-block">
<input type="text" id="idCardNumber" name="idCardNumber" class="layui-input" value="" placeholder="请输入公民身份证进行检索">
</div>
</div>
</div>
<div class="layui-col-md3">
<div style="margin: 4px 4px;">
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
</div>
</div>
<div class="div-base-population-info" style="display: none">
<blockquote class="layui-elem-quote">人员基础信息</blockquote>
<div class="layui-row">
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">姓名</label>
<div class="layui-input-block">
<input type="text" id="fullName" name="fullName" class="layui-input" value="" readonly="readonly">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">性别</label>
<div class="layui-input-block">
<input type="text" id="gender" name="gender" class="layui-input" value="" readonly="readonly">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">联系方式</label>
<div class="layui-input-block">
<input type="text" id="telephone" name="telephone" class="layui-input" value="" readonly="readonly">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">籍贯</label>
<div class="layui-input-block">
<input type="text" id="nativePlace" name="nativePlace" class="layui-input" value="" readonly="readonly">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-form-item">
<label class="layui-form-label">现住地</label>
<div class="layui-input-block">
<input type="text" id="currentResidence" name="currentResidence" class="layui-input" value="" readonly="readonly">
</div>
</div>
</div>
</div>
</div>
<blockquote class="layui-elem-quote">户籍信息</blockquote>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6" pane>
<label class="layui-form-label" style="width: 125px;"><span style="color:red;">*</span>人户一致标识</label>
<div class="layui-input-block" style="margin-left: 125px;">
<select id="peopleSameCensus" name="peopleSameCensus" lay-verify="required">
<option value="">请选择人户一致标识</option>
<option value="01">一致</option>
<option value="02">不一致</option>
</select>
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label"><span style="color:red;">*</span>户号</label>
<div class="layui-input-block">
<input type="text" id="censusNumber" name="censusNumber" class="layui-input" value="" lay-verify="required" placeholder="请输入户号" >
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 145px;">户主公民身份证号</label>
<div class="layui-input-block" style="margin-left: 145px;">
<input type="text" id="idCardOfHouseholder" name="idCardOfHouseholder" class="layui-input" value="" placeholder="请输入户主公民身份证号" lay-verify="identity">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">户主姓名</label>
<div class="layui-input-block">
<input type="text" id="nameOfHouseholder" name="nameOfHouseholder" class="layui-input" value="" placeholder="请输入户主姓名" lay-verify="required">
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6" pane>
<label class="layui-form-label"><span style="color:red;">*</span>与户主关系</label>
<div class="layui-input-block layui-form" id="relationshipWithHouseholderSelectTemplateBox" lay-filter="relationshipWithHouseholderSelectTemplateBox"></div>
<script id="relationshipWithHouseholderSelectTemplate" type="text/html">
<select id="relationshipWithHouseholder" name="relationshipWithHouseholder" lay-verify="required">
<option value="">请选择与户主关系</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryName}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 140px;">户主联系方式</label>
<div class="layui-input-block" style="margin-left: 140px;">
<input type="text" id="contact" name="contact" class="layui-input" value="" placeholder="请输入户主联系方式" >
</div>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" id="submitBtn" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var censusMsgId = top.restAjax.params(window.location.href).censusMsgId;
var baseInfoId;
function queryBasePopulationInfo(idCardNumber){
if(!idCardNumber){
top.dialog.msg('请输入身份证号进行查询');
$('#submitBtn').addClass("layui-btn-disabled").attr("disabled",true);
return false;
}
var loadIndex = layer.load(0);
top.restAjax.get(top.restAjax.path('api/basepopulationinfo/getbasepopulationinfo', []),
{idCardNumber:idCardNumber}, null, function(code, data) {
if(!data || !data.basePopulationInfoId) {
top.dialog.msg('暂无此人,请先补充人员基本信息');
$('#submitBtn').addClass("layui-btn-disabled").attr("disabled",true);
$('.div-base-population-info').hide();
return false;
}
$('#submitBtn').removeClass("layui-btn-disabled").attr("disabled",false);
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
baseInfoId = data['basePopulationInfoId'];
dataFormData['currentResidence'] = dataFormData['currentResidence'] + '-' + dataFormData['currentResidenceAddr'];
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
$('.div-base-population-info').show();
}, function(code, data) {
top.dialog.msg(data.msg);
},function(){},
function () {
layer.close(loadIndex);
});
}
$(document).on('click','#search',function(){
queryBasePopulationInfo($('#idCardNumber').val());
});
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化与户主关系下拉选择
function initRelationshipWithHouseholderSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/4c21d91a-d5e1-4cfc-a18a-d63272763cdb', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('relationshipWithHouseholderSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('relationshipWithHouseholderSelectTemplateBox').innerHTML = html;
});
form.render('select', 'relationshipWithHouseholderSelectTemplateBox');
var selectObj = {};
selectObj['relationshipWithHouseholder'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
function backData(data) {
$("#dataForm").find('select').each(function(){
var selId;
selId = $(this).attr('id');
$('#' + selId + ' option').each(function () {
for(var key in data) {
if(key == selId) {
if ($(this).text() == data[key]) {
var val = $(this).val();
var select = 'dd[lay-value=' + val + ']';
$('#' + key).siblings("div.layui-form-select").find('dl').find(select).click();
}
}
}
});
});
}
// 初始化内容
function initData() {
$('#submitBtn').addClass("layui-btn-disabled").attr("disabled",true);
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/censusmsg/getcensusmsgbyid/{censusMsgId}', [censusMsgId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initRelationshipWithHouseholderSelect(data['relationshipWithHouseholder']);
queryBasePopulationInfo(data['idCardNumber']);
backData(data);
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
function valueFun(formData) {
$("#dataForm").find('select').each(function(){
var value;
var selId;
value = $(this).find('option:selected').text();
selId = $(this).attr('id');
formData.field['' + selId] = value;
});
}
// 提交表单
form.on('submit(submitForm)', function(formData) {
valueFun(formData);
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
formData.field.baseId = baseInfoId;
top.restAjax.put(top.restAjax.path('api/censusmsg/updatecensusmsg/{censusMsgId}', [censusMsgId]), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>