update code

dev_xd
lijun 2024-12-17 22:57:59 +08:00
parent b0ba39d781
commit d563d23b07
15 changed files with 1503 additions and 46 deletions

View File

@ -1,39 +1,108 @@
import request from "@/utils/request";
import { tryToJson } from "../utils/tools";
import $dt from "dayjs";
const groupByCraftType = (data) => {
return request({
url: "/manage/proProjectInfoSubdeptsUsers/groupByCraftType",
method: "get",
params:data
});
};
return request({
url: "/manage/proProjectInfoSubdeptsUsers/groupByCraftType",
method: "get",
params: data,
});
};
const groupByCraftTypeByAttendance = (data) => {
return request({
url: "/manage/proProjectInfoSubdeptsUsers/groupByCraftTypeByAttendance",
method: "get",
params:data
});
};
const groupByCraftTypeByAttendance = (data) => {
return request({
url: "/manage/proProjectInfoSubdeptsUsers/groupByCraftTypeByAttendance",
method: "get",
params: data,
});
};
const subdeptsUsersList=(data)=>{
const subdeptsUsersList = (data) => {
return request({
url: "/manage/proProjectInfoSubdeptsUsers/list",
method: "get",
params: data,
});
};
const attendanceUbiDataList = (data) => {
return request({
url: "/manage/attendanceUbiData/list",
method: "get",
params: data,
});
};
const updateItemState = (it) => {
let dt0 = +$dt($dt(new Date()).format("YYYY-MM-DD")); //当时时间
let dt1 = it.planStartDate ? +$dt(it.planStartDate) : 0; //计划开始
let dt2 = it.planEndDate ? +$dt(it.planEndDate) : 0; //计划结束
let dt3 = it.startDate ? +$dt(it.startDate) : 0; //实际开始
let dt4 = it.endDate ? +$dt(it.endDate) : 0; //实际结束
if (!it.planStartDate) {
return;
}
if (it.endDate) {
if (!it.planEndDate) {
it.finish = "正常完成";
it.finishState = 3;
return;
}
if (dt4 > dt2) {
it.finish = "逾期完成";
it.finishState = 1;
} else {
it.finish = "正常完成";
it.finishState = 3;
}
return;
}
if (it.startDate) {
if (!it.planEndDate) {
it.finish = "进行中";
it.finishState = 2;
return;
}
if (dt2 < dt0) {
it.finish = "逾期" + (dt0 - dt2) / 3600 / 1000 / 24 + "天";
it.finishState = 1;
} else {
it.finish = "进行中";
it.finishState = 2;
}
return;
}
if (!it.startDate) {
it.finish = "未开始";
it.finishState = 4;
}
};
const milestoneList = (data) => {
return new Promise((resolve) => {
return request({
url: "/manage/proProjectInfoSubdeptsUsers/list",
method: "get",
params:data
url: "/manage/milestone/list",
method: "get",
params: data,
}).then((d) => {
let tmps = (d.rows || []).map((it) => {
it.nodeText = it.nodeName||'';
it.planStartDate=it.scheduledStart;
it.planEndDate=it.scheduledEnd;
it.startDate=it.actualStart;
it.endDate=it.actualEnd;
updateItemState(it);
return it;
});
}
const attendanceUbiDataList=(data)=>{
return request({
url: "/manage/attendanceUbiData/list",
method: "get",
params:data
resolve(tmps);
});
}
export default{
groupByCraftType,
groupByCraftTypeByAttendance,
subdeptsUsersList,
attendanceUbiDataList
}
});
};
export default {
groupByCraftType,
groupByCraftTypeByAttendance,
subdeptsUsersList,
attendanceUbiDataList,
milestoneList,
};

View File

@ -363,7 +363,8 @@
<div class="dangerous-timeline-max w-scroll">
<div class="dangerous-timeline-min" :style="{ width: maxWidth + 'px' }">
<template v-if="projectBuildNode && projectBuildNode.length > 0">
<div class="dangerous-timeline-con" v-for="(item,idx) in projectBuildNode" :key="idx">
<div class="dangerous-timeline-con" v-for="(item, idx) in projectBuildNode"
:key="idx">
<div class="dangerous-text" v-html="item.nodeText"></div>
<div class="dangerous-dot">
<div class="dangerous-dot-item"></div>
@ -570,16 +571,7 @@ export default {
this.$api.weather.getCityInfo().then(d => {
this.cityInfo = d.data?.city || [];
});
this.projectBuildNode = testData.projectBuildNode;
let itemWidth = this.$dpi() == "1K" ? 200 : this.$dpi() == "2K" ? 300 : 500;
this.maxWidth = itemWidth * this.projectBuildNode.length;
let n = 0;
for (let i = 0; i < this.projectBuildNode.length; i++) {
if (this.projectBuildNode[i].finish == "进行中") {
n = i;
}
}
this.minWidth = n * itemWidth + 100;
},
methods: {
showDetailDlg() {
@ -622,6 +614,26 @@ export default {
}
});
this.loadAttendanceData();
this.loadMilestoneData();
},
loadMilestoneData() {
this.$api.detail.milestoneList({
pageNum: 1,
pageSize: 100,
comId: this.prjInfo.comId,
projectId: this.prjInfo.id
}).then(d => {
this.projectBuildNode = d;
let itemWidth = this.$dpi() == "1K" ? 200 : this.$dpi() == "2K" ? 300 : 500;
this.maxWidth = itemWidth * this.projectBuildNode.length;
let n = 0;
for (let i = 0; i < this.projectBuildNode.length; i++) {
if (this.projectBuildNode[i].finish == "进行中") {
n = i;
}
}
this.minWidth = n * itemWidth + 100;
})
},
loadAttendanceData() {
let ajax = this.$api.detail.groupByCraftType;
@ -632,7 +644,7 @@ export default {
if (this.attendanceNav == 1) {
ajax = this.$api.detail.groupByCraftTypeByAttendance;
//posData.createTime = this.$dt(new Date()).format("YYYY-MM-DD");
posData.createTime ='2024-10-13';
posData.createTime = '2024-10-13';
}
ajax(posData).then(d => {
this.attendanceData = (d.data || []).map(it => {
@ -973,12 +985,14 @@ export default {
}
}
}
.attendance-info-title {
* {
font-size: 24px;
}
}
.attendance-tag {
* {
font-size: 24px;

View File

@ -0,0 +1,218 @@
package com.yanzhu.manage.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.yanzhu.common.core.annotation.Excel;
import com.yanzhu.common.core.web.domain.BaseEntity;
import java.util.Date;
/**
* pro_milestone
*
* @author yanzhu
* @date 2024-12-16
*/
public class ProMilestone extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 公司ID */
@Excel(name = "公司ID")
private Long comid;
/** 项目ID */
@Excel(name = "项目ID")
private Long projectId;
/** $column.columnComment */
private Long id;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 计划开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date scheduledStart;
/** 计划结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date scheduledEnd;
/** 实际开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "实际开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date actualStart;
/** 实际结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "实际结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date actualEnd;
/** 工期 */
@Excel(name = "工期")
private Long days;
/** 说明 */
@Excel(name = "说明")
private String explainInfo;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long isDel;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String state;
private String compName;
private String projectName;
public Long getComid() {
return comid;
}
public void setComid(Long comid) {
this.comid = comid;
}
public Long getProjectId() {
return projectId;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
public String getCompName() {
return compName;
}
public void setCompName(String compName) {
this.compName = compName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setNodeName(String nodeName)
{
this.nodeName = nodeName;
}
public String getNodeName()
{
return nodeName;
}
public void setScheduledStart(Date scheduledStart)
{
this.scheduledStart = scheduledStart;
}
public Date getScheduledStart()
{
return scheduledStart;
}
public void setScheduledEnd(Date scheduledEnd)
{
this.scheduledEnd = scheduledEnd;
}
public Date getScheduledEnd()
{
return scheduledEnd;
}
public void setActualStart(Date actualStart)
{
this.actualStart = actualStart;
}
public Date getActualStart()
{
return actualStart;
}
public void setActualEnd(Date actualEnd)
{
this.actualEnd = actualEnd;
}
public Date getActualEnd()
{
return actualEnd;
}
public void setDays(Long days)
{
this.days = days;
}
public Long getDays()
{
return days;
}
public String getExplainInfo() {
return explainInfo;
}
public void setExplainInfo(String explainInfo) {
this.explainInfo = explainInfo;
}
public void setIsDel(Long isDel)
{
this.isDel = isDel;
}
public Long getIsDel()
{
return isDel;
}
public void setState(String state)
{
this.state = state;
}
public String getState()
{
return state;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("nodeName", getNodeName())
.append("scheduledStart", getScheduledStart())
.append("scheduledEnd", getScheduledEnd())
.append("actualStart", getActualStart())
.append("actualEnd", getActualEnd())
.append("days", getDays())
.append("explain", getExplainInfo())
.append("isDel", getIsDel())
.append("remark", getRemark())
.append("state", getState())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.yanzhu.manage.mapper;
import java.util.List;
import com.yanzhu.manage.domain.ProMilestone;
/**
* Mapper
*
* @author yanzhu
* @date 2024-12-16
*/
public interface ProMilestoneMapper
{
/**
*
*
* @param id
* @return
*/
public ProMilestone selectProMilestoneById(Long id);
/**
*
*
* @param proMilestone
* @return
*/
public List<ProMilestone> selectProMilestoneList(ProMilestone proMilestone);
/**
*
*
* @param proMilestone
* @return
*/
public int insertProMilestone(ProMilestone proMilestone);
/**
*
*
* @param proMilestone
* @return
*/
public int updateProMilestone(ProMilestone proMilestone);
/**
*
*
* @param id
* @return
*/
public int deleteProMilestoneById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteProMilestoneByIds(Long[] ids);
}

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yanzhu.manage.mapper.ProMilestoneMapper">
<resultMap type="ProMilestone" id="ProMilestoneResult">
<result property="id" column="id" />
<result property="comid" column="comid" />
<result property="projectId" column="project_id" />
<result property="nodeName" column="node_name" />
<result property="scheduledStart" column="scheduled_start" />
<result property="scheduledEnd" column="scheduled_end" />
<result property="actualStart" column="actual_start" />
<result property="actualEnd" column="actual_end" />
<result property="days" column="days" />
<result property="explainInfo" column="explain_info" />
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
<result property="state" column="state" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="compName" column="comp_name"/>
<result property="projectName" column="project_name"/>
</resultMap>
<sql id="selectProMilestoneVo">
select pm.id, pm.comid, pm.project_id,pm.node_name, pm.scheduled_start, pm.scheduled_end, pm.actual_start
, pm.actual_end, pm.days, pm.explain_info,
pm.is_del, pm.remark, pm.state, pm.create_by, pm.create_time, pm.update_by, pm.update_time,dp.`dept_name` comp_name,pi.`project_name`
from pro_milestone pm
LEFT JOIN sys_dept dp ON pm.`comid`=dp.`dept_id`
LEFT JOIN pro_project_info pi ON pm.`project_id`=pi.`id`
</sql>
<select id="selectProMilestoneList" parameterType="ProMilestone" resultMap="ProMilestoneResult">
<include refid="selectProMilestoneVo"/>
<where>
<if test="comid != null "> and pm.comid = #{comid}</if>
<if test="projectId != null "> and pm.project_id = #{projectId}</if>
<if test="nodeName != null and nodeName != ''"> and pm.node_name like concat('%', #{nodeName}, '%')</if>
<if test="scheduledStart != null "> and pm.scheduled_start = #{scheduledStart}</if>
<if test="scheduledEnd != null "> and pm.scheduled_end = #{scheduledEnd}</if>
<if test="actualStart != null "> and pm.actual_start = #{actualStart}</if>
<if test="actualEnd != null "> and pm.actual_end = #{actualEnd}</if>
<if test="days != null "> and pm.days = #{days}</if>
<if test="explainInfo != null and explainInfo != ''"> and pm.explain_info = #{explainInfo}</if>
<if test="isDel != null "> and pm.is_del = #{isDel}</if>
<if test="state != null and state != ''"> and pm.state = #{state}</if>
</where>
</select>
<select id="selectProMilestoneById" parameterType="Long" resultMap="ProMilestoneResult">
<include refid="selectProMilestoneVo"/>
where pm.id = #{id}
</select>
<insert id="insertProMilestone" parameterType="ProMilestone" useGeneratedKeys="true" keyProperty="id">
insert into pro_milestone
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="comid != null">comid,</if>
<if test="projectId != null">project_id,</if>
<if test="nodeName != null">node_name,</if>
<if test="scheduledStart != null">scheduled_start,</if>
<if test="scheduledEnd != null">scheduled_end,</if>
<if test="actualStart != null">actual_start,</if>
<if test="actualEnd != null">actual_end,</if>
<if test="days != null">days,</if>
<if test="explainInfo != null">explain_info,</if>
<if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if>
<if test="state != null">state,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="comid != null">#{comid},</if>
<if test="projectId != null">#{projectId},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="scheduledStart != null">#{scheduledStart},</if>
<if test="scheduledEnd != null">#{scheduledEnd},</if>
<if test="actualStart != null">#{actualStart},</if>
<if test="actualEnd != null">#{actualEnd},</if>
<if test="days != null">#{days},</if>
<if test="explainInfo != null">#{explainInfo},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if>
<if test="state != null">#{state},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateProMilestone" parameterType="ProMilestone">
update pro_milestone
<trim prefix="SET" suffixOverrides=",">
<if test="comid != null">comid = #{comid},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="scheduledStart != null">scheduled_start = #{scheduledStart},</if>
<if test="scheduledEnd != null">scheduled_end = #{scheduledEnd},</if>
<if test="actualStart != null">actual_start = #{actualStart},</if>
<if test="actualEnd != null">actual_end = #{actualEnd},</if>
<if test="days != null">days = #{days},</if>
<if test="explainInfo != null">explain_info = #{explainInfo},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="state != null">state = #{state},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteProMilestoneById" parameterType="Long">
delete from pro_milestone where id = #{id}
</delete>
<delete id="deleteProMilestoneByIds" parameterType="String">
delete from pro_milestone where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -105,7 +105,9 @@
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>iTextAsian</artifactId>
<version>1.0</version>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}\libs\iTextAsian-1.0.0.jar</systemPath>
</dependency>
<dependency>
@ -123,6 +125,9 @@
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}\libs\aspose-words-15.8.0-jdk16.jar</systemPath>
</dependency>
<!--word文件转化为PDF文件 结束-->

View File

@ -0,0 +1,116 @@
package com.yanzhu.manage.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.yanzhu.common.core.utils.poi.ExcelUtil;
import com.yanzhu.common.core.web.controller.BaseController;
import com.yanzhu.common.core.web.domain.AjaxResult;
import com.yanzhu.common.core.web.page.TableDataInfo;
import com.yanzhu.common.log.annotation.Log;
import com.yanzhu.common.log.enums.BusinessType;
import com.yanzhu.common.security.annotation.RequiresPermissions;
import com.yanzhu.manage.domain.ProMilestone;
import com.yanzhu.manage.service.IProMilestoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Controller
*
* @author yanzhu
* @date 2024-12-16
*/
@RestController
@RequestMapping("/milestone")
public class ProMilestoneController extends BaseController
{
@Autowired
private IProMilestoneService proMilestoneService;
/**
*
*/
@RequiresPermissions("manage:milestone:list")
@GetMapping("/list")
public TableDataInfo list(ProMilestone proMilestone)
{
startPage();
List<ProMilestone> list = proMilestoneService.selectProMilestoneList(proMilestone);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("manage:milestone:export")
@Log(title = "项目里程碑", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProMilestone proMilestone)
{
List<ProMilestone> list = proMilestoneService.selectProMilestoneList(proMilestone);
ExcelUtil<ProMilestone> util = new ExcelUtil<ProMilestone>(ProMilestone.class);
util.exportExcel(response, list, "项目里程碑数据");
}
/**
*
*/
@RequiresPermissions("manage:milestone:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(proMilestoneService.selectProMilestoneById(id));
}
/**
*
*/
@RequiresPermissions("manage:milestone:add")
@Log(title = "项目里程碑", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProMilestone proMilestone)
{
return toAjax(proMilestoneService.insertProMilestone(proMilestone));
}
/**
*
*/
@RequiresPermissions("manage:milestone:add")
@Log(title = "项目里程碑", businessType = BusinessType.INSERT)
@PostMapping("/addBatch")
public AjaxResult addBatch(@RequestBody List<ProMilestone> proMilestones)
{
return toAjax(proMilestoneService.addBatch(proMilestones));
}
/**
*
*/
@RequiresPermissions("manage:milestone:edit")
@Log(title = "项目里程碑", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProMilestone proMilestone)
{
return toAjax(proMilestoneService.updateProMilestone(proMilestone));
}
/**
*
*/
@RequiresPermissions("manage:milestone:remove")
@Log(title = "项目里程碑", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(proMilestoneService.deleteProMilestoneByIds(ids));
}
}

View File

@ -0,0 +1,68 @@
package com.yanzhu.manage.service;
import java.util.List;
import com.yanzhu.manage.domain.ProMilestone;
/**
* Service
*
* @author yanzhu
* @date 2024-12-16
*/
public interface IProMilestoneService
{
/**
*
*
* @param id
* @return
*/
public ProMilestone selectProMilestoneById(Long id);
/**
*
*
* @param proMilestone
* @return
*/
public List<ProMilestone> selectProMilestoneList(ProMilestone proMilestone);
/**
*
*
* @param proMilestone
* @return
*/
public int insertProMilestone(ProMilestone proMilestone);
/**
*
*
* @param proMilestone
* @return
*/
public int updateProMilestone(ProMilestone proMilestone);
/**
*
*
* @param ids
* @return
*/
public int deleteProMilestoneByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteProMilestoneById(Long id);
/**
*
* @param proMilestones
* @return
*/
int addBatch(List<ProMilestone> proMilestones);
}

View File

@ -0,0 +1,155 @@
package com.yanzhu.manage.service.impl;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import com.yanzhu.common.core.context.SecurityContextHolder;
import com.yanzhu.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.manage.mapper.ProMilestoneMapper;
import com.yanzhu.manage.domain.ProMilestone;
import com.yanzhu.manage.service.IProMilestoneService;
/**
* Service
*
* @author yanzhu
* @date 2024-12-16
*/
@Service
public class ProMilestoneServiceImpl implements IProMilestoneService
{
@Autowired
private ProMilestoneMapper proMilestoneMapper;
/**
*
*
* @param id
* @return
*/
@Override
public ProMilestone selectProMilestoneById(Long id)
{
return proMilestoneMapper.selectProMilestoneById(id);
}
/**
*
*
* @param proMilestone
* @return
*/
@Override
public List<ProMilestone> selectProMilestoneList(ProMilestone proMilestone)
{
return proMilestoneMapper.selectProMilestoneList(proMilestone);
}
/**
*
*
* @param proMilestone
* @return
*/
@Override
public int insertProMilestone(ProMilestone proMilestone)
{
proMilestone.setCreateBy(SecurityContextHolder.getUserName());
proMilestone.setCreateTime(DateUtils.getNowDate());
return proMilestoneMapper.insertProMilestone(proMilestone);
}
/**
*
*
* @param proMilestone
* @return
*/
@Override
public int updateProMilestone(ProMilestone proMilestone)
{
proMilestone.setUpdateBy(SecurityContextHolder.getUserName());
proMilestone.setUpdateTime(DateUtils.getNowDate());
return proMilestoneMapper.updateProMilestone(proMilestone);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteProMilestoneByIds(Long[] ids)
{
return proMilestoneMapper.deleteProMilestoneByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteProMilestoneById(Long id)
{
return proMilestoneMapper.deleteProMilestoneById(id);
}
@Override
public int addBatch(List<ProMilestone> proMilestones) {
if(proMilestones==null||proMilestones.size()==0){
return 0;
}
ProMilestone where=new ProMilestone();
where.setComid(proMilestones.get(0).getComid());
where.setProjectId(proMilestones.get(0).getProjectId());
List<ProMilestone> oldList=selectProMilestoneList(where);
List<Long> updateIds=new ArrayList<>();
for(ProMilestone it:proMilestones){
if(it.getScheduledStart()!=null && it.getScheduledEnd()!=null){
Date date2=it.getScheduledEnd();
Date date1=it.getScheduledStart();
long daysBetween = DateUtils.isSameDay(date1, date2) ? 0 : 1 + (date2.getTime() - date1.getTime()) / (1000 * 60 * 60 * 24);
it.setDays(daysBetween);
}else{
it.setDays(null);
}
ProMilestone old=findInOldList(oldList,it,updateIds);
if(old==null){ //增加
insertProMilestone(it);
}else{//修改
old.setDays(it.getDays());
old.setScheduledEnd(it.getScheduledEnd());
old.setScheduledStart(it.getScheduledStart());
old.setActualEnd(it.getActualEnd());
old.setActualStart(it.getActualStart());
old.setExplainInfo(it.getExplainInfo());
proMilestoneMapper.updateProMilestone(old);
updateIds.add(old.getId());
}
}
for (ProMilestone old : oldList){
if(!updateIds.contains(old.getId())){
deleteProMilestoneById(old.getId());
}
}
return proMilestones.size();
}
private ProMilestone findInOldList(List<ProMilestone> oldList, ProMilestone it,List<Long> updateIds) {
for (ProMilestone old : oldList) {
if(old.getNodeName().equals(it.getNodeName())){
if(!updateIds.contains(old.getId())){
return old;
}
}
}
return null;
}
}

View File

@ -0,0 +1,52 @@
import request from '@/utils/request'
// 查询项目里程碑列表
export function listMilestone(query) {
return request({
url: '/manage/milestone/list',
method: 'get',
params: query
})
}
// 查询项目里程碑详细
export function getMilestone(id) {
return request({
url: '/manage/milestone/' + id,
method: 'get'
})
}
// 新增项目里程碑
export function addMilestone(data) {
return request({
url: '/manage/milestone',
method: 'post',
data: data
})
}
// 修改项目里程碑
export function updateMilestone(data) {
return request({
url: '/manage/milestone',
method: 'put',
data: data
})
}
// 删除项目里程碑
export function delMilestone(id) {
return request({
url: '/manage/milestone/' + id,
method: 'delete'
})
}
export function addBatch(datas){
return request({
url: '/manage/milestone/addBatch',
method: 'post',
data: datas
})
}

View File

@ -1,12 +1,12 @@
<template>
<div class="app-container green-carbon-data">
<template v-if="data.currentProId">
<el-tabs v-model="data.selTab" type="card" class="main-tab" @click="doTabClick">
<el-tab-pane v-for="(it, idx) in data.types" :key="idx" :name="it.value"
:label="it.text + '(' + it.count + ')'"></el-tab-pane>
</el-tabs>
<template v-if="data.currentProId">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd"

View File

@ -0,0 +1,190 @@
<template>
<div class="app-container project-milestone">
<template v-if="data.currentProId">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd"
v-hasPermi="['manage:milestone:add']">新增一行</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" @click="handleUpdate"
v-hasPermi="['manage:milestone:edit']">保存</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="data.milestoneList" class="data-list">
<el-table-column label="节点名称" align="center" prop="nodeName">
<template #default="scope">
<el-input v-model="scope.row.nodeName" />
</template>
</el-table-column>
<el-table-column label="工期" align="center" prop="days" width="180">
<template #default="scope">
<span v-if="scope.row.days">{{ scope.row.days }}</span>
</template>
</el-table-column>
<el-table-column label="计划开始日期" align="center" prop="scheduledStart" width="180">
<template #default="scope">
<el-date-picker v-model="scope.row.scheduledStart" />
</template>
</el-table-column>
<el-table-column label="计划结束日期" align="center" prop="scheduledEnd" width="180">
<template #default="scope">
<el-date-picker v-model="scope.row.scheduledEnd" />
</template>
</el-table-column>
<el-table-column label="实际开始日期" align="center" prop="actualStart" width="180">
<template #default="scope">
<el-date-picker v-model="scope.row.actualStart" />
</template>
</el-table-column>
<el-table-column label="实际结束日期" align="center" prop="actualEnd" width="180">
<template #default="scope">
<el-date-picker v-model="scope.row.actualEnd" />
</template>
</el-table-column>
<el-table-column label="说明" align="center" prop="explainInfo">
<template #default="scope">
<el-input v-model="scope.row.explainInfo" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
<template #default="scope">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['manage:milestone:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
</template>
<div v-else style="margin-top:50px;text-align: center;color: #999;">
<el-icon color="#999">
<WarningFilled />
</el-icon>
</div>
</div>
</template>
<script setup name="Milestone">
import { listMilestone, getMilestone, delMilestone, addBatch } from "@/api/manage/milestone";
import useUserStore from '@/store/modules/user'
const { proxy } = getCurrentInstance();
const userStore = useUserStore()
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 100,
comId: null,
projectId: null,
nodeName: null,
scheduledStart: null,
scheduledEnd: null,
actualStart: null,
actualEnd: null,
days: null,
explainInfo: null,
isDel: null,
state: null,
},
rules: {
},
currentProId: '',
milestoneList: []
});
const { queryParams, form, rules } = toRefs(data);
/** 查询项目里程碑列表 */
function getList() {
loading.value = true;
listMilestone(queryParams.value).then(response => {
data.milestoneList = response.rows;
total.value = response.total;
loading.value = false;
});
}
/** 新增按钮操作 */
function handleAdd() {
data.milestoneList.push({
nodeName: '',
scheduledStart: null,
scheduledEnd: null,
actualStart: null,
actualEnd: null,
days: null,
explainInfo: ''
});
}
/** 修改按钮操作 */
function handleUpdate(row) {
let objs = data.milestoneList.filter(d => d.nodeName).filter(d => d.nodeName.trim());
objs.forEach(it => {
it.comId = userStore.currentComId;
it.projectId = userStore.currentProId;
})
if (objs.length == 0) {
proxy.$modal.msgError("请输入节点名称!");
} else {
addBatch(objs).then(d => {
if (d.code == 200) {
proxy.$modal.msgSuccess("保存成功!");
getList();
} else {
proxy.$modal.msgError("保存失败!");
}
});
}
}
/** 删除按钮操作 */
function handleDelete(row) {
let _ids = [row.id];
if (!(row.nodeName && row.nodeName.trim())) {
let index = data.milestoneList.indexOf(row);
if (index >= 0) {
data.milestoneList.splice(index, 1);
}
return;
}
proxy.$modal.confirm('是否确认删除项目里程碑【' + row.nodeName + '】的数据项?').then(function () {
return delMilestone(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => { });
}
onMounted(() => {
queryParams.value.projectId = userStore.currentProId;
queryParams.value.comId = userStore.currentComId;
data.currentProId = userStore.currentProId;
getList();
});
</script>
<style lang="scss">
.project-milestone {
.data-list {
div.cell {
.el-date-editor {
width: 100%;
}
}
}
}
</style>

View File

@ -0,0 +1,376 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="节点名称" prop="nodeName">
<el-input
v-model="queryParams.nodeName"
placeholder="请输入节点名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="计划开始日期" prop="scheduledStart">
<el-date-picker clearable
v-model="queryParams.scheduledStart"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择计划开始日期">
</el-date-picker>
</el-form-item>
<el-form-item label="计划结束日期" prop="scheduledEnd">
<el-date-picker clearable
v-model="queryParams.scheduledEnd"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择计划结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="实际开始日期" prop="actualStart">
<el-date-picker clearable
v-model="queryParams.actualStart"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择实际开始日期">
</el-date-picker>
</el-form-item>
<el-form-item label="实际结束日期" prop="actualEnd">
<el-date-picker clearable
v-model="queryParams.actualEnd"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择实际结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="工期" prop="days">
<el-input
v-model="queryParams.days"
placeholder="请输入工期"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="${comment}" prop="isDel">
<el-input
v-model="queryParams.isDel"
placeholder="请输入${comment}"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="${comment}" prop="state">
<el-input
v-model="queryParams.state"
placeholder="请输入${comment}"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @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="Plus"
@click="handleAdd"
v-hasPermi="['manage:milestone:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['manage:milestone:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['manage:milestone:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['manage:milestone:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="milestoneList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="${comment}" align="center" prop="id" />
<el-table-column label="节点名称" align="center" prop="nodeName" />
<el-table-column label="计划开始日期" align="center" prop="scheduledStart" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.scheduledStart, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划结束日期" align="center" prop="scheduledEnd" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.scheduledEnd, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="实际开始日期" align="center" prop="actualStart" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.actualStart, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="实际结束日期" align="center" prop="actualEnd" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.actualEnd, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="工期" align="center" prop="days" />
<el-table-column label="说明" align="center" prop="explain" />
<el-table-column label="${comment}" align="center" prop="isDel" />
<el-table-column label="${comment}" align="center" prop="remark" />
<el-table-column label="${comment}" align="center" prop="state" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:milestone:edit']"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:milestone:remove']"></el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改项目里程碑对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="milestoneRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="节点名称" prop="nodeName">
<el-input v-model="form.nodeName" placeholder="请输入节点名称" />
</el-form-item>
<el-form-item label="计划开始日期" prop="scheduledStart">
<el-date-picker clearable
v-model="form.scheduledStart"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择计划开始日期">
</el-date-picker>
</el-form-item>
<el-form-item label="计划结束日期" prop="scheduledEnd">
<el-date-picker clearable
v-model="form.scheduledEnd"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择计划结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="实际开始日期" prop="actualStart">
<el-date-picker clearable
v-model="form.actualStart"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择实际开始日期">
</el-date-picker>
</el-form-item>
<el-form-item label="实际结束日期" prop="actualEnd">
<el-date-picker clearable
v-model="form.actualEnd"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择实际结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="工期" prop="days">
<el-input v-model="form.days" placeholder="请输入工期" />
</el-form-item>
<el-form-item label="说明" prop="explain">
<el-input v-model="form.explain" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="${comment}" prop="isDel">
<el-input v-model="form.isDel" placeholder="请输入${comment}" />
</el-form-item>
<el-form-item label="${comment}" prop="remark">
<el-input v-model="form.remark" placeholder="请输入${comment}" />
</el-form-item>
<el-form-item label="${comment}" prop="state">
<el-input v-model="form.state" placeholder="请输入${comment}" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Milestone">
import { listMilestone, getMilestone, delMilestone, addMilestone, updateMilestone } from "@/api/manage/milestone";
const { proxy } = getCurrentInstance();
const milestoneList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
nodeName: null,
scheduledStart: null,
scheduledEnd: null,
actualStart: null,
actualEnd: null,
days: null,
explain: null,
isDel: null,
state: null,
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询项目里程碑列表 */
function getList() {
loading.value = true;
listMilestone(queryParams.value).then(response => {
milestoneList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
id: null,
nodeName: null,
scheduledStart: null,
scheduledEnd: null,
actualStart: null,
actualEnd: null,
days: null,
explain: null,
isDel: null,
remark: null,
state: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
proxy.resetForm("milestoneRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加项目里程碑";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getMilestone(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改项目里程碑";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["milestoneRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateMilestone(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addMilestone(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除项目里程碑编号为"' + _ids + '"的数据项?').then(function() {
return delMilestone(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('manage/milestone/export', {
...queryParams.value
}, `milestone_${new Date().getTime()}.xlsx`)
}
getList();
</script>