diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java index f0cf5a97..e0a02b40 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/flowable/mapper/FlowBusinessKeyMapper.java @@ -74,4 +74,12 @@ public interface FlowBusinessKeyMapper { * @return */ public List> selectMySubdeptsGroups(@Param("proId")Long proId, @Param("userId")Long userId); + + /** + * 查询我的隐患代办 + * @param proId + * @param userId + * @return + */ + public List> selectMyAwaitSspTask(@Param("proId")Long proId, @Param("userId")Long userId); } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProVideoMonitor.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProVideoMonitor.java index 7996e966..e22e9028 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProVideoMonitor.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProVideoMonitor.java @@ -18,15 +18,15 @@ public class ProVideoMonitor extends BaseEntity { private static final long serialVersionUID = 1L; - /** $column.columnComment */ + /** 编号 */ private Long id; - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + /** 公司编号 */ + @Excel(name = "公司编号") private Long comId; - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + /** 项目编号 */ + @Excel(name = "项目编号") private Long projectId; /** 监控名称 */ diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/SmzSspAuditinfo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/SmzSspAuditinfo.java index 3b16a890..0784a3e7 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/SmzSspAuditinfo.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/SmzSspAuditinfo.java @@ -17,7 +17,7 @@ public class SmzSspAuditinfo extends BaseEntity { private static final long serialVersionUID = 1L; - /** $column.columnComment */ + /** 编号 */ private Long id; /** 问题整改质量留痕id */ diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/SmzSspFileinfo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/SmzSspFileinfo.java index 6e55de4f..84e74934 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/SmzSspFileinfo.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/SmzSspFileinfo.java @@ -14,7 +14,7 @@ public class SmzSspFileinfo extends BaseEntity { private static final long serialVersionUID = 1L; - /** $column.columnComment */ + /** 编号 */ private Long id; /** 审核表id */ diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml index be7e37a2..977b220d 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml @@ -156,4 +156,33 @@ select id, sub_dept_name, sub_dept_group, user_post from pro_project_info_subdepts_users where project_id = #{proId} and user_id = #{userId} and approve_status = ]]> 100 and is_del=0 and sub_dept_group is not null + + \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/trouble/SmzSspAuditinfoMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/trouble/SmzSspAuditinfoMapper.xml index 1d245527..841eed08 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/trouble/SmzSspAuditinfoMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/trouble/SmzSspAuditinfoMapper.xml @@ -25,21 +25,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -85,4 +85,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + \ No newline at end of file diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/trouble/SmzSspProblemmodifyMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/trouble/SmzSspProblemmodifyMapper.xml index 1f913386..986e18f4 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/trouble/SmzSspProblemmodifyMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/trouble/SmzSspProblemmodifyMapper.xml @@ -288,16 +288,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - - delete from smz_ssp_problemmodify where id = #{id} - + + update smz_ssp_problemmodify set isDel=2 where id = #{id} + - - delete from smz_ssp_problemmodify where id in + + update smz_ssp_problemmodify set isDel=2 where id in #{id} - + and a,problemType = #{problemType} diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowBusinessKeyController.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowBusinessKeyController.java index 8a91f8fe..3fecc994 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowBusinessKeyController.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/controller/FlowBusinessKeyController.java @@ -226,6 +226,8 @@ public class FlowBusinessKeyController extends BaseController { flowTaskEntity.setRoleIds(roleIds); } List> list = flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity); + List> smzTaskList = flowBusinessKeyService.selectMyAwaitSspTask(Convert.toLong(proId,null),SecurityUtils.getUserId()); + list.addAll(smzTaskList); Map sumByCategory = list.stream() .collect(Collectors.groupingBy( map -> (String) map.get("category"), @@ -240,6 +242,10 @@ public class FlowBusinessKeyController extends BaseController { data.put("dwsh",Convert.toInt(sumByCategory.get("1"),0)); int rysh = Convert.toInt(sumByCategory.get("2"),0)+Convert.toInt(sumByCategory.get("3"),0)+Convert.toInt(sumByCategory.get("4"),0)+Convert.toInt(sumByCategory.get("5"),0)+Convert.toInt(sumByCategory.get("6"),0)+Convert.toInt(sumByCategory.get("8"),0); data.put("rysh",rysh); + int aqyh = Convert.toInt(sumByCategory.get("106"),0)+Convert.toInt(sumByCategory.get("107"),0); + data.put("aqyh",aqyh); + int zlyh = Convert.toInt(sumByCategory.get("108"),0)+Convert.toInt(sumByCategory.get("109"),0); + data.put("zlyh",zlyh); return success(data); } diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java index 90123bce..da71103a 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/IFlowBusinessKeyService.java @@ -53,4 +53,11 @@ public interface IFlowBusinessKeyService { */ public List> selectMyFinishedFlowTask(FlowTaskEntity flowTaskEntity); + /** + * 查询我的隐患代办 + * @param proId + * @param userId + * @return + */ + public List> selectMyAwaitSspTask(Long proId,Long userId); } diff --git a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java index 310f8df7..71a1caa3 100644 --- a/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java +++ b/yanzhu-modules/yanzhu-flowable/src/main/java/com/yanzhu/flowable/service/impl/FlowBusinessKeyServiceImpl.java @@ -134,4 +134,15 @@ public class FlowBusinessKeyServiceImpl implements IFlowBusinessKeyService { return flowBusinessKeyMapper.selectMyFinishedFlowTask(flowTaskEntity); } + /** + * 查询我的隐患代办 + * @param proId + * @param userId + * @return + */ + @Override + public List> selectMyAwaitSspTask(Long proId,Long userId){ + return flowBusinessKeyMapper.selectMyAwaitSspTask(proId,userId); + } + } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/SmzSspProblemmodifyController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/SmzSspProblemmodifyController.java index f67719ad..40ee6f3e 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/SmzSspProblemmodifyController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/SmzSspProblemmodifyController.java @@ -1,26 +1,24 @@ package com.yanzhu.manage.controller; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; +import com.yanzhu.common.core.enums.IsDelEnums; import com.yanzhu.common.core.text.Convert; import com.yanzhu.common.core.utils.StringUtils; import com.yanzhu.common.security.utils.SecurityUtils; +import com.yanzhu.manage.domain.SmzSspAuditinfo; import com.yanzhu.manage.domain.SmzSspProblemmodify; import com.yanzhu.manage.enums.CheckStateEnums; +import com.yanzhu.manage.service.ISmzSspAuditinfoService; import com.yanzhu.manage.service.ISmzSspProblemmodifyService; import com.yanzhu.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.yanzhu.common.core.utils.poi.ExcelUtil; import com.yanzhu.common.core.web.controller.BaseController; import com.yanzhu.common.core.web.domain.AjaxResult; @@ -39,6 +37,9 @@ import com.yanzhu.common.security.annotation.RequiresPermissions; @RequestMapping("/problemmodify") public class SmzSspProblemmodifyController extends BaseController { + @Autowired + private ISmzSspAuditinfoService smzSspAuditinfoService; + @Autowired private ISmzSspProblemmodifyService smzSspProblemmodifyService; @@ -159,8 +160,8 @@ public class SmzSspProblemmodifyController extends BaseController /** * 获取隐患问题详细信息 + * @RequiresPermissions("trouble:problemmodify:query") */ - @RequiresPermissions("trouble:problemmodify:query") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { @@ -226,4 +227,61 @@ public class SmzSspProblemmodifyController extends BaseController List data = smzSspProblemmodifyService.selectSmzSspProblemmodifyList(query); return success(data); } + + /** + * 查询问题整改详情 + * @param id + * @return + */ + @GetMapping("/findAuditInfos/{id}") + public AjaxResult findAuditInfo(@PathVariable("id") Long id){ + SmzSspAuditinfo query = new SmzSspAuditinfo(); + query.setMainId(id); + query.setIsDel(IsDelEnums.NO.getCode()); + List list = smzSspAuditinfoService.selectSmzSspAuditinfoList(query); + List findList = new ArrayList<>(); + if(StringUtils.isNotEmpty(list)){ + for(SmzSspAuditinfo auditinfo:list){ + // 每种类型获取一条 + List _findList = findList.stream().filter(detail -> StringUtils.eqObj(detail.getProcessState(),auditinfo.getProcessState())).collect(Collectors.toList()); + if(_findList.size()==0){ + findList.add(auditinfo); + } + } + } + return success(findList); + } + + /** + * 删除隐患问题 + */ + @Log(title = "删除隐患问题", businessType = BusinessType.DELETE) + @DeleteMapping("/wxRemove/{id}") + public AjaxResult wxRemove(@PathVariable("id") Long id) + { + return toAjax(smzSspProblemmodifyService.deleteSmzSspProblemmodifyById(id)); + } + + /** + * 提交问题整改 + * @param smzSspAuditinfo + * @return + */ + @PostMapping("/modifyProblemmodify") + @Log(title = "提交隐患整改", businessType = BusinessType.UPDATE) + public AjaxResult modifyProblemmodify(@RequestBody SmzSspAuditinfo smzSspAuditinfo){ + return success(smzSspAuditinfoService.insertSmzSspAuditinfo(smzSspAuditinfo)); + } + + /** + * 提交问题复检 + * @param smzSspAuditinfo + * @return + */ + @PostMapping("/checkProblemmodify") + @Log(title = "提交隐患复检", businessType = BusinessType.UPDATE) + public AjaxResult checkProblemmodify(@RequestBody SmzSspAuditinfo smzSspAuditinfo){ + return success(smzSspAuditinfoService.insertSmzSspAuditinfo(smzSspAuditinfo)); + } + } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/ISmzSspProblemmodifyService.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/ISmzSspProblemmodifyService.java index 1f6e0413..73584d03 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/ISmzSspProblemmodifyService.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/ISmzSspProblemmodifyService.java @@ -3,6 +3,7 @@ package com.yanzhu.manage.service; import java.util.List; import java.util.Map; +import com.yanzhu.manage.domain.SmzSspAuditinfo; import com.yanzhu.manage.domain.SmzSspProblemmodify; /** @@ -78,9 +79,10 @@ public interface ISmzSspProblemmodifyService public List> getWxListCount(SmzSspProblemmodify where); /** - * 分组查询 全部数据、待整改、待复检、整改完成、整改超时的数量 + * 分组查询 全部数据、待整改、待复检、整改完成、整改超时的数量 * @param where * @return */ public List selectList(SmzSspProblemmodify where); + } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/SmzSspAuditinfoServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/SmzSspAuditinfoServiceImpl.java index 183ed2f1..a40f0541 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/SmzSspAuditinfoServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/SmzSspAuditinfoServiceImpl.java @@ -4,11 +4,13 @@ import java.util.Arrays; import java.util.List; import cn.hutool.core.util.NumberUtil; +import com.yanzhu.common.core.enums.IsDelEnums; import com.yanzhu.common.core.utils.DateUtils; import com.yanzhu.common.core.utils.StringUtils; import com.yanzhu.common.security.utils.SecurityUtils; import com.yanzhu.manage.domain.SmzSspFileinfo; import com.yanzhu.manage.domain.SmzSspProblemmodify; +import com.yanzhu.manage.enums.CheckStateEnums; import com.yanzhu.manage.mapper.SmzSspFileinfoMapper; import com.yanzhu.manage.mapper.SmzSspProblemmodifyMapper; import com.yanzhu.system.api.domain.SysUser; @@ -69,10 +71,9 @@ public class SmzSspAuditinfoServiceImpl implements ISmzSspAuditinfoService @Override public int insertSmzSspAuditinfo(SmzSspAuditinfo smzSspAuditinfo) { - LoginUser loginUser= SecurityUtils.getLoginUser(); - SysUser sysUser=loginUser.getSysUser(); + String userName = SecurityUtils.getLoginUser().getSysUser().getNickName(); smzSspAuditinfo.setCreateTime(DateUtils.getNowDate()); - smzSspAuditinfo.setCreateUser(sysUser.getUserName()); + smzSspAuditinfo.setCreateUser(userName); int result= smzSspAuditinfoMapper.insertSmzSspAuditinfo(smzSspAuditinfo); //上传图片 String images=smzSspAuditinfo.getImages(); @@ -82,25 +83,37 @@ public class SmzSspAuditinfoServiceImpl implements ISmzSspAuditinfoService file.setFileType(0L); file.setAuditId(smzSspAuditinfo.getId()); file.setFileUrl(img); - file.setCreateUser(sysUser.getUserName()); + file.setCreateUser(userName); file.setCreateTime(DateUtils.getNowDate()); fileinfoMapper.insertSmzSspFileinfo(file); }); } - //修改安全隐患的状态 - SmzSspProblemmodify problemmodify=new SmzSspProblemmodify(); - problemmodify.setId(smzSspAuditinfo.getMainId()); - //(0待审,1通过,2驳回) + // 修改安全隐患的状态 + SmzSspProblemmodify smzSspProblemmodify = new SmzSspProblemmodify(); + smzSspProblemmodify.setId(smzSspAuditinfo.getMainId()); + // (0待审,1通过,2驳回) //(0待整改,1待复检,2复检驳回,3复检通过) if("0".equals(smzSspAuditinfo.getProcessState())){ - problemmodify.setCheckState(1L); + smzSspProblemmodify.setCheckState(CheckStateEnums.DFJ.getCode()); }else if("1".equals(smzSspAuditinfo.getProcessState())){ - problemmodify.setCheckState(3L); + smzSspProblemmodify.setCheckState(CheckStateEnums.ZGWC.getCode()); + // 复检通过时将整改图片同步至隐患信息中 + SmzSspAuditinfo query = new SmzSspAuditinfo(); + query.setMainId(smzSspAuditinfo.getMainId()); + query.setProcessState("0"); + query.setIsDel(IsDelEnums.NO.getCode()); + List zgList = smzSspAuditinfoMapper.selectSmzSspAuditinfoList(query); + if(StringUtils.isNotEmpty(zgList) && StringUtils.isNotEmpty(zgList.get(0).getFiles())){ + String marksPictures = ""; + for(SmzSspFileinfo fileinfo:zgList.get(0).getFiles()){ + marksPictures += ","+fileinfo.getFileUrl(); + } + smzSspProblemmodify.setMarksPicture(marksPictures.substring(1)); + } }else{ - problemmodify.setCheckState(2L); + smzSspProblemmodify.setCheckState(CheckStateEnums.ZGBH.getCode()); } - - problemmodifyMapper.updateSmzSspProblemmodify(problemmodify); + problemmodifyMapper.updateSmzSspProblemmodify(smzSspProblemmodify); return result; } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/SmzSspProblemmodifyServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/SmzSspProblemmodifyServiceImpl.java index 86dabe59..692682f6 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/SmzSspProblemmodifyServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/SmzSspProblemmodifyServiceImpl.java @@ -1,9 +1,16 @@ package com.yanzhu.manage.service.impl; +import com.yanzhu.common.core.enums.IsDelEnums; +import com.yanzhu.common.core.text.Convert; import com.yanzhu.common.core.utils.DateUtils; +import com.yanzhu.common.core.utils.StringUtils; import com.yanzhu.common.security.utils.SecurityUtils; +import com.yanzhu.manage.domain.SmzSspAuditinfo; +import com.yanzhu.manage.domain.SmzSspFileinfo; import com.yanzhu.manage.domain.SmzSspProblemmodify; import com.yanzhu.manage.enums.CheckStateEnums; +import com.yanzhu.manage.mapper.SmzSspAuditinfoMapper; +import com.yanzhu.manage.mapper.SmzSspFileinfoMapper; import com.yanzhu.manage.mapper.SmzSspProblemmodifyMapper; import com.yanzhu.manage.service.ISmzSspProblemmodifyService; import com.yanzhu.system.api.domain.SysUser; @@ -11,6 +18,7 @@ import com.yanzhu.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; @@ -24,6 +32,12 @@ import java.util.concurrent.atomic.AtomicInteger; @Service public class SmzSspProblemmodifyServiceImpl implements ISmzSspProblemmodifyService { + @Autowired + private SmzSspAuditinfoMapper smzSspAuditinfoMapper; + + @Autowired + private SmzSspFileinfoMapper smzSspFileinfoMapper; + @Autowired private SmzSspProblemmodifyMapper smzSspProblemmodifyMapper; diff --git a/yanzhu-ui-app/miniprogram/api/problemmodify.js b/yanzhu-ui-app/miniprogram/api/problemmodify.js index 24317555..2b693c44 100644 --- a/yanzhu-ui-app/miniprogram/api/problemmodify.js +++ b/yanzhu-ui-app/miniprogram/api/problemmodify.js @@ -20,6 +20,22 @@ export function listCount(query) { }) } +// 查询隐患详情 +export function findInfo(id) { + return request({ + url: '/manage/problemmodify/'+id, + method: 'get' + }) +} + +// 查询隐患审批详情 +export function findAuditInfos(id) { + return request({ + url: '/manage/problemmodify/findAuditInfos/'+id, + method: 'get' + }) +} + // 新增隐患问题 export function add(data) { return request({ @@ -38,6 +54,32 @@ export function addDraft(data) { }) } +// 删除隐患详情 +export function remove(id) { + return request({ + url: '/manage/problemmodify/wxRemove/'+id, + method: 'delete' + }) +} + +// 提交隐患整改 +export function modifyProblemmodify(data) { + return request({ + url: '/manage/problemmodify/modifyProblemmodify', + method: 'post', + data: data + }) +} + +// 提交问题复检 +export function checkProblemmodify(data) { + return request({ + url: '/manage/problemmodify/checkProblemmodify', + method: 'post', + data: data + }) +} + // 查询我上次提交的隐患信息 export function findMyLastProblemmodify(proId,type) { return request({ diff --git a/yanzhu-ui-app/miniprogram/app.wxss b/yanzhu-ui-app/miniprogram/app.wxss index a490706c..e996d8f0 100644 --- a/yanzhu-ui-app/miniprogram/app.wxss +++ b/yanzhu-ui-app/miniprogram/app.wxss @@ -1539,7 +1539,7 @@ swiper-item video { font-size: 50rpx !important; } -/* 问题整改 */ +/* 隐患整改 */ .inspect_overview_max { background: #191d28; padding-bottom: 30rpx; @@ -1898,7 +1898,7 @@ swiper-item video { } .code_label { - font-size: 0.6rem; + font-size: 0.9rem; width: 120rpx; margin: auto; text-align: center; diff --git a/yanzhu-ui-app/miniprogram/pages/project_more/index.js b/yanzhu-ui-app/miniprogram/pages/project_more/index.js index 54b333b0..790d3be7 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_more/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_more/index.js @@ -23,7 +23,9 @@ Page({ initData: {}, todoDB: 0, fbdwDB: 0, - fbrtDB: 0 + fbrtDB: 0, + aqyhDB: 0, + zlyhDB: 0 }, @@ -157,7 +159,9 @@ Page({ this.setData({ todoDb: res.data.todo, fbdwDB: res.data.dwsh, - fbrtDB: res.data.rysh + fbrtDB: res.data.rysh, + aqyhDB: res.data.aqyh, + zlyhDB: res.data.zlyh, }) } }); diff --git a/yanzhu-ui-app/miniprogram/pages/project_more/index.wxml b/yanzhu-ui-app/miniprogram/pages/project_more/index.wxml index ab871579..5c9bab55 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_more/index.wxml +++ b/yanzhu-ui-app/miniprogram/pages/project_more/index.wxml @@ -25,6 +25,8 @@ {{fbdwDB}} {{fbrtDB}} + {{aqyhDB}} + {{zlyhDB}} {{item.menuName}} diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/add/index.js b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/add/index.js index be124ab9..a3019825 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/add/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/add/index.js @@ -43,7 +43,7 @@ Page({ copySend: "", copySendUser: "" }, - active: 0, + active: 1, flowNodes: [{ text: '开始' }, { @@ -306,7 +306,7 @@ Page({ app.toast("新增数据成功!") setTimeout(() => { wx.redirectTo({ - url: '../list/index', + url: `../list/index?type=${this.data.type}`, }) }, 200) } @@ -366,7 +366,6 @@ Page({ }, returnToPage: function () { - /*关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面*/ wx.redirectTo({ url: `../list/index?type=${this.data.type}` }) diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.js b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.js index 10fc8bbb..f3df4cfc 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.js @@ -1,304 +1,266 @@ +import config from '../../../config' +import { + getToken +} from '../../../utils/auth' +import { + findInfo, + findAuditInfos, + checkProblemmodify +} from '../../../api/problemmodify' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - id:"", - infoData:{}, - loadShow:false, - auditInfo:{}, - reject:false, - rejectOpinion:"", - loadShow:false, - loginName:"", - imageList:[], - minImageList:[], - auditImageList:[], - auditMinImageList:[], - request:app.globalData.reqUrl, - flowNodes:[{text:'开始'},{text:'提交隐患'},{text:'隐患整改'},{text:'隐患复检'},{text:'结束'}], - active: 3 - }, + /** + * 页面的初始数据 + */ + data: { + infoData: {}, + loadShow: false, + auditInfo1: {}, + auditInfo3: {}, + auditInfo4: {}, + form: {}, + imageInfoData: [], + imageList: [], + auditImageList: [], + active: 3, + flowNodes: [{ + text: '开始' + }, { + text: '提交隐患' + }, { + text: '隐患整改' + }, { + text: '隐患复检' + }, { + text: '结束' + }] + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - let {id} = options - //获取缓存数据 - wx.getStorage({ - key: 'userinfo', - success:res=>{ - this.setData({ - id, - loginName:res.data.loginName - }) - this.getInfo(); - this.getAuditinfo(); - } - }) - }, - - - /** - * 获取安全检查详情信息 - * - */ - getInfo(){ - let {id} = this.data - let that = this - wx.request({ - url: app.globalData.reqUrl+'/wechat/projectProblemmodify/info', - method:"get", - data:{ - id:id - }, - success(res){ - res = res.data - if(res.code == 200){ - let urls = []; - let minUrls = []; - if(res.data.smarkUrl){ - res.data.smarkUrl.split(',').forEach(element => { - urls.push(that.data.request+element); - minUrls.push(that.data.request+element+'.min.jpg'); - }); - } - that.setData({ - infoData:res.data, - imageList:urls, - minImageList:minUrls, - loadShow:false - }) - } - } - }) - }, - - getAuditinfo(){ - let {id} = this.data - let that = this - wx.request({ - url: app.globalData.reqUrl+'/wechat/projectProblemmodify/queryAuditInfo', - method:"get", - data:{ - id:id - }, - success(res){ - res = res.data - if(res.code == 200 && res.data){ - let urls = []; - let minUrls = []; - if(res.data.fileUrls){ - res.data.fileUrls.split(',').forEach(element => { - urls.push(that.data.request+element); - minUrls.push(that.data.request+element+'.min.jpg'); - }); - } - that.setData({ - auditInfo:res.data, - auditImageList:urls, - auditMinImageList:minUrls - }) - } - } + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (!getToken()) { + wx.redirectTo({ + url: '../../login/login', }) - }, + } + this.setData({ + type: options.type, + typeName: options.type == 1 ? "质量" : "安全", + }); + this.getInfo(options.id); + this.getAuditInfos(options.id); + }, - //取消页面 - cancelSaveView(){ - this.returnToPage() + /** + * 查详隐患详情 + * @param {*} id + */ + getInfo(id) { + findInfo(id).then(res => { + if (res.code == 200) { + let urls = []; + if (res.data.smarkUrl) { + res.data.smarkUrl.split(',').forEach(item => { + urls.push(config.baseImgUrl + item); + }); + } + this.setData({ + infoData: res.data, + imageList: urls, + "form.mainId": res.data.id, + }) + } + }) + }, + + /** + * 查详隐患流程 + * @param {*} id + */ + getAuditInfos(id) { + findAuditInfos(id).then(res => { + if (res.code == 200 && res.data.length > 0) { + res.data.forEach(item => { + if (item.processState == "0") { + let urls = []; + if (item.files.length > 0) { + item.files.forEach(_file => { + urls.push(config.baseImgUrl + _file.fileUrl); + }); + } + this.setData({ + auditInfo1: item, + auditImageList: urls + }) + } else if (item.processState == "1") { + this.setData({ + auditInfo4: item + }) + } else if (item.processState == "2") { + this.setData({ + auditInfo3: item + }) + } + }); + } + }); + }, + + //取消页面 + cancelSaveView() { + this.returnToPage() }, //保存 - onSubmitSave(status){ + onSubmitSave(status) { + let _form = { + ...this.data.form + }; + _form.processState = status; + this.setData({ + loadShow: true + }); + checkProblemmodify(_form).then(res =>{ this.setData({ - loadShow:true - }) - let that = this - let {id,reject,rejectOpinion,loginName} = that.data; - //数据效验 - if(id==""){ - app.toast("数据异常,请刷新页面重试!") - that.setData({ - loadShow:false + loadShow: false + }); + if (res.code == 200) { + app.toast("复检隐患成功!") + setTimeout(() => { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}` }) - return; + }, 200) } - if(reject && rejectOpinion==""){ - app.toast("请填写整改驳回意见!") - that.setData({ - loadShow:false - }) - return; - } - - let params = { - mainId:id, - processState:status, - opinion:rejectOpinion, - createUser:loginName - } - wx.request({ - url: app.globalData.reqUrl + '/wechat/projectProblemmodify/modifyProblem', - method:"POST", - data:params, - header: { - "Username": loginName, - "Content-Type": "application/json" - }, - success(res){ - that.setData({ - loadShow:false - }) - res =res.data - if(res.code == 200){ - app.toast("操作成功!") - setTimeout(()=>{ - wx.redirectTo({ - url: '../list/index', - }) - },200) - } - } - }) + }); }, + //审核驳回 - onRejectSave(){ + onRejectSave() { let that = this; - if(that.data.rejectOpinion!=""){ + if (this.data.form.opinion) { //弹出确认 wx.showModal({ - title: '提示', - content: '是否确认复检驳回?', - success: function (sm) { - if (sm.confirm) { - // 用户点击了确定 可以调用了 - that.onSubmitSave(2); - } else if (sm.cancel) { - console.log('用户点击取消'); - } - } - }) - }else{ - app.toast("请填写整改驳回意见!") - that.setData({ - loadShow:false - }) - return; - } - }, - //审核通过 - onPassSave(){ - let that = this; - //弹出确认 - wx.showModal({ title: '提示', - content: '是否确定确认复检通过?', + content: '是否确认隐患复检驳回?', success: function (sm) { if (sm.confirm) { - // 用户点击了确定 可以调用了 - that.setData({ - reject:false - }); - that.onSubmitSave(4); - } else if (sm.cancel) { - console.log('用户点击取消'); - } + // 用户点击了确定 可以调用了 + that.onSubmitSave(2); + } else if (sm.cancel) { + console.log('用户点击取消'); } - }) + } + }) + } else { + app.toast("请填写整改驳回意见!") + return false; + } }, - //展示图片 - showImg:function(e){ - var that=this; - wx.previewImage({ - urls: that.data.imageList, - current: that.data.imageList[e.currentTarget.dataset.index] - }) - }, - - //展示图片 - showAuditinfoImg:function(e){ - var that=this; - wx.previewImage({ - urls: that.data.auditImageList, - current: that.data.auditImageList[e.currentTarget.dataset.index] - }) - }, - - returnToPage: function () { - /*关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面*/ - wx.redirectTo({ - url: '../list/index', - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - //驳回意见 - onInputOpinion(e){ - let rejectOpinion = e.detail.value + //审核通过 + onPassSave() { + let that = this; + if (!this.data.form.opinion) { this.setData({ - rejectOpinion + "form.opinion": "审核通过!" }) - }, - - // list 上传图片 - onImagesArr(e){ - var data = this.data.imageInfoData - data = e.detail - this.setData({ - imageInfoData:data - }) - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - } + //弹出确认 + wx.showModal({ + title: '提示', + content: '是否确认隐患复检通过?', + success: function (sm) { + if (sm.confirm) { + // 用户点击了确定 可以调用了 + that.onSubmitSave(1); + } else if (sm.cancel) { + console.log('用户点击取消'); + } + } + }) + }, + + //展示图片 + showImg: function (e) { + let img = e.target.dataset.set; + wx.previewImage({ + urls: img.split(','), + current: 0 + }) + }, + + returnToPage: function () { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}` + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + // 审核意见 + onInputOpinion(e) { + this.setData({ + "form.opinion": e.detail.value + }) + }, + + // list 上传图片 + onImagesArr(e) { + var data = this.data.imageInfoData + data = e.detail + this.setData({ + imageInfoData: data + }) + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.json b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.json index 1edf10dc..8b79f9ef 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.json +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.json @@ -1,10 +1,8 @@ { - "usingComponents": { - "van-popup": "@vant/weapp/popup/index", - "van-collapse": "@vant/weapp/collapse", - "van-steps": "@vant/weapp/steps/index", - "van-collapse-item": "@vant/weapp/collapse-item", - "van-overlay": "@vant/weapp/overlay/index" - }, - "navigationStyle":"custom" + "usingComponents": { + "van-popup": "@vant/weapp/popup/index", + "van-steps": "@vant/weapp/steps/index", + "van-overlay": "@vant/weapp/overlay/index" + }, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.wxml b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.wxml index c0845c72..710adc58 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.wxml +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.wxml @@ -7,78 +7,25 @@ - 质量隐患复检 + {{typeName}}隐患复检 - + - - {{infoData.problemArea}} - - - - - - - - - - - {{(flowRecordList.length-index) < 9 ?'0'+(flowRecordList.length-index):(flowRecordList.length-index)}} - {{item.taskName}}{{item.commentResult}} - {{item.commentResult}} - {{item.commentResult}} - {{item.commentResult}} - - - - - - 办理用户:{{item.assigneeName}} - - - 办理单位:{{item.deptName}} - - - 候选办理:{{item.candidate}} - - - 驳回节点:{{item.deleteReason}} - - - 接收时间:{{item.startTime}} - - - 处理时间:{{item.endTime}} - - - 处理耗时:{{item.duration}} - - - 处理意见:{{item.message}} - - - - - - - - + + {{infoData.projectName}} + 隐患图片 - - + + @@ -87,8 +34,8 @@ 问题类型 - 常规检查 - 专项检查 + {{infoData.problemTypeName}} + {{infoData.problemTypeName}} @@ -110,12 +57,6 @@ {{infoData.changeInfo}} - - - 检查单位 - {{infoData.deptName}} - - 检查人 @@ -131,19 +72,19 @@ 整改人 - {{infoData.lordSent}} - - - - - 抄送人 - {{infoData.copySend}} + {{infoData.lordSentUser}} 复检人 - {{infoData.recheckSend}} + {{infoData.recheckSendUser}} + + + + + 抄送人 + {{infoData.copySendUser}} @@ -155,39 +96,32 @@ - - - - 问题整改 - - - - - 整改说明 - {{auditInfo.opinion}} - - - - - 整改后图片 - - - - - - - - - - 完成时间 - {{infoData.nickedTime}} - - - - + + + 隐患整改 + + + + + 整改说明 + {{auditInfo1.opinion}} + + + + + 整改后图片 + + + + + + + + + - 整改复检意见 + 隐患复检意见 @@ -205,7 +139,7 @@ - - 数据加载中!请稍后... + + 数据处理中!请稍后... \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.wxss b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.wxss index aa0f6e37..cd1a9e59 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.wxss +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/check/index.wxss @@ -19,4 +19,16 @@ height: 180rpx; border-radius: 15rpx; position: relative; + } + + .van-steps { + background-color: transparent !important; + } + + .van-step--horizontal .van-step__circle-container { + background-color: transparent !important; + } + + .van-steps--horizontal { + padding: 10px 20px !important; } \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.js b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.js index cc2f6534..c9460d6a 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.js @@ -31,7 +31,7 @@ Page({ lordSent: "", lordSentUser: "", }, - active: 0, + active: 1, flowNodes: [{ text: '开始' }, { @@ -173,10 +173,10 @@ Page({ return false; } - if (inspectInfoData.length>0) { - for(let i=0;i 0) { + for (let i = 0; i < inspectInfoData.length; i++) { + if (inspectInfoData[i].image_upload.length == 0) { + app.toast("请上传问题“" + (i + 1) + "”的隐患图片或删除问题项!"); return false; } } @@ -206,7 +206,7 @@ Page({ app.toast("新增数据成功!") setTimeout(() => { wx.redirectTo({ - url: '../list/index', + url: `../list/index?type=${this.data.type}`, }) }, 200); } @@ -263,7 +263,6 @@ Page({ }, returnToPage: function () { - /*关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面*/ if (wx.getStorageSync('nav-menu') == "list") { wx.redirectTo({ url: `../list/index?type=${this.data.type}` diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.wxml b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.wxml index c9e6ccb1..39df8035 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.wxml +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.wxml @@ -60,7 +60,7 @@ - 数据加载中!请稍后... + 数据处理中!请稍后... diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.wxss b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.wxss index 9b5e1efb..71dc6876 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.wxss +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/draft/index.wxss @@ -1,18 +1,19 @@ -.van-popup{ - background: none !important; +.van-popup { + background: none !important; } -.van-image__img{ - border-radius: 10rpx !important; + +.van-image__img { + border-radius: 10rpx !important; } .van-steps { - background-color: transparent !important; - } - - .van-step--horizontal .van-step__circle-container { - background-color: transparent !important; - } - - .van-steps--horizontal { - padding: 10px 20px !important; - } + background-color: transparent !important; +} + +.van-step--horizontal .van-step__circle-container { + background-color: transparent !important; +} + +.van-steps--horizontal { + padding: 10px 20px !important; +} \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.js b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.js index 8a18fbfa..ac2c9262 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.js @@ -1,3 +1,13 @@ +import config from '../../../config' +import { + getToken, + getUserInfo +} from '../../../utils/auth' +import { + remove, + findInfo, + findAuditInfos +} from '../../../api/problemmodify' const app = getApp() Page({ @@ -5,17 +15,15 @@ Page({ * 页面的初始数据 */ data: { - id: "", infoData: {}, - loadShow: false, - auditInfo: {}, - loginName: "", + auditInfo1: {}, + auditInfo3: {}, + auditInfo4: {}, showDel: false, imageList: [], - minImageList: [], auditImageList: [], - auditMinImageList: [], - request: app.globalData.reqUrl, + proUserInfo: {}, + active: 100, flowNodes: [{ text: '开始' }, { @@ -26,178 +34,150 @@ Page({ text: '隐患复检' }, { text: '结束' - }], - active: 100 + }] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - let { - id - } = options - //获取缓存数据 - wx.getStorage({ - key: 'userinfo', - success: res => { - this.setData({ - id, - loginName: res.data.loginName - }) - this.getInfo(); - this.getAuditinfo(); - } - }) + if (!getToken()) { + wx.redirectTo({ + url: '../../login/login', + }) + } + const proUserInfo = getUserInfo(); + this.setData({ + proUserInfo, + type: options.type, + typeName: options.type == 1 ? "质量" : "安全", + }); + this.getInfo(options.id); + this.getAuditInfos(options.id); }, - /** - * 获取安全检查详情信息 - * + * 查详隐患详情 + * @param {*} id */ - getInfo() { - let { - id - } = this.data - let that = this - wx.request({ - url: app.globalData.reqUrl + '/wechat/projectProblemmodify/info', - method: "get", - data: { - id: id - }, - success(res) { - res = res.data - if (res.code == 200) { - let state = that.data.active; - if (res.data.checkState == "0") { - state = 2; - } else if (res.data.checkState == "1") { - state = 3; - } else if (res.data.checkState == "3") { - state = 1; - } - that.setData({ - active: state + getInfo(id) { + findInfo(id).then(res => { + if (res.code == 200) { + let state = this.data.active; + if (res.data.checkState == "0") { + state = 2; + } else if (res.data.checkState == "1") { + state = 3; + } else if (res.data.checkState == "3") { + state = 2; + } + this.setData({ + active: state + }) + let urls = []; + if (res.data.smarkUrl) { + res.data.smarkUrl.split(',').forEach(item => { + urls.push(config.baseImgUrl + item); + }); + } + this.setData({ + infoData: res.data, + imageList: urls + }) + //判断当前能否删除 + if (res.data.checkState != 4 && res.data.createUser == this.data.proUserInfo.userId) { + this.setData({ + showDel: true }) - let urls = []; - let minUrls = []; - if (res.data.smarkUrl) { - res.data.smarkUrl.split(',').forEach(element => { - urls.push(that.data.request + element); - minUrls.push(that.data.request + element + '.min.jpg'); - }); + } + } + }) + }, + + /** + * 查详隐患流程 + * @param {*} id + */ + getAuditInfos(id) { + findAuditInfos(id).then(res => { + if (res.code == 200 && res.data.length > 0) { + res.data.forEach(item => { + if (item.processState == "0") { + let urls = []; + if (item.files.length > 0) { + item.files.forEach(_file => { + urls.push(config.baseImgUrl + _file.fileUrl); + }); } - that.setData({ - infoData: res.data, - imageList: urls, - minImageList: minUrls, - loadShow: false - }) - //判断当前能否删除 - if (res.data.checkState != 4 && res.data.createUser == that.data.loginName) { - that.setData({ - showDel: true + this.setData({ + auditInfo1: item, + auditImageList: urls + }) + } else if (item.processState == "1") { + this.setData({ + auditInfo4: item + }) + } else if (item.processState == "2") { + this.setData({ + auditInfo3: item }) } - } + }); } - }) - }, - - getAuditinfo() { - let { - id - } = this.data - let that = this - wx.request({ - url: app.globalData.reqUrl + '/wechat/projectProblemmodify/queryAuditInfo', - method: "get", - data: { - id: id - }, - success(res) { - res = res.data - if (res.code == 200 && res.data) { - let urls = []; - let minUrls = []; - if (res.data.fileUrls) { - res.data.fileUrls.split(',').forEach(element => { - urls.push(that.data.request + element); - minUrls.push(that.data.request + element + '.min.jpg'); - }); - } - that.setData({ - auditInfo: res.data, - auditImageList: urls, - auditMinImageList: minUrls - }) - } - } - }) + }); }, + /** + * 点击删除 + */ onDelete() { - //弹出确认 let that = this wx.showModal({ title: '提示', - content: '是否确定删除此条数据?', + content: '是否确定删除当前隐患数据?', success: function (sm) { if (sm.confirm) { // 用户点击了确定 可以调用了 - that.deleteData(); + that.submitDelete(); } else if (sm.cancel) { console.log('用户点击取消'); } } }) }, - deleteData() { + + /** + * 提交删除 + */ + submitDelete() { let { - id + infoData } = this.data - wx.request({ - url: app.globalData.reqUrl + '/wechat/projectProblemmodify/removeQuality', - header: { - "Username": this.data.loginName, - }, - data: { - id: id - }, - method: "get", - success(res) { - app.toast("删除成功!") - wx.redirectTo({ - url: `../list/index`, - }) + remove(infoData.id).then(res => { + if (res.code == 200) { + app.toast("删除数据成功!") + setTimeout(() => { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}`, + }) + }, 200); } - }) + }); }, //展示图片 showImg: function (e) { - var that = this; + let img = e.target.dataset.set; wx.previewImage({ - urls: that.data.imageList, - current: that.data.imageList[e.currentTarget.dataset.index] - }) - }, - - //展示图片 - showAuditinfoImg: function (e) { - var that = this; - wx.previewImage({ - urls: that.data.auditImageList, - current: that.data.auditImageList[e.currentTarget.dataset.index] + urls: img.split(','), + current: 0 }) }, returnToPage: function () { /*关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面*/ wx.redirectTo({ - url: '../list/index', + url: `../list/index?type=${this.data.type}`, }) }, diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.wxml b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.wxml index f45e09c6..0bb9511d 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.wxml +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.wxml @@ -1,169 +1,167 @@ - - - - - - - 质量隐患详情 - - - + + + + + + + + + {{typeName}}隐患详情 + + + - - - {{infoData.problemArea}} - - - - - - 隐患图片 - - - + + + {{infoData.projectName}} + + + + + 隐患图片 + + + + - - - - - - 问题类型 - - 常规检查 - 专项检查 - - - - - - 隐患类型 - {{infoData.dangerTypeName}} - - - - - 隐患描述 - {{infoData.workParts}} - - - - - 整改要求 - {{infoData.changeInfo}} - - - - - 检查单位 - {{infoData.deptName}} - - - - - 检查人 - {{infoData.createUserName}} - - - - - 检查时间 - {{infoData.createTime}} - - - - - 整改人 - - {{infoData.lordSent}} - 集团公司 - 子公司 - 总包单位 - 分包单位 - 监理单位 - - - - - - 抄送人 - {{infoData.copySend}} - - - - - 复检人 - {{infoData.recheckSend}} - 集团公司 - 子公司 - 总包单位 - 分包单位 - 监理单位 - - - - - - 截至时间 - {{infoData.nickedTime}} - - - - - - - - 问题整改 - - - - - 整改说明 - {{auditInfo.opinion}} - - - - - 整改后图片 - - - - - - - - - - 完成时间 - {{infoData.nickedTime}} - - + + + + + 问题类型 + + {{infoData.problemTypeName}} + {{infoData.problemTypeName}} + + + + + + 隐患类型 + {{infoData.dangerTypeName}} + + + + + 隐患描述 + {{infoData.workParts}} + + + + + 整改要求 + {{infoData.changeInfo}} + + + + + 检查人 + {{infoData.createUserName}} + + + + + 检查时间 + {{infoData.createTime}} + + + + + 整改人 + + {{infoData.lordSentUser}} + + + + + + 复检人 + {{infoData.recheckSendUser}} + + + + + 抄送人 + {{infoData.copySendUser}} + + + + + 截至时间 + {{infoData.nickedTime}} + + - - - 问题整改驳回 - - + + + + 隐患整改 + + - - 驳回意见 - {{auditInfo.opinion}} - - - - - 驳回时间 - {{auditInfo.createTime}} - - + + 整改说明 + {{auditInfo1.opinion}} + - - - 删除 - - - + + + 整改后图片 + + + + + + + + + + + + 问题复检 + + + + + 复检结果 + + 复检驳回 + 复检通过 + + + + + + 复检意见 + {{auditInfo3.opinion}} + + + + + 复检意见 + {{auditInfo4.opinion}} + + + + + 复检时间 + {{auditInfo3.createTime}} + + + + + 复检时间 + {{auditInfo4.createTime}} + + + + + + 删除 + + \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.wxss b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.wxss index aa0f6e37..abe2ea52 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.wxss +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/info/index.wxss @@ -1,22 +1,37 @@ -.in-img-max:after{ - display:block; - clear:both; - content:""; - visibility:hidden; - height:0 - } - .in-img-max{ - width: auto; - zoom:1 - } - .in-img-div{ - position: relative; - margin: 0 8px 8px 0; - float: left; - } - .in-img-div image{ - width: 180rpx; - height: 180rpx; - border-radius: 15rpx; - position: relative; - } \ No newline at end of file +.in-img-max:after { + display: block; + clear: both; + content: ""; + visibility: hidden; + height: 0 +} + +.in-img-max { + width: auto; + zoom: 1 +} + +.in-img-div { + position: relative; + margin: 0 8px 8px 0; + float: left; +} + +.in-img-div image { + width: 180rpx; + height: 180rpx; + border-radius: 15rpx; + position: relative; +} + +.van-steps { + background-color: transparent !important; +} + +.van-step--horizontal .van-step__circle-container { + background-color: transparent !important; +} + +.van-steps--horizontal { + padding: 10px 20px !important; +} \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/list/index.js b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/list/index.js index 672e531a..f508419b 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/list/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/list/index.js @@ -99,22 +99,22 @@ Page({ let { id, checkState, - lordSentUser, - recheckSendUser + lordSent, + recheckSend } = e.currentTarget.dataset.set - if ((checkState == 0 || checkState == 3) && lordSentUser == this.data.loginName) { + if ((checkState == 0 || checkState == 3) && lordSent == this.data.projectUserInfo.userId) { //整改页面(状态时待整改&&整改人是当前登录人) wx.redirectTo({ - url: `../modify/index?id=${id}`, + url: `../modify/index?type=${this.data.type}&id=${id}`, }) - } else if (checkState == 1 && recheckSendUser == this.data.loginName) { + } else if (checkState == 1 && recheckSend == this.data.projectUserInfo.userId) { //复检页面 (状态时待复检&&复检人是当前登录人) wx.redirectTo({ - url: `../check/index?id=${id}`, + url: `../check/index?type=${this.data.type}&id=${id}`, }) } else { wx.redirectTo({ - url: `../info/index?id=${id}`, + url: `../info/index?type=${this.data.type}&id=${id}`, }) } }, @@ -125,7 +125,10 @@ Page({ getListData(userInfo, activeState, type) { let params = "pageNum=" + this.data.pageNum + "&pageSize=" + this.data.pageSize + "&comId=" + userInfo.comId + "&projectId=" + app.globalData.useProjectId + "&infoType=" + type + "&activeTags=" + activeState; list(params).then(res => { - if (res.data == 200) { + if (res.code == 200) { + res.rows.forEach(item => { + item.marksPicture = item.smarkUrl.split(',')[0]; + }); this.setData({ total: res.total, listData: this.data.listData.concat(res.rows) diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/list/index.wxml b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/list/index.wxml index ecda720a..84e982cb 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/list/index.wxml +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/list/index.wxml @@ -30,52 +30,52 @@ {{index < 10 ?'0'+(index+1):(index+1)}} - - 待整改 - 待复检 - 复检驳回 - 整改完成 - - {{item.problemTypeName}} - {{item.problemTypeName}} + + {{item.createTime}} + + {{item.problemTypeName}} + {{item.problemTypeName}} + + + + + + 待整改 + 待复检 + 复检驳回 + 整改完成 + + + + 隐患类型:{{item.dangerTypeName}} + 隐患描述:{{item.workParts}} + 整改人员:{{item.lordSentUser}} + 复检人员:{{item.recheckSendUser}} - - - - - - - 隐患类型:{{item.dangerTypeName}} - 隐患描述:{{item.workParts}} - 整改人:{{item.lordSentUser}} - 复检人:{{item.recheckSendUser}} - 检查时间:{{item.createTime}} - - - + + + + + 暂无数据 + + + + + + 草稿 + + + + + + 新增 + + + \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/modify/index.js b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/modify/index.js index 5e3305c7..f62c2bae 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/modify/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/modify/index.js @@ -1,3 +1,12 @@ +import config from '../../../config' +import { + getToken +} from '../../../utils/auth' +import { + findInfo, + findAuditInfos, + modifyProblemmodify +} from '../../../api/problemmodify' const app = getApp() Page({ @@ -5,231 +14,214 @@ Page({ * 页面的初始数据 */ data: { - id:"", - infoData:{}, - loadShow:false, - auditInfo:{}, - opinion:"", - imageInfoData:[], - loadShow:false, - loginName:"", - status:"0", - imageList:[], - minImageList:[], - request:app.globalData.reqUrl, - flowNodes:[{text:'开始'},{text:'提交隐患'},{text:'隐患整改'},{text:'隐患复检'},{text:'结束'}], - active: 2 + infoData: {}, + loadShow: false, + auditInfo1: {}, + auditInfo3: {}, + auditInfo4: {}, + form: {}, + imageInfoData: [], + imageList: [], + auditImageList: [], + active: 2, + flowNodes: [{ + text: '开始' + }, { + text: '提交隐患' + }, { + text: '隐患整改' + }, { + text: '隐患复检' + }, { + text: '结束' + }] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - let {id} = options - //获取缓存数据 - wx.getStorage({ - key: 'userinfo', - success:res=>{ - this.setData({ - id, - loginName:res.data.loginName - }) - this.getInfo(); - this.getAuditinfo(); - } - }) + if (!getToken()) { + wx.redirectTo({ + url: '../../login/login', + }) + } + this.setData({ + type: options.type, + typeName: options.type == 1 ? "质量" : "安全", + }); + this.getInfo(options.id); + this.getAuditInfos(options.id); }, - /** - * 获取安全检查详情信息 - * + * 查详隐患详情 + * @param {*} id */ - getInfo(){ - let {id} = this.data - let that = this - wx.request({ - url: app.globalData.reqUrl+'/wechat/projectProblemmodify/info', - method:"get", - data:{ - id:id - }, - success(res){ - res = res.data - if(res.code == 200){ + getInfo(id) { + findInfo(id).then(res => { + if (res.code == 200) { + let state = this.data.active; + if (res.data.checkState == "0") { + state = 2; + } else if (res.data.checkState == "1") { + state = 3; + } else if (res.data.checkState == "3") { + state = 2; + } + this.setData({ + active: state + }) let urls = []; - let minUrls = []; - if(res.data.smarkUrl){ - res.data.smarkUrl.split(',').forEach(element => { - urls.push(that.data.request+element); - minUrls.push(that.data.request+element+'.min.jpg'); - }); - } - that.setData({ - infoData:res.data, - imageList:urls, - minImageList:minUrls, - loadShow:false - }) + if (res.data.smarkUrl) { + res.data.smarkUrl.split(',').forEach(item => { + urls.push(config.baseImgUrl + item); + }); + } + this.setData({ + infoData: res.data, + imageList: urls, + "form.mainId": res.data.id, + }) } - } }) }, - getAuditinfo(){ - let {id} = this.data - let that = this - wx.request({ - url: app.globalData.reqUrl+'/wechat/projectProblemmodify/queryAuditInfo', - method:"get", - data:{ - id:id - }, - success(res){ - res = res.data - if(res.code == 200 && res.data){ - let urls = []; - if(res.data.fileUrls){ - res.data.fileUrls.split(',').forEach(element => { - urls.push(element+'.min.jpg'); - }); - } - that.setData({ - auditInfo:res.data, - auditImgs:urls - }) - } - } - }) + /** + * 查详隐患流程 + * @param {*} id + */ + getAuditInfos(id) { + findAuditInfos(id).then(res => { + if (res.code == 200 && res.data.length > 0) { + res.data.forEach(item => { + if (item.processState == "0") { + let urls = []; + if (item.files.length > 0) { + item.files.forEach(_file => { + urls.push(config.baseImgUrl + _file.fileUrl); + }); + } + this.setData({ + auditInfo1: item, + auditImageList: urls + }) + } else if (item.processState == "1") { + this.setData({ + auditInfo4: item + }) + } else if (item.processState == "2") { + this.setData({ + auditInfo3: item + }) + } + }); + } + }); }, //取消页面 - cancelSaveView(){ - this.returnToPage() - }, + cancelSaveView() { + this.returnToPage() + }, - //保存 - onSubmitSave(){ - this.setData({ - loadShow:true - }) - let that = this - let {id,opinion,status,imageInfoData,loginName} = that.data; - //数据效验 - if(id==""){ - app.toast("数据异常,请刷新页面重试!") - that.setData({ - loadShow:false - }) - return; - } - if(opinion==""){ - app.toast("请填写整改说明!") - that.setData({ - loadShow:false - }) - return; - } - if(imageInfoData.length==0){ - app.toast("请上传整改后图片!") - that.setData({ - loadShow:false - }) - return; - } - - let fileUrls = []; - imageInfoData.forEach(async (item)=>{ - let uploadUrl = app.globalData.uploadUrl+'/common/upload' - let name = "file" - //这里复杂的图片上传,改为同步上传,因为小程序只能上传一张图片 - let obj = await that.syncUploadImage(uploadUrl,item,name); - fileUrls.push(obj.data.fileName); - //验证图片上传完毕 - if(fileUrls.length == imageInfoData.length){ - let params = { - mainId:id, - processState:status, - opinion, - createUser:loginName, - fileUrls:fileUrls.toString() - } - wx.request({ - url: app.globalData.reqUrl + '/wechat/projectProblemmodify/modifyProblem', - method:"POST", - data:params, - header: { - "Username": loginName, - "Content-Type": "application/json" - }, - success(res){ - that.setData({ - loadShow:false - }) - res =res.data - if(res.code == 200){ - app.toast("提交成功!") - setTimeout(()=>{ - wx.redirectTo({ - url: '../list/index', - }) - },200) - } - } - }) - } - }) - }, + //保存 + onSubmitSave() { + let _form = { + ...this.data.form + }; + let { + imageInfoData + } = this.data + //数据效验 + if (!_form.mainId) { + app.toast("数据异常,请刷新页面重试!") + return false; + } + if (!_form.opinion) { + app.toast("请填写整改说明!") + return false; + } + if (imageInfoData.length == 0) { + app.toast("请上传整改后图片!") + return false; + } + this.setData({ + loadShow: true + }) + let that = this + let fileUrls = []; + imageInfoData.forEach(async (item) => { + let obj = await that.syncUploadImage(item); + fileUrls.push(obj.data.data.url); + //验证图片上传完毕 + if (fileUrls.length == imageInfoData.length) { + _form.processState = "0"; + _form.images = fileUrls.toString(); + modifyProblemmodify(_form).then(res => { + if (res.code == 200) { + app.toast("整改提交成功,请关注审核结果!") + setTimeout(() => { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}`, + }) + }, 200) + } + }); + } + }) + }, - /** - * 这里考虑上传图片异步问题,封装为同步 - */ - syncUploadImage(url,uploadFile,name) { - return new Promise((resolve, reject) => { - wx.uploadFile({ - url, // 上传的服务器接口地址 - filePath: uploadFile, - header: { - "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" - }, - name, //上传的所需字段,后端提供 - formData: { user: 'test' }, - success: (res) => { - // 上传完成操作 - const data = JSON.parse(res.data) - resolve({ - data: data - }) - }, - fail: (err) => { - //上传失败:修改pedding为reject - console.log("访问接口失败", err); - wx.showToast({ - title: "网络出错,上传失败", - icon: 'none', - duration: 1000 - }); - reject(err) - } - }); - }) - }, + /** + * 这里考虑上传图片异步问题,封装为同步 + */ + syncUploadImage(file) { + let _baseUrl = config.baseUrl; + return new Promise((resolve, reject) => { + wx.uploadFile({ + url: _baseUrl + "/file/upload", // 上传的服务器接口地址 + filePath: file, + header: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", + 'Authorization': 'Bearer ' + getToken() + }, + name: "file", //上传的所需字段,后端提供 + formData: {}, + success: (res) => { + // 上传完成操作 + const data = JSON.parse(res.data) + resolve({ + data: data + }) + }, + fail: (err) => { + //上传失败:修改pedding为reject + console.log("访问接口失败", err); + wx.showToast({ + title: "网络出错,上传失败", + icon: 'none', + duration: 1000 + }); + reject(err) + } + }); + }) + }, - //展示图片 - showImg:function(e){ - var that=this; + //展示图片 + showImg: function (e) { + let img = e.target.dataset.set; wx.previewImage({ - urls: that.data.imageList, - current: that.data.imageList[e.currentTarget.dataset.index] + urls: img.split(','), + current: 0 }) }, returnToPage: function () { - /*关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面*/ wx.redirectTo({ - url: '../list/index', + url: `../list/index?type=${this.data.type}` }) - }, + }, /** * 生命周期函数--监听页面初次渲染完成 @@ -266,21 +258,18 @@ Page({ }, - //验收描述 - onInputOpinion(e){ - let opinion = e.detail.value - this.setData({ - opinion - }) + // 整改说明 + onInputOpinion(e) { + this.setData({ + "form.opinion": e.detail.value + }) }, - // list 上传图片 - onImagesArr(e){ - var data = this.data.imageInfoData - data = e.detail - this.setData({ - imageInfoData:data - }) + // 上传图片 + onImagesArr(e) { + this.setData({ + imageInfoData: e.detail + }) }, /** diff --git a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/modify/index.wxml b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/modify/index.wxml index e03718ec..dbc5da2a 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_problemmodify/modify/index.wxml +++ b/yanzhu-ui-app/miniprogram/pages/project_problemmodify/modify/index.wxml @@ -1,154 +1,148 @@ - - - - - - - 质量隐患整改 - - - + + + + + + + + + {{typeName}}隐患整改 + + + - - - {{infoData.problemArea}} - - - - - - 隐患图片 - - - - - - - - - - 问题类型 - - 常规检查 - 专项检查 - - - - - - 隐患类型 - {{infoData.dangerTypeName}} - - - - - 隐患描述 - {{infoData.workParts}} - - - - - 整改要求 - {{infoData.changeInfo}} - - - - - 检查单位 - {{infoData.deptName}} - - - - - 检查人 - {{infoData.createUserName}} - - - - - 检查时间 - {{infoData.createTime}} - - - - - 整改人 - {{infoData.lordSent}} - - - - - 抄送人 - {{infoData.copySend}} - - - - - 复检人 - {{infoData.recheckSend}} - - - - - 截至时间 - {{infoData.nickedTime}} - - - - - - - - 问题整改驳回 - - - - - 驳回意见 - {{auditInfo.opinion}} - - - - - 驳回时间 - {{auditInfo.createTime}} - - - - - - 问题整改 - - - - 整改说明 - -