Compare commits

..

34 Commits

Author SHA1 Message Date
3613b6d83a refactor(oa): 需求管理模块的Vo修改
- 继承 BaseEntity 类以统一实体基类功能
- 添加 BaseEntity 依赖导入以支持基础属性扩展
- 保持现有数据传输对象结构不变
2026-04-25 16:11:58 +08:00
4faad94c79 feat(oa): 添加定位权限说明提示功能
- 添加了定位获取失败时的操作指引提示框
- 提供了浏览器定位权限配置的详细步骤说明
- 包含Edge和Chrome浏览器的配置方法
- 添加了站点地址的配置示例
- 更新了工作地点输入框的提示文字格式
2026-04-25 14:29:38 +08:00
f6b5940a27 merge origin main conflicts resolved 2026-04-23 13:20:29 +08:00
db90e2a084 feat: 添加项目进度统计功能,支持在列表中显示各项目的进度步骤统计信息,以及跳转 2026-04-23 12:47:23 +08:00
f48818b14d Merge remote-tracking branch 'origin/main'
# Conflicts:
#	ruoyi-ui/src/views/oa/project/dashboard2/index.vue
#	ruoyi-ui/src/views/oa/project/pace/components/xmind.vue
2026-04-22 18:45:45 +08:00
602928dc0b 修复综合看板 2026-04-22 18:44:14 +08:00
455f3bbf09 Merge branch 'main' of http://49.232.154.205:10100/liujingchao/fad_oa 2026-04-22 18:01:23 +08:00
e0e31c765b feat: 增加抄送标记未读功能 2026-04-22 18:00:41 +08:00
335dc88a2a 综合运营:分支图BUG、跳转
feat:完善进度/总数
2026-04-22 16:32:43 +08:00
50527f68e0 添加我的审核,我的申请提前结束 2026-04-22 16:11:43 +08:00
8b78e82a80 添加1报工审批2添加我的申请 2026-04-22 15:52:58 +08:00
8b3e016568 去掉审批历史静态路由 2026-04-22 13:35:52 +08:00
c1c3fdba68 Merge remote-tracking branch 'origin/main' 2026-04-22 13:12:41 +08:00
2d86713971 出差新增检索 2026-04-22 13:10:54 +08:00
f3d5556196 feat:完善出差申请,城市页面优化 2026-04-21 16:32:24 +08:00
f831f29b63 feat: 完善城市管理功能 2026-04-21 10:47:01 +08:00
03b0e20301 feat: 完成城市管理前端增删改查功能 2026-04-20 20:02:35 +08:00
ba5796984c Merge branch 'main' of http://49.232.154.205:10100/liujingchao/fad_oa 2026-04-20 17:52:40 +08:00
a69c1f0cb2 feat:完成城市管理增刪改查功能 2026-04-20 17:51:59 +08:00
e728a98dcc 出差新增检索 2026-04-20 15:55:00 +08:00
54b820cc40 Merge remote-tracking branch 'origin/main' 2026-04-20 15:43:51 +08:00
f73a002f0f 新增城市管理 2026-04-20 14:14:08 +08:00
0400398361 feat(geolocation): 完善工作地点获取功能
- 新增高德地图逆地理编码接口,支持根据浏览器定位自动获取工作地点。
- 在项目报工页面中实现工作地点的自动更新,用户可通过按钮重新获取定位。
- 添加加载状态和错误提示,提升用户体验。
- 优化相关方法以处理地理位置获取的异步操作。
2026-04-17 13:57:27 +08:00
edca68136c feat(geolocation): 添加工作地点自动获取功能
- 在项目报工页面中新增工作地点自动获取功能,用户可通过点击按钮重新获取定位。
- 添加了工作地点加载状态和错误提示,提升用户体验。
- 优化了相关方法以处理地理位置获取的异步操作。
2026-04-17 13:06:39 +08:00
1584d7e06d 提交app同步后端 2026-04-17 12:05:15 +08:00
7c261c3028 feat: 完善高德地图地点搜索功能 2026-04-17 10:36:18 +08:00
5d0c056449 feat: 完成出差目的地高德地图选择功能(2) 2026-04-16 16:22:05 +08:00
fd72c18d48 feat: 完成出差目的地高德地图选择功能 2026-04-16 15:37:08 +08:00
dfd912bf07 feat(security): 新增高德逆地理编码接口并配置RestTemplate超时时间 2026-04-16 11:05:02 +08:00
8b627c000f Merge branch 'main' of http://49.232.154.205:10100/liujingchao/fad_oa 2026-04-15 18:39:01 +08:00
56f7a6abb9 feat:完成出差申请提前结束功能 2026-04-15 18:32:59 +08:00
ebb57f4f26 fix(oa): 修复项目进度步骤查询遗漏删除标记过滤条件
- 在步骤表公共筛选方法中添加删除标记等于0的过滤条件
- 确保查询结果不包含已删除的步骤记录
- 修复因缺少软删除过滤导致的数据查询异常问题
2026-04-15 18:05:23 +08:00
365fc08b62 Merge branch 'main' of http://49.232.154.205:10100/liujingchao/fad_oa into main 2026-04-15 17:26:25 +08:00
50f3f15f48 feat(项目看板): 新增项目综合看板功能
新增项目综合看板功能,聚合展示项目、任务、进度主表和步骤数据
- 新增后端聚合接口 GET /oa/project/dashboard/{projectId}
- 新增前端看板页面,包含项目列表、任务表格和进度导图
- 优化思维导图组件,支持看板模式下的紧凑展示
- 新增进度明细表格视图和状态图例
- 实现任务与进度步骤的关联展示
- 添加项目模糊搜索功能
2026-04-15 17:19:56 +08:00
106 changed files with 5255 additions and 300 deletions

View File

@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.hrm.domain.bo.HrmAppropriationReqBo;
import com.ruoyi.hrm.domain.vo.HrmAppropriationReqVo;
import com.ruoyi.hrm.service.IHrmAppropriationReqService;
@@ -31,6 +32,7 @@ public class HrmAppropriationReqController extends BaseController {
@GetMapping("/list")
public TableDataInfo<HrmAppropriationReqVo> list(HrmAppropriationReqBo bo, PageQuery pageQuery) {
bo.setCreateBy(LoginHelper.getUsername());
return service.queryPageList(bo, pageQuery);
}
@@ -59,6 +61,7 @@ public class HrmAppropriationReqController extends BaseController {
@GetMapping("/all")
public R<List<HrmAppropriationReqVo>> all(HrmAppropriationReqBo bo) {
bo.setCreateBy(String.valueOf(LoginHelper.getUserId()));
return R.ok(service.queryList(bo));
}
}

View File

@@ -64,11 +64,9 @@ public class HrmEmployeeController extends BaseController {
*/
@GetMapping("/byUserId/{userId}")
public R<HrmEmployeeVo> getByUserId(@PathVariable @NotNull Long userId) {
HrmEmployeeBo bo = new HrmEmployeeBo();
bo.setUserId(userId);
List<HrmEmployeeVo> list = service.queryList(bo);
if (list != null && !list.isEmpty()) {
return R.ok(list.get(0));
HrmEmployeeVo vo = service.queryByUserId(userId);
if (vo != null) {
return R.ok(vo);
}
return R.fail("未找到该用户对应的员工信息");
}

View File

@@ -66,7 +66,14 @@ public class HrmFlowCcController extends BaseController {
Long userId = LoginHelper.getUserId();
return toAjax(service.markRead(ccId, userId));
}
/**
* 标记抄送未读(新增)
*/
@PostMapping("/{ccId}/unread")
public R<Void> unread(@PathVariable Long ccId) {
Long userId = LoginHelper.getUserId();
return toAjax(service.markUnread(ccId, userId));
}
@GetMapping("/ping")
public R<String> ping(@RequestParam @NotNull String x) {
return R.ok(x);

View File

@@ -56,6 +56,16 @@ public class HrmFlowTaskController extends BaseController {
}
/**
* 详情页使用:按 bizType + bizId 查询审批概要、当前待办和历史记录
*/
@GetMapping("/detailByBiz")
public R<?> detailByBiz(@RequestParam @NotNull String bizType,
@RequestParam @NotNull Long bizId,
@RequestParam(required = false) Long assigneeUserId) {
return R.ok(service.queryDetailByBiz(bizType, bizId, assigneeUserId));
}
@GetMapping("/{taskId}")
public R<HrmFlowTaskVo> getInfo(@PathVariable @NotNull Long taskId) {
return R.ok(service.queryById(taskId));

View File

@@ -6,7 +6,7 @@ import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.hrm.domain.HrmLeaveReq;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.hrm.domain.bo.HrmLeaveReqBo;
import com.ruoyi.hrm.domain.vo.HrmLeaveReqVo;
import com.ruoyi.hrm.domain.vo.HrmLeaveStatsVo;
@@ -30,6 +30,7 @@ public class HrmLeaveReqController extends BaseController {
@GetMapping("/list")
public TableDataInfo<HrmLeaveReqVo> list(HrmLeaveReqBo bo, PageQuery pageQuery) {
bo.setCreateBy(LoginHelper.getUsername());
return service.queryPageList(bo, pageQuery);
}
@@ -58,6 +59,7 @@ public class HrmLeaveReqController extends BaseController {
@GetMapping("/all")
public R<List<HrmLeaveReqVo>> all(HrmLeaveReqBo bo) {
bo.setCreateBy(LoginHelper.getUsername());
return R.ok(service.queryList(bo));
}

View File

@@ -0,0 +1,127 @@
package com.ruoyi.hrm.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.hrm.domain.HrmEmployee;
import com.ruoyi.hrm.domain.bo.HrmAppropriationReqBo;
import com.ruoyi.hrm.domain.bo.HrmLeaveReqBo;
import com.ruoyi.hrm.domain.bo.HrmReimburseReqBo;
import com.ruoyi.hrm.domain.bo.HrmSealReqBo;
import com.ruoyi.hrm.domain.bo.HrmTravelReqBo;
import com.ruoyi.hrm.domain.vo.HrmAppropriationReqVo;
import com.ruoyi.hrm.domain.vo.HrmLeaveReqVo;
import com.ruoyi.hrm.domain.vo.HrmMyApplyVo;
import com.ruoyi.hrm.domain.vo.HrmReimburseReqVo;
import com.ruoyi.hrm.domain.vo.HrmSealReqVo;
import com.ruoyi.hrm.domain.vo.HrmTravelReqVo;
import com.ruoyi.hrm.mapper.HrmAppropriationReqMapper;
import com.ruoyi.hrm.mapper.HrmEmployeeMapper;
import com.ruoyi.hrm.mapper.HrmLeaveReqMapper;
import com.ruoyi.hrm.mapper.HrmReimburseReqMapper;
import com.ruoyi.hrm.mapper.HrmSealReqMapper;
import com.ruoyi.hrm.mapper.HrmTravelReqMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@RestController
@RequestMapping("/hrm/my-apply")
public class HrmMyApplyController extends BaseController {
private final HrmEmployeeMapper employeeMapper;
private final SysUserMapper sysUserMapper;
private final HrmLeaveReqMapper leaveReqMapper;
private final HrmTravelReqMapper travelReqMapper;
private final HrmSealReqMapper sealReqMapper;
private final HrmReimburseReqMapper reimburseReqMapper;
private final HrmAppropriationReqMapper appropriationReqMapper;
@GetMapping("/list")
public TableDataInfo<HrmMyApplyVo> list(String bizType, String status, String keyword, PageQuery pageQuery) {
Long currentUserId = LoginHelper.getUserId();
if (currentUserId == null) {
return TableDataInfo.build();
}
HrmEmployee emp = employeeMapper.selectOne(new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<HrmEmployee>()
.eq(HrmEmployee::getUserId, currentUserId));
if (emp == null) {
return TableDataInfo.build();
}
SysUser sysUser = sysUserMapper.selectUserById(emp.getUserId());
String nickName = sysUser != null ? sysUser.getNickName() : null;
List<HrmMyApplyVo> all = new ArrayList<>();
if (bizType == null || bizType.isEmpty() || "leave".equals(bizType)) {
all.addAll(mapLeave(leaveReqMapper.selectVoWithProjectList(buildLeaveBo(emp.getEmpId(), status)), nickName));
}
if (bizType == null || bizType.isEmpty() || "travel".equals(bizType)) {
all.addAll(mapTravel(travelReqMapper.selectVoWithProjectList(buildTravelBo(emp.getEmpId(), status)), nickName));
}
if (bizType == null || bizType.isEmpty() || "seal".equals(bizType)) {
all.addAll(mapSeal(sealReqMapper.selectVoWithProjectList(buildSealBo(emp.getEmpId(), status)), nickName));
}
if (bizType == null || bizType.isEmpty() || "reimburse".equals(bizType)) {
all.addAll(mapReimburse(reimburseReqMapper.selectVoWithProjectList(buildReimburseBo(emp.getEmpId(), status)), nickName));
}
if (bizType == null || bizType.isEmpty() || "appropriation".equals(bizType)) {
all.addAll(mapAppropriation(appropriationReqMapper.selectVoWithProjectList(buildAppropriationBo(emp.getEmpId(), status)), nickName));
}
if (keyword != null && !keyword.isEmpty()) {
String lower = keyword.toLowerCase();
all = all.stream().filter(v -> contains(v, lower)).collect(Collectors.toList());
}
all.sort(Comparator.comparing(HrmMyApplyVo::getCreateTime, Comparator.nullsLast(Comparator.naturalOrder())).reversed());
long start = (pageQuery.getPageNum() - 1L) * pageQuery.getPageSize();
long end = Math.min(start + pageQuery.getPageSize(), all.size());
Page<HrmMyApplyVo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize(), all.size());
page.setRecords(start >= all.size() ? new ArrayList<>() : all.subList((int) start, (int) end));
return TableDataInfo.build(page);
}
private boolean contains(HrmMyApplyVo v, String lower) {
return Objects.toString(v.getTitle(), "").toLowerCase().contains(lower)
|| Objects.toString(v.getRemark(), "").toLowerCase().contains(lower)
|| Objects.toString(v.getNickName(), "").toLowerCase().contains(lower)
|| Objects.toString(v.getEmpName(), "").toLowerCase().contains(lower)
|| Objects.toString(v.getBizId(), "").contains(lower);
}
private HrmLeaveReqBo buildLeaveBo(Long empId, String status) { HrmLeaveReqBo bo = new HrmLeaveReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
private HrmTravelReqBo buildTravelBo(Long empId, String status) { HrmTravelReqBo bo = new HrmTravelReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
private HrmSealReqBo buildSealBo(Long empId, String status) { HrmSealReqBo bo = new HrmSealReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
private HrmReimburseReqBo buildReimburseBo(Long empId, String status) { HrmReimburseReqBo bo = new HrmReimburseReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
private HrmAppropriationReqBo buildAppropriationBo(Long empId, String status) { HrmAppropriationReqBo bo = new HrmAppropriationReqBo(); bo.setEmpId(empId); bo.setStatus(status); return bo; }
private List<HrmMyApplyVo> mapLeave(List<HrmLeaveReqVo> list, String nickName) { return list.stream().map(v -> toVo("leave", v.getBizId(), v.getEmpId(), nickName, v.getReason(), v.getStatus(), v.getCreateTime())).collect(Collectors.toList()); }
private List<HrmMyApplyVo> mapTravel(List<HrmTravelReqVo> list, String nickName) { return list.stream().map(v -> toVo("travel", v.getBizId(), v.getEmpId(), nickName, v.getReason(), v.getStatus(), v.getCreateTime())).collect(Collectors.toList()); }
private List<HrmMyApplyVo> mapSeal(List<HrmSealReqVo> list, String nickName) { return list.stream().map(v -> toVo("seal", v.getBizId(), v.getEmpId(), nickName, v.getRemark(), v.getStatus(), v.getCreateTime())).collect(Collectors.toList()); }
private List<HrmMyApplyVo> mapReimburse(List<HrmReimburseReqVo> list, String nickName) { return list.stream().map(v -> toVo("reimburse", v.getBizId(), v.getEmpId(), nickName, v.getReason(), v.getStatus(), v.getCreateTime())).collect(Collectors.toList()); }
private List<HrmMyApplyVo> mapAppropriation(List<HrmAppropriationReqVo> list, String nickName) { return list.stream().map(v -> toVo("appropriation", v.getBizId(), v.getEmpId(), nickName, v.getReason(), v.getStatus(), v.getCreateTime())).collect(Collectors.toList()); }
private HrmMyApplyVo toVo(String bizType, Long bizId, Long empId, String nickName, String title, String status, java.util.Date createTime) {
HrmMyApplyVo vo = new HrmMyApplyVo();
vo.setBizType(bizType);
vo.setBizId(bizId);
vo.setEmpId(empId);
vo.setNickName(nickName);
vo.setTitle(title);
vo.setStatus(status);
vo.setCreateTime(createTime);
return vo;
}
}

View File

@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.hrm.domain.bo.HrmReimburseReqBo;
import com.ruoyi.hrm.domain.vo.HrmReimburseReqVo;
import com.ruoyi.hrm.service.IHrmReimburseReqService;
@@ -31,6 +32,7 @@ public class HrmReimburseReqController extends BaseController {
@GetMapping("/list")
public TableDataInfo<HrmReimburseReqVo> list(HrmReimburseReqBo bo, PageQuery pageQuery) {
bo.setCreateBy(LoginHelper.getUsername());
return service.queryPageList(bo, pageQuery);
}
@@ -59,6 +61,7 @@ public class HrmReimburseReqController extends BaseController {
@GetMapping("/all")
public R<List<HrmReimburseReqVo>> all(HrmReimburseReqBo bo) {
bo.setCreateBy(LoginHelper.getUsername());
return R.ok(service.queryList(bo));
}
}

View File

@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.hrm.domain.bo.HrmSealReqBo;
import com.ruoyi.hrm.domain.bo.HrmSealStampBo;
import com.ruoyi.hrm.domain.vo.HrmSealReqVo;
@@ -32,6 +33,7 @@ public class HrmSealReqController extends BaseController {
@GetMapping("/list")
public TableDataInfo<HrmSealReqVo> list(HrmSealReqBo bo, PageQuery pageQuery) {
bo.setCreateBy(LoginHelper.getUsername());
return service.queryPageList(bo, pageQuery);
}
@@ -40,6 +42,11 @@ public class HrmSealReqController extends BaseController {
return R.ok(service.queryById(bizId));
}
@GetMapping("/{bizId}/pdfPages")
public R<Integer> pdfPages(@PathVariable @NotNull Long bizId) {
return R.ok(service.queryPdfPageTotal(bizId));
}
@Log(title = "用印申请", businessType = BusinessType.INSERT)
@PostMapping
public R<HrmSealReqVo> add(@Validated @RequestBody HrmSealReqBo bo) {

View File

@@ -6,10 +6,12 @@ import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.hrm.domain.bo.HrmTravelReqBo;
import com.ruoyi.hrm.domain.vo.HrmTravelReqVo;
import com.ruoyi.hrm.service.IHrmTravelReqService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -28,9 +30,17 @@ import java.util.List;
public class HrmTravelReqController extends BaseController {
private final IHrmTravelReqService service;
private final IHrmTravelReqService hrmTravelReqService;
@Value("${fad.amap.webkey}")
private String amapKey;
@Value("${fad.amap.securitykey}")
private String amapSecurityKey;
@GetMapping("/list")
public TableDataInfo<HrmTravelReqVo> list(HrmTravelReqBo bo, PageQuery pageQuery) {
bo.setCreateBy(LoginHelper.getUsername());
return service.queryPageList(bo, pageQuery);
}
@@ -56,9 +66,24 @@ public class HrmTravelReqController extends BaseController {
public R<Void> remove(@PathVariable @NotEmpty Long[] bizIds) {
return toAjax(service.deleteWithValidByIds(Arrays.asList(bizIds), true));
}
@PutMapping("/earlyEnd/{bizId}")
public R<Void> earlyEnd(@PathVariable Long bizId) {
return toAjax(hrmTravelReqService.earlyEnd(bizId));
}
@GetMapping("/amapKey")
public R<String> getAmapKey() {
return R.ok(amapKey);
}
@GetMapping("/amapSecurityKey")
public R<String> getAmapSecurityKey() {
return R.ok(amapSecurityKey);
}
@GetMapping("/all")
public R<List<HrmTravelReqVo>> all(HrmTravelReqBo bo) {
bo.setCreateBy(LoginHelper.getUsername());
return R.ok(service.queryList(bo));
}
}

View File

@@ -7,12 +7,11 @@ import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hrm_flow_action")
public class HrmFlowAction extends BaseEntity implements Serializable {
public class HrmFlowAction extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId

View File

@@ -7,7 +7,6 @@ import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* 用印申请
@@ -15,7 +14,7 @@ import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hrm_seal_req")
public class HrmSealReq extends BaseEntity implements Serializable {
public class HrmSealReq extends BaseEntity {
private static final long serialVersionUID = 1L;
@@ -29,7 +28,7 @@ public class HrmSealReq extends BaseEntity implements Serializable {
/** 项目ID */
private Long projectId;
/** 用印类型(公章/合同章/财务章等) */
/** 用印类型(对应印章文件名) */
private String sealType;
/** 用途说明 */

View File

@@ -32,6 +32,7 @@ public class HrmTravelReq extends BaseEntity {
private String bankName;
private String bankAccount;
private String remark;
private Date actualEndTime;
@TableLogic
private Integer delFlag;
}

View File

@@ -24,7 +24,7 @@ public class HrmSealReqBo extends BaseEntity {
/** 项目ID */
private Long projectId;
/** 用印类型 */
/** 用印类型(对应印章文件名) */
@NotBlank(message = "用印类型不能为空")
private String sealType;

View File

@@ -0,0 +1,28 @@
package com.ruoyi.hrm.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class HrmFlowActionTimelineVo implements Serializable {
private static final long serialVersionUID = 1L;
private Long actionId;
private Long taskId;
private Long instId;
private Long actionUserId;
private String actionUserName;
private Long assigneeUserId;
private String assigneeUserName;
private String action;
private String actionText;
private String remark;
private String bizType;
private Long bizId;
private Long nodeId;
private String nodeName;
private String taskStatus;
private Date createTime;
}

View File

@@ -34,6 +34,8 @@ public class HrmFlowInstanceVo implements Serializable {
private Date endTime;
private BigDecimal hours;
private String procStatus;
private Date actualEndTime;
private String statusName;
private String createBy;
private Date createTime;

View File

@@ -0,0 +1,32 @@
package com.ruoyi.hrm.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class HrmFlowTaskDetailVo implements Serializable {
private static final long serialVersionUID = 1L;
/** 当前业务对应的待办任务 */
private HrmFlowTaskVo currentTask;
/** 当前业务对应的全部任务历史 */
private List<HrmFlowTaskVo> taskHistory;
/** 当前流程实例状态 */
private String flowStatus;
/** 当前节点ID */
private Long currentNodeId;
/** 当前节点名称 */
private String currentNodeName;
/** 审批是否通过 */
private Boolean approved;
/** 流程动作历史(更细粒度) */
private List<HrmFlowActionTimelineVo> actionTimeline;
}

View File

@@ -0,0 +1,24 @@
package com.ruoyi.hrm.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class HrmMyApplyVo implements Serializable {
private static final long serialVersionUID = 1L;
private String bizType;
private Long bizId;
private Long empId;
private String empName;
private Long userId;
private String nickName;
private String title;
private String status;
private Date createTime;
private Date endTime;
private Date actualEndTime;
private String remark;
}

View File

@@ -88,6 +88,9 @@ public class HrmSealReqVo implements Serializable {
@Excel(name = "回执附件ID列表")
private String receiptFileIds;
@Excel(name = "PDF页数")
private Integer pdfPageTotal;
@Excel(name = "状态")
private String status;

View File

@@ -74,6 +74,8 @@ public class HrmTravelReqVo implements Serializable {
private String bankAccount;
@Excel(name = "备注")
private String remark;
private Date actualEndTime;
private String createBy;
private Date createTime;
private String updateBy;

View File

@@ -15,6 +15,8 @@ public interface IHrmEmployeeService {
List<HrmEmployeeVo> queryList(HrmEmployeeBo bo);
HrmEmployeeVo queryByUserId(Long userId);
Boolean insertByBo(HrmEmployeeBo bo);
Boolean updateByBo(HrmEmployeeBo bo);

View File

@@ -27,5 +27,9 @@ public interface IHrmFlowCcService {
* 标记已读
*/
Boolean markRead(Long ccId, Long userId);
/**
* 标记未读
*/
Boolean markUnread(Long ccId, Long userId);
}

View File

@@ -2,8 +2,8 @@ package com.ruoyi.hrm.service;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.hrm.domain.HrmFlowTask;
import com.ruoyi.hrm.domain.bo.HrmFlowTaskBo;
import com.ruoyi.hrm.domain.vo.HrmFlowTaskDetailVo;
import com.ruoyi.hrm.domain.vo.HrmFlowTaskVo;
import java.util.Collection;
@@ -51,4 +51,9 @@ public interface IHrmFlowTaskService {
* 根据业务类型 + 业务ID 查询当前待办任务pending用于详情页自动带出 currentTaskId
*/
HrmFlowTaskVo queryTodoByBiz(String bizType, Long bizId, Long assigneeUserId);
/**
* 按业务查询详情:当前待办、状态和历史审批记录
*/
HrmFlowTaskDetailVo queryDetailByBiz(String bizType, Long bizId, Long assigneeUserId);
}

View File

@@ -0,0 +1,9 @@
package com.ruoyi.hrm.service;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.hrm.domain.vo.HrmMyApplyVo;
public interface IHrmMyApplyService {
TableDataInfo<HrmMyApplyVo> queryPageList(String bizType, String status, String keyword, PageQuery pageQuery);
}

View File

@@ -13,6 +13,8 @@ public interface IHrmSealReqService {
HrmSealReqVo queryById(Long bizId);
Integer queryPdfPageTotal(Long bizId);
TableDataInfo<HrmSealReqVo> queryPageList(HrmSealReqBo bo, PageQuery pageQuery);
List<HrmSealReqVo> queryList(HrmSealReqBo bo);

View File

@@ -22,5 +22,7 @@ public interface IHrmTravelReqService {
Boolean updateByBo(HrmTravelReqBo bo);
int earlyEnd(Long bizId);
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -29,6 +29,11 @@ public class HrmEmployeeServiceImpl implements IHrmEmployeeService {
return baseMapper.selectVoById(empId);
}
@Override
public HrmEmployeeVo queryByUserId(Long userId) {
return baseMapper.selectVoOne(Wrappers.<HrmEmployee>lambdaQuery().eq(HrmEmployee::getUserId, userId));
}
@Override
public TableDataInfo<HrmEmployeeVo> queryPageList(HrmEmployeeBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<HrmEmployee> lqw = buildQueryWrapper(bo);

View File

@@ -99,6 +99,23 @@ public class HrmFlowCcServiceImpl implements IHrmFlowCcService {
.eq(HrmFlowCc::getDelFlag, 0)
) > 0;
}
/**
* 标记未读
*/
@Override
public Boolean markUnread(Long ccId, Long userId) {
if (ccId == null || userId == null) {
return false;
}
return baseMapper.update(
null,
Wrappers.<HrmFlowCc>lambdaUpdate()
.set(HrmFlowCc::getReadFlag, 0)
.eq(HrmFlowCc::getCcId, ccId)
.eq(HrmFlowCc::getCcUserId, userId)
.eq(HrmFlowCc::getDelFlag, 0)
) > 0;
}
private LambdaQueryWrapper<HrmFlowCc> buildQueryWrapper(HrmFlowCcBo bo) {
LambdaQueryWrapper<HrmFlowCc> lqw = Wrappers.lambdaQuery();

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.service.UserService;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.hrm.domain.HrmFlowInstance;
import com.ruoyi.hrm.domain.HrmFlowNode;
import com.ruoyi.hrm.domain.HrmFlowTask;
@@ -15,6 +16,7 @@ import com.ruoyi.hrm.domain.bo.HrmFlowStartBo;
import com.ruoyi.hrm.domain.bo.HrmFlowInstanceBo;
import com.ruoyi.hrm.domain.vo.HrmFlowInstanceVo;
import com.ruoyi.hrm.domain.vo.HrmFlowTaskVo;
import com.ruoyi.hrm.domain.vo.HrmTravelReqVo;
import com.ruoyi.hrm.mapper.*;
import com.ruoyi.hrm.service.IHrmFlowInstanceService;
import lombok.RequiredArgsConstructor;
@@ -37,6 +39,7 @@ public class HrmFlowInstanceServiceImpl implements IHrmFlowInstanceService {
private final FlowAssigneeHelper assigneeHelper;
private final UserService userService;
private final HrmFlowCcMapper ccMapper;
private final HrmTravelReqMapper travelReqMapper;
@Override
public HrmFlowInstanceVo queryById(Long instId) {
@@ -75,6 +78,7 @@ public class HrmFlowInstanceServiceImpl implements IHrmFlowInstanceService {
task.setNodeId(0L);
task.setAssigneeUserId(bo.getManualAssigneeUserId());
task.setStatus("pending");
task.setRemark("自选审批人一次性审批");
// 关键:写入业务关联字段,便于审批中心联查业务数据
task.setBizType(bo.getBizType());
task.setBizId(bo.getBizId());
@@ -121,6 +125,7 @@ public class HrmFlowInstanceServiceImpl implements IHrmFlowInstanceService {
task.setNodeId(firstNode.getNodeId());
task.setAssigneeUserId(assignees.get(0));
task.setStatus("pending");
task.setRemark(firstNode.getRemark());
// 关键:写入业务关联字段,便于审批中心联查业务数据
task.setBizType(bo.getBizType());
task.setBizId(bo.getBizId());
@@ -140,12 +145,36 @@ public class HrmFlowInstanceServiceImpl implements IHrmFlowInstanceService {
public TableDataInfo<HrmFlowInstanceVo> queryMyInstancePageList(HrmFlowInstanceBo bo, PageQuery pageQuery) {
// “我的申请”= 当前登录用户发起的流程实例
// 这里不信任前端传 startUserId统一以登录态为准
Long userId = com.ruoyi.common.helper.LoginHelper.getUserId();
Long userId = LoginHelper.getUserId();
LambdaQueryWrapper<HrmFlowInstance> lqw = buildQueryWrapper(bo);
lqw.eq(userId != null, HrmFlowInstance::getStartUserId, userId);
// 默认按发起时间倒序如果表里没createTime字段这里可改成instId倒序
lqw.orderByDesc(HrmFlowInstance::getInstId);
Page<HrmFlowInstanceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
for (HrmFlowInstanceVo record : result.getRecords()) {
// 写入出差相关的时间,用于在页面中可以提前结束
if (record.getBizType().equals("travel")){
HrmTravelReqVo hrmTravelReqVo = travelReqMapper.selectVoById(record.getBizId());
record.setActualEndTime(hrmTravelReqVo.getActualEndTime());
}
}
for (HrmFlowInstanceVo vo : result.getRecords()) {
if ("travel".equals(vo.getBizType())) {
HrmTravelReqVo travel = travelReqMapper.selectVoById(vo.getBizId());
if (travel != null) {
vo.setActualEndTime(travel.getActualEndTime());
// 只有流程已完成,才替换显示文字
if ("complete".equals(vo.getStatus())) {
if (travel.getActualEndTime() == null) {
vo.setStatusName("出差中");
} else {
vo.setStatusName("已结束");
}
}
}
}
}
return TableDataInfo.build(result);
}

View File

@@ -12,11 +12,15 @@ import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.hrm.domain.*;
import com.ruoyi.hrm.domain.bo.HrmFlowTaskBo;
import com.ruoyi.hrm.domain.bo.HrmSealStampBo;
import com.ruoyi.hrm.domain.vo.HrmFlowActionTimelineVo;
import com.ruoyi.hrm.domain.vo.HrmFlowTaskDetailVo;
import com.ruoyi.hrm.domain.vo.HrmFlowTaskVo;
import com.ruoyi.hrm.domain.vo.HrmEmployeeVo;
import com.ruoyi.hrm.mapper.*;
import com.ruoyi.hrm.service.IHrmFlowTaskService;
import com.ruoyi.hrm.service.IHrmSealReqService;
import com.ruoyi.hrm.service.IHrmFlowCcService;
import com.ruoyi.hrm.service.IHrmEmployeeService;
import com.ruoyi.hrm.domain.bo.HrmFlowCcBo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -38,7 +42,6 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
private final FlowAssigneeHelper assigneeHelper;
private final BizStatusSyncHelper bizStatusSyncHelper;
private final HrmFlowTaskMapper hrmFlowTaskMapper;
// 注入五个业务Mapper
private final HrmLeaveReqMapper leaveReqMapper;
private final HrmTravelReqMapper travelReqMapper;
@@ -47,6 +50,7 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
private final HrmAppropriationReqMapper appropriationReqMapper;
private final ObjectMapper objectMapper; // Spring Boot 默认提供
private final UserService userService;
private final IHrmEmployeeService employeeService;
@Override
public HrmFlowTaskVo queryById(Long taskId) {
@@ -74,7 +78,7 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
return tasks;
}
private void fillBizData(List<HrmFlowTaskVo> tasks) {
private void fillBizData(List<HrmFlowTaskVo> tasks) {
// 1. 按 bizType 分组,并收集 bizId
Map<String, List<Long>> bizIdsByType = tasks.stream()
.filter(t -> t.getBizType() != null && t.getBizId() != null)
@@ -90,19 +94,39 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
if (bizIds.isEmpty()) return;
switch (bizType) {
case "leave":
leaveReqMapper.selectBatchIds(bizIds).forEach(d -> bizDataMap.put("leave_" + d.getBizId(), d));
leaveReqMapper.selectBatchIds(bizIds).forEach(d -> {
Map<String, Object> dataMap = objectMapper.convertValue(d, Map.class);
fillEmpName(dataMap, d.getEmpId());
bizDataMap.put("leave_" + d.getBizId(), dataMap);
});
break;
case "travel":
travelReqMapper.selectBatchIds(bizIds).forEach(d -> bizDataMap.put("travel_" + d.getBizId(), d));
travelReqMapper.selectBatchIds(bizIds).forEach(d -> {
Map<String, Object> dataMap = objectMapper.convertValue(d, Map.class);
fillEmpName(dataMap, d.getEmpId());
bizDataMap.put("travel_" + d.getBizId(), dataMap);
});
break;
case "seal":
sealReqMapper.selectBatchIds(bizIds).forEach(d -> bizDataMap.put("seal_" + d.getBizId(), d));
sealReqMapper.selectBatchIds(bizIds).forEach(d -> {
Map<String, Object> dataMap = objectMapper.convertValue(d, Map.class);
fillEmpName(dataMap, d.getEmpId());
bizDataMap.put("seal_" + d.getBizId(), dataMap);
});
break;
case "reimburse":
reimburseReqMapper.selectBatchIds(bizIds).forEach(d -> bizDataMap.put("reimburse_" + d.getBizId(), d));
reimburseReqMapper.selectBatchIds(bizIds).forEach(d -> {
Map<String, Object> dataMap = objectMapper.convertValue(d, Map.class);
fillEmpName(dataMap, d.getEmpId());
bizDataMap.put("reimburse_" + d.getBizId(), dataMap);
});
break;
case "appropriation":
appropriationReqMapper.selectBatchIds(bizIds).forEach(d -> bizDataMap.put("appropriation_" + d.getBizId(), d));
appropriationReqMapper.selectBatchIds(bizIds).forEach(d -> {
Map<String, Object> dataMap = objectMapper.convertValue(d, Map.class);
fillEmpName(dataMap, d.getEmpId());
bizDataMap.put("appropriation_" + d.getBizId(), dataMap);
});
break;
}
});
@@ -112,13 +136,20 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
String key = task.getBizType() + "_" + task.getBizId();
Object data = bizDataMap.get(key);
if (data != null) {
// 将实体对象转换为 Map<String, Object>,方便前端使用
Map<String, Object> dataMap = objectMapper.convertValue(data, Map.class);
task.setBizData(dataMap);
task.setBizData((Map<String, Object>) data);
}
});
}
private void fillEmpName(Map<String, Object> dataMap, Long empId) {
if (empId != null) {
HrmEmployeeVo emp = employeeService.queryById(empId);
if (emp != null && emp.getEmpName() != null) {
dataMap.put("empName", emp.getEmpName());
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
@@ -155,12 +186,13 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
if (inst == null) {
return false;
}
Long operatorUserId = actionUserId != null ? actionUserId : LoginHelper.getUserId();
// 无模板一次性审批tplId=0 或 nodeId=0直接结束流程
if (inst.getTplId() != null && inst.getTplId() == 0L) {
// 记录动作
saveAction(taskId, inst.getInstId(), "approve", remark, actionUserId,task.getBizType(), task.getBizId());
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "approve", remark, operatorUserId);
if (stampBo != null) {
saveAction(taskId, inst.getInstId(), "stamp", "盖章", actionUserId,task.getBizType(), task.getBizId());
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "stamp", "盖章", operatorUserId);
}
task.setStatus("approved");
baseMapper.updateById(task);
@@ -172,7 +204,7 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
sealReqService.updateStatus(inst.getBizId(), "approved");
if (stampBo != null) {
// 盖章动作也写入流转历史
saveAction(taskId, inst.getInstId(), "stamp", "盖章", actionUserId,task.getBizType(), task.getBizId());
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "stamp", "盖章", operatorUserId);
sealReqService.stampWithJava(inst.getBizId(), stampBo);
}
}
@@ -185,7 +217,7 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
return false;
}
// 记录动作
saveAction(taskId, inst.getInstId(), "approve", remark, actionUserId,task.getBizType(),task.getBizId());
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "approve", remark, operatorUserId);
// 完成当前任务
task.setStatus("approved");
baseMapper.updateById(task);
@@ -269,7 +301,8 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
if (inst == null) {
return false;
}
saveAction(taskId, inst.getInstId(), "reject", remark, actionUserId,task.getBizType(),task.getBizId());
Long operatorUserId = actionUserId != null ? actionUserId : LoginHelper.getUserId();
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "reject", remark, operatorUserId);
task.setStatus("rejected");
baseMapper.updateById(task);
inst.setStatus("rejected");
@@ -293,7 +326,8 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
if (inst == null) {
return false;
}
saveAction(taskId, inst.getInstId(), "withdraw", remark, actionUserId, task.getBizType(), task.getBizId());
Long operatorUserId = actionUserId != null ? actionUserId : LoginHelper.getUserId();
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), task.getAssigneeUserId(), "withdraw", remark, operatorUserId);
task.setStatus("withdraw");
baseMapper.updateById(task);
// 无模板一次性审批:撤回后业务回到 pending并重新生成一个待办仍然只允许一次审批
@@ -330,13 +364,13 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
return true;
}
private void saveAction(Long taskId, Long instId, String action, String remark, Long userId, String bizType, Long bizId) {
private void saveAction(Long taskId, Long instId, String bizType, Long bizId, Long assigneeUserId, String action, String remark, Long actionUserId) {
HrmFlowAction log = new HrmFlowAction();
log.setTaskId(taskId);
log.setInstId(instId);
log.setAction(action);
log.setRemark(remark);
log.setActionUserId(userId);
log.setActionUserId(actionUserId);
log.setCreateTime(new Date());
log.setBizType(bizType);
log.setBizId(bizId);
@@ -358,7 +392,8 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
return false;
}
// 记录动作
saveAction(taskId, inst.getInstId(), "transfer", remark, actionUserId, task.getBizType(), task.getBizId());
Long operatorUserId = actionUserId != null ? actionUserId : LoginHelper.getUserId();
saveAction(taskId, inst.getInstId(), task.getBizType(), task.getBizId(), newAssigneeUserId, "transfer", remark, operatorUserId);
// 更新办理人
HrmFlowTask u = new HrmFlowTask();
@@ -369,7 +404,6 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
@Override
public HrmFlowTaskVo queryTodoByBiz(String bizType, Long bizId, Long assigneeUserId) {
// 只取"待办 pending"的一条(理论上同一 biz 同一时刻最多一条待办)
LambdaQueryWrapper<HrmFlowTask> lqw = Wrappers.<HrmFlowTask>lambdaQuery()
.eq(bizType != null, HrmFlowTask::getBizType, bizType)
.eq(bizId != null, HrmFlowTask::getBizId, bizId)
@@ -378,12 +412,118 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
.orderByDesc(HrmFlowTask::getTaskId)
.last("limit 1");
HrmFlowTaskVo hrmFlowTaskVo = baseMapper.selectVoOne(lqw);
if (hrmFlowTaskVo != null) {
if (hrmFlowTaskVo != null && hrmFlowTaskVo.getAssigneeUserId() != null) {
hrmFlowTaskVo.setAssigneeNickName(userService.selectNickNameById(hrmFlowTaskVo.getAssigneeUserId()));
}
return hrmFlowTaskVo;
}
@Override
public HrmFlowTaskDetailVo queryDetailByBiz(String bizType, Long bizId, Long assigneeUserId) {
HrmFlowTaskDetailVo result = new HrmFlowTaskDetailVo();
HrmFlowTaskVo currentTask = queryTodoByBiz(bizType, bizId, assigneeUserId);
result.setCurrentTask(currentTask);
LambdaQueryWrapper<HrmFlowTask> historyQ = Wrappers.<HrmFlowTask>lambdaQuery()
.eq(bizType != null, HrmFlowTask::getBizType, bizType)
.eq(bizId != null, HrmFlowTask::getBizId, bizId)
.orderByAsc(HrmFlowTask::getCreateTime);
List<HrmFlowTaskVo> histories = baseMapper.selectVoList(historyQ);
if (histories != null) {
histories.forEach(task -> {
if (task.getAssigneeUserId() != null) {
task.setAssigneeNickName(userService.selectNickNameById(task.getAssigneeUserId()));
}
});
}
result.setTaskHistory(histories == null ? Collections.emptyList() : histories);
HrmFlowInstance inst = instanceMapper.selectOne(Wrappers.<HrmFlowInstance>lambdaQuery()
.eq(bizType != null, HrmFlowInstance::getBizType, bizType)
.eq(bizId != null, HrmFlowInstance::getBizId, bizId)
.orderByDesc(HrmFlowInstance::getInstId)
.last("limit 1"));
if (inst != null) {
result.setFlowStatus(inst.getStatus());
result.setCurrentNodeId(inst.getCurrentNodeId());
HrmFlowNode node = inst.getCurrentNodeId() == null ? null : nodeMapper.selectById(inst.getCurrentNodeId());
if (node != null) {
result.setCurrentNodeName(node.getRemark());
}
result.setApproved(Boolean.valueOf("approved".equalsIgnoreCase(inst.getStatus())));
}
result.setActionTimeline(buildActionTimeline(bizType, bizId));
return result;
}
private List<HrmFlowActionTimelineVo> buildActionTimeline(String bizType, Long bizId) {
LambdaQueryWrapper<HrmFlowAction> actionQ = Wrappers.<HrmFlowAction>lambdaQuery()
.eq(bizType != null, HrmFlowAction::getBizType, bizType)
.eq(bizId != null, HrmFlowAction::getBizId, bizId)
.orderByAsc(HrmFlowAction::getCreateTime);
List<HrmFlowAction> actions = actionMapper.selectList(actionQ);
if (actions == null || actions.isEmpty()) {
return Collections.emptyList();
}
Map<Long, HrmFlowTask> taskMap = new HashMap<>();
List<Long> taskIds = actions.stream().map(HrmFlowAction::getTaskId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
if (!taskIds.isEmpty()) {
baseMapper.selectBatchIds(taskIds).forEach(task -> taskMap.put(task.getTaskId(), task));
}
List<HrmFlowActionTimelineVo> timelines = new ArrayList<HrmFlowActionTimelineVo>();
for (HrmFlowAction action : actions) {
HrmFlowActionTimelineVo vo = new HrmFlowActionTimelineVo();
vo.setActionId(action.getActionId());
vo.setTaskId(action.getTaskId());
vo.setInstId(action.getInstId());
vo.setActionUserId(action.getActionUserId());
vo.setActionUserName(action.getActionUserId() == null ? null : userService.selectNickNameById(action.getActionUserId()));
vo.setAction(action.getAction());
vo.setActionText(actionText(action.getAction()));
vo.setRemark(action.getRemark());
vo.setBizType(action.getBizType());
vo.setBizId(action.getBizId());
HrmFlowTask task = taskMap.get(action.getTaskId());
if (task != null) {
vo.setNodeId(task.getNodeId());
vo.setTaskStatus(task.getStatus());
HrmFlowNode node = task.getNodeId() == null ? null : nodeMapper.selectById(task.getNodeId());
if (node != null) {
vo.setNodeName(node.getRemark());
}
}
vo.setCreateTime(action.getCreateTime());
timelines.add(vo);
}
return timelines;
}
private String actionText(String action) {
if (action == null) {
return "-";
}
String lower = action.toLowerCase();
if ("approve".equals(lower)) {
return "通过";
}
if ("reject".equals(lower)) {
return "驳回";
}
if ("withdraw".equals(lower)) {
return "撤回";
}
if ("transfer".equals(lower)) {
return "转办";
}
if ("stamp".equals(lower)) {
return "盖章";
}
return action;
}
private LambdaQueryWrapper<HrmFlowTask> buildQueryWrapper(HrmFlowTaskBo bo) {
LambdaQueryWrapper<HrmFlowTask> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getTaskId() != null, HrmFlowTask::getTaskId, bo.getTaskId());
@@ -416,6 +556,11 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
if (result.getRecords() != null && !result.getRecords().isEmpty()) {
fillBizData(result.getRecords());
result.getRecords().forEach(task -> {
if (task.getAssigneeUserId() != null) {
task.setAssigneeNickName(userService.selectNickNameById(task.getAssigneeUserId()));
}
});
}
return TableDataInfo.build(result);

View File

@@ -21,6 +21,8 @@ import com.ruoyi.hrm.service.IHrmSealReqService;
import com.ruoyi.oss.core.OssClient;
import com.ruoyi.oss.entity.UploadResult;
import com.ruoyi.oss.factory.OssFactory;
import com.ruoyi.system.domain.vo.SysOssVo;
import com.ruoyi.system.mapper.SysOssMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.pdmodel.PDDocument;
@@ -28,7 +30,6 @@ import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -48,10 +49,59 @@ public class HrmSealReqServiceImpl implements IHrmSealReqService {
private final HrmSealReqMapper baseMapper;
private final StampProperties stampProperties;
private final IHrmFlowInstanceService flowInstanceService;
private final SysOssMapper sysOssMapper;
@Override
public HrmSealReqVo queryById(Long bizId) {
return baseMapper.selectVoWithProjectById(bizId);
HrmSealReqVo vo = baseMapper.selectVoWithProjectById(bizId);
if (vo != null) {
vo.setPdfPageTotal(queryPdfPageTotal(bizId));
}
return vo;
}
@Override
public Integer queryPdfPageTotal(Long bizId) {
HrmSealReqVo vo = baseMapper.selectVoWithProjectById(bizId);
String applyFileIds = vo != null ? vo.getApplyFileIds() : null;
if (applyFileIds == null || applyFileIds.trim().isEmpty()) {
return 0;
}
String firstFileId = applyFileIds.split(",")[0].trim();
if (firstFileId.isEmpty()) {
return 0;
}
String fileUrl = resolveSealPdfUrl(firstFileId);
if (fileUrl == null || fileUrl.trim().isEmpty()) {
return 0;
}
try (InputStream inputStream = getObject(fileUrl); PDDocument document = PDDocument.load(inputStream)) {
return document.getNumberOfPages();
} catch (Exception e) {
log.warn("查询用印PDF页数失败 bizId={}, fileId={}, fileUrl={}", bizId, firstFileId, fileUrl, e);
return 0;
}
}
private String resolveObjectKey(String fileRef) {
if (fileRef == null) {
return null;
}
String ref = fileRef.trim();
if (ref.isEmpty()) {
return ref;
}
if (ref.startsWith("http://") || ref.startsWith("https://")) {
int idx = ref.indexOf("/files/");
if (idx >= 0) {
return ref.substring(idx + "/files/".length());
}
idx = ref.indexOf("/files%2F");
if (idx >= 0) {
return ref.substring(idx + "/files%2F".length());
}
}
return ref;
}
@Override
@@ -269,6 +319,17 @@ public class HrmSealReqServiceImpl implements IHrmSealReqService {
}
}
private String resolveSealPdfUrl(String ossIdText) {
try {
Long ossId = Long.valueOf(ossIdText);
SysOssVo sysOss = sysOssMapper.selectVoById(ossId);
return sysOss != null ? sysOss.getUrl() : null;
} catch (Exception e) {
log.warn("解析用印PDF文件地址失败 ossIdText={}", ossIdText, e);
return null;
}
}
private InputStream getObject(String url) {
OssClient storage = OssFactory.instance();
return storage.getObjectContent(url);

View File

@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.List;
import java.util.Date;
@RequiredArgsConstructor
@Service
@@ -128,4 +129,36 @@ public class HrmTravelReqServiceImpl implements IHrmTravelReqService {
private String defaultStatus(String status) {
return status == null ? "draft" : status;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int earlyEnd(Long bizId) {
HrmTravelReq travelReq = baseMapper.selectById(bizId);
if (travelReq == null) {
throw new RuntimeException("出差申请不存在");
}
String status = travelReq.getStatus();
if (!"approved".equals(status) && !"in_progress".equals(status)) {
throw new RuntimeException("当前状态不能提前结束,只有已通过或进行中的出差才能提前结束");
}
// 3. 检查是否已经提前结束过
if (travelReq.getActualEndTime() != null) {
throw new RuntimeException("该出差已经提前结束过了");
}
// 4. 更新实际结束时间为当前时间
travelReq.setActualEndTime(new Date());
// 5. 可选:更新状态为已完成
travelReq.setStatus("completed");
// 6. 执行更新
int result = baseMapper.updateById(travelReq);
if (result <= 0) {
throw new RuntimeException("提前结束失败");
}
return result;
}
}

View File

@@ -51,12 +51,13 @@
<sql id="selectVo">
SELECT
e.emp_id, e.user_id, e.emp_no, e.emp_name, e.gender, e.mobile, e.email, e.id_no,
e.hire_date, e.employment_type, e.status, e.dept_id, e.post_id, e.remark,
e.hire_date, e.employment_type, e.status, su.dept_id, e.post_id, e.remark,
e.create_by, e.create_time, e.update_by, e.update_time,
d.dept_name,
p.post_name
FROM hrm_employee e
LEFT JOIN sys_dept d ON e.dept_id = d.dept_id AND d.del_flag = '0'
left join sys_user su on su.user_id = e.user_id
LEFT JOIN sys_dept d ON su.dept_id = d.dept_id AND d.del_flag = 0
LEFT JOIN sys_post p ON e.post_id = p.post_id
WHERE e.del_flag = 0
</sql>

View File

@@ -170,6 +170,8 @@ security:
- /oa/attendanceRecord/**
- /oa/oaWarehouse/**
- /oa/oaWarehouseMaster/**
# 高德逆地理(经纬度转城市等,供前端/H5 调用)
- /oa/amap/**
# MyBatisPlus配置
# https://baomidou.com/config/
@@ -317,8 +319,12 @@ flowable:
check-process-definitions: false
# 关闭历史任务定时任务job
async-history-executor-activate: false
fad:
amap:
key: 978ae5bc551f57d172d3e397af5a6f67
# 留作后端接口调用(服务 API的 Key
key: 978ae5bc551f57d172d3e397af5a6f67
# 新增的前端 Web 端使用的 Key 和安全密钥
webKey: 34bf20d1db5b183558b9bb85d6eed783
securityKey: 6f9171724396deb5f8c42ef256b3cbc5

View File

@@ -2,13 +2,20 @@ package com.ruoyi.framework.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig {
private static final int CONNECT_TIMEOUT_MS = 5_000;
private static final int READ_TIMEOUT_MS = 15_000;
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setConnectTimeout(CONNECT_TIMEOUT_MS);
factory.setReadTimeout(READ_TIMEOUT_MS);
return new RestTemplate(factory);
}
}

View File

@@ -73,6 +73,12 @@
<artifactId>xxl-job-core</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>fad-hrm</artifactId>
</dependency>
</dependencies>

View File

@@ -0,0 +1,46 @@
package com.ruoyi.oa.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.oa.domain.vo.AmapCityNameVo;
import com.ruoyi.oa.service.IOaAmapGeocodeService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
/**
* 高德地图:经纬度逆地理编码(城市名等)
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/oa/amap")
public class OaAmapController extends BaseController {
private final IOaAmapGeocodeService oaAmapGeocodeService;
/**
* 根据经纬度获取城市名称(高德逆地理编码)
*/
@GetMapping("/city")
public R<AmapCityNameVo> cityByLocation(
@NotNull(message = "经度不能为空")
@DecimalMin(value = "-180.0", message = "经度范围无效")
@DecimalMax(value = "180.0", message = "经度范围无效")
@RequestParam Double longitude,
@NotNull(message = "纬度不能为空")
@DecimalMin(value = "-90.0", message = "纬度范围无效")
@DecimalMax(value = "90.0", message = "纬度范围无效")
@RequestParam Double latitude
) {
AmapCityNameVo vo = oaAmapGeocodeService.reverseGeocodeCity(longitude, latitude);
return R.ok(vo);
}
}

View File

@@ -0,0 +1,62 @@
package com.ruoyi.oa.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.oa.domain.bo.OaCityBo;
import com.ruoyi.oa.domain.vo.OaCityVo;
import com.ruoyi.oa.service.IOaCityService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
@RequiredArgsConstructor
@RestController
@RequestMapping("/oa/city")
@Validated
public class OaCityController extends BaseController {
private final IOaCityService cityService;
@GetMapping("/list")
public TableDataInfo<OaCityVo> list(OaCityBo bo, PageQuery pageQuery) {
return cityService.queryPageList(bo, pageQuery);
}
@GetMapping("/{cityId}")
public R<OaCityVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long cityId) {
return R.ok(cityService.queryById(cityId));
}
@Log(title = "城市管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated(AddGroup.class) @RequestBody OaCityBo bo) {
return toAjax(cityService.insertByBo(bo));
}
@Log(title = "城市管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OaCityBo bo) {
return toAjax(cityService.updateByBo(bo));
}
@Log(title = "城市管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{cityIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] cityIds) {
return toAjax(cityService.deleteWithValidByIds(Arrays.asList(cityIds), true));
}
}

View File

@@ -12,6 +12,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.oa.domain.bo.OaProjectReportBo;
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
import com.ruoyi.oa.domain.vo.OaProjectTravelCompareVo;
import com.ruoyi.oa.domain.vo.ProjectReportCardVo;
import com.ruoyi.oa.domain.vo.ProjectReportPieVo;
import com.ruoyi.oa.domain.vo.ProjectReportTrendVo;
@@ -51,6 +52,15 @@ public class OaProjectReportController extends BaseController {
return iOaProjectReportService.queryPageList(bo, pageQuery);
}
@GetMapping("/travel-compare")
public TableDataInfo<OaProjectTravelCompareVo> travelCompare(@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate start,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate end,
@RequestParam(required = false) String nickName,
@RequestParam(required = false) String workPlace,
PageQuery pageQuery) {
return iOaProjectReportService.getTravelCompareList(start, end, nickName, workPlace, pageQuery);
}
/**
* 查询项目报工列表
*/

View File

@@ -0,0 +1,64 @@
package com.ruoyi.oa.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.oa.domain.bo.OaProjectScheduleBo;
import com.ruoyi.oa.domain.bo.OaProjectScheduleStepBo;
import com.ruoyi.oa.domain.vo.OaProjectScheduleStepVo;
import com.ruoyi.oa.domain.vo.OaProjectScheduleVo;
import com.ruoyi.oa.domain.vo.OaScheduleListVo;
import com.ruoyi.oa.service.IOaProjectScheduleService;
import com.ruoyi.oa.service.IOaProjectScheduleStepService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* 项目进度(主表 + 子表聚合)
*
* 该控制器用于满足综合看板接口规范:
* - GET /oa/schedule/list?projectId=xx
*
* 复用现有服务:
* - /oa/projectSchedule主表
* - /oa/projectScheduleStep子表
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/oa/schedule")
public class OaScheduleController extends BaseController {
private final IOaProjectScheduleService projectScheduleService;
private final IOaProjectScheduleStepService projectScheduleStepService;
/**
* 获取进度主表 + 子表数据
*
* @param projectId 项目ID
*/
@GetMapping("/list")
public R<List<OaScheduleListVo>> list(@RequestParam("projectId") Long projectId) {
OaProjectScheduleBo scheduleBo = new OaProjectScheduleBo();
scheduleBo.setProjectId(projectId);
List<OaProjectScheduleVo> schedules = projectScheduleService.queryList(scheduleBo);
List<OaScheduleListVo> result = new ArrayList<>();
for (OaProjectScheduleVo schedule : schedules) {
List<OaProjectScheduleStepVo> steps = projectScheduleStepService.selectProjectScheduleStepList(schedule.getScheduleId());
OaScheduleListVo vo = new OaScheduleListVo();
vo.setSchedule(schedule);
vo.setStepList(steps);
result.add(vo);
}
return R.ok(result);
}
}

View File

@@ -87,6 +87,17 @@ public class SysOaProjectController extends BaseController {
return R.ok(iSysOaProjectService.getMaxCode(prefix));
}
/**
* 项目综合看板聚合数据(项目 + 任务 + 进度主表 + 步骤)
* 必须声明在 /{projectId} 之前,避免部分环境下通配路径优先匹配导致 404。
* 菜单权限请在 sys_menu 中配置后使用全局路由守卫或接口级注解单独加回。
*/
@GetMapping("/dashboard/{projectId}")
public R<OaProjectDashboardVo> dashboard(@NotNull(message = "主键不能为空") @PathVariable Long projectId) {
OaProjectDashboardVo data = iSysOaProjectService.getProjectDashboard(projectId);
return data == null ? R.fail("项目不存在") : R.ok(data);
}
/**
* 获取项目管理详细信息
*

View File

@@ -0,0 +1,49 @@
package com.ruoyi.oa.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 城市管理对象 oa_city
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("oa_city")
public class OaCity extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(value = "city_id")
private Long cityId;
/** 国家 */
private String countryName;
/** 城市 */
private String cityName;
/**
* 城市编码
*/
private String cityCode;
/**
* 所属省份
*/
private String provinceName;
/** 状态 1正常 0禁用 */
private Long status;
/** 备注 */
private String remark;
@TableLogic
private Integer delFlag;
}

View File

@@ -0,0 +1,29 @@
package com.ruoyi.oa.domain.bo;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 城市管理业务对象 oa_city
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class OaCityBo extends BaseEntity {
private Long cityId;
@NotBlank(message = "国家不能为空")
private String countryName;
@NotBlank(message = "城市不能为空")
private String cityName;
private Long status;
private String cityCode;
private String provinceName;
private String remark;
}

View File

@@ -201,6 +201,17 @@ public class SysOaProjectBo extends BaseEntity {
private Long customerId;
//客户名称
private String customerName;
/**
* 综合模糊查询(名称 / 编号 / 代号 任一匹配),与 projectName、projectNum、projectCode 互斥:有值时优先使用本字段
*/
private String keyword;
/**
* 为 true 时在列表结果中附带各项目进度步骤统计(综合看板等,不参与 SQL 条件)
*/
private Boolean scheduleStats;
//是否置顶
private Integer isTop;

View File

@@ -0,0 +1,18 @@
package com.ruoyi.oa.domain.dto;
import lombok.Data;
/**
* 项目维度进度步骤汇总(综合看板左侧列表等)
*/
@Data
public class ProjectScheduleStepStatsDto {
private Long projectId;
private Long totalNodes;
private Long completedNodes;
private Long pendingAcceptNodes;
}

View File

@@ -0,0 +1,23 @@
package com.ruoyi.oa.domain.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 高德逆地理编码:城市名称(及可选行政区信息,便于展示/调试)
*/
@Data
public class AmapCityNameVo implements Serializable {
private static final long serialVersionUID = 1L;
/** 城市名(直辖市、省直辖等场景可能为省名或区名,与高德 addressComponent 一致) */
private String cityName;
/** 省 */
private String province;
/** 区/县 */
private String district;
}

View File

@@ -0,0 +1,27 @@
package com.ruoyi.oa.domain.vo;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 城市管理视图对象 oa_city
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class OaCityVo extends BaseEntity {
private Long cityId;
private String countryName;
private String cityName;
private Long status;
private String remark;
/** 城市编码 */
private String cityCode;
/** 所属省份 */
private String provinceName;
}

View File

@@ -0,0 +1,23 @@
package com.ruoyi.oa.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 项目综合看板聚合数据
*/
@Data
public class OaProjectDashboardVo implements Serializable {
private static final long serialVersionUID = 1L;
private SysOaProjectVo project;
private List<SysOaTaskVo> tasks;
private List<OaProjectScheduleVo> schedules;
private List<OaProjectScheduleStepVo> steps;
}

View File

@@ -0,0 +1,47 @@
package com.ruoyi.oa.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
/**
* 报工出差比对结果
*/
@Data
public class OaProjectTravelCompareVo implements Serializable {
private static final long serialVersionUID = 1L;
/** 用户昵称 */
private String nickName;
/** 比对日期(一天) */
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate compareDate;
/** 是否出差 */
private Long isTrip;
/** 是否出差(中文) */
private String trip;
/** 报工地点 */
private String workPlace;
/** 实际出差地点 */
private String travelPlace;
/** 机器比对结果 */
private String compareResult;
/** 是否通过 */
private Boolean pass;
/** 出差记录ID */
private Long travelBizId;
/** 报工ID */
private Long reportId;
}

View File

@@ -6,6 +6,7 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
@@ -19,7 +20,7 @@ import java.util.Date;
*/
@Data
@ExcelIgnoreUnannotated
public class OaRequirementsVo {
public class OaRequirementsVo extends BaseEntity {
private static final long serialVersionUID = 1L;

View File

@@ -0,0 +1,26 @@
package com.ruoyi.oa.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 项目进度列表(主表 + 子表)
*
* 对应表:
* - oa_project_schedule主表
* - oa_project_schedule_step子表
*
* 该 VO 用于接口GET /oa/schedule/list
*/
@Data
public class OaScheduleListVo implements Serializable {
/** 进度主表 */
private OaProjectScheduleVo schedule;
/** 进度子表步骤 */
private List<OaProjectScheduleStepVo> stepList;
}

View File

@@ -5,6 +5,7 @@ import java.util.Date;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.common.annotation.ExcelDictFormat;
@@ -14,7 +15,6 @@ import com.ruoyi.system.domain.SysOss;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
@@ -284,4 +284,27 @@ public class SysOaProjectVo {
private Long processCardCount;
private Long deliveryOrderCount;
/** 列表 SQL 聚合:任务/进度总览 */
@ExcelIgnore
private Long taskFinishCount;
@ExcelIgnore
private Long taskTotalCount;
@ExcelIgnore
private Long scheduleTotalCount;
@ExcelIgnore
private Long scheduleFinishCount;
/** 进度步骤汇总(列表请求 scheduleStats=true 时由服务层填充) */
@ExcelIgnore
private Long scheduleStepTotal;
@ExcelIgnore
private Long scheduleStepCompleted;
@ExcelIgnore
private Long scheduleStepPendingAccept;
}

View File

@@ -1,7 +1,5 @@
package com.ruoyi.oa.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
@@ -218,11 +216,28 @@ public class SysOaTaskVo {
//部门名称
private String deptName;
//关联项目进度id
/** 关联进度子表主键 oa_project_schedule_step.track_id */
private Long trackId;
//联查的节点信息
private String tabNode;
private String firstLevelNode;
private String secondLevelNode;
/** 进度步骤名称 oa_project_schedule_step.step_name综合看板联表 */
private String scheduleStepName;
/** 进度步骤状态 0未开始 1进行中 2完成 3暂停 */
private Long scheduleStatus;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date schedulePlanStart;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date schedulePlanEnd;
/** 进度负责人 oa_project_schedule_step.header */
private String scheduleHeader;
}

View File

@@ -0,0 +1,11 @@
package com.ruoyi.oa.mapper;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.ruoyi.oa.domain.OaCity;
import com.ruoyi.oa.domain.vo.OaCityVo;
/**
* 城市管理 Mapper
*/
public interface OaCityMapper extends BaseMapperPlus<OaCityMapper, OaCity, OaCityVo> {
}

View File

@@ -52,5 +52,11 @@ public interface OaProjectReportMapper extends BaseMapperPlus<OaProjectReportMap
List<OaProjectReportVo> getClearList(@Param("start") LocalDate start, @Param("end") LocalDate end);
Page<OaProjectReportVo> selectTravelCompareReportPage(@Param("page") Page<OaProjectReportVo> page,
@Param("start") LocalDate start,
@Param("end") LocalDate end,
@Param("nickName") String nickName,
@Param("workPlace") String workPlace);
List<OaProjectReportVo> getSummaryData(@Param("start") LocalDate start, @Param("end") LocalDate end);
}

View File

@@ -3,6 +3,7 @@ package com.ruoyi.oa.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.oa.domain.OaProjectScheduleStep;
import com.ruoyi.oa.domain.dto.ProjectScheduleStepStatsDto;
import com.ruoyi.oa.domain.vo.OaProjectScheduleStepVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
@@ -31,6 +32,11 @@ public interface OaProjectScheduleStepMapper extends BaseMapperPlus<OaProjectSch
void saveBatch(List<OaProjectScheduleStep> entities);
/**
* 按 schedule_id 查询步骤列表(综合看板使用)
*/
List<OaProjectScheduleStepVo> selectProjectScheduleStepList(@Param("scheduleId") Long scheduleId);
/**
* 根据 schedule_id 批量删除步骤记录
* @param scheduleIds 主表的 schedule_id 集合
@@ -39,4 +45,9 @@ public interface OaProjectScheduleStepMapper extends BaseMapperPlus<OaProjectSch
int deleteByScheduleIds(@Param("scheduleIds") Collection<Long> scheduleIds);
Page<OaProjectScheduleStepVo> selectVoPageNew(Page<Object> build,@Param(Constants.WRAPPER) QueryWrapper<OaProjectScheduleStep> lqw);
/**
* 按项目汇总进度步骤:总数、已完成(2)、待验收(1)
*/
List<ProjectScheduleStepStatsDto> selectStepStatsGroupByProjectId(@Param("projectIds") Collection<Long> projectIds);
}

View File

@@ -46,6 +46,11 @@ public interface SysOaTaskMapper extends BaseMapperPlus<SysOaTaskMapper, SysOaTa
List<SysOaTaskVo> listDocumentProject(Long projectId);
/**
* 综合看板:某项目下任务(一行一条任务)
*/
List<SysOaTaskVo> selectDashboardTasksByProjectId(@Param("projectId") Long projectId);
/**
* 新增自定义查询任务列表Plus版
*/

View File

@@ -0,0 +1,18 @@
package com.ruoyi.oa.service;
import com.ruoyi.oa.domain.vo.AmapCityNameVo;
/**
* 高德地图逆地理编码(经纬度 → 城市等)
*/
public interface IOaAmapGeocodeService {
/**
* 根据经纬度解析城市名称等信息
*
* @param longitude 经度
* @param latitude 纬度
* @return 非 null解析失败时 cityName 等可能为空
*/
AmapCityNameVo reverseGeocodeCity(Double longitude, Double latitude);
}

View File

@@ -0,0 +1,24 @@
package com.ruoyi.oa.service;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.oa.domain.bo.OaCityBo;
import com.ruoyi.oa.domain.vo.OaCityVo;
import java.util.Collection;
import java.util.List;
public interface IOaCityService {
OaCityVo queryById(Long cityId);
TableDataInfo<OaCityVo> queryPageList(OaCityBo bo, PageQuery pageQuery);
List<OaCityVo> queryList(OaCityBo bo);
Boolean insertByBo(OaCityBo bo);
Boolean updateByBo(OaCityBo bo);
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -1,78 +1,48 @@
package com.ruoyi.oa.service;
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
import com.ruoyi.oa.domain.bo.OaProjectReportBo;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.oa.domain.bo.OaProjectReportBo;
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
import com.ruoyi.oa.domain.vo.OaProjectTravelCompareVo;
import com.ruoyi.oa.domain.vo.ProjectReportCardVo;
import com.ruoyi.oa.domain.vo.ProjectReportPieVo;
import com.ruoyi.oa.domain.vo.ProjectReportTrendVo;
import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
/**
* 项目报工Service接口
*
* @author hdka
* @date 2025-06-16
*/
public interface IOaProjectReportService {
/**
* 查询项目报工
*/
OaProjectReportVo queryById(Long reportId);
/**
* 查询项目报工列表
*/
TableDataInfo<OaProjectReportVo> queryPageList(OaProjectReportBo bo, PageQuery pageQuery);
/**
* 查询项目报工列表
*/
List<OaProjectReportVo> queryList(OaProjectReportBo bo);
/**
* 新增项目报工
*/
Boolean insertByBo(OaProjectReportBo bo);
/**
* 修改项目报工
*/
Boolean updateByBo(OaProjectReportBo bo);
/**
* 校验并批量删除项目报工信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 报工数据看板
* @return
*/
ProjectReportCardVo getCardData();
public List<ProjectReportTrendVo> getTrend(LocalDate start, LocalDate end);
public List<ProjectReportPieVo> getDistribution(LocalDate start, LocalDate end);
List<OaProjectReportVo> getRankData(LocalDate start, LocalDate end);
List<OaProjectReportVo> getProjects(LocalDate start, LocalDate end);
List<OaProjectReportVo> clearList(LocalDate start, LocalDate end);
OaProjectReportVo queryById(Long reportId);
Boolean insertByBo(OaProjectReportBo bo);
Boolean updateByBo(OaProjectReportBo bo);
Boolean deleteWithValidByIds(List<Long> ids, Boolean isValid);
List<OaProjectReportVo> getRankData(LocalDate start, LocalDate end);
ProjectReportCardVo getCardData();
List<ProjectReportTrendVo> getTrend(LocalDate start, LocalDate end);
List<ProjectReportPieVo> getDistribution(LocalDate start, LocalDate end);
List<OaProjectReportVo> getProjects(LocalDate start, LocalDate end);
List<OaProjectReportVo> getSummaryData(LocalDate start, LocalDate end);
/**
* 查询当前登录用户今日的报工记录
*/
OaProjectReportVo getTodayReportByCurrentUser();
Boolean insertReportSupplement(OaProjectReportBo bo);
TableDataInfo<OaProjectTravelCompareVo> getTravelCompareList(LocalDate start, LocalDate end, String nickName, String workPlace, PageQuery pageQuery);
}

View File

@@ -38,6 +38,11 @@ public interface IOaProjectScheduleStepService{
*/
List<OaProjectScheduleStepVo> queryList(OaProjectScheduleStepBo bo);
/**
* 按 scheduleId 查询进度步骤列表(综合看板聚合接口使用)
*/
List<OaProjectScheduleStepVo> selectProjectScheduleStepList(Long scheduleId);
/**
* 新增项目进度步骤跟踪
*/

View File

@@ -103,4 +103,9 @@ public interface ISysOaProjectService {
Boolean postponeProject(SysOaProject bo);
SysOaProjectVo getMaxCode(String prefix);
/**
* 综合看板:项目详情 + 任务 + 进度主表 + 进度步骤(一次返回)
*/
OaProjectDashboardVo getProjectDashboard(Long projectId);
}

View File

@@ -109,6 +109,11 @@ public interface ISysOaTaskService {
* @return
*/
List<SysOaTaskVo> listDocumentProject(Long projectId);
/**
* 综合看板任务列表(完整字段,无 task_item 重复行)
*/
List<SysOaTaskVo> listDashboardTasks(Long projectId);
/**
* 新增自定义查询任务列表Plus版
*/

View File

@@ -0,0 +1,118 @@
package com.ruoyi.oa.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.oa.domain.vo.AmapCityNameVo;
import com.ruoyi.oa.service.IOaAmapGeocodeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
/**
* 高德逆地理编码restapi.amap.com/v3/geocode/regeo
* <p>
* 配置项:{@code fad.amap.key}(与 {@code application.yml} 中一致)
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class OaAmapGeocodeServiceImpl implements IOaAmapGeocodeService {
private static final String AMAP_REGEO_URL = "https://restapi.amap.com/v3/geocode/regeo";
private final RestTemplate restTemplate;
@Value("${fad.amap.key:}")
private String amapKey;
@Override
public AmapCityNameVo reverseGeocodeCity(Double longitude, Double latitude) {
AmapCityNameVo vo = new AmapCityNameVo();
if (longitude == null || latitude == null) {
return vo;
}
if (!StringUtils.hasText(amapKey)) {
log.warn("fad.amap.key 未配置,无法调用高德逆地理编码");
return vo;
}
try {
// 高德要求location = 经度,纬度
String location = longitude + "," + latitude;
String url = UriComponentsBuilder.fromHttpUrl(AMAP_REGEO_URL)
.queryParam("key", amapKey)
.queryParam("location", location)
.queryParam("extensions", "base")
.queryParam("batch", "false")
.queryParam("output", "JSON")
.build(true)
.toUriString();
String body = restTemplate.getForObject(url, String.class);
if (!StringUtils.hasText(body)) {
log.warn("高德逆地理编码响应为空, location={}", location);
return vo;
}
JSONObject response = JSONObject.parseObject(body);
if (response == null) {
log.warn("高德逆地理编码 JSON 解析失败, location={}", location);
return vo;
}
if (!"1".equals(response.getString("status"))) {
String info = response.getString("info");
log.warn("高德逆地理编码失败: status={}, info={}, infocode={}",
response.getString("status"), info, response.getString("infocode"));
return vo;
}
JSONObject regeocode = response.getJSONObject("regeocode");
if (regeocode == null) {
return vo;
}
JSONObject addressComponent = regeocode.getJSONObject("addressComponent");
if (addressComponent == null) {
return vo;
}
String province = nullToEmpty(addressComponent.getString("province"));
String district = nullToEmpty(addressComponent.getString("district"));
vo.setProvince(province);
vo.setDistrict(district);
String cityName = resolveCityName(addressComponent, province);
vo.setCityName(cityName);
return vo;
} catch (Exception e) {
log.warn("高德逆地理编码异常, longitude={}, latitude={}, err={}",
longitude, latitude, e.getMessage(), e);
return vo;
}
}
/**
* 城市字段:普通城市为字符串;部分省直辖为 [];直辖市可能用省名表示
*/
private static String resolveCityName(JSONObject addressComponent, String province) {
Object cityRaw = addressComponent.get("city");
if (cityRaw instanceof JSONArray) {
JSONArray arr = (JSONArray) cityRaw;
if (!arr.isEmpty()) {
return nullToEmpty(arr.getString(0));
}
return province;
}
String city = addressComponent.getString("city");
if (StringUtils.hasText(city) && !"[]".equals(city)) {
return city.trim();
}
return province;
}
private static String nullToEmpty(String s) {
return s == null ? "" : s.trim();
}
}

View File

@@ -0,0 +1,73 @@
package com.ruoyi.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.oa.domain.OaCity;
import com.ruoyi.oa.domain.bo.OaCityBo;
import com.ruoyi.oa.domain.vo.OaCityVo;
import com.ruoyi.oa.mapper.OaCityMapper;
import com.ruoyi.oa.service.IOaCityService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
@RequiredArgsConstructor
@Service
public class OaCityServiceImpl implements IOaCityService {
private final OaCityMapper baseMapper;
@Override
public OaCityVo queryById(Long cityId) {
return baseMapper.selectVoById(cityId);
}
@Override
public TableDataInfo<OaCityVo> queryPageList(OaCityBo bo, PageQuery pageQuery) {
IPage<OaCityVo> page = baseMapper.selectVoPage(pageQuery.build(), buildQueryWrapper(bo));
TableDataInfo<OaCityVo> tableDataInfo = new TableDataInfo<>(page.getRecords(), page.getTotal());
return tableDataInfo;
}
@Override
public List<OaCityVo> queryList(OaCityBo bo) {
return baseMapper.selectVoList(buildQueryWrapper(bo));
}
@Override
public Boolean insertByBo(OaCityBo bo) {
OaCity add = BeanUtil.toBean(bo, OaCity.class);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setCityId(add.getCityId());
}
return flag;
}
@Override
public Boolean updateByBo(OaCityBo bo) {
OaCity update = BeanUtil.toBean(bo, OaCity.class);
return baseMapper.updateById(update) > 0;
}
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
return baseMapper.deleteBatchIds(ids) > 0;
}
private LambdaQueryWrapper<OaCity> buildQueryWrapper(OaCityBo bo) {
LambdaQueryWrapper<OaCity> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getCountryName()), OaCity::getCountryName, bo.getCountryName());
lqw.like(StringUtils.isNotBlank(bo.getCityName()), OaCity::getCityName, bo.getCityName());
lqw.eq(bo.getStatus() != null, OaCity::getStatus, bo.getStatus());
lqw.orderByDesc(OaCity::getCreateTime);
return lqw;
}
}

View File

@@ -1,30 +1,35 @@
package com.ruoyi.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.hrm.domain.bo.HrmTravelReqBo;
import com.ruoyi.hrm.domain.vo.HrmTravelReqVo;
import com.ruoyi.hrm.service.IHrmTravelReqService;
import com.ruoyi.oa.domain.OaProjectReport;
import com.ruoyi.oa.domain.bo.OaProjectReportBo;
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
import com.ruoyi.oa.domain.vo.OaProjectTravelCompareVo;
import com.ruoyi.oa.domain.vo.ProjectReportCardVo;
import com.ruoyi.oa.domain.vo.ProjectReportPieVo;
import com.ruoyi.oa.domain.vo.ProjectReportTrendVo;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import com.ruoyi.oa.domain.bo.OaProjectReportBo;
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
import com.ruoyi.oa.domain.OaProjectReport;
import com.ruoyi.oa.mapper.OaProjectReportMapper;
import com.ruoyi.oa.service.IOaProjectReportService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 项目报工Service业务层处理
@@ -37,6 +42,7 @@ import java.util.*;
public class OaProjectReportServiceImpl implements IOaProjectReportService {
private final OaProjectReportMapper baseMapper;
private final IHrmTravelReqService hrmTravelReqService;
/**
* 查询项目报工
@@ -64,6 +70,77 @@ public class OaProjectReportServiceImpl implements IOaProjectReportService {
return baseMapper.selectAll(bo);
}
@Override
public TableDataInfo<OaProjectTravelCompareVo> getTravelCompareList(LocalDate start, LocalDate end, String nickName, String workPlace, PageQuery pageQuery) {
int pageNum = pageQuery.getPageNum() == null || pageQuery.getPageNum() <= 0 ? 1 : pageQuery.getPageNum();
int pageSize = pageQuery.getPageSize() == null || pageQuery.getPageSize() <= 0 ? 50 : pageQuery.getPageSize();
Page<OaProjectReportVo> page = new Page<>(pageNum, pageSize);
Page<OaProjectReportVo> reportPage = baseMapper.selectTravelCompareReportPage(page, start, end, nickName, workPlace);
List<OaProjectReportVo> reportList = reportPage.getRecords();
List<OaProjectTravelCompareVo> rows = new ArrayList<>();
List<HrmTravelReqVo> travelList = hrmTravelReqService.queryList(new HrmTravelReqBo());
for (OaProjectReportVo report : reportList) {
OaProjectTravelCompareVo vo = new OaProjectTravelCompareVo();
vo.setNickName(report.getNickName());
vo.setCompareDate(toLocalDate(report.getCreateTime()));
vo.setWorkPlace(safeString(report.getWorkPlace()));
vo.setReportId(report.getReportId());
vo.setIsTrip(report.getIsTrip());
vo.setTrip(report.getTrip());
if (report.getIsTrip() == null || report.getIsTrip() != 1) {
vo.setTravelPlace("无出差记录");
vo.setPass(false);
vo.setCompareResult("该员工未出差");
rows.add(vo);
continue;
}
HrmTravelReqVo matchedTravel = null;
LocalDate reportDate = vo.getCompareDate();
if (reportDate != null) {
for (HrmTravelReqVo travel : travelList) {
if (travel.getEmpId() == null || report.getUserId() == null || !travel.getEmpId().equals(report.getUserId())) {
continue;
}
if (travel.getStartTime() == null) {
continue;
}
LocalDate travelStart = toLocalDate(travel.getStartTime());
LocalDate travelEnd = toLocalDate(travel.getActualEndTime() != null ? travel.getActualEndTime() : travel.getEndTime());
if (travelStart == null || travelEnd == null) {
continue;
}
if (!reportDate.isBefore(travelStart) && !reportDate.isAfter(travelEnd)) {
matchedTravel = travel;
break;
}
}
}
if (matchedTravel == null) {
vo.setTravelPlace("无出差记录");
vo.setPass(false);
vo.setCompareResult("该员工未出差");
} else {
String travelPlace = safeString(matchedTravel.getDestination());
boolean pass = isLocationMatched(vo.getWorkPlace(), travelPlace);
vo.setTravelPlace(travelPlace);
vo.setPass(pass);
vo.setCompareResult(pass ? "通过" : "异常");
vo.setTravelBizId(matchedTravel.getBizId());
}
rows.add(vo);
}
TableDataInfo<OaProjectTravelCompareVo> table = TableDataInfo.build();
table.setRows(rows);
table.setTotal(reportPage.getTotal());
return table;
}
private QueryWrapper<OaProjectReport> buildQueryWrapper(OaProjectReportBo bo) {
Map<String, Object> params = bo.getParams();
@@ -110,6 +187,45 @@ public class OaProjectReportServiceImpl implements IOaProjectReportService {
return lqw;
}
private LocalDate toLocalDate(Date date) {
if (date == null) return null;
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
private String safeString(String value) {
return value == null ? "" : value.trim();
}
private boolean isLocationMatched(String a, String b) {
if (StringUtils.isBlank(a) || StringUtils.isBlank(b)) {
return false;
}
String left = normalizeLocation(a);
String right = normalizeLocation(b);
return !left.isEmpty() && left.equals(right);
}
private String normalizeLocation(String value) {
String normalized = value.trim();
if (normalized.length() >= 2) {
normalized = normalized.substring(0, 2);
}
return normalized;
}
private <T> TableDataInfo<T> toPage(List<T> list, PageQuery pageQuery) {
int pageNum = pageQuery.getPageNum() == null || pageQuery.getPageNum() <= 0 ? 1 : pageQuery.getPageNum();
int pageSize = pageQuery.getPageSize() == null || pageQuery.getPageSize() <= 0 ? 50 : pageQuery.getPageSize();
long total = list.size();
int fromIndex = Math.min((pageNum - 1) * pageSize, list.size());
int toIndex = Math.min(fromIndex + pageSize, list.size());
List<T> records = list.subList(fromIndex, toIndex);
TableDataInfo<T> tableDataInfo = TableDataInfo.build();
tableDataInfo.setRows(records);
tableDataInfo.setTotal(total);
return tableDataInfo;
}
/**
* 新增项目报工
*/
@@ -168,7 +284,7 @@ public class OaProjectReportServiceImpl implements IOaProjectReportService {
* 批量删除项目报工
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
public Boolean deleteWithValidByIds(List<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}

View File

@@ -68,7 +68,8 @@ public class OaProjectScheduleServiceImpl implements IOaProjectScheduleService {
*/
@Override
public TableDataInfo<OaProjectScheduleVo> queryPageList(OaProjectScheduleBo bo, PageQuery pageQuery) {
QueryWrapper<OaProjectSchedule> lqw = buildQueryWrapper(bo);
// 分页列表走自定义 Join SQLXML 中存在 ops/op 别名)
QueryWrapper<OaProjectSchedule> lqw = buildQueryWrapperJoin(bo);
Page<OaProjectScheduleVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@@ -78,11 +79,17 @@ public class OaProjectScheduleServiceImpl implements IOaProjectScheduleService {
*/
@Override
public List<OaProjectScheduleVo> queryList(OaProjectScheduleBo bo) {
QueryWrapper<OaProjectSchedule> lqw = buildQueryWrapper(bo);
// 非分页列表走 BaseMapper 默认 SQL无 ops/op 别名),避免出现 ops.del_flag 这类不存在的列引用
QueryWrapper<OaProjectSchedule> lqw = buildQueryWrapperBase(bo);
return baseMapper.selectVoList(lqw);
}
private QueryWrapper<OaProjectSchedule> buildQueryWrapper(OaProjectScheduleBo bo) {
/**
* Join 场景查询条件(对应 XML: OaProjectScheduleMapper.selectVoPagePlus
* - 主表别名ops (oa_project_schedule)
* - 项目表别名op (sys_oa_project)
*/
private QueryWrapper<OaProjectSchedule> buildQueryWrapperJoin(OaProjectScheduleBo bo) {
Map<String, Object> params = bo.getParams();
QueryWrapper<OaProjectSchedule> lqw = Wrappers.query();
lqw.eq("ops.del_flag", 0);
@@ -112,6 +119,27 @@ public class OaProjectScheduleServiceImpl implements IOaProjectScheduleService {
return lqw;
}
/**
* Base 表场景查询条件(对应 BaseMapper 默认 SQLFROM oa_project_schedule
* 仅使用 oa_project_schedule 表字段,严格对齐表结构:
* - oa_project_scheduleproject_id、schedule_id、...、del_flag
*/
private QueryWrapper<OaProjectSchedule> buildQueryWrapperBase(OaProjectScheduleBo bo) {
QueryWrapper<OaProjectSchedule> lqw = Wrappers.query();
// TableLogic 字段,默认查询只取未删除
lqw.eq("del_flag", 0);
lqw.eq(bo.getProjectId() != null, "project_id", bo.getProjectId());
lqw.eq(bo.getTemplateId() != null, "template_id", bo.getTemplateId());
lqw.eq(bo.getCurrentStep() != null, "current_step", bo.getCurrentStep());
lqw.eq(bo.getStatus() != null, "status", bo.getStatus());
lqw.eq(bo.getSteward() != null, "steward", bo.getSteward());
// 使用 startTime / endTime 进行范围筛选
lqw.between(bo.getStartTime() != null && bo.getEndTime() != null, "start_time", bo.getStartTime(), bo.getEndTime());
lqw.ge(bo.getStartTime() != null && bo.getEndTime() == null, "start_time", bo.getStartTime());
lqw.le(bo.getStartTime() == null && bo.getEndTime() != null, "end_time", bo.getEndTime());
return lqw;
}
/**
* 新增项目进度
*/

View File

@@ -95,13 +95,13 @@ public class OaProjectScheduleStepServiceImpl implements IOaProjectScheduleStepS
*/
@Override
public TableDataInfo<OaProjectScheduleStepVo> queryPageList(OaProjectScheduleStepBo bo, PageQuery pageQuery) {
QueryWrapper<OaProjectScheduleStep> lqw = buildQueryWrapper(bo);
QueryWrapper<OaProjectScheduleStep> lqw = buildQueryWrapper(bo, true);
Page<OaProjectScheduleStepVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw,LoginHelper.getUserId());
return TableDataInfo.build(result);
}
@Override
public TableDataInfo<OaProjectScheduleStepVo> queryPageListPage(OaProjectScheduleStepBo bo, PageQuery pageQuery) {
QueryWrapper<OaProjectScheduleStep> lqw = buildQueryWrapper(bo);
QueryWrapper<OaProjectScheduleStep> lqw = buildQueryWrapper(bo, true);
Page<OaProjectScheduleStepVo> result = baseMapper.selectVoPageNew(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@@ -113,22 +113,13 @@ public class OaProjectScheduleStepServiceImpl implements IOaProjectScheduleStepS
return TableDataInfo.build(result);
}
private QueryWrapper<OaProjectScheduleStep> buildQueryMyWrapper(OaProjectScheduleStepBo bo) {
Map<String, Object> params = bo.getParams();
QueryWrapper<OaProjectScheduleStep> lqw = Wrappers.query();
lqw.eq(bo.getScheduleId() != null, "opss.schedule_id", bo.getScheduleId());
lqw.eq("opss.del_flag", 0);
lqw.eq(bo.getStepOrder() != null, "opss.step_order", bo.getStepOrder());
lqw.like(StringUtils.isNotBlank(bo.getStepName()), "opss.step_name", bo.getStepName());
lqw.eq(bo.getStatus() != null, "opss.status", bo.getStatus());
appendCommonStepFilters(lqw, bo, "opss");
// 默认将负责人设置为当前用户
String currentUser = LoginHelper.getNickName();
lqw.eq(StringUtils.isNotBlank(currentUser), "opss.node_header", currentUser);
lqw.eq(bo.getSupplierId() != null, "opss.supplier_id", bo.getSupplierId());
//根据开始时间和结束时间作为范围判断planEnd
lqw.ge(bo.getStartTime() != null, "opss.plan_end", bo.getStartTime());
lqw.le(bo.getEndTime() != null, "opss.plan_end", bo.getEndTime());
lqw.eq(StringUtils.isNotBlank(currentUser), stepCol("opss", "node_header"), currentUser);
// 按时间倒序排列,已完成的排在最后
lqw.orderByDesc("opss.plan_end");
lqw.orderByDesc(stepCol("opss", "plan_end"));
lqw.orderByAsc("opss.status = 2"); // 状态为2表示已完成将其排在最后
return lqw;
}
@@ -137,26 +128,42 @@ public class OaProjectScheduleStepServiceImpl implements IOaProjectScheduleStepS
*/
@Override
public List<OaProjectScheduleStepVo> queryList(OaProjectScheduleStepBo bo) {
QueryWrapper<OaProjectScheduleStep> lqw = buildQueryWrapper(bo);
QueryWrapper<OaProjectScheduleStep> lqw = buildQueryWrapper(bo, false);
return baseMapper.selectVoList(lqw);
}
private QueryWrapper<OaProjectScheduleStep> buildQueryWrapper(OaProjectScheduleStepBo bo) {
Map<String, Object> params = bo.getParams();
@Override
public List<OaProjectScheduleStepVo> selectProjectScheduleStepList(Long scheduleId) {
return baseMapper.selectProjectScheduleStepList(scheduleId);
}
/**
* @param forJoinSql trueXML 中带 opss/schedule 等多表别名,条件须加 opss. 前缀,避免 schedule_id 等列歧义
*/
private QueryWrapper<OaProjectScheduleStep> buildQueryWrapper(OaProjectScheduleStepBo bo, boolean forJoinSql) {
QueryWrapper<OaProjectScheduleStep> lqw = Wrappers.query();
lqw.eq(bo.getScheduleId() != null, "opss.schedule_id", bo.getScheduleId());
lqw.eq("opss.del_flag", 0);
lqw.eq(bo.getStepOrder() != null, "opss.step_order", bo.getStepOrder());
lqw.like(StringUtils.isNotBlank(bo.getStepName()), "opss.step_name", bo.getStepName());
lqw.eq(bo.getStatus() != null, "opss.status", bo.getStatus());
lqw.eq(StringUtils.isNotBlank(bo.getNodeHeader()), "opss.node_header", bo.getNodeHeader());
lqw.eq(bo.getSupplierId() != null, "opss.supplier_id", bo.getSupplierId());
//根据开始时间和结束时间作为范围判断planEnd
lqw.ge(bo.getStartTime() != null, "opss.plan_end", bo.getStartTime());
lqw.le(bo.getEndTime() != null, "opss.plan_end", bo.getEndTime());
String alias = forJoinSql ? "opss" : null;
appendCommonStepFilters(lqw, bo, alias);
lqw.eq(StringUtils.isNotBlank(bo.getNodeHeader()), stepCol(alias, "node_header"), bo.getNodeHeader());
return lqw;
}
private static String stepCol (String tableAlias, String column) {
return StringUtils.isBlank(tableAlias) ? column : tableAlias + "." + column;
}
/** 步骤表公共筛选(与 oa_project_schedule 联表时须使用别名 opss */
private void appendCommonStepFilters (QueryWrapper<OaProjectScheduleStep> lqw, OaProjectScheduleStepBo bo, String alias) {
lqw.eq(stepCol(alias, "del_flag"), 0);
lqw.eq(bo.getScheduleId() != null, stepCol(alias, "schedule_id"), bo.getScheduleId());
lqw.eq(bo.getStepOrder() != null, stepCol(alias, "step_order"), bo.getStepOrder());
lqw.like(StringUtils.isNotBlank(bo.getStepName()), stepCol(alias, "step_name"), bo.getStepName());
lqw.eq(bo.getStatus() != null, stepCol(alias, "status"), bo.getStatus());
lqw.eq(bo.getSupplierId() != null, stepCol(alias, "supplier_id"), bo.getSupplierId());
lqw.ge(bo.getStartTime() != null, stepCol(alias, "plan_end"), bo.getStartTime());
lqw.le(bo.getEndTime() != null, stepCol(alias, "plan_end"), bo.getEndTime());
}
/**
* 新增项目进度步骤跟踪
*/

View File

@@ -12,23 +12,30 @@ import com.ruoyi.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.oa.domain.bo.OaProjectScheduleBo;
import com.ruoyi.oa.domain.bo.SysOaWarehouseDetailBo;
import com.ruoyi.oa.domain.dto.ProjectActivityDTO;
import com.ruoyi.oa.domain.dto.ProjectDataDTO;
import com.ruoyi.oa.domain.dto.ProjectScheduleStepStatsDto;
import com.ruoyi.oa.domain.vo.*;
import com.ruoyi.oa.service.CodeGeneratorService;
import com.ruoyi.oa.service.IExchangeRateService;
import com.ruoyi.oa.service.IOaProjectScheduleService;
import com.ruoyi.oa.service.IOaProjectScheduleStepService;
import com.ruoyi.oa.service.ISysOaTaskService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.oa.domain.bo.SysOaProjectBo;
import com.ruoyi.oa.domain.SysOaProject;
import com.ruoyi.oa.mapper.OaProjectScheduleStepMapper;
import com.ruoyi.oa.mapper.SysOaProjectMapper;
import com.ruoyi.oa.service.ISysOaProjectService;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -43,6 +50,14 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
private final SysOaProjectMapper baseMapper;
private final ISysOaTaskService sysOaTaskService;
private final IOaProjectScheduleService oaProjectScheduleService;
private final IOaProjectScheduleStepService oaProjectScheduleStepService;
private final OaProjectScheduleStepMapper oaProjectScheduleStepMapper;
@Autowired
private CodeGeneratorService codeGeneratorService;
@Autowired
@@ -181,15 +196,47 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
vo.setFundsRmb(vo.getFunds());
}
}
if (Boolean.TRUE.equals(bo.getScheduleStats()) && result.getRecords() != null && !result.getRecords().isEmpty()) {
List<Long> projectIds = result.getRecords().stream()
.map(SysOaProjectVo::getProjectId)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList());
if (!projectIds.isEmpty()) {
List<ProjectScheduleStepStatsDto> statRows = oaProjectScheduleStepMapper.selectStepStatsGroupByProjectId(projectIds);
Map<Long, ProjectScheduleStepStatsDto> statMap = statRows.stream()
.collect(Collectors.toMap(ProjectScheduleStepStatsDto::getProjectId, Function.identity(), (a, b) -> a));
for (SysOaProjectVo vo : result.getRecords()) {
ProjectScheduleStepStatsDto s = statMap.get(vo.getProjectId());
if (s != null) {
vo.setScheduleStepTotal(s.getTotalNodes());
vo.setScheduleStepCompleted(s.getCompletedNodes());
vo.setScheduleStepPendingAccept(s.getPendingAcceptNodes());
} else {
vo.setScheduleStepTotal(0L);
vo.setScheduleStepCompleted(0L);
vo.setScheduleStepPendingAccept(0L);
}
}
}
}
return TableDataInfo.build(result);
}
private QueryWrapper<SysOaProject> buildAliasPQueryWrapper(SysOaProjectBo bo) {
Map<String, Object> params = bo.getParams();
QueryWrapper<SysOaProject> qw = Wrappers.query();
qw.like(StringUtils.isNotBlank(bo.getProjectName()), "p.project_name", bo.getProjectName());
qw.like(StringUtils.isNotBlank(bo.getProjectNum()), "p.project_num", bo.getProjectNum());
qw.like(StringUtils.isNotBlank(bo.getProjectCode()), "p.project_code", bo.getProjectCode());
if (StringUtils.isNotBlank(bo.getKeyword())) {
String kw = bo.getKeyword().trim();
qw.and(w -> w.like("p.project_name", kw)
.or().like("p.project_num", kw)
.or().like("p.project_code", kw));
} else {
qw.like(StringUtils.isNotBlank(bo.getProjectName()), "p.project_name", bo.getProjectName());
qw.like(StringUtils.isNotBlank(bo.getProjectNum()), "p.project_num", bo.getProjectNum());
qw.like(StringUtils.isNotBlank(bo.getProjectCode()), "p.project_code", bo.getProjectCode());
}
qw.eq(bo.getProductStatus() != null, "p.product_status", bo.getProductStatus());
qw.eq(bo.getTradeType() != null, "p.trade_type", bo.getTradeType());
if (bo.getPrePay() != null && bo.getPrePay() > 0) {
@@ -204,6 +251,7 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
}
qw.eq(bo.getCustomerId() != null, "p.customer_id", bo.getCustomerId());
qw.orderByDesc("p.is_top").orderByDesc("p.create_time");
qw.groupBy("p.project_id");
return qw;
}
@@ -219,9 +267,16 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
private LambdaQueryWrapper<SysOaProject> buildQueryWrapper(SysOaProjectBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SysOaProject> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getProjectName()), SysOaProject::getProjectName, bo.getProjectName());
lqw.like(StringUtils.isNotBlank(bo.getProjectNum()), SysOaProject::getProjectNum, bo.getProjectNum());
lqw.like(StringUtils.isNotBlank(bo.getProjectCode()), SysOaProject::getProjectCode, bo.getProjectCode());
if (StringUtils.isNotBlank(bo.getKeyword())) {
String kw = bo.getKeyword().trim();
lqw.and(w -> w.like(SysOaProject::getProjectName, kw)
.or().like(SysOaProject::getProjectNum, kw)
.or().like(SysOaProject::getProjectCode, kw));
} else {
lqw.like(StringUtils.isNotBlank(bo.getProjectName()), SysOaProject::getProjectName, bo.getProjectName());
lqw.like(StringUtils.isNotBlank(bo.getProjectNum()), SysOaProject::getProjectNum, bo.getProjectNum());
lqw.like(StringUtils.isNotBlank(bo.getProjectCode()), SysOaProject::getProjectCode, bo.getProjectCode());
}
//新增生产结项状态筛选
lqw.eq(bo.getProductStatus() != null, SysOaProject::getProductStatus, bo.getProductStatus());
lqw.eq(bo.getTradeType() != null, SysOaProject::getTradeType, bo.getTradeType());
@@ -587,4 +642,37 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
return baseMapper.getMaxCodeProject(prefix);
}
@Override
public OaProjectDashboardVo getProjectDashboard(Long projectId) {
SysOaProjectVo project = queryById(projectId);
if (project == null) {
return null;
}
List<SysOaTaskVo> tasks = sysOaTaskService.listDashboardTasks(projectId);
OaProjectScheduleBo scheduleBo = new OaProjectScheduleBo();
scheduleBo.setProjectId(projectId);
List<OaProjectScheduleVo> schedules = oaProjectScheduleService.queryList(scheduleBo);
List<OaProjectScheduleStepVo> steps = new ArrayList<>();
for (OaProjectScheduleVo sch : schedules) {
List<OaProjectScheduleStepVo> part = oaProjectScheduleStepService.selectProjectScheduleStepList(sch.getScheduleId());
if (part == null) {
continue;
}
for (OaProjectScheduleStepVo st : part) {
st.setProjectId(projectId);
st.setProjectName(project.getProjectName());
}
steps.addAll(part);
}
OaProjectDashboardVo vo = new OaProjectDashboardVo();
vo.setProject(project);
vo.setTasks(tasks);
vo.setSchedules(schedules);
vo.setSteps(steps);
return vo;
}
}

View File

@@ -135,6 +135,11 @@ public class SysOaTaskServiceImpl implements ISysOaTaskService {
return baseMapper.listDocumentProject(projectId);
}
@Override
public List<SysOaTaskVo> listDashboardTasks(Long projectId) {
return baseMapper.selectDashboardTasksByProjectId(projectId);
}
/**
* 新增自定义查询任务列表Plus版
*/
@@ -149,6 +154,7 @@ public class SysOaTaskServiceImpl implements ISysOaTaskService {
QueryWrapper<SysOaTask> lqw = Wrappers.query();
lqw.eq("sot.del_flag", 0);
lqw.eq(bo.getProjectId()!=null, "sot.project_id", bo.getProjectId());
lqw.eq(bo.getTaskId()!=null, "sot.task_id", bo.getTaskId());
lqw.eq(bo.getCreateUserId()!=null, "sot.create_user_id", bo.getCreateUserId());
lqw.eq(bo.getWorkerId()!=null, "sot.worker_id", bo.getWorkerId());
lqw.eq(bo.getProjectId()!=null, "sot.project_id", bo.getProjectId());

View File

@@ -195,11 +195,54 @@
left join sys_user su on su.user_id = opr.user_id
left join sys_dept sd on su.dept_id = sd.dept_id
WHERE opr.del_flag = 0
AND DATE(opr.create_time)
BETWEEN DATE_FORMAT(#{start}, '%Y-%m-%d')
AND DATE_FORMAT(#{end}, '%Y-%m-%d')
<if test="start != null">
AND DATE(opr.create_time) &gt;= DATE_FORMAT(#{start}, '%Y-%m-%d')
</if>
<if test="end != null">
AND DATE(opr.create_time) &lt;= DATE_FORMAT(#{end}, '%Y-%m-%d')
</if>
ORDER BY opr.create_time DESC
</select>
<select id="selectTravelCompareReportPage" resultType="com.ruoyi.oa.domain.vo.OaProjectReportVo">
select opr.report_id,
opr.user_id,
opr.is_trip,
opr.work_place,
opr.project_id,
opr.content,
opr.create_time,
opr.create_by,
opr.update_time,
opr.update_by,
opr.del_flag,
opr.remark,
op.project_name,
op.project_num,
op.project_code,
su.nick_name,
opr.work_type,
sd.dept_name
from oa_project_report opr
left join sys_oa_project op on opr.project_id = op.project_id
left join sys_user su on su.user_id = opr.user_id
left join sys_dept sd on su.dept_id = sd.dept_id
<where>
opr.del_flag = 0
<if test="start != null">
AND DATE(opr.create_time) &gt;= DATE_FORMAT(#{start}, '%Y-%m-%d')
</if>
<if test="end != null">
AND DATE(opr.create_time) &lt;= DATE_FORMAT(#{end}, '%Y-%m-%d')
</if>
<if test="nickName != null and nickName != ''">
AND su.nick_name LIKE CONCAT('%', #{nickName}, '%')
</if>
<if test="workPlace != null and workPlace != ''">
AND opr.work_place LIKE CONCAT('%', #{workPlace}, '%')
</if>
</where>
ORDER BY opr.create_time DESC
LIMIT 20
</select>
<select id="getSummaryData" resultType="com.ruoyi.oa.domain.vo.OaProjectReportVo">

View File

@@ -204,8 +204,8 @@
status,
header
from oa_project_schedule_step opss
WHERE schedule_id = #{scheduleId}
AND step_order = #{currentStep}
WHERE opss.schedule_id = #{scheduleId}
AND opss.step_order = #{currentStep}
and use_flag = '1'
AND del_flag = '0'
</select>
@@ -258,5 +258,46 @@
${ew.customSqlSegment}
</select>
<!--
综合看板:按 schedule_id 查询步骤列表
要求:
- 删除 del_flag表无该字段
- 不使用 opss.* 前缀(不定义别名)
- 仅保留 WHERE schedule_id = #{scheduleId}
-->
<select id="selectProjectScheduleStepList"
parameterType="com.ruoyi.oa.domain.OaProjectScheduleStep"
resultMap="OaProjectScheduleStepResult">
SELECT
track_id, accessory, schedule_id, step_order, step_name,
plan_start, plan_end, actual_start, actual_end, status,
header, use_flag, batch_id, tab_node,
first_level_node, second_level_node,
start_time, original_end_time, end_time,
node_header, related_docs, related_images,
specification, sort_num, supplier_id,
requirement_file, other,
create_by, create_time, update_by, update_time
FROM oa_project_schedule_step
WHERE schedule_id = #{scheduleId}
</select>
<select id="selectStepStatsGroupByProjectId"
resultType="com.ruoyi.oa.domain.dto.ProjectScheduleStepStatsDto">
SELECT
sch.project_id AS projectId,
COUNT(step.track_id) AS totalNodes,
IFNULL(SUM(CASE WHEN step.status = 2 THEN 1 ELSE 0 END), 0) AS completedNodes,
IFNULL(SUM(CASE WHEN step.status = 1 THEN 1 ELSE 0 END), 0) AS pendingAcceptNodes
FROM oa_project_schedule sch
INNER JOIN oa_project_schedule_step step ON step.schedule_id = sch.schedule_id
WHERE sch.del_flag = '0'
AND step.del_flag = '0'
AND sch.project_id IN
<foreach collection="projectIds" item="pid" open="(" separator="," close=")">
#{pid}
</foreach>
GROUP BY sch.project_id
</select>
</mapper>

View File

@@ -310,9 +310,15 @@
TIMESTAMPDIFF(DAY, NOW(), p.postpone_time) AS remainTime,
p.customer_id AS customerId,
c.name AS customerName,
p.is_top AS isTop
p.is_top AS isTop,
COUNT(sot.task_id) AS taskTotalCount ,
SUM(CASE WHEN sot.status = 1 THEN 1 ELSE 0 END) AS taskFinishCount,
COUNT(ops.schedule_id) AS scheduleTotalCount,
SUM(CASE WHEN ops.status = 2 THEN 1 ELSE 0 END) AS scheduleFinishCount
FROM sys_oa_project p
LEFT JOIN oa_customer c ON p.customer_id = c.customer_id
left join sys_oa_task sot on sot.project_id = p.project_id and sot.del_flag = 0
left join oa_project_schedule ops on ops.project_id = p.project_id and ops.del_flag = 0
${ew.getCustomSqlSegment}
</select>

View File

@@ -474,6 +474,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<!-- 综合看板LEFT JOIN 进度步骤 del_flag=0、use_flag=1与步骤表一致即可展示不再依赖进度主表 project 联表) -->
<select id="selectDashboardTasksByProjectId" resultType="com.ruoyi.oa.domain.vo.SysOaTaskVo">
SELECT
sot.task_id AS taskId,
sot.project_id AS projectId,
sop.project_code AS projectCode,
sot.task_title AS taskTitle,
sot.task_type AS taskType,
sot.task_grade AS taskGrade,
su1.nick_name AS createUserNickName,
su2.nick_name AS workerNickName,
sot.state AS state,
sot.finish_time AS finishTime,
sot.track_id AS trackId,
opss.tab_node AS tabNode,
opss.first_level_node AS firstLevelNode,
opss.second_level_node AS secondLevelNode,
opss.step_name AS scheduleStepName,
opss.status AS scheduleStatus,
opss.plan_start AS schedulePlanStart,
opss.plan_end AS schedulePlanEnd,
opss.header AS scheduleHeader
FROM sys_oa_task sot
LEFT JOIN sys_user su1 ON su1.user_id = sot.create_user_id
LEFT JOIN sys_user su2 ON su2.user_id = sot.worker_id
LEFT JOIN sys_oa_project sop ON sop.project_id = sot.project_id
LEFT JOIN oa_project_schedule_step opss
ON opss.track_id = sot.track_id
AND opss.del_flag = '0'
AND opss.use_flag = 1
WHERE sot.project_id = #{projectId}
AND sot.del_flag = '0'
ORDER BY sot.create_time DESC
</select>
<select id="queryListPlus" parameterType="com.ruoyi.oa.domain.bo.SysOaTaskBo" resultType="com.ruoyi.oa.domain.vo.SysOaTaskVo">
SELECT
task_id AS taskId,

View File

@@ -5,7 +5,7 @@ VUE_APP_TITLE = 福安德综合办公系统
ENV = 'development'
# 若依管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'
VUE_APP_BASE_API = '/dev-api'
# VUE_APP_BASE_API = 'http://110.41.139.73:8080'
# 应用访问路径 例如使用前缀 /admin/

View File

@@ -37,6 +37,7 @@
"url": "https://gitee.com/KonBAI-Q/ruoyi-flowable-plus.git"
},
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"@babel/parser": "7.7.4",
"@handsontable/vue": "^15.3.0",
"@jiaminghi/data-view": "^2.10.0",

View File

@@ -10,6 +10,7 @@
<title>
<%= webpackConfig.name %>
</title>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<style>
html,
@@ -18,7 +19,7 @@
height: 100%;
margin: 0px;
padding: 0px;
}
.chromeframe {
margin: 0.2em 0;
@@ -216,4 +217,4 @@
</div>
</body>
</html>
</html>

View File

@@ -16,7 +16,13 @@ export function readCc(ccId) {
method: 'post'
})
}
// 标记抄送为未读
export function unreadCc(ccId) {
return request({
url: `/hrm/flow/cc/${ccId}/unread`,
method: 'post'
})
}
// 手动抄送
export function addCc(data) {
return request({

View File

@@ -254,9 +254,4 @@ export function listAssignTask (instId) {
url: `/hrm/flow/instance/tasks/${instId}`,
method: 'get'
})
/**
* 查询当前用户的审批历史
*/
}

View File

@@ -0,0 +1,9 @@
import request from '@/utils/request'
export function listMyApply(query) {
return request({
url: '/hrm/my-apply/list',
method: 'get',
params: query
})
}

View File

@@ -46,3 +46,22 @@ export function allTravelReq(query) {
params: query
})
}
export function earlyEndTravel(bizId) {
return request({
url: `/hrm/travel/earlyEnd/${bizId}`,
method: 'put'
})
}
export function getAmapKey() {
return request({
url: '/hrm/travel/amapKey',
method: 'get'
})
}
export function getAmapSecurityKey() {
return request({
url: '/hrm/travel/amapSecurityKey',
method: 'get'
})
}

View File

@@ -0,0 +1,15 @@
import request from '@/utils/request'
/**
* 根据经纬度逆地理编码获取城市等信息(后端转发高德)
* @param {number} longitude 经度
* @param {number} latitude 纬度
*/
export function getCityByLocation (longitude, latitude) {
return request({
url: '/oa/amap/city',
method: 'get',
params: { longitude, latitude },
timeout: 15000
})
}

View File

@@ -36,6 +36,14 @@ export function getProject (projectId) {
method: 'get'
})
}
/** 综合看板聚合数据:项目 + 任务 + 进度主表 + 步骤 */
export function getProjectDashboard (projectId) {
return request({
url: '/oa/project/dashboard/' + projectId,
method: 'get'
})
}
// 查询项目管理详细
export function projectData (date) {
return request({

View File

@@ -0,0 +1,18 @@
import request from '@/utils/request'
export function listTravelCompare (start, end, nickName, workPlace, pageNum, pageSize) {
return request({
url: '/oa/projectReport/travel-compare',
method: 'get',
params: {
...(start ? { start } : {}),
...(end ? { end } : {}),
...(nickName ? { nickName } : {}),
...(workPlace ? { workPlace } : {}),
pageNum,
pageSize,
orderByColumn: 'compareDate',
isAsc: 'desc'
}
})
}

View File

@@ -0,0 +1,12 @@
import request from '@/utils/request'
// 查询进度主表 + 子表(项目综合看板使用)
// 接口:/oa/schedule/list GET 入参projectId
export function listSchedule (query) {
return request({
url: '/oa/schedule/list',
method: 'get',
params: query
})
}

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询城市列表
export function listCity(query) {
return request({
url: '/oa/city/list',
method: 'get',
params: query
})
}
// 查询城市详细
export function getCity(cityId) {
return request({
url: `/oa/city/${cityId}`,
method: 'get'
})
}
// 新增城市
export function addCity(data) {
return request({
url: '/oa/city',
method: 'post',
data: data
})
}
// 修改城市
export function updateCity(data) {
return request({
url: '/oa/city',
method: 'put',
data: data
})
}
// 删除城市
export function delCity(cityIds) {
return request({
url: `/oa/city/${cityIds}`,
method: 'delete'
})
}

View File

@@ -0,0 +1,371 @@
<template>
<div class="amap-city-select">
<el-input
v-model="cityName"
:placeholder="placeholder"
@focus="openMapDialog"
clearable
readonly
>
<i slot="prefix" class="el-icon-location" style="color: #409eff"></i>
</el-input>
<el-dialog
title="选择出差城市 / 地点"
:visible.sync="dialogVisible"
width="900px"
:append-to-body="true"
@opened="onDialogOpened"
>
<div class="map-selector">
<div class="city-sidebar">
<div class="search-box">
<el-input
v-model="searchKeyword"
placeholder="输入城市或具体地点搜索"
size="small"
prefix-icon="el-icon-search"
@keyup.enter.native="searchLocation"
clearable
@clear="searchKeyword = ''"
>
<el-button slot="append" @click="searchLocation">搜索</el-button>
</el-input>
</div>
<!-- 热门城市模块 -->
<div class="hot-cities" v-if="!searchKeyword || searchResults.length === 0">
<div class="section-title">热门城市</div>
<div class="city-list">
<span
v-for="city in hotCities"
:key="city"
class="city-item"
@click="selectHotCity(city)"
>
{{ city }}
</span>
</div>
</div>
<!-- 搜索结果模块 -->
<div class="search-results" v-if="searchResults.length > 0">
<div class="section-title">搜索结果</div>
<div class="result-list">
<div
v-for="(result, index) in searchResults"
:key="index"
class="result-item"
@click="selectLocation(result)"
>
<i class="el-icon-location-outline"></i>
<div class="result-info">
<div class="poi-name">{{ result.name }}</div>
<div class="poi-address">{{ result.address }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="map-container">
<div id="amapContainer" class="amap-wrapper"></div>
<div class="map-tip">
<i class="el-icon-info"></i> 点击地图上的位置或搜索地点自动识别归属城市
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<div class="selected-info" v-if="selectedCity">
识别城市<span class="selected-city">{{ selectedCity }}</span>
<span v-if="selectedPoi" style="margin-left: 10px; color: #909399; font-size: 12px;">
( {{ selectedPoi }} )
</span>
</div>
<div v-else></div>
<div>
<el-button @click="closeDialog">取消</el-button>
<el-button type="primary" @click="confirmCity" :disabled="!selectedCity">确定</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import AMapLoader from '@amap/amap-jsapi-loader'
import { getAmapKey, getAmapSecurityKey } from '@/api/hrm/travel'
export default {
name: 'AmapCitySelect',
props: {
value: { type: String, default: '' },
placeholder: { type: String, default: '请选择出差地点' }
},
data() {
return {
cityName: '',
dialogVisible: false,
searchKeyword: '',
searchResults: [],
selectedCity: '', // 最终表单需要的城市名
selectedPoi: '', // 具体的地点名(仅用于展示)
map: null,
geocoder: null,
placeSearch: null, // 新增地点搜索对象
marker: null,
AMap: null,
hotCities: [
'北京市', '上海市', '广州市', '深圳市',
'杭州市', '南京市', '成都市', '武汉市',
'重庆市', '天津市', '苏州市', '西安市'
]
}
},
watch: {
value: {
immediate: true,
handler(val) { this.cityName = val || '' }
}
},
methods: {
async onDialogOpened() {
const AMap = await this.loadAMap()
if (!AMap) return
this.$nextTick(() => {
this.initMap()
})
},
async loadAMap() {
if (this.AMap && window._AMapSecurityConfig) return this.AMap
try {
const [keyRes, securityRes] = await Promise.all([getAmapKey(), getAmapSecurityKey()])
const amapkey = keyRes.data || keyRes.msg
const securityKey = securityRes.data || securityRes.msg
if (!amapkey) throw new Error('未获取到高德地图 Key')
window._AMapSecurityConfig = { securityJsCode: securityKey }
this.AMap = await AMapLoader.load({
key: amapkey,
version: '2.0',
// 加入 PlaceSearch 插件
plugins: ['AMap.Geocoder', 'AMap.PlaceSearch']
})
return this.AMap
} catch (error) {
console.error('地图加载失败:', error)
this.$message.error('地图加载失败,请重试')
return null
}
},
initMap() {
const container = document.getElementById('amapContainer')
if (!container) {
setTimeout(() => this.initMap(), 100)
return
}
if (this.map) {
this.map.destroy()
this.map = null
}
this.map = new this.AMap.Map('amapContainer', {
zoom: 12,
center: [116.397428, 39.90923], // 默认北京
resizeEnable: true
})
this.geocoder = new this.AMap.Geocoder()
// 初始化地点搜索插件
this.placeSearch = new this.AMap.PlaceSearch({
pageSize: 15, // 单页显示结果条数
pageIndex: 1, // 页码
autoFitView: false // 禁用自动调整视图,我们自己控制
})
// 监听地图点击
this.map.on('click', (e) => {
const lng = e.lnglat.getLng()
const lat = e.lnglat.getLat()
this.selectedPoi = '地图选点'
this.getCityByLngLat(lng, lat, true)
})
},
// 通过经纬度逆解析城市
getCityByLngLat(lng, lat, setCenter = false) {
this.geocoder.getAddress([lng, lat], (status, result) => {
if (status === 'complete' && result.regeocode) {
const addrComp = result.regeocode.addressComponent
let city = addrComp.city
// 直辖市的 city 可能是空的,取 province
if (!city || city === '[]' || city.length === 0) {
city = addrComp.province
}
this.selectedCity = city
this.addMarker(lng, lat)
if(setCenter) {
this.map.setCenter([lng, lat])
}
}
})
},
// 在地图上打点
addMarker(lng, lat) {
if (this.marker) {
this.marker.setMap(null)
}
this.marker = new this.AMap.Marker({
position: [lng, lat],
map: this.map,
animation: 'AMAP_ANIMATION_DROP' // 加上掉落动画
})
},
openMapDialog() {
this.dialogVisible = true
this.selectedCity = this.value || ''
this.selectedPoi = ''
this.searchKeyword = ''
this.searchResults = []
},
// 搜索地点核心方法
async searchLocation() {
if (!this.searchKeyword.trim()) {
this.searchResults = []
return
}
await this.loadAMap()
// 使用 PlaceSearch 搜索具体地点
this.placeSearch.search(this.searchKeyword, (status, result) => {
if (status === 'complete' && result.info === 'OK') {
// 提取返回的 POI 列表
const pois = result.poiList.pois
this.searchResults = pois.map(poi => ({
id: poi.id,
name: poi.name,
address: poi.address && typeof poi.address === 'string' ? poi.address : poi.adname,
location: poi.location, // 包含 lng/lat 的对象
city: poi.cityname || poi.pname // 城市名
}))
} else {
this.searchResults = []
this.$message.info('未找到相关地点,请尝试更换关键词')
}
})
},
// 选中左侧搜索结果列表的具体地点
selectLocation(poi) {
if (!poi.location) {
this.$message.warning('该地点缺少坐标信息')
return
}
const lng = poi.location.lng
const lat = poi.location.lat
// 设置地图中心点并放大(层级15看街道)
this.map.setZoomAndCenter(15, [lng, lat])
this.addMarker(lng, lat)
// 更新选择数据
this.selectedCity = poi.city
this.selectedPoi = poi.name
this.$message.success(`已定位到:${poi.name}`)
},
// 选中热门城市
async selectHotCity(city) {
await this.loadAMap()
this.selectedCity = city
this.selectedPoi = city
// 获取城市中心点坐标
this.geocoder.getLocation(city, (status, result) => {
if (status === 'complete' && result.geocodes.length) {
const loc = result.geocodes[0].location
this.map.setZoomAndCenter(11, [loc.lng, loc.lat])
this.addMarker(loc.lng, loc.lat)
}
})
},
confirmCity() {
if (this.selectedCity) {
this.cityName = this.selectedCity
// 组件 v-model 抛出城市名
this.$emit('input', this.selectedCity)
// 如果你需要具体的地点名,可以额外抛出一个事件
this.$emit('poi-change', { city: this.selectedCity, poi: this.selectedPoi })
this.closeDialog()
}
},
closeDialog() {
this.dialogVisible = false
}
}
}
</script>
<style lang="scss" scoped>
.amap-city-select { width: 100%; }
.map-selector { display: flex; gap: 20px; min-height: 450px;
.city-sidebar { width: 300px; flex-shrink: 0; display: flex; flex-direction: column;
.search-box { margin-bottom: 16px; }
.section-title { font-size: 14px; font-weight: bold; color: #303133; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #ebeef5; }
.hot-cities .city-list { display: flex; flex-wrap: wrap; gap: 10px;
.city-item { padding: 6px 14px; background: #f4f4f5; color: #606266; border-radius: 4px; font-size: 13px; cursor: pointer; transition: all 0.2s;
&:hover { background: #409eff; color: white; }
}
}
/* 搜索结果列表样式升级 */
.search-results {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.result-list {
flex: 1; overflow-y: auto; padding-right: 5px;
/* 自定义滚动条 */
&::-webkit-scrollbar { width: 4px; }
&::-webkit-scrollbar-thumb { background: #dcdfe6; border-radius: 4px; }
.result-item {
padding: 12px 10px; cursor: pointer; display: flex; align-items: flex-start; gap: 10px; border-bottom: 1px solid #ebeef5; transition: background 0.2s;
&:hover { background: #f0f7ff; }
i { color: #409eff; margin-top: 3px; font-size: 16px; }
.result-info {
flex: 1; overflow: hidden;
.poi-name { font-size: 14px; color: #303133; font-weight: 500; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poi-address { font-size: 12px; color: #909399; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
}
}
}
.map-container { flex: 1; display: flex; flex-direction: column;
.amap-wrapper { flex: 1; width: 100%; border: 1px solid #dcdfe6; border-radius: 6px; overflow: hidden; }
.map-tip { margin-top: 10px; font-size: 12px; color: #909399; text-align: center; i { margin-right: 4px; color: #e6a23c; } }
}
}
.dialog-footer { display: flex; justify-content: space-between; align-items: center;
.selected-info { font-size: 14px; color: #606266; .selected-city { color: #409eff; font-weight: bold; font-size: 15px; } }
}
</style>

View File

@@ -182,6 +182,7 @@ export const constantRoutes = [
];
export const dynamicRoutes = [
{
path: "/system/user-auth",
component: Layout,
@@ -314,6 +315,7 @@ export const dynamicRoutes = [
},
],
},
];
let routerPush = Router.prototype.push;

View File

@@ -8,6 +8,7 @@ import permission from './modules/permission'
import settings from './modules/settings'
import tagsView from './modules/tagsView'
import user from './modules/user'
import oaProjectDashboard2 from './modules/oaProjectDashboard2'
Vue.use(Vuex)
@@ -19,7 +20,8 @@ const store = new Vuex.Store({
tagsView,
permission,
settings,
meta
meta,
oaProjectDashboard2
},
getters
})

View File

@@ -0,0 +1,122 @@
import { listProject, getProjectDashboard } from '@/api/oa/project'
function sleep (ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
async function retry (fn, times, delayMs) {
let lastErr
for (let i = 0; i < times; i++) {
try {
return await fn()
} catch (e) {
lastErr = e
if (i < times - 1) {
await sleep(delayMs)
}
}
}
throw lastErr
}
const state = {
currentProjectId: '',
projectQuery: {
pageNum: 1,
pageSize: 15,
keyword: ''
},
projectList: [],
projectTotal: 0,
projectDetail: null,
taskList: [],
scheduleList: [],
stepList: [],
taskQuery: {
pageNum: 1,
pageSize: 10,
projectCode: '',
taskKeyword: ''
},
loading: false
}
const mutations = {
SET_LOADING (state, val) {
state.loading = !!val
},
SET_CURRENT_PROJECT (state, projectId) {
state.currentProjectId = projectId || ''
},
SET_PROJECT_QUERY (state, payload) {
state.projectQuery = { ...state.projectQuery, ...(payload || {}) }
},
SET_PROJECT_LIST (state, payload) {
state.projectList = payload.rows || []
state.projectTotal = payload.total || 0
},
SET_DASHBOARD (state, payload) {
const p = payload || {}
state.projectDetail = p.project || null
state.taskList = p.tasks || []
state.scheduleList = p.schedules || []
state.stepList = p.steps || []
},
CLEAR_RIGHT (state) {
state.projectDetail = null
state.taskList = []
state.scheduleList = []
state.stepList = []
},
SET_TASK_QUERY (state, payload) {
state.taskQuery = { ...state.taskQuery, ...(payload || {}) }
}
}
const actions = {
async fetchProjectList ({ commit, state }, payload) {
const merged = { ...state.projectQuery, ...(payload || {}) }
const query = {
pageNum: merged.pageNum,
pageSize: merged.pageSize,
keyword: (merged.keyword != null ? String(merged.keyword) : '').trim(),
scheduleStats: true
}
commit('SET_PROJECT_QUERY', query)
commit('SET_LOADING', true)
try {
const res = await retry(() => listProject(query), 2, 600)
commit('SET_PROJECT_LIST', { rows: res.rows || [], total: res.total || 0 })
return res
} finally {
commit('SET_LOADING', false)
}
},
async selectProject ({ commit }, projectId) {
commit('SET_CURRENT_PROJECT', projectId)
if (!projectId) {
commit('CLEAR_RIGHT')
return
}
const res = await retry(() => getProjectDashboard(projectId), 2, 600)
const data = res.data || {}
commit('SET_DASHBOARD', data)
return res
}
}
export default {
namespaced: true,
state,
mutations,
actions
}

View File

@@ -33,30 +33,6 @@ const permission = {
return new Promise(resolve => {
getRouters().then(res => {
const oaMenu = res.data.find(item => item.path === '/oa' || (item.meta && item.meta.title === '办公中心'));
if (oaMenu) {
if (!oaMenu.children) oaMenu.children = [];
const hasHistory = oaMenu.children.some(child => child.path === 'flowHistory');
if (!hasHistory) {
oaMenu.children.push({
name: 'HrmFlowHistory',
path: 'flowHistory',
hidden: false,
component: 'hrm/flow/taskHistory',
meta: {
title: '审批历史',
icon: 'date-range',
noCache: false
}
});
}
}
// ================= 新增拦截代码:将页面注入到办公中心结束 =================
const sdata = JSON.parse(JSON.stringify(res.data))
@@ -155,4 +131,4 @@ export const loadView = (view) => {
}
}
export default permission
export default permission

View File

@@ -0,0 +1,98 @@
import { getCityByLocation } from '@/api/oa/amap'
const GEO_OPTIONS = {
enableHighAccuracy: false,
timeout: 20000,
maximumAge: 120000
}
export const EMPTY_GEOCODE = 'EMPTY_GEOCODE'
/**
* 将 AmapCityNameVo 格式化为展示用工作地点字符串
*/
export function formatWorkPlaceFromAmap (vo) {
if (!vo) {
return ''
}
const province = (vo.province || '').trim()
const cityName = (vo.cityName || '').trim()
const district = (vo.district || '').trim()
const parts = []
if (province) {
parts.push(province)
}
if (cityName && cityName !== province) {
parts.push(cityName)
}
if (district) {
parts.push(district)
}
const joined = parts.join(' ').trim()
return joined || cityName || province || ''
}
function getCurrentPositionAsync () {
return new Promise((resolve, reject) => {
if (typeof navigator === 'undefined' || !navigator.geolocation) {
reject(new Error('BROWSER_UNSUPPORTED'))
return
}
navigator.geolocation.getCurrentPosition(
position => resolve(position),
err => reject(err),
GEO_OPTIONS
)
})
}
/**
* 浏览器定位 + 后端逆地理 → 工作地点字符串
* @returns {Promise<string>}
*/
export async function resolveWorkPlaceFromBrowser () {
const position = await getCurrentPositionAsync()
const { longitude, latitude } = position.coords
const res = await getCityByLocation(longitude, latitude)
const vo = res && res.data
const text = formatWorkPlaceFromAmap(vo)
if (!text) {
const err = new Error(EMPTY_GEOCODE)
console.warn('[workPlace] 逆地理结果为空', { longitude, latitude, vo })
throw err
}
return text
}
/**
* 将定位/逆地理错误转换为用户可读文案
*/
export function geolocationUserMessage (err) {
if (!err) {
return '获取工作地点失败'
}
if (err.message === 'BROWSER_UNSUPPORTED') {
return '当前浏览器不支持定位,请更换浏览器或使用 HTTPS 访问后重试'
}
if (err.message === EMPTY_GEOCODE) {
return '无法根据当前位置解析城市请稍后重试若持续失败请联系管理员检查高德地图配置fad.amap.key'
}
const code = err.code
if (code === 1) {
return '您已拒绝定位权限,请在浏览器设置中允许本站点定位后点击「重新获取定位」'
}
if (code === 2) {
return '暂时无法获取位置信息,请到信号较好处点击「重新获取定位」重试'
}
if (code === 3) {
return '定位请求超时,请检查网络后点击「重新获取定位」重试'
}
const msg = err.message || ''
if (msg.includes('timeout') || msg.includes('超时')) {
return '接口请求超时,请稍后点击「重新获取定位」重试'
}
if (msg.includes('Network Error') || msg.includes('网络')) {
return '网络异常,请检查连接后点击「重新获取定位」重试'
}
return '获取工作地点失败,请点击「重新获取定位」重试'
}

View File

@@ -0,0 +1,139 @@
import store from '@/store'
function isHttpUrl (path) {
return path && /^(https?:|mailto:|tel:)/.test(path)
}
function joinPaths (parentPath, segment) {
if (segment == null || segment === '') {
return parentPath || '/'
}
if (isHttpUrl(segment)) {
return segment
}
if (segment.startsWith('/')) {
return segment.replace(/\/+/g, '/')
}
const base = (parentPath || '').replace(/\/+$/, '')
const rel = segment.replace(/^\//, '')
if (!base) {
return '/' + rel
}
return (base + '/' + rel).replace(/\/+/g, '/')
}
/**
* 遍历侧边栏路由树,得到所有带 meta.title 的叶子及其完整 path与菜单渲染路径一致
*/
export function flattenSidebarLeaves (routes, parentPath = '') {
const out = []
if (!routes || !routes.length) {
return out
}
for (const r of routes) {
if (!r || r.hidden) {
continue
}
const current = joinPaths(parentPath, r.path)
if (r.children && r.children.length > 0) {
out.push(...flattenSidebarLeaves(r.children, current))
} else if (r.meta && r.meta.title) {
out.push({ fullPath: current, title: r.meta.title, name: r.name })
}
}
return out
}
/**
* 按菜单名称(与 sys_menu.menu_name 一致)查找已注册的前端 path
*/
export function findMenuFullPathByTitles (titles) {
const set = new Set((titles || []).filter(Boolean))
if (!set.size) {
return null
}
const routes = store.getters.sidebarRouters || []
const leaves = flattenSidebarLeaves(routes)
const hit = leaves.find((l) => set.has(l.title))
return hit ? hit.fullPath : null
}
/**
* 将当前路由最后一级替换为另一段,用于「综合看板」与「任务」「进度」在同一父菜单下的场景
*/
export function siblingPathReplaceLast (currentPath, newLastSegment) {
if (!currentPath || !newLastSegment) {
return null
}
const normalized = String(currentPath).replace(/\/+$/, '')
const idx = normalized.lastIndexOf('/')
if (idx < 0) {
return '/' + newLastSegment
}
return `${normalized.slice(0, idx)}/${newLastSegment}`.replace(/\/+/g, '/')
}
/**
* 在候选 path 中选第一个 resolve 后不是 404 页的地址
*/
export function pickExistingRoutePath (router, candidates) {
for (const p of candidates) {
if (!p) {
continue
}
try {
const { route } = router.resolve({ path: p })
if (!route || !route.matched || route.matched.length === 0) {
continue
}
if (route.path === '/404' || (route.fullPath && route.fullPath.includes('/404'))) {
continue
}
return p
} catch (e) {
continue
}
}
return null
}
function findLeafPathMatchingPath (predicate) {
const routes = store.getters.sidebarRouters || []
const leaves = flattenSidebarLeaves(routes)
const hit = leaves.find((l) => predicate(l.fullPath))
return hit ? hit.fullPath : null
}
/**
* 解析「我的任务」对应前端 path勿硬编码父级目录避免项目中心与项目管理 path 不一致导致 404
*/
export function resolveOaTaskCenterPath (vm) {
const fromMenuTitle = findMenuFullPathByTitles(['我的任务', '任务管理'])
const fromPathEndsTask = findLeafPathMatchingPath((p) => /\/task(\/|$)/i.test(p))
const sib = siblingPathReplaceLast(vm.$route.path, 'task')
const candidates = [fromMenuTitle, fromPathEndsTask, sib, '/project/task'].filter(Boolean)
return pickExistingRoutePath(vm.$router, candidates) || candidates[candidates.length - 1]
}
const PACE_MENU_TITLES = [
'项目进度',
'进度管理',
'进度跟踪',
'绑定进度',
'进度中心'
]
/**
* 解析进度中心pace 列表+抽屉)页面前端 path
*/
export function resolveOaPaceCenterPath (vm) {
const fromMenu = findMenuFullPathByTitles(PACE_MENU_TITLES)
const fromPathEndsPace = findLeafPathMatchingPath((p) => /\/pace$/i.test(p))
const base = vm.$route.path
const siblingSegs = ['pace', 'schedule', 'projectSchedule', 'project-schedule']
const fromSiblings = siblingSegs
.map((s) => siblingPathReplaceLast(base, s))
.filter(Boolean)
const candidates = [fromMenu, fromPathEndsPace, ...fromSiblings, '/project/pace'].filter(Boolean)
return pickExistingRoutePath(vm.$router, candidates) || candidates[candidates.length - 1]
}

View File

@@ -56,8 +56,8 @@
</template>
<script>
import { listCc, readCc } from '@/api/hrm/cc';
import applyTypeMinix from '@/views/hrm/minix/applyTypeMinix.js';
import { listCc, readCc, unreadCc } from '@/api/hrm/cc';
export default {
name: 'HrmFlowCc',
@@ -115,6 +115,14 @@ export default {
this.getList()
})
},
// 标记未读
handleUnread(row) {
unreadCc(row.ccId).then(() => {
this.$modal.msgSuccess('已标记为未读')
// 刷新当前列表(这条记录会移到未读列表)
this.getList()
})
},
handleRefresh () {
this.getList()
}

View File

@@ -0,0 +1,323 @@
<template>
<div class="my-apply-page">
<section class="stats-strip">
<el-card shadow="never" class="stat-card">
<div class="stat-label">总申请</div>
<div class="stat-value">{{ summary.total }}</div>
</el-card>
<el-card shadow="never" class="stat-card">
<div class="stat-label">审批中</div>
<div class="stat-value warning">{{ summary.running }}</div>
</el-card>
<el-card shadow="never" class="stat-card">
<div class="stat-label">已通过</div>
<div class="stat-value success">{{ summary.approved }}</div>
</el-card>
</section>
<section class="filters">
<el-card shadow="never" class="filter-card">
<div class="filter-row">
<el-select v-model="query.bizType" placeholder="申请类型" clearable size="small" style="width: 130px" @change="handleFilterChange">
<el-option label="全部" value="" />
<el-option label="请假" value="leave" />
<el-option label="出差" value="travel" />
<el-option label="用印" value="seal" />
<el-option label="报销" value="reimburse" />
<el-option label="拨款" value="appropriation" />
</el-select>
<el-select v-model="query.status" placeholder="状态" clearable size="small" style="width: 130px" @change="handleFilterChange">
<el-option label="全部" value="" />
<el-option label="草稿" value="draft" />
<el-option label="审批中" value="running" />
<el-option label="已通过" value="approved" />
<el-option label="已驳回" value="rejected" />
<el-option label="已撤销" value="revoked" />
</el-select>
<el-input v-model="query.keyword" placeholder="输入申请标题/备注关键词" size="small" clearable style="width: 260px" @keyup.enter.native="handleFilterChange" />
<el-button type="primary" size="small" icon="el-icon-search" @click="handleFilterChange">查询</el-button>
<el-button size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</div>
</el-card>
</section>
<section class="content">
<el-card shadow="never" class="table-card">
<div slot="header" class="card-header">
<span>申请列表</span>
<el-button size="mini" icon="el-icon-refresh" @click="loadList">刷新</el-button>
</div>
<el-table :data="list" v-loading="loading" stripe @row-dblclick="goDetail" empty-text="暂无申请记录">
<el-table-column label="申请类型" min-width="100">
<template slot-scope="scope">
<el-tag :type="getTypeTagType(scope.row.bizType)">{{ getTypeText(scope.row.bizType) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="申请名称" min-width="240" show-overflow-tooltip>
<template slot-scope="scope">
{{ getRowTitle(scope.row) }}
</template>
</el-table-column>
<el-table-column label="发起人" min-width="140" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.nickName || '-' }}
</template>
</el-table-column>
<el-table-column label="状态" min-width="110">
<template slot-scope="scope">
<el-tag :type="statusType(scope.row)" size="small">{{ statusText(scope.row) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="发起时间" prop="createTime" min-width="160">
<template slot-scope="scope">{{ formatDate(scope.row.createTime) }}</template>
</el-table-column>
<el-table-column label="操作" min-width="180" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="goDetail(scope.row)">详情</el-button>
<el-button
v-if="showEarlyEndButton(scope.row)"
type="text"
size="mini"
style="color: #e6a23c"
:loading="earlyEndLoadingId === scope.row.bizId"
@click.stop="handleEarlyEnd(scope.row)"
>
提前结束
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-wrapper">
<el-pagination
:current-page="query.pageNum"
:page-size="query.pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</el-card>
</section>
</div>
</template>
<script>
import { listMyApply } from '@/api/hrm/myApply'
import { earlyEndTravel } from '@/api/hrm/travel'
import applyTypeMinix from '@/views/hrm/minix/applyTypeMinix.js'
export default {
name: 'HrmMyApply',
mixins: [applyTypeMinix],
data () {
return {
loading: false,
earlyEndLoadingId: null,
list: [],
total: 0,
summary: {
total: 0,
running: 0,
approved: 0
},
query: {
pageNum: 1,
pageSize: 50,
bizType: '',
status: '',
keyword: ''
}
}
},
created () {
this.loadList()
},
methods: {
getRowTitle (row) {
return row.title || row.remark || '-'
},
isTravelCompleted (row) {
if (!row || row.bizType !== 'travel') return false
const endTime = row.endTime ? new Date(row.endTime).getTime() : 0
const now = Date.now()
return Boolean(row.actualEndTime) || (endTime && endTime <= now)
},
showEarlyEndButton (row) {
if (!row || row.bizType !== 'travel') return false
if (row.actualEndTime) return false
const endTime = row.endTime ? new Date(row.endTime).getTime() : 0
return row.status === 'approved' && endTime > Date.now()
},
statusText (row) {
const status = row?.status
if (row?.bizType === 'travel' && status === 'approved') {
return this.isTravelCompleted(row) ? '已完成' : '进行中'
}
const map = { draft: '草稿', running: '审批中', pending: '审批中', approved: '已通过', rejected: '已驳回', revoked: '已撤销', finished: '已完成' }
return map[status] || status || '-'
},
statusType (row) {
const status = row?.status
if (row?.bizType === 'travel' && status === 'approved') {
return this.isTravelCompleted(row) ? 'success' : 'warning'
}
const map = { draft: 'info', running: 'warning', pending: 'warning', approved: 'success', rejected: 'danger', revoked: 'danger', finished: 'success' }
return map[status] || 'info'
},
formatDate (val) {
if (!val) return ''
const d = new Date(val)
const p = n => (n < 10 ? `0${n}` : n)
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
},
handleFilterChange () {
this.query.pageNum = 1
this.loadList()
},
resetQuery () {
this.query = { pageNum: 1, pageSize: 10, bizType: '', status: '', keyword: '' }
this.loadList()
},
async loadList () {
this.loading = true
try {
const res = await listMyApply({
pageNum: this.query.pageNum,
pageSize: this.query.pageSize,
bizType: this.query.bizType || undefined,
status: this.query.status || undefined,
keyword: this.query.keyword || undefined
})
this.list = res.rows || []
this.total = res.total || 0
this.summary.total = res.total || 0
this.summary.running = (res.rows || []).filter(i => ['running', 'pending'].includes(i.status) || (i.bizType === 'travel' && i.status === 'approved' && !this.isTravelCompleted(i))).length
this.summary.approved = (res.rows || []).filter(i => i.status === 'approved' && !(i.bizType === 'travel' && !this.isTravelCompleted(i))).length
} catch (err) {
console.error('加载我的申请失败:', err)
this.$message.error('加载我的申请失败')
this.list = []
this.total = 0
} finally {
this.loading = false
}
},
handleSizeChange (val) {
this.query.pageSize = val
this.query.pageNum = 1
this.loadList()
},
handleCurrentChange (val) {
this.query.pageNum = val
this.loadList()
},
async handleEarlyEnd (row) {
this.$confirm('确认提前结束本次出差吗?结束后的实际时间将记录为当前时间。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.earlyEndLoadingId = row.bizId
try {
await earlyEndTravel(row.bizId)
this.$message.success('提前结束成功')
await this.loadList()
} catch (error) {
this.$message.error(error.message || '提前结束失败')
} finally {
this.earlyEndLoadingId = null
}
}).catch(() => {})
},
goDetail (row) {
if (!row) return
const routeMap = {
leave: '/hrm/HrmLeaveDetail',
travel: '/hrm/HrmTravelDetail',
seal: '/hrm/HrmSealDetail',
reimburse: '/hrm/HrmReimburseDetail',
appropriation: '/hrm/HrmAppropriationDetail'
}
const path = routeMap[row.bizType]
if (!path) {
this.$message.warning('暂不支持该申请类型的详情页')
return
}
this.$router.push({ path, query: { bizId: row.bizId } })
}
}
}
</script>
<style lang="scss" scoped>
.my-apply-page {
padding: 16px 20px 32px;
background: #f8f9fb;
}
.stats-strip {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
margin-bottom: 16px;
}
.stat-card {
border: 1px solid #e6e8ed;
border-radius: 10px;
background: #fff;
text-align: center;
}
.stat-label {
font-size: 12px;
color: #8a8f99;
}
.stat-value {
margin-top: 4px;
font-size: 22px;
font-weight: 800;
color: #2b2f36;
}
.warning { color: #e6a23c; }
.success { color: #67c23a; }
.filter-card,
.table-card {
border: 1px solid #d7d9df;
border-radius: 10px;
}
.filter-row {
display: flex;
gap: 10px;
align-items: center;
flex-wrap: wrap;
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 700;
color: #2b2f36;
}
.pagination-wrapper {
margin-top: 16px;
display: flex;
justify-content: flex-end;
}
@media (max-width: 1200px) {
.stats-strip {
grid-template-columns: 1fr;
}
}
</style>

View File

@@ -65,8 +65,8 @@
</el-row>
<el-form-item label="目的地" prop="destination">
<el-input v-model="form.destination" placeholder="城市/地址/项目现场" />
<div class="hint-text">填写具体目的地便于审批人判断出差必要性</div>
<amap-city-select v-model="form.destination" placeholder="请选择出差城市" />
<div class="hint-text">通过地图或搜索选择具体城市便于审批人判断出差必要性</div>
</el-form-item>
<div class="block-title">出差说明</div>
@@ -223,13 +223,15 @@ import { ccFlowTask, listFlowNode, listFlowTemplate } from '@/api/hrm/flow'
import FileUpload from '@/components/FileUpload'
import UserMultiSelect from '@/components/UserSelect/multi.vue'
import UserSelect from '@/components/UserSelect/single.vue'
import AmapCitySelect from '@/components/AmapCitySelect/index.vue'
export default {
name: 'HrmTravelRequest',
components: {
UserSelect,
FileUpload,
UserMultiSelect
UserMultiSelect,
AmapCitySelect
},
data () {
return {

View File

@@ -2,6 +2,39 @@
<BizDetailContainer :bizId="currentBizId" bizType="travel" :preview="preview">
<template slot-scope="{ detail }">
<div>
<!-- ===== 新增提前结束按钮区域 ===== -->
<div class="action-buttons" v-if="showEarlyEndButton(detail)">
<el-button
type="warning"
size="small"
icon="el-icon-finished"
:loading="earlyEndLoading"
@click="handleEarlyEnd"
>
提前结束
</el-button>
<span class="hint-text">提前结束将把当前时间记录为实际结束时间</span>
</div>
<div v-if="detail.actualEndTime" class="early-end-info">
<el-alert
type="info"
:closable="false"
show-icon>
<template slot="default">
该出差已于 {{ formatDate(detail.actualEndTime) }} 提前结束
</template>
</el-alert>
</div>
<div v-else-if="isTravelCompleted(detail)" class="early-end-info">
<el-alert
type="success"
:closable="false"
show-icon>
<template slot="default">
该出差已完成
</template>
</el-alert>
</div>
<!-- 出差时间与行程 -->
<div class="block-title">出差时间与行程</div>
<el-card class="inner-card" shadow="never">
@@ -41,6 +74,7 @@
<script>
import FilePreview from "@/components/FilePreview/index.vue";
import BizDetailContainer from '@/views/hrm/components/BizDetailContainer/index.vue';
import { earlyEndTravel } from '@/api/hrm/travel'
export default {
name: 'TravelDetail',
@@ -53,7 +87,11 @@ export default {
BizDetailContainer,
FilePreview
},
name: 'HrmTravelDetail',
data() {
return {
earlyEndLoading: false
}
},
computed: {
currentBizId () {
return this.bizId || this.$route?.params?.bizId || this.$route?.query?.bizId || this.$route?.params?.id
@@ -66,7 +104,44 @@ export default {
const p = n => (n < 10 ? `0${n}` : n)
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
},
isTravelCompleted (detail) {
if (!detail) return false
const endTime = detail.endTime ? new Date(detail.endTime).getTime() : 0
const now = Date.now()
return Boolean(detail.actualEndTime) || (endTime && endTime <= now)
},
showEarlyEndButton(detail) {
if (!detail) return false
if (detail.actualEndTime) return false
const status = detail.status
const endTime = detail.endTime ? new Date(detail.endTime).getTime() : 0
const now = Date.now()
return status === 'approved' && endTime > now
},
handleEarlyEnd() {
this.$confirm('确认提前结束本次出差吗?结束后的实际时间将记录为当前时间。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.earlyEndLoading = true
try {
const bizId = this.currentBizId
await earlyEndTravel(bizId)
this.$message.success('提前结束成功')
this.$emit('refresh')
this.$forceUpdate()
} catch (error) {
this.$message.error(error.message || '提前结束失败')
} finally {
this.earlyEndLoading = false
}
}).catch(() => {})
},
}
}
</script>
@@ -375,4 +450,17 @@ export default {
display: none;
}
}
.action-buttons {
margin-bottom: 16px;
padding: 12px;
background: #fdf6ec;
border-radius: 8px;
display: flex;
align-items: center;
gap: 12px;
}
.early-end-info {
margin-bottom: 16px;
}
</style>

View File

@@ -0,0 +1,204 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="城市名称" prop="cityName">
<el-input
v-model="queryParams.cityName"
placeholder="请输入城市名称"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
</el-col>
</el-row>
<!-- 表格取消所有固定宽度100%自适应铺满容器 -->
<el-table
v-loading="loading"
:data="cityList"
@selection-change="handleSelectionChange"
border stripe
style="width: 100%"
>
<el-table-column type="selection" align="center" />
<el-table-column label="序号" type="index" align="center" />
<el-table-column prop="cityCode" label="城市编码" align="center" />
<el-table-column prop="countryName" label="国家" align="center" />
<el-table-column prop="cityName" label="城市名称" align="center" />
<el-table-column prop="provinceName" label="所属省份" align="center" />
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 弹窗表单 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="国家" prop="countryName">
<el-input v-model="form.countryName" placeholder="请输入国家(如:中国)" />
</el-form-item>
<el-form-item label="城市编码" prop="cityCode">
<el-input v-model="form.cityCode" placeholder="请输入城市编码" />
</el-form-item>
<el-form-item label="城市名称" prop="cityName">
<el-input v-model="form.cityName" placeholder="请输入城市名称" />
</el-form-item>
<el-form-item label="所属省份" prop="provinceName">
<el-input v-model="form.provinceName" placeholder="请输入所属省份" />
</el-form-item>
</el-form>
<div slot="footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listCity, getCity, delCity, addCity, updateCity } from "@/api/system/city";
import Pagination from "@/components/Pagination";
export default {
name: "City",
components: { Pagination },
data() {
return {
loading: false,
cityList: [],
total: 0,
queryParams: {
pageNum: 1,
pageSize: 50, // 已改成每页50条
cityName: null
},
ids: [],
multiple: true,
title: "",
open: false,
form: {},
rules: {
cityCode: [{ required: true, message: "城市编码不能为空", trigger: "blur" }],
cityName: [{ required: true, message: "城市名称不能为空", trigger: "blur" }]
}
};
},
created() {
this.getList();
},
methods: {
getList() {
this.loading = true;
listCity(this.queryParams).then(response => {
this.cityList = response.rows || [];
this.total = response.total || 0;
this.loading = false;
}).catch(() => {
this.loading = false;
});
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
resetQuery() {
this.queryParams = { pageNum: 1, pageSize: 50, cityName: null };
this.getList();
},
handleSelectionChange(selection) {
this.ids = selection.map(item => item.cityId);
this.multiple = !selection.length;
},
handleAdd() {
this.form = {};
this.open = true;
this.title = "添加城市";
},
handleUpdate(row) {
getCity(row.cityId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改城市";
});
},
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.cityId) {
updateCity(this.form).then(() => {
this.$message.success("修改成功");
this.open = false;
this.getList();
});
} else {
addCity(this.form).then(() => {
this.$message.success("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
handleDelete(row) {
const cityIds = row.cityId || this.ids.join(",");
this.$confirm("确认删除选中的城市吗?", "提示", { type: "warning" }).then(() => {
delCity(cityIds).then(() => {
this.$message.success("删除成功");
this.getList();
});
});
},
cancel() {
this.open = false;
}
}
};
</script>
<style scoped>
/* 全局弱化边框、阴影、降低层级 */
.app-container {
padding: 12px;
}
.el-table {
box-shadow: none !important;
border-radius: 4px;
}
.el-table th, .el-table td {
border-color: #f0f2f5 !important;
}
/* 按钮缩小、弱化样式 */
.el-button--mini {
padding: 3px 10px;
font-size: 12px;
}
/* 降低弹窗层级柔和化 */
.el-dialog {
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -87,6 +87,15 @@ export default {
tabNode: this.defaultTabNode,
firstLevelNode: this.defaultFirstLevelNode
});
},
/** 外部(路由深链等)同步选中进度类别与一级分类,并通知父级更新筛选 */
setSelection (tabNode, firstLevelNode) {
this.defaultTabNode = tabNode != null ? String(tabNode) : "";
this.defaultFirstLevelNode = firstLevelNode != null ? String(firstLevelNode) : "";
this.$emit("change", {
tabNode: this.defaultTabNode,
firstLevelNode: this.defaultFirstLevelNode
});
}
}
};

View File

@@ -107,6 +107,11 @@ export default {
type: Boolean | Number,
default: false
},
/** 打开进度详情时由路由传入定位左侧分类与表格筛选tabNode / firstLevelNode / trackId */
initialStepFocus: {
type: Object,
default: null
}
},
components: {
StepTable,
@@ -289,8 +294,44 @@ export default {
},
immediate: true
},
initialStepFocus: {
handler () {
this.$nextTick(() => this.applyInitialStepFocus());
},
deep: true
}
},
methods: {
applyInitialStepFocus () {
const hint = this.initialStepFocus;
if (!hint || !this.projectScheduleStepList.length) {
return;
}
let tabNode = hint.tabNode != null ? String(hint.tabNode) : "";
let firstLevelNode = hint.firstLevelNode != null ? String(hint.firstLevelNode) : "";
if ((!tabNode || !firstLevelNode) && hint.trackId != null && hint.trackId !== "") {
const st = this.projectScheduleStepList.find(
(s) => String(s.trackId) === String(hint.trackId)
);
if (st) {
tabNode = st.tabNode != null ? String(st.tabNode) : tabNode;
firstLevelNode = st.firstLevelNode != null ? String(st.firstLevelNode) : firstLevelNode;
}
}
if (!tabNode) {
return;
}
this.viewMode = "table";
this.$nextTick(() => {
const menu = this.$refs.menuSelectRef;
if (menu && typeof menu.setSelection === "function") {
menu.setSelection(tabNode, firstLevelNode);
} else {
this.defaultTabNode = tabNode;
this.defaultFirstLevelNode = firstLevelNode;
}
});
},
/** 查询项目进度步骤跟踪列表 */
getList () {
this.loading = true;
@@ -298,6 +339,7 @@ export default {
this.projectScheduleStepList = response.rows;
this.total = response.total;
this.loading = false;
this.$nextTick(() => this.applyInitialStepFocus());
});
},
handleOverview () {

Some files were not shown because too many files have changed in this diff Show More