新增公共区域上报

This commit is contained in:
wenc000 2020-04-20 19:07:45 +08:00
parent f294751796
commit 718bbd53ed
18 changed files with 2928 additions and 41 deletions

View File

@ -0,0 +1,128 @@
package com.cm.inspection.controller.apis.publicareareport;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.component.SecurityComponent;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.CurrentUserIdInfoDTO;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.publicareareport.PublicAreaReportDTO;
import com.cm.inspection.pojo.vos.publicareareport.PublicAreaReportVO;
import com.cm.inspection.service.publicareareport.IPublicAreaReportService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: PublicAreaReportController
* @Description: 公共区域上报
* @Author: WenG
* @Date: 2020-04-20 17:27
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "公共区域上报接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/publicareareport")
public class PublicAreaReportController extends AbstractController {
@Autowired
private IPublicAreaReportService publicAreaReportService;
@Autowired
private SecurityComponent securityComponent;
@ApiOperation(value = "新增公共区域上报", notes = "新增公共区域上报接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savepublicareareport")
@CheckRequestBodyAnnotation
public SuccessResult savePublicAreaReport(@RequestBody PublicAreaReportVO publicAreaReportVO) throws Exception {
return publicAreaReportService.savePublicAreaReport(publicAreaReportVO);
}
@ApiOperation(value = "删除公共区域上报(id列表)", notes = "删除公共区域上报(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removepublicareareport/{ids}")
public SuccessResult removePublicAreaReport(@PathVariable("ids") String ids) throws RemoveException {
return publicAreaReportService.removePublicAreaReport(ids);
}
@ApiOperation(value = "修改公共区域上报", notes = "修改公共区域上报接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "publicAreaReportId", value = "公共区域上报ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatepublicareareport/{publicAreaReportId}")
@CheckRequestBodyAnnotation
public SuccessResult updatePublicAreaReport(@PathVariable("publicAreaReportId") String publicAreaReportId, @RequestBody PublicAreaReportVO publicAreaReportVO) throws Exception {
return publicAreaReportService.updatePublicAreaReport(publicAreaReportId, publicAreaReportVO);
}
@ApiOperation(value = "公共区域上报详情(通过ID)", notes = "公共区域上报详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "publicAreaReportId", value = "公共区域上报ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getpublicareareportbyid/{publicAreaReportId}")
public PublicAreaReportDTO getPublicAreaReportById(@PathVariable("publicAreaReportId") String publicAreaReportId) throws SearchException {
return publicAreaReportService.getPublicAreaReportById(publicAreaReportId);
}
@ApiOperation(value = "公共区域上报列表", notes = "公共区域上报列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpublicareareport")
public List<PublicAreaReportDTO> listPublicAreaReport() throws SearchException {
Map<String, Object> params = requestParams();
return publicAreaReportService.listPublicAreaReport(params);
}
@ApiOperation(value = "公共区域上报分页列表", notes = "公共区域上报分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagepublicareareport")
public SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReport(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return publicAreaReportService.listPagePublicAreaReport(page);
}
@ApiOperation(value = "当前用户id信息", notes = "当前用户id信息接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcurrentuseridinfo")
public CurrentUserIdInfoDTO getCurrentUserIdInfo() {
return securityComponent.getCurrentUserIdInfo();
}
@ApiOperation(value = "公共区域上报分页(我的)列表", notes = "公共区域上报分页列表(我的)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "Integer", 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("listpagepublicareareportofmine")
public SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReportOfMine(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return publicAreaReportService.listPagePublicAreaReportOfMine(page);
}
}

View File

@ -0,0 +1,143 @@
package com.cm.inspection.controller.app.apis.publicareareport;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.ParamsException;
import com.cm.common.exception.RemoveException;
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.common.utils.RegexUtil;
import com.cm.inspection.pojo.dtos.publicareareport.PublicAreaReportDTO;
import com.cm.inspection.pojo.vos.publicareareport.PublicAreaReportVO;
import com.cm.inspection.service.publicareareport.IPublicAreaReportService;
import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: PublicAreaReportAppController
* @Description: 公共区域上报
* @Author: WenG
* @Date: 2020-04-20 17:27
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "公共区域上报接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/publicareareport")
public class PublicAreaReportAppController extends AbstractController {
@Autowired
private IPublicAreaReportService publicAreaReportService;
@ApiOperation(value = "新增公共区域上报", notes = "新增公共区域上报接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savepublicareareport")
@CheckRequestBodyAnnotation
public SuccessResult savePublicAreaReport(@RequestHeader("token") String token, @RequestBody PublicAreaReportVO publicAreaReportVO) throws Exception {
if (publicAreaReportVO.getCheckType() != 1) {
throw new ParamsException("检查类型错误");
}
if (!RegexUtil.isDate(publicAreaReportVO.getCheckDate())) {
throw new ParamsException("检查日期错误");
}
return publicAreaReportService.savePublicAreaReportByToken(token, publicAreaReportVO);
}
@ApiOperation(value = "删除公共区域上报(id列表)", notes = "删除公共区域上报(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removepublicareareport/{ids}")
public SuccessResult removePublicAreaReport(@RequestHeader("token") String token, @PathVariable("ids") String ids) throws RemoveException {
return publicAreaReportService.removePublicAreaReportByToken(token, ids);
}
@ApiOperation(value = "修改公共区域上报", notes = "修改公共区域上报接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "publicAreaReportId", value = "公共区域上报ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatepublicareareport/{publicAreaReportId}")
@CheckRequestBodyAnnotation
public SuccessResult updatePublicAreaReport(@RequestHeader("token") String token, @PathVariable("publicAreaReportId") String publicAreaReportId, @RequestBody PublicAreaReportVO publicAreaReportVO) throws Exception {
if (publicAreaReportVO.getCheckType() != 2 && publicAreaReportVO.getCheckType() != 3) {
throw new ParamsException("检查类型错误");
}
if (!RegexUtil.isDate(publicAreaReportVO.getRecheckDate())) {
throw new ParamsException("检查日期错误");
}
return publicAreaReportService.updatePublicAreaReportByToken(token, publicAreaReportId, publicAreaReportVO);
}
@ApiOperation(value = "公共区域上报详情(通过ID)", notes = "公共区域上报详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "publicAreaReportId", value = "公共区域上报ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getpublicareareportbyid/{publicAreaReportId}")
public PublicAreaReportDTO getPublicAreaReportById(@RequestHeader("token") String token, @PathVariable("publicAreaReportId") String publicAreaReportId) throws SearchException {
return publicAreaReportService.getPublicAreaReportById(publicAreaReportId);
}
@ApiOperation(value = "公共区域上报列表", notes = "公共区域上报列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpublicareareport")
public List<PublicAreaReportDTO> listPublicAreaReport(@RequestHeader("token") String token) throws SearchException {
Map<String, Object> params = requestParams();
return publicAreaReportService.listPublicAreaReport(params);
}
@ApiOperation(value = "公共区域上报分页列表", notes = "公共区域上报分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagepublicareareport")
public SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReport(@RequestHeader("token") String token, ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return publicAreaReportService.listPagePublicAreaReport(page);
}
@ApiOperation(value = "公共区域上报分页(我的)列表", notes = "公共区域上报分页列表(我的)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "Integer", 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("listpagepublicareareportofmine")
public SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReportOfMine(@RequestHeader("token") String token, ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return publicAreaReportService.listPagePublicAreaReportOfMine(token, page);
}
}

View File

@ -0,0 +1,127 @@
package com.cm.inspection.controller.resources.publicareareport;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
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.inspection.pojo.dtos.publicareareport.PublicAreaReportDTO;
import com.cm.inspection.pojo.vos.publicareareport.PublicAreaReportVO;
import com.cm.inspection.service.publicareareport.IPublicAreaReportService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: PublicAreaReportResourceController
* @Description: 公共区域上报
* @Author: WenG
* @Date: 2020-04-20 17:27
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "公共区域上报接口")
@RestController
@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/publicareareport")
public class PublicAreaReportResourceController extends AbstractController {
@Autowired
private IPublicAreaReportService publicAreaReportService;
@ApiOperation(value = "新增公共区域上报", notes = "新增公共区域上报接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savepublicareareport")
@CheckRequestBodyAnnotation
public SuccessResult savePublicAreaReport(@RequestBody PublicAreaReportVO publicAreaReportVO) throws Exception {
return publicAreaReportService.savePublicAreaReport(publicAreaReportVO);
}
@ApiOperation(value = "删除公共区域上报(id列表)", notes = "删除公共区域上报(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removepublicareareport/{ids}")
public SuccessResult removePublicAreaReport(@PathVariable("ids") String ids) throws RemoveException {
return publicAreaReportService.removePublicAreaReport(ids);
}
@ApiOperation(value = "修改公共区域上报", notes = "修改公共区域上报接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "publicAreaReportId", value = "公共区域上报ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatepublicareareport/{publicAreaReportId}")
@CheckRequestBodyAnnotation
public SuccessResult updatePublicAreaReport(@PathVariable("publicAreaReportId") String publicAreaReportId, @RequestBody PublicAreaReportVO publicAreaReportVO) throws Exception {
return publicAreaReportService.updatePublicAreaReport(publicAreaReportId, publicAreaReportVO);
}
@ApiOperation(value = "公共区域上报详情(通过ID)", notes = "公共区域上报详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "publicAreaReportId", value = "公共区域上报ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getpublicareareportbyid/{publicAreaReportId}")
public PublicAreaReportDTO getPublicAreaReportById(@PathVariable("publicAreaReportId") String publicAreaReportId) throws SearchException {
return publicAreaReportService.getPublicAreaReportById(publicAreaReportId);
}
@ApiOperation(value = "公共区域上报列表", notes = "公共区域上报列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpublicareareport")
public List<PublicAreaReportDTO> listPublicAreaReport() throws SearchException {
Map<String, Object> params = requestParams();
return publicAreaReportService.listPublicAreaReport(params);
}
@ApiOperation(value = "公共区域上报分页列表", notes = "公共区域上报分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagepublicareareport")
public SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReport(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return publicAreaReportService.listPagePublicAreaReport(page);
}
@ApiOperation(value = "公共区域上报分页(我的)列表", notes = "公共区域上报分页列表(我的)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "Integer", 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("listpagepublicareareportofmine")
public SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReportOfMine(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return publicAreaReportService.listPagePublicAreaReportOfMine(page);
}
}

View File

@ -0,0 +1,66 @@
package com.cm.inspection.dao.publicareareport;
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.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.publicareareport.PublicAreaReportDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IPublicAreaReportDao
* @Description: 公共区域上报
* @Author: WenG
* @Date: 2020-04-20 17:27
* @Version: 1.0
**/
@Repository
public interface IPublicAreaReportDao {
/**
* 新增公共区域上报
*
* @param params
* @throws SaveException
*/
void savePublicAreaReport(Map<String, Object> params) throws SaveException;
/**
* 删除公共区域上报
*
* @param params
* @throws RemoveException
*/
void removePublicAreaReport(Map<String, Object> params) throws RemoveException;
/**
* 修改公共区域上报
*
* @param params
* @throws UpdateException
*/
void updatePublicAreaReport(Map<String, Object> params) throws UpdateException;
/**
* 公共区域上报详情
*
* @param params
* @return
* @throws SearchException
*/
PublicAreaReportDTO getPublicAreaReport(Map<String, Object> params) throws SearchException;
/**
* 公共区域上报列表
*
* @param params
* @return
* @throws SearchException
*/
List<PublicAreaReportDTO> listPublicAreaReport(Map<String, Object> params) throws SearchException;
}

View File

@ -0,0 +1,148 @@
package com.cm.inspection.pojo.dtos.publicareareport;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: PublicAreaReportDTO
* @Description: 公共区域上报
* @Author: WenG
* @Date: 2020-04-20 17:27
* @Version: 1.0
**/
@ApiModel
public class PublicAreaReportDTO {
@ApiModelProperty(name = "publicAreaReportId", value = "主键")
private String publicAreaReportId;
@ApiModelProperty(name = "checkAddress", value = "检查地址")
private String checkAddress;
@ApiModelProperty(name = "checkDate", value = "检查时间")
private String checkDate;
@ApiModelProperty(name = "checkContent", value = "检查内容")
private String checkContent;
@ApiModelProperty(name = "checkPhotos", value = "检查图片")
private String checkPhotos;
@ApiModelProperty(name = "checkType", value = "检查类型")
private Integer checkType;
@ApiModelProperty(name = "checkLng", value = "检查经度")
private String checkLng;
@ApiModelProperty(name = "checkLat", value = "检查纬度")
private String checkLat;
@ApiModelProperty(name = "recheckContent", value = "复查描述")
private String recheckContent;
@ApiModelProperty(name = "recheckDate", value = "复查时间")
private String recheckDate;
@ApiModelProperty(name = "recheckPhotos", value = "复查图片")
private String recheckPhotos;
@ApiModelProperty(name = "recheckLng", value = "复查经度")
private String recheckLng;
@ApiModelProperty(name = "recheckLat", value = "复查纬度")
private String recheckLat;
public String getPublicAreaReportId() {
return publicAreaReportId == null ? "" : publicAreaReportId;
}
public void setPublicAreaReportId(String publicAreaReportId) {
this.publicAreaReportId = publicAreaReportId;
}
public String getCheckAddress() {
return checkAddress == null ? "" : checkAddress;
}
public void setCheckAddress(String checkAddress) {
this.checkAddress = checkAddress;
}
public String getCheckDate() {
return checkDate == null ? "" : checkDate;
}
public void setCheckDate(String checkDate) {
this.checkDate = checkDate;
}
public String getCheckContent() {
return checkContent == null ? "" : checkContent;
}
public void setCheckContent(String checkContent) {
this.checkContent = checkContent;
}
public String getCheckPhotos() {
return checkPhotos == null ? "" : checkPhotos;
}
public void setCheckPhotos(String checkPhotos) {
this.checkPhotos = checkPhotos;
}
public Integer getCheckType() {
return checkType == null ? 0 : checkType;
}
public void setCheckType(Integer checkType) {
this.checkType = checkType;
}
public String getCheckLng() {
return checkLng == null ? "" : checkLng;
}
public void setCheckLng(String checkLng) {
this.checkLng = checkLng;
}
public String getCheckLat() {
return checkLat == null ? "" : checkLat;
}
public void setCheckLat(String checkLat) {
this.checkLat = checkLat;
}
public String getRecheckContent() {
return recheckContent == null ? "" : recheckContent;
}
public void setRecheckContent(String recheckContent) {
this.recheckContent = recheckContent;
}
public String getRecheckDate() {
return recheckDate == null ? "" : recheckDate;
}
public void setRecheckDate(String recheckDate) {
this.recheckDate = recheckDate;
}
public String getRecheckPhotos() {
return recheckPhotos == null ? "" : recheckPhotos;
}
public void setRecheckPhotos(String recheckPhotos) {
this.recheckPhotos = recheckPhotos;
}
public String getRecheckLng() {
return recheckLng == null ? "" : recheckLng;
}
public void setRecheckLng(String recheckLng) {
this.recheckLng = recheckLng;
}
public String getRecheckLat() {
return recheckLat == null ? "" : recheckLat;
}
public void setRecheckLat(String recheckLat) {
this.recheckLat = recheckLat;
}
}

View File

@ -25,6 +25,10 @@ public class TaskCheckDTO {
private String enterpriseMaster;
@ApiModelProperty(name = "enterprisePhone", value = "企业负责人电话")
private String enterprisePhone;
@ApiModelProperty(name = "enterpriseNature", value = "企业场所性质")
private String enterpriseNature;
@ApiModelProperty(name = "enterpriseNatureDictionaryName", value = "企业场所性质名称")
private String enterpriseNatureDictionaryName;
@ApiModelProperty(name = "gmtCreate", value = "发布时间")
private String gmtCreate;
@ApiModelProperty(name = "userId", value = "处理人")
@ -80,6 +84,22 @@ public class TaskCheckDTO {
this.enterprisePhone = enterprisePhone;
}
public String getEnterpriseNature() {
return enterpriseNature == null ? "" : enterpriseNature;
}
public void setEnterpriseNature(String enterpriseNature) {
this.enterpriseNature = enterpriseNature;
}
public String getEnterpriseNatureDictionaryName() {
return enterpriseNatureDictionaryName == null ? "" : enterpriseNatureDictionaryName;
}
public void setEnterpriseNatureDictionaryName(String enterpriseNatureDictionaryName) {
this.enterpriseNatureDictionaryName = enterpriseNatureDictionaryName;
}
public String getUserId() {
return userId == null ? "" : userId.trim();
}
@ -119,6 +139,10 @@ public class TaskCheckDTO {
.append(enterpriseMaster).append('\"');
sb.append(",\"enterprisePhone\":\"")
.append(enterprisePhone).append('\"');
sb.append(",\"enterpriseNature\":\"")
.append(enterpriseNature).append('\"');
sb.append(",\"enterpriseNatureDictionaryName\":\"")
.append(enterpriseNatureDictionaryName).append('\"');
sb.append(",\"gmtCreate\":\"")
.append(gmtCreate).append('\"');
sb.append(",\"userId\":\"")

View File

@ -0,0 +1,142 @@
package com.cm.inspection.pojo.vos.publicareareport;
import com.cm.common.annotation.CheckEmptyAnnotation;
import com.cm.common.annotation.CheckNumberAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: PublicAreaReportVO
* @Description: 公共区域上报
* @Author: WenG
* @Date: 2020-04-20 17:27
* @Version: 1.0
**/
@ApiModel
public class PublicAreaReportVO {
@ApiModelProperty(name = "checkAddress", value = "检查地址")
private String checkAddress;
@ApiModelProperty(name = "checkDate", value = "检查时间")
private String checkDate;
@ApiModelProperty(name = "checkContent", value = "检查内容")
private String checkContent;
@ApiModelProperty(name = "checkPhotos", value = "检查图片")
private String checkPhotos;
@ApiModelProperty(name = "checkType", value = "检查类型")
@CheckNumberAnnotation(name = "检查类型", types = {"1", "2", "3"})
private Integer checkType;
@ApiModelProperty(name = "checkLng", value = "检查经度")
private String checkLng;
@ApiModelProperty(name = "checkLat", value = "检查纬度")
private String checkLat;
@ApiModelProperty(name = "recheckContent", value = "复查描述")
private String recheckContent;
@ApiModelProperty(name = "recheckDate", value = "复查时间")
private String recheckDate;
@ApiModelProperty(name = "recheckPhotos", value = "复查图片")
private String recheckPhotos;
@ApiModelProperty(name = "recheckLng", value = "复查经度")
private String recheckLng;
@ApiModelProperty(name = "recheckLat", value = "复查纬度")
private String recheckLat;
public String getCheckAddress() {
return checkAddress == null ? "" : checkAddress;
}
public void setCheckAddress(String checkAddress) {
this.checkAddress = checkAddress;
}
public String getCheckDate() {
return checkDate == null ? "" : checkDate;
}
public void setCheckDate(String checkDate) {
this.checkDate = checkDate;
}
public String getCheckContent() {
return checkContent == null ? "" : checkContent;
}
public void setCheckContent(String checkContent) {
this.checkContent = checkContent;
}
public String getCheckPhotos() {
return checkPhotos == null ? "" : checkPhotos;
}
public void setCheckPhotos(String checkPhotos) {
this.checkPhotos = checkPhotos;
}
public Integer getCheckType() {
return checkType == null ? 0 : checkType;
}
public void setCheckType(Integer checkType) {
this.checkType = checkType;
}
public String getCheckLng() {
return checkLng == null ? "" : checkLng;
}
public void setCheckLng(String checkLng) {
this.checkLng = checkLng;
}
public String getCheckLat() {
return checkLat == null ? "" : checkLat;
}
public void setCheckLat(String checkLat) {
this.checkLat = checkLat;
}
public String getRecheckContent() {
return recheckContent == null ? "" : recheckContent;
}
public void setRecheckContent(String recheckContent) {
this.recheckContent = recheckContent;
}
public String getRecheckDate() {
return recheckDate == null ? "" : recheckDate;
}
public void setRecheckDate(String recheckDate) {
this.recheckDate = recheckDate;
}
public String getRecheckPhotos() {
return recheckPhotos == null ? "" : recheckPhotos;
}
public void setRecheckPhotos(String recheckPhotos) {
this.recheckPhotos = recheckPhotos;
}
public String getRecheckLng() {
return recheckLng == null ? "" : recheckLng;
}
public void setRecheckLng(String recheckLng) {
this.recheckLng = recheckLng;
}
public String getRecheckLat() {
return recheckLat == null ? "" : recheckLat;
}
public void setRecheckLat(String recheckLat) {
this.recheckLat = recheckLat;
}
}

View File

@ -462,8 +462,10 @@ public class CheckServiceImpl extends BaseService implements ICheckService {
checkItemDTO.setHiddenDangerReports(hiddenDangerReportDTOs);
}
checkDTO.setCheckItems(checkItemDTOs);
params.put("checkItemIds", checkItemParentIds);
setCheckItemParent(params, checkItemDTOs);
if (!checkItemParentIds.isEmpty()) {
params.put("checkItemIds", checkItemParentIds);
setCheckItemParent(params, checkItemDTOs);
}
}
return checkDTO;
}

View File

@ -0,0 +1,129 @@
package com.cm.inspection.service.publicareareport;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.publicareareport.PublicAreaReportDTO;
import com.cm.inspection.pojo.vos.publicareareport.PublicAreaReportVO;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IPublicAreaReportService
* @Description: 公共区域上报
* @Author: WenG
* @Date: 2020-04-20 17:27
* @Version: 1.0
**/
public interface IPublicAreaReportService {
/**
* 新增公共区域上报
*
* @param publicAreaReportVO
* @return
* @throws Exception
*/
SuccessResult savePublicAreaReport(PublicAreaReportVO publicAreaReportVO) throws Exception;
/**
* 新增公共区域上报(APP)
*
* @param token
* @param publicAreaReportVO
* @return
* @throws Exception
*/
SuccessResult savePublicAreaReportByToken(String token, PublicAreaReportVO publicAreaReportVO) throws Exception;
/**
* 删除公共区域上报
*
* @param ids
* @return
* @throws RemoveException
*/
SuccessResult removePublicAreaReport(String ids) throws RemoveException;
/**
* 删除公共区域上报(APP)
*
* @param token
* @param ids
* @return
* @throws RemoveException
*/
SuccessResult removePublicAreaReportByToken(String token, String ids) throws RemoveException;
/**
* 修改公共区域上报
*
* @param publicAreaReportId
* @param publicAreaReportVO
* @return
* @throws Exception
*/
SuccessResult updatePublicAreaReport(String publicAreaReportId, PublicAreaReportVO publicAreaReportVO) throws Exception;
/**
* 修改公共区域上报(APP)
*
* @param token
* @param publicAreaReportId
* @param publicAreaReportVO
* @return
* @throws Exception
*/
SuccessResult updatePublicAreaReportByToken(String token, String publicAreaReportId, PublicAreaReportVO publicAreaReportVO) throws Exception;
/**
* 公共区域上报详情(通过ID)
*
* @param publicAreaReportId
* @return
* @throws SearchException
*/
PublicAreaReportDTO getPublicAreaReportById(String publicAreaReportId) throws SearchException;
/**
* 公共区域上报列表
*
* @param params
* @return
* @throws SearchException
*/
List<PublicAreaReportDTO> listPublicAreaReport(Map<String, Object> params) throws SearchException;
/**
* 公共区域上报分页列表
*
* @param page
* @return
* @throws SearchException
*/
SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReport(ListPage page) throws SearchException;
/**
* 公共区域上报分页列表我的
*
* @param page
* @return
* @throws SearchException
*/
SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReportOfMine(ListPage page) throws SearchException;
/**
* 公共区域上报分页列表我的
*
* @param token
* @param page
* @return
* @throws SearchException
*/
SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReportOfMine(String token, ListPage page) throws SearchException;
}

View File

@ -0,0 +1,168 @@
package com.cm.inspection.service.publicareareport.impl;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
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.token.app.AppTokenManager;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.publicareareport.IPublicAreaReportDao;
import com.cm.inspection.pojo.dtos.publicareareport.PublicAreaReportDTO;
import com.cm.inspection.pojo.vos.publicareareport.PublicAreaReportVO;
import com.cm.inspection.service.BaseService;
import com.cm.inspection.service.publicareareport.IPublicAreaReportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @ClassName: PublicAreaReportServiceImpl
* @Description: 公共区域上报
* @Author: WenG
* @Date: 2020-04-20 17:27
* @Version: 1.0
**/
@Service
public class PublicAreaReportServiceImpl extends BaseService implements IPublicAreaReportService {
@Autowired
private IPublicAreaReportDao publicAreaReportDao;
@Override
public SuccessResult savePublicAreaReport(PublicAreaReportVO publicAreaReportVO) throws Exception {
savePublicAreaReportInfo(null, publicAreaReportVO);
return new SuccessResult();
}
@Override
public SuccessResult savePublicAreaReportByToken(String token, PublicAreaReportVO publicAreaReportVO) throws Exception {
savePublicAreaReportInfo(token, publicAreaReportVO);
return new SuccessResult();
}
/**
* 新增公共区域上报
*
* @param token
* @param publicAreaReportVO
* @throws Exception
*/
private void savePublicAreaReportInfo(String token, PublicAreaReportVO publicAreaReportVO) throws Exception {
Map<String, Object> params = HashMapUtil.beanToMap(publicAreaReportVO);
params.put("publicAreaReportId", UUIDUtil.getUUID());
if (token != null) {
setSaveInfo(token, params);
} else {
setSaveInfo(params);
}
publicAreaReportDao.savePublicAreaReport(params);
}
@Override
public SuccessResult removePublicAreaReport(String ids) throws RemoveException {
removePublicAreaReportInfo(null, ids);
return new SuccessResult();
}
@Override
public SuccessResult removePublicAreaReportByToken(String token, String ids) throws RemoveException {
removePublicAreaReportInfo(token, ids);
return new SuccessResult();
}
/**
* 删除公共区域上报
*
* @param token
* @param ids
*/
private void removePublicAreaReportInfo(String token, String ids) {
Map<String, Object> params = getHashMap(3);
params.put("publicAreaReportIds", Arrays.asList(ids.split("_")));
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
publicAreaReportDao.removePublicAreaReport(params);
}
@Override
public SuccessResult updatePublicAreaReport(String publicAreaReportId, PublicAreaReportVO publicAreaReportVO) throws Exception {
updatePublicAreaReportInfo(null, publicAreaReportId, publicAreaReportVO);
return new SuccessResult();
}
@Override
public SuccessResult updatePublicAreaReportByToken(String token, String publicAreaReportId, PublicAreaReportVO publicAreaReportVO) throws Exception {
updatePublicAreaReportInfo(token, publicAreaReportId, publicAreaReportVO);
return new SuccessResult();
}
/**
* 修改公共区域上报
*
* @param token
* @param publicAreaReportId
* @param publicAreaReportVO
*/
private void updatePublicAreaReportInfo(String token, String publicAreaReportId, PublicAreaReportVO publicAreaReportVO) throws Exception {
publicAreaReportVO.setCheckAddress(null);
publicAreaReportVO.setCheckContent(null);
publicAreaReportVO.setCheckDate(null);
publicAreaReportVO.setCheckPhotos(null);
publicAreaReportVO.setCheckLat(null);
publicAreaReportVO.setCheckLng(null);
Map<String, Object> params = HashMapUtil.beanToMap(publicAreaReportVO);
params.put("publicAreaReportId", publicAreaReportId);
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
publicAreaReportDao.updatePublicAreaReport(params);
}
@Override
public PublicAreaReportDTO getPublicAreaReportById(String publicAreaReportId) throws SearchException {
Map<String, Object> params = super.getHashMap(1);
params.put("publicAreaReportId", publicAreaReportId);
return publicAreaReportDao.getPublicAreaReport(params);
}
@Override
public List<PublicAreaReportDTO> listPublicAreaReport(Map<String, Object> params) throws SearchException {
return publicAreaReportDao.listPublicAreaReport(params);
}
@Override
public SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReport(ListPage page) throws SearchException {
PageHelper.startPage(page.getPage(), page.getRows());
List<PublicAreaReportDTO> publicAreaReportDTOs = publicAreaReportDao.listPublicAreaReport(page.getParams());
PageInfo<PublicAreaReportDTO> pageInfo = new PageInfo<>(publicAreaReportDTOs);
return new SuccessResultList<>(publicAreaReportDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReportOfMine(ListPage page) throws SearchException {
return listPagePublicAreaReportOfMine(null, page);
}
@Override
public SuccessResultList<List<PublicAreaReportDTO>> listPagePublicAreaReportOfMine(String token, ListPage page) throws SearchException {
if (StringUtils.isBlank(token)) {
page.getParams().put("creator", securityComponent.getCurrentUser().getUserId());
} else {
page.getParams().put("creator", AppTokenManager.getInstance().getToken(token).getAppTokenUser().getId());
}
return listPagePublicAreaReport(page);
}
}

View File

@ -0,0 +1,203 @@
<?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.inspection.dao.publicareareport.IPublicAreaReportDao">
<resultMap id="publicAreaReportDTO" type="com.cm.inspection.pojo.dtos.publicareareport.PublicAreaReportDTO">
<id column="public_area_report_id" property="publicAreaReportId"/>
<result column="check_address" property="checkAddress"/>
<result column="check_date" property="checkDate"/>
<result column="check_content" property="checkContent"/>
<result column="check_photos" property="checkPhotos"/>
<result column="check_type" property="checkType"/>
<result column="check_lng" property="checkLng"/>
<result column="check_lat" property="checkLat"/>
<result column="recheck_content" property="recheckContent"/>
<result column="recheck_date" property="recheckDate"/>
<result column="recheck_photos" property="recheckPhotos"/>
<result column="recheck_lng" property="recheckLng"/>
<result column="recheck_lat" property="recheckLat"/>
</resultMap>
<!-- 新增公共区域上报 -->
<insert id="savePublicAreaReport" parameterType="map">
INSERT INTO gen_public_area_report(
public_area_report_id,
check_address,
check_date,
check_content,
check_photos,
check_type,
check_lng,
check_lat,
recheck_content,
recheck_date,
recheck_photos,
recheck_lng,
recheck_lat,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{publicAreaReportId},
#{checkAddress},
#{checkDate},
#{checkContent},
#{checkPhotos},
#{checkType},
#{checkLng},
#{checkLat},
#{recheckContent},
#{recheckDate},
#{recheckPhotos},
#{recheckLng},
#{recheckLat},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除公共区域上报 -->
<update id="removePublicAreaReport" parameterType="map">
UPDATE
gen_public_area_report
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
public_area_report_id IN
<foreach collection="publicAreaReportIds" index="index" open="(" separator="," close=")">
#{publicAreaReportIds[${index}]}
</foreach>
</update>
<!-- 修改公共区域上报 -->
<update id="updatePublicAreaReport" parameterType="map">
UPDATE
gen_public_area_report
SET
<if test="checkAddress != null and checkAddress != ''">
check_address = #{checkAddress},
</if>
<if test="checkDate != null and checkDate != ''">
check_date = #{checkDate},
</if>
<if test="checkContent != null and checkContent != ''">
check_content = #{checkContent},
</if>
<if test="checkPhotos != null and checkPhotos != ''">
check_photos = #{checkPhotos},
</if>
<if test="checkType != null">
check_type = #{checkType},
</if>
<if test="checkLng != null and checkLng != ''">
check_lng = #{checkLng},
</if>
<if test="checkLat != null and checkLat != ''">
check_lat = #{checkLat},
</if>
<if test="recheckContent != null and recheckContent != ''">
recheck_content = #{recheckContent},
</if>
<if test="recheckDate != null and recheckDate != ''">
recheck_date = #{recheckDate},
</if>
<if test="recheckPhotos != null and recheckPhotos != ''">
recheck_photos = #{recheckPhotos},
</if>
<if test="recheckLng != null and recheckLng != ''">
recheck_lng = #{recheckLng},
</if>
<if test="recheckLat != null and recheckLat != ''">
recheck_lat = #{recheckLat},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
public_area_report_id = #{publicAreaReportId}
</update>
<!-- 公共区域上报详情 -->
<select id="getPublicAreaReport" parameterType="map" resultMap="publicAreaReportDTO">
SELECT
t1.check_address,
t1.check_date,
t1.check_content,
t1.check_photos,
t1.check_type,
t1.check_lng,
t1.check_lat,
t1.recheck_content,
t1.recheck_date,
t1.recheck_photos,
t1.recheck_lng,
t1.recheck_lat,
t1.public_area_report_id
FROM
gen_public_area_report t1
WHERE
t1.is_delete = 0
<if test="publicAreaReportId != null and publicAreaReportId != ''">
AND
t1.public_area_report_id = #{publicAreaReportId}
</if>
</select>
<!-- 公共区域上报列表 -->
<select id="listPublicAreaReport" parameterType="map" resultMap="publicAreaReportDTO">
SELECT
t1.check_address,
t1.check_date,
t1.check_content,
t1.check_photos,
t1.check_type,
t1.check_lng,
t1.check_lat,
t1.recheck_content,
t1.recheck_date,
t1.recheck_photos,
t1.recheck_lng,
t1.recheck_lat,
t1.public_area_report_id
FROM
gen_public_area_report t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
t1.check_address LIKE CONCAT('%', #{keywords}, '%')
OR
t1.check_content LIKE CONCAT('%', #{keywords}, '%')
OR
t1.recheck_content LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="creator != null and creator != ''">
AND
creator = #{creator}
</if>
<if test="publicAreaReportIds != null and publicAreaReportIds.size > 0">
AND
t1.public_area_report_id IN
<foreach collection="publicAreaReportIds" index="index" open="(" separator="," close=")">
#{publicAreaReportIds[${index}]}
</foreach>
</if>
</select>
</mapper>

View File

@ -9,6 +9,8 @@
<result column="enterprise_address" property="enterpriseAddress"/>
<result column="enterprise_master" property="enterpriseMaster"/>
<result column="enterprise_phone" property="enterprisePhone"/>
<result column="enterprise_nature" property="enterpriseNature"/>
<result column="enterprise_nature_dictionary_name" property="enterpriseNatureDictionaryName"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="is_handled" property="isHandled"/>
<result column="user_id" property="userId"/>
@ -78,11 +80,23 @@
<select id="getTaskCheck" parameterType="map" resultMap="taskCheckDTO">
SELECT
t1.enterprise_id,
jt1.name enterprise_name,
jt1.address enterprise_address,
jt1.master enterprise_master,
jt1.phone enterprise_phone,
jt1.nature enterprise_nature,
jt1.nature_dictionary_name enterprise_nature_dictionary_name,
t1.user_id,
t1.is_handled,
t1.task_check_id
FROM
gen_task_check t1
INNER JOIN
gen_enterprise jt1
ON
jt1.enterprise_id = t1.enterprise_id
AND
jt1.is_delete = 0
WHERE
t1.is_delete = 0
<if test="taskCheckId != null and taskCheckId != ''">
@ -99,6 +113,8 @@
jt1.address enterprise_address,
jt1.master enterprise_master,
jt1.phone enterprise_phone,
jt1.nature enterprise_nature,
jt1.nature_dictionary_name enterprise_nature_dictionary_name,
t1.user_id,
LEFT(t1.gmt_create, 19) gmt_create,
t1.is_handled,
@ -108,7 +124,9 @@
INNER JOIN
gen_enterprise jt1
ON
t1.enterprise_id = jt1.enterprise_id
jt1.enterprise_id = t1.enterprise_id
AND
jt1.is_delete = 0
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
@ -133,6 +151,10 @@
AND
LEFT(t1.user_id, 36) = #{userId}
</if>
<if test="isHandled != null">
AND
t1.is_handled = #{isHandled}
</if>
ORDER BY
t1.gmt_create DESC
</select>

View File

@ -31,7 +31,7 @@
<label class="layui-form-label">企业</label>
<div class="layui-input-block layui-form">
<input type="hidden" id="enterpriseId" name="enterpriseId" class="layui-input">
<input type="text" id="enterpriseName" name="enterpriseName" lay-verify="required" class="layui-input" placeholder="请选择企业" style="cursor: pointer;">
<input type="text" id="enterpriseName" name="enterpriseName" class="layui-input" readonly>
</div>
</div>
<div class="layui-form-item">
@ -116,17 +116,6 @@
<input type="radio" name="rectificationDays" value="30" title="30天">
</td>
</tr>
<tr id="hd_scenePhotos">
<td>
<input type="hidden" id="scenePhotos" name="scenePhotos"/>
<div id="scenePhotos_ImageBox" style="display: inline-block"></div>
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="佐证图片" data-name="scenePhotos" lay-filter="scenePhotosUploadFiles">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</script>

View File

@ -0,0 +1,443 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<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">
<style>
.check-item-option-number-box {display: inline-block; vertical-align: middle; margin-top: 6px; margin-right: 20px;}
.check-item-option-text-box {display: inline-block; vertical-align: middle; margin-top: 6px; margin-right: 20px;}
.check-item-option-number-input {width: 50px; height: 24px; text-align: center;}
.check-item-option-text-input {width: 200px; height: 24px; text-align: center;}
</style>
</head>
<body>
<div class="layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item">
<label class="layui-form-label">企业</label>
<div class="layui-input-block layui-form">
<input type="hidden" id="enterpriseId" name="enterpriseId" class="layui-input">
<input type="text" id="enterpriseName" name="enterpriseName" class="layui-input" readonly>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">是否配合</label>
<div class="layui-input-block">
<select id="isCoordination" name="isCoordination" lay-verify="required">
<option value="">请选择</option>
<option value="0">未整改</option>
<option value="1">配合</option>
</select>
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block" id="checkItemTemplateBox"></div>
<script id="checkItemTemplate" type="text/html">
<table class="layui-table">
<thead>
<tr>
<th style="width: 300px;">检查项</th>
<th>检查结果</th>
</tr>
</thead>
<tbody>
{{# for(var i = 0, item; item = d[i++]; ) { }}
{{# if(item.type == 0) {continue;} }}
<tr>
<td>{{item.nameJoinByCheckItemId}}({{item.type == '1' ? '必查': '选查'}})</td>
<td>
{{# for(var j = 0, jItem; jItem = item.checkItemOptions[j++]; ) { }}
{{# if(jItem.type == 1) { }}
<input type="radio" name="hd_checkResult_{{item.checkItemId}}_{{item.checkItemParentId}}" value="{{jItem.checkItemOptionId}}" title="{{jItem.name}}" data-checktype="{{item.type}}" data-type="{{jItem.type}}" data-iswrong="{{jItem.isWrong}}" lay-filter="checkItemOptionCheckResult" lay-verify="otherReq">
{{# } else if(jItem.type == 2) { }}
<div class="check-item-option-number-box"><span>{{jItem.name}}</span><input class="check-item-option-number-input" id="hd_checkNumber_{{item.checkItemId}}_{{jItem.checkItemOptionId}}_{{item.checkItemParentId}}" name="hd_checkNumber_{{item.checkItemId}}_{{jItem.checkItemOptionId}}_{{item.checkItemParentId}}" type="number" step="1" lay-verify="requiredInput"/> <span>{{jItem.unit}}</span></div>
{{# } else if(jItem.type == 3) { }}
<div class="check-item-option-text-box"><span>{{jItem.name}}</span><input class="check-item-option-text-input" id="hd_checkText_{{item.checkItemId}}_{{jItem.checkItemOptionId}}_{{item.checkItemParentId}}" name="hd_checkText_{{item.checkItemId}}_{{jItem.checkItemOptionId}}_{{item.checkItemParentId}}" type="text" lay-verify="requiredInput"/> <span>{{jItem.unit}}</span></div>
{{# } }}
{{# } }}
</td>
<tr id="hd_scenePhotos_{{item.checkItemId}}_Box">
<td></td>
<td>
<input type="hidden" id="hd_scenePhotos_{{item.checkItemId}}" name="hd_scenePhotos_{{item.checkItemId}}"/>
<div id="hd_scenePhotos_{{item.checkItemId}}_ImageBox" style="display: inline-block"></div>
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="佐证图片" data-name="hd_scenePhotos_{{item.checkItemId}}" lay-filter="scenePhotosUploadFiles">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
</td>
</tr>
</tr>
{{# } }}
</tbody>
</table>
<table id="handleTable" class="layui-table" style="display: none;">
<thead>
<tr>
<th>整改处理</th>
</tr>
</thead>
</thead>
<tbody>
<tr id="hd_checkResult">
<td>
<input type="radio" name="rectificationType" value="1" title="立即整改" lay-filter="checkResultFilter" checked>
<input type="radio" name="rectificationType" value="2" title="限期整改" lay-filter="checkResultFilter">
</td>
</tr>
<tr id="hd_immediatelyChangeType">
<td>
<input type="radio" name="immediatelyChangeType" value="1" title="当场" checked>
<input type="radio" name="immediatelyChangeType" value="2" title="当天">
</td>
</tr>
<tr id="hd_rectificationDays" style="display: none;">
<td>
<input type="radio" name="rectificationDays" value="1" title="1天" checked>
<input type="radio" name="rectificationDays" value="5" title="5天">
<input type="radio" name="rectificationDays" value="15" title="15天">
<input type="radio" name="rectificationDays" value="20" title="20天">
<input type="radio" name="rectificationDays" value="25" title="25天">
<input type="radio" name="rectificationDays" value="30" title="30天">
</td>
</tr>
</tbody>
</table>
</script>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" 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/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 taskCheckId = top.restAjax.params(window.location.href).taskCheckId;
var checkItemArray = [];
var wrongCheckItemArray = [];
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
/**
* 初始化检查项
*
* @param data
*/
function initCheckItem(natureId) {
if(!natureId) {
laytpl(document.getElementById("checkItemTemplate").innerHTML).render([], function(html) {
document.getElementById("checkItemTemplateBox").innerHTML = html;
});
return;
}
top.restAjax.get(top.restAjax.path('api/industrycheckitem/listindustrycheckitem', []), {
natureId: natureId
}, null, function(code, data) {
checkItemArray = data;
laytpl(document.getElementById("checkItemTemplate").innerHTML).render(data, function(html) {
document.getElementById("checkItemTemplateBox").innerHTML = html;
});
form.render('radio');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/taskcheck/gettaskcheckbyid/{taskCheckId}', [taskCheckId]), {}, null, function(code, data) {
var dataFormData = {
enterpriseId: data.enterpriseId,
enterpriseName: data.enterpriseName,
};
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initCheckItem(data.enterpriseNature);
}, 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();
// 提交表单
form.on('submit(submitForm)', function(formData) {
var field = formData.field;
// 获取隐患项列表
var hdFieldArray = [];
for(var i in field) {
if(i.indexOf('hd_') > -1) {
hdFieldArray.push({
k: i,
v: field[i]
});
delete field[i];
}
}
// 筛选隐藏项
var hiddenDangerReports = [];
var temp;
for(var i = 0; i < hdFieldArray.length; i++) {
var removeItemCount = 0;
for(var j = 0; j < hdFieldArray.length; j++) {
var checkItem = hdFieldArray[j];
var checkItemKey = checkItem.k;
var hiddenDangerReportArray = checkItemKey.split('_');
var checkItemId = hiddenDangerReportArray[2];
var scenePhotos = $('#hd_scenePhotos_'+ checkItemId).val();
if(checkItemKey.indexOf(checkItemId) > -1) {
if(checkItemKey.indexOf('checkResult') > -1) {
hiddenDangerReports.push({
checkItemParentId: hiddenDangerReportArray[3],
checkItemId: checkItemId,
checkItemOptionId: checkItem.v,
scenePhotos: scenePhotos,
checkResult: checkItem.v
});
hdFieldArray.splice(j, 1);
j--;
removeItemCount++;
} else if(checkItemKey.indexOf('checkNumber') > -1) {
hiddenDangerReports.push({
checkItemParentId: hiddenDangerReportArray[4],
checkItemId: checkItemId,
checkItemOptionId: hiddenDangerReportArray[3],
scenePhotos: scenePhotos,
checkResult: checkItem.v
});
hdFieldArray.splice(j, 1);
j--;
removeItemCount++;
} else if(checkItemKey.indexOf('checkText') > -1) {
hiddenDangerReports.push({
checkItemParentId: hiddenDangerReportArray[4],
checkItemId: checkItemId,
checkItemOptionId: hiddenDangerReportArray[3],
scenePhotos: scenePhotos,
checkResult: checkItem.v
});
hdFieldArray.splice(j, 1);
j--;
removeItemCount++;
} else if(checkItemKey.indexOf('scenePhotos') > -1) {
hdFieldArray.splice(j, 1);
j--;
removeItemCount++;
}
}
}
if(removeItemCount > 0) {
i--;
}
}
field.hiddenDangerReports = hiddenDangerReports;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
formData.field.taskCheckId = taskCheckId;
top.restAjax.post(top.restAjax.path('api/check/savecheck', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg('提交成功', {
time: 0,
btn: [top.dataMessage.button.yes],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
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({
otherReq: function(value, item) {
if($('#isCoordination').val() != '1') {
return;
}
var verifyName = $(item).attr('name')
,verifyType = $(item).attr('type')
,formElem = $(item).parents('.layui-form')//获取当前所在的form元素如果存在的话
,verifyElem = formElem.find('input[name='+verifyName+']')//获取需要校验的元素
,isTrue = verifyElem.is(':checked')//是否命中校验
,focusElem = verifyElem.next().find('i.layui-icon');//焦点元素
if(!isTrue || !value){
//定位焦点
focusElem.css(verifyType=='radio' ? {"color":"#FF5722"} : {"border-color":"#FF5722"});
//对非输入框设置焦点
focusElem.first().attr("tabIndex","1").css("outline","0").blur(function() {
focusElem.css(verifyType=='radio' ? {"color":""} : {"border-color":""});
}).focus();
return '必填项不能为空';
}
},
requiredInput: function(value, item) {
if($('#isCoordination').val() != '1') {
return;
}
if(!value) {
return '必填项不能为空'
}
}
});
form.on('radio(checkItemOptionCheckResult)', function(data) {
var name = data.elem.name;
var checkItemId = name.split('_')[2];
if(this.dataset.checktype == 1 && this.dataset.iswrong == 1) {
wrongCheckItemArray.push(checkItemId);
} else {
for(var i = 0; i < wrongCheckItemArray.length; i++) {
if(checkItemId == wrongCheckItemArray[i]) {
wrongCheckItemArray.splice(i, 1);
break;
}
}
}
if(wrongCheckItemArray.length > 0) {
$('#handleTable').show();
} else {
$('#handleTable').hide();
}
});
form.on('radio(checkResultFilter)', function(data) {
if(data.value == 1) {
$('#hd_rectificationDays').hide();
$('#hd_immediatelyChangeType').show();
} else {
$('#hd_immediatelyChangeType').hide();
$('#hd_rectificationDays').show();
}
});
function refreshDownloadTemplet(fileName, file) {
var dataRander = {};
dataRander[fileName] = file;
var photos = '';
for(var i = 0, item; item = file[i++];) {
photos += '<div class="upload-image-box">'+
'<span class="upload-image-span">'+
'<img src="route/file/downloadfile/false/'+ item.fileId +'" align="加载失败">'+
'</span>'+
'<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="'+ item.fileId +'" data-name="'+ fileName +'" lay-filter="scenePhotosRemoveFile">'+
'<i class="fa fa-trash-o"></i>'+
'</a>'+
'</div>';
}
$('#'+ fileName +'_ImageBox').empty();
$('#'+ fileName +'_ImageBox').append(photos);
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 上传图片
form.on('button(scenePhotosUploadFiles)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {});
}
}
});
});
form.on('button(scenePhotosRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 2);
}
initFileList(name, files, function(fileName) {});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,341 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<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>
<div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
</div>
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
</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'], 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/publicareareport/listpagepublicareareport';
// 初始化表格
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: 'checkAddress', width: 200, title: '检查地址', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkDate', width: 150, title: '检查时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return common.formatDate('yyyy-MM-dd hh:mm:ss', new Date(rowData));
}
},
{field: 'checkContent', width: 150, title: '检查内容', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkPhotos', width: 150, title: '检查图片', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
var downloadFile = '';
var datas = rowData.split(',');
for(var i = 0, item = datas[i]; item = datas[i++];) {
if(downloadFile.length > 0) {
downloadFile += ' | ';
}
downloadFile += '<a href="route/file/downloadfile/false/'+ item +'" target="_blank">点击下载</a>'
}
return downloadFile;
}
},
{field: 'checkType', width: 100, title: '检查类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkLng', width: 150, title: '检查经度', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkLat', width: 150, title: '检查纬度', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'recheckContent', width: 150, title: '复查描述', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'recheckDate', width: 100, title: '复查时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return common.formatDate('yyyy-MM-dd hh:mm:ss', new Date(rowData));
}
},
{field: 'recheckPhotos', width: 150, title: '复查图片', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
var downloadFile = '';
var datas = rowData.split(',');
for(var i = 0, item = datas[i]; item = datas[i++];) {
if(downloadFile.length > 0) {
downloadFile += ' | ';
}
downloadFile += '<a href="route/file/downloadfile/false/'+ item +'" target="_blank">点击下载</a>'
}
return downloadFile;
}
},
{field: 'recheckLng', width: 150, title: '复查经度', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'recheckLat', width: 150, title: '复查纬度', 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 initDate() {
// 日期选择
laydate.render({
elem: '#startTime',
format: 'yyyy-MM-dd'
});
laydate.render({
elem: '#endTime',
format: 'yyyy-MM-dd'
});
}
// 删除
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/publicareareport/removepublicareareport/{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();
initDate();
// 事件 - 页面变化
$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/publicareareport/save-publicareareport.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/publicareareport/update-publicareareport.html?publicAreaReportId={publicAreaReportId}', [checkDatas[0].publicAreaReportId]),
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['publicAreaReportId'];
}
removeData(ids);
}
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,406 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<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-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">
<div class="layui-form-item">
<label class="layui-form-label">检查地址</label>
<div class="layui-input-block">
<input type="text" id="checkAddress" name="checkAddress" class="layui-input" value="" placeholder="请输入检查地址" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检查时间</label>
<div class="layui-input-block">
<input type="text" id="checkDate" name="checkDate" class="layui-input" value="" placeholder="请选择检查时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">检查内容</label>
<div class="layui-input-block">
<textarea id="checkContent" name="checkContent" class="layui-textarea" placeholder="请输入检查内容"></textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">检查图片</label>
<div class="layui-input-block">
<input type="hidden" id="checkPhotos" name="checkPhotos">
<div class="layui-btn-container" id="checkPhotosFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="checkPhotosFileDownload" type="text/html">
{{# var fileName = 'checkPhotos'; }}
{{# if(d[fileName].length > 0) { }}
{{# var files = d[fileName];}}
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<div class="upload-image-box">
<span class="upload-image-span">
<img src="route/file/downloadfile/false/{{item.fileId}}" align="加载失败">
</span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="checkPhotosRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 9) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="检查图片" data-name="checkPhotos" lay-filter="checkPhotosUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检查类型</label>
<div class="layui-input-block">
<input type="number" id="checkType" name="checkType" class="layui-input" value="1" placeholder="请输入检查类型" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检查经度</label>
<div class="layui-input-block">
<input type="text" id="checkLng" name="checkLng" class="layui-input" value="" placeholder="请输入检查经度" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检查纬度</label>
<div class="layui-input-block">
<input type="text" id="checkLat" name="checkLat" class="layui-input" value="" placeholder="请输入检查纬度" >
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">复查描述</label>
<div class="layui-input-block">
<textarea id="recheckContent" name="recheckContent" class="layui-textarea" placeholder="请输入复查描述"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">复查时间</label>
<div class="layui-input-block">
<input type="text" id="recheckDate" name="recheckDate" class="layui-input" value="" placeholder="请选择复查时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">复查图片</label>
<div class="layui-input-block">
<input type="hidden" id="recheckPhotos" name="recheckPhotos">
<div class="layui-btn-container" id="recheckPhotosFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="recheckPhotosFileDownload" type="text/html">
{{# var fileName = 'recheckPhotos'; }}
{{# if(d[fileName].length > 0) { }}
{{# var files = d[fileName];}}
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<div class="upload-image-box">
<span class="upload-image-span">
<img src="route/file/downloadfile/false/{{item.fileId}}" align="加载失败">
</span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="recheckPhotosRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 9) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="复查图片" data-name="recheckPhotos" lay-filter="recheckPhotosUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">复查经度</label>
<div class="layui-input-block">
<input type="text" id="recheckLng" name="recheckLng" class="layui-input" value="" placeholder="请输入复查经度" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">复查纬度</label>
<div class="layui-input-block">
<input type="text" id="recheckLat" name="recheckLat" class="layui-input" value="" placeholder="请输入复查纬度" >
</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" 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/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 = {};
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function refreshDownloadTemplet(fileName, file) {
var dataRander = {};
dataRander[fileName] = file;
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
document.getElementById(fileName +'FileBox').innerHTML = html;
});
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化视频
function initVideo(fileName, data) {
for(var i = 0, item; item = data[i++];) {
var player = new ckplayer({
container: '#'+ fileName + i,
variable: 'player',
flashplayer: false,
video: {
file: 'route/file/downloadfile/true/'+ item.fileId,
type: 'video/mp4'
}
});
}
}
// 初始化检查时间时间戳
function initCheckDateDateTime() {
laydate.render({
elem: '#checkDate',
type: 'datetime',
value: new Date(),
trigger: 'click'
});
}
// 初始化检查图片图片上传
function initCheckPhotosUploadFile() {
var files = $('#checkPhotos').val();
initFileList('checkPhotos', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(checkPhotosUploadFile)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
}
}
});
});
form.on('button(checkPhotosRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 2);
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
});
}
// 初始化复查时间时间戳
function initRecheckDateDateTime() {
laydate.render({
elem: '#recheckDate',
type: 'datetime',
value: new Date(),
trigger: 'click'
});
}
// 初始化复查图片图片上传
function initRecheckPhotosUploadFile() {
var files = $('#recheckPhotos').val();
initFileList('recheckPhotos', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(recheckPhotosUploadFile)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
}
}
});
});
form.on('button(recheckPhotosRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 2);
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
});
}
// 初始化内容
function initData() {
top.restAjax.get(top.restAjax.path('api/publicareareport/getcurrentuseridinfo', []), {}, null, function(code, data) {
initCheckDateDateTime();
initCheckPhotosUploadFile();
initRecheckDateDateTime();
initRecheckPhotosUploadFile();
}, 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();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/publicareareport/savepublicareareport', []), 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,415 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<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-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">
<div class="layui-form-item">
<label class="layui-form-label">检查地址</label>
<div class="layui-input-block">
<input type="text" id="checkAddress" name="checkAddress" class="layui-input" value="" placeholder="请输入检查地址" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检查时间</label>
<div class="layui-input-block">
<input type="text" id="checkDate" name="checkDate" class="layui-input" value="" placeholder="请选择检查时间" lay-verify="required" readonly style="cursor: pointer;">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">检查内容</label>
<div class="layui-input-block">
<textarea id="checkContent" name="checkContent" class="layui-textarea" placeholder="请输入检查内容"></textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">检查图片</label>
<div class="layui-input-block">
<input type="hidden" id="checkPhotos" name="checkPhotos">
<div class="layui-btn-container" id="checkPhotosFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="checkPhotosFileDownload" type="text/html">
{{# var fileName = 'checkPhotos'; }}
{{# if(d[fileName].length > 0) { }}
{{# var files = d[fileName];}}
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<div class="upload-image-box">
<span class="upload-image-span">
<img src="route/file/downloadfile/false/{{item.fileId}}" align="加载失败">
</span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="checkPhotosRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 9) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="检查图片" data-name="checkPhotos" lay-filter="checkPhotosUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检查类型</label>
<div class="layui-input-block">
<input type="number" id="checkType" name="checkType" class="layui-input" value="1" placeholder="请输入检查类型" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检查经度</label>
<div class="layui-input-block">
<input type="text" id="checkLng" name="checkLng" class="layui-input" value="" placeholder="请输入检查经度" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检查纬度</label>
<div class="layui-input-block">
<input type="text" id="checkLat" name="checkLat" class="layui-input" value="" placeholder="请输入检查纬度" >
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">复查描述</label>
<div class="layui-input-block">
<textarea id="recheckContent" name="recheckContent" class="layui-textarea" placeholder="请输入复查描述"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">复查时间</label>
<div class="layui-input-block">
<input type="text" id="recheckDate" name="recheckDate" class="layui-input" value="" placeholder="请选择复查时间" lay-verify="required" readonly style="cursor: pointer;">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">复查图片</label>
<div class="layui-input-block">
<input type="hidden" id="recheckPhotos" name="recheckPhotos">
<div class="layui-btn-container" id="recheckPhotosFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="recheckPhotosFileDownload" type="text/html">
{{# var fileName = 'recheckPhotos'; }}
{{# if(d[fileName].length > 0) { }}
{{# var files = d[fileName];}}
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<div class="upload-image-box">
<span class="upload-image-span">
<img src="route/file/downloadfile/false/{{item.fileId}}" align="加载失败">
</span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="recheckPhotosRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 9) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="复查图片" data-name="recheckPhotos" lay-filter="recheckPhotosUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">复查经度</label>
<div class="layui-input-block">
<input type="text" id="recheckLng" name="recheckLng" class="layui-input" value="" placeholder="请输入复查经度" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">复查纬度</label>
<div class="layui-input-block">
<input type="text" id="recheckLat" name="recheckLat" class="layui-input" value="" placeholder="请输入复查纬度" >
</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" 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/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 publicAreaReportId = top.restAjax.params(window.location.href).publicAreaReportId;
var wangEditor = window.wangEditor;
var wangEditorObj = {};
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function refreshDownloadTemplet(fileName, file) {
var dataRander = {};
dataRander[fileName] = file;
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
document.getElementById(fileName +'FileBox').innerHTML = html;
});
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化视频
function initVideo(fileName, data) {
for(var i = 0, item; item = data[i++];) {
var player = new ckplayer({
container: '#'+ fileName + i,
variable: 'player',
flashplayer: false,
video: {
file: 'route/file/downloadfile/true/'+ item.fileId,
type: 'video/mp4'
}
});
}
}
// 初始化检查时间时间戳
function initCheckDateDateTime() {
laydate.render({
elem: '#checkDate',
type: 'datetime',
value: new Date(),
trigger: 'click'
});
}
// 初始化检查图片图片上传
function initCheckPhotosUploadFile() {
var files = $('#checkPhotos').val();
initFileList('checkPhotos', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(checkPhotosUploadFile)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
}
}
});
});
form.on('button(checkPhotosRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 2);
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
});
}
// 初始化复查时间时间戳
function initRecheckDateDateTime() {
laydate.render({
elem: '#recheckDate',
type: 'datetime',
value: new Date(),
trigger: 'click'
});
}
// 初始化复查图片图片上传
function initRecheckPhotosUploadFile() {
var files = $('#recheckPhotos').val();
initFileList('recheckPhotos', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(recheckPhotosUploadFile)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
}
}
});
});
form.on('button(recheckPhotosRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 2);
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
});
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/publicareareport/getpublicareareportbyid/{publicAreaReportId}', [publicAreaReportId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i];
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initCheckDateDateTime();
initCheckPhotosUploadFile();
initRecheckDateDateTime();
initRecheckPhotosUploadFile();
}, 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();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/publicareareport/updatepublicareareport/{publicAreaReportId}', [publicAreaReportId]), 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>

View File

@ -124,6 +124,14 @@
return rowData;
}
},
{field: 'option', width: 100, title: '操作', align:'center',
templet: function(row) {
if(row.isHandled == 0) {
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="handledCheckEvent">检查</button>';
}
return '-';
}
},
]],
page: true,
parseData: function(data) {
@ -199,36 +207,19 @@
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
table.on('tool(dataTable)', function(obj) {
var data = obj.data;
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/taskcheck/save-taskcheck.html', []),
end: function() {
if(layEvent === 'handledCheckEvent') {
top.dialog.open({
url: top.restAjax.path('route/check/save-taskcheck-mine.html?taskCheckId={taskCheckId}', [data.taskCheckId]),
title: '任务检查',
width: '80%',
height: '80%',
onClose: 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['taskCheckId'];
}
removeData(ids);
}
}
});
});