Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into weicd
1 files added
24 files modified
| | |
| | | @NotNull |
| | | @ApiModelProperty(value = "绩效单金") |
| | | private BigDecimal performancePrice; |
| | | |
| | | @Column(name = "`performance_objectives`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "绩效目标") |
| | | private Double performanceObjectives; |
| | | |
| | | @Column(name = "`contract_price`",nullable = false) |
| | | @NotNull |
| | |
| | | */ |
| | | package me.zhengjie.modules.project.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.JoinColumn; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.Table; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | @Column(name = "`belong_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "生成日") |
| | | private Date belongDate; |
| | | private Timestamp belongDate; |
| | | |
| | | @ManyToOne |
| | | @JoinColumn(name = "`project_id`",nullable = false) |
| | |
| | | @ApiModelProperty(value = "总消耗工作量") |
| | | private Double workTotalCost; |
| | | |
| | | @Column(name = "`money_total_init`") |
| | | @ApiModelProperty(value = "计划总成本") |
| | | private BigDecimal moneyTotalInit; |
| | | |
| | | @Column(name = "`money_total_cost`") |
| | | @ApiModelProperty(value = "总消耗成本") |
| | | private BigDecimal moneyTotalCost; |
| | | |
| | | public void copy(ProjectProgress source) { |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | |
| | | @ApiModelProperty(value = "标准单价币种") |
| | | private String standardUnitCurrency; |
| | | |
| | | @Column(name = "`standard_unit_price`",nullable = false) |
| | | @Column(name = "`standard_quotation_price`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "标准单价金额") // TODO |
| | | private BigDecimal standardUnitPrice; |
| | | @ApiModelProperty(value = "标准报价单金") |
| | | private BigDecimal standardQuotationPrice; |
| | | |
| | | @Column(name = "`standard_profit_price`",nullable = false) |
| | | @Column(name = "`standard_performance_price`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "标准利润金额") // TODO |
| | | private BigDecimal standardProfitPrice; |
| | | @ApiModelProperty(value = "标准绩效单金") |
| | | private BigDecimal standardPerformancePrice; |
| | | |
| | | @Column(name = "`standard_performance_objectives`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "标准绩效目标") |
| | | private Double standardPerformanceObjectives; |
| | | |
| | | @Column(name = "`standard_workload_unit`",nullable = false) |
| | | @NotBlank |
| | |
| | | |
| | | /** |
| | | * 根据任务ID查询任务工时总和 |
| | | * @param taskId / |
| | | * @param id / |
| | | * @return / |
| | | */ |
| | | @Query(value = "SELECT COALESCE(SUM(project_cost), 0) AS totalLaborCost FROM project_cost WHERE project_id = ?1", nativeQuery = true) |
| | |
| | | Project findByIdUpdate(Long id); |
| | | |
| | | List<Project> findByProjectStatus(String projectStatus); |
| | | |
| | | List<Project> findByProjectStatusAndIdIn(String projectStatus, Long[] ids); |
| | | } |
| | |
| | | @Query(value = "SELECT * FROM project_task WHERE project_id = ?1", nativeQuery = true) |
| | | List<ProjectTask> findByProjectId(Long id); |
| | | |
| | | @Query(value = "SELECT MIN(plan_start_time) AS taskStartDate, MAX(plan_end_time) AS taskEndDate, SUM(plan_hours) AS totalTaskTime FROM project_task WHERE project_id = ?1", nativeQuery = true) |
| | | @Query(value = "SELECT MIN(plan_start_time) AS taskStartDate, MAX(plan_end_time) AS taskEndDate, COALESCE(SUM(plan_hours), 0) AS totalTaskTime FROM project_task WHERE project_id = ?1", nativeQuery = true) |
| | | ProjectTaskSummary findSummaryByProjectId(Long id); |
| | | } |
| | |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ProjectCostDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | BigDecimal calcUserCostByDate(Long userId, String enterProjectTime, String exitProjectTime, Map<String, Double> costHoursMap) throws Exception; |
| | | } |
| | |
| | | * @param year / |
| | | */ |
| | | List<Integer> queryWeeksSelection(Integer year); |
| | | |
| | | /** |
| | | * 生成周报 |
| | | * @param ids 项目ID |
| | | */ |
| | | void generateProjectProcess(Integer year, Integer weeks, Long[] ids); |
| | | } |
| | |
| | | |
| | | /** 绩效单金 */ |
| | | private BigDecimal performancePrice; |
| | | |
| | | /** 绩效目标 */ |
| | | private Double performanceObjectives; |
| | | |
| | | /** 合同金额 */ |
| | | private BigDecimal contractPrice; |
| | |
| | | package me.zhengjie.modules.project.service.dto; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectProgress; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | /** 本周消化工作量 */ |
| | | private Double workLastCost; |
| | | |
| | | /** 计划总成本 */ |
| | | private BigDecimal moneyTotalInit; |
| | | |
| | | /** 总消耗成本 */ |
| | | private BigDecimal moneyTotalCost; |
| | | |
| | | /** 上周进度 */ |
| | | private ProjectProgress lastProjectProcess; |
| | | |
| | | } |
| | |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | |
| | | import javax.persistence.Column; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | |
| | | /** 标准单价币种 */ |
| | | private String standardUnitCurrency; |
| | | |
| | | /** 标准单价金额 */ |
| | | private BigDecimal standardUnitPrice; // TODO |
| | | /** 标准报价单金 */ |
| | | private BigDecimal standardQuotationPrice; |
| | | |
| | | /** 标准利润金额 */ |
| | | private BigDecimal standardProfitPrice; // TODO |
| | | /** 标准绩效单金 */ |
| | | private BigDecimal standardPerformancePrice; |
| | | |
| | | /** 标准绩效目标 */ |
| | | private Double standardPerformanceObjectives; |
| | | |
| | | /** 标准工作量单位 */ |
| | | private String standardWorkloadUnit; |
| | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String name; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String standardUnitCurrency; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal calcUserCostByDate(Long userId, String enterProjectTime, String exitProjectTime, Map<String, Double> costHoursMap) throws Exception { |
| | | // 工资 |
| | | BigDecimal wageCost = BigDecimal.valueOf(0); |
| | | // 工作天数 |
| | | LocalDateTime enterProject = LocalDateTime.parse(enterProjectTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | LocalDateTime exitProject = LocalDateTime.parse(exitProjectTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date startDate = simpleDateFormat.parse(enterProjectTime); |
| | | Date endDate = simpleDateFormat.parse(exitProjectTime); |
| | | |
| | | // 通过id获取用户级别工资 |
| | | List<SysUserLevelWage> sysUserLevelWages = sysUserLevelWageRepository.findByUserId(userId) |
| | | .stream().filter(sysUserLevelWage -> !((sysUserLevelWage.getEndDate() != null && sysUserLevelWage.getEndDate().before(startDate)) || sysUserLevelWage.getStartDate().after(endDate))) |
| | | .collect(Collectors.toList()); |
| | | // 通过id获取用户级别保险 |
| | | List<SysUserLevelInsurance> sysUserLevelInsurances = sysUserLevelInsuranceRepository.findByUserId(userId) |
| | | .stream().filter(sysUserLevelInsurance -> !((sysUserLevelInsurance.getEndDate() != null && sysUserLevelInsurance.getEndDate().before(startDate)) || sysUserLevelInsurance.getStartDate().after(endDate))) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 判断是否有用户级别工资 |
| | | if(sysUserLevelWages.size() <= 0){ |
| | | throw new BadRequestException("此用户暂无级别工资"); |
| | | } |
| | | // 判断是否有用户级别保险 |
| | | if(sysUserLevelInsurances.size() <= 0){ |
| | | throw new BadRequestException("此用户暂无级别保险"); |
| | | } |
| | | |
| | | Map<Long, Double> sysUserLevelWageHoursMap = new HashMap<Long, Double>(); |
| | | for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) { |
| | | sysUserLevelWageHoursMap.put(sysUserLevelWage.getId(), 0.0); |
| | | } |
| | | |
| | | Map<Long, Double> sysUserLevelInsuranceHoursMap = new HashMap<Long, Double>(); |
| | | for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) { |
| | | sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getId(), 0.0); |
| | | } |
| | | |
| | | for (LocalDate currentLocalDate = enterProject.toLocalDate(); |
| | | currentLocalDate.isBefore(exitProject.toLocalDate()) || currentLocalDate.isEqual(exitProject.toLocalDate()); |
| | | currentLocalDate = currentLocalDate.plusDays(1)) { |
| | | |
| | | String dateStr = currentLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | if (!costHoursMap.containsKey(dateStr)) { |
| | | continue; |
| | | } |
| | | |
| | | Date currentDate = Date.from(currentLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); |
| | | |
| | | Double costHours = costHoursMap.get(dateStr); |
| | | |
| | | for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) { |
| | | if (sysUserLevelWage.getEndDate() == null || sysUserLevelWage.getEndDate().after(currentDate) || sysUserLevelWage.getEndDate().equals(currentDate)) { |
| | | sysUserLevelWageHoursMap.put(sysUserLevelWage.getId(), costHours + sysUserLevelWageHoursMap.get(sysUserLevelWage.getId())); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) { |
| | | if (sysUserLevelInsurance.getEndDate() == null || sysUserLevelInsurance.getEndDate().after(currentDate) || sysUserLevelInsurance.getEndDate().equals(currentDate)) { |
| | | sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getId(), costHours + sysUserLevelInsuranceHoursMap.get(sysUserLevelInsurance.getId())); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (Entry<Long, Double> entry : sysUserLevelWageHoursMap.entrySet()) { |
| | | SysUserLevelWage sysLevel = sysUserLevelWageRepository.findById(entry.getKey()).orElseGet(SysUserLevelWage::new); |
| | | wageCost = wageCost.add(sysLevel.getLevelWage().multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING)); |
| | | } |
| | | |
| | | for (Entry<Long, Double> entry : sysUserLevelInsuranceHoursMap.entrySet()) { |
| | | SysUserLevelInsurance sysLevel = sysUserLevelInsuranceRepository.findById(entry.getKey()).orElseGet(SysUserLevelInsurance::new); |
| | | |
| | | BigDecimal accumulationRadix = sysLevel.getAccumulationRadix().multiply(BigDecimal.valueOf(sysLevel.getAccumulationCompanyProportion() / 100)); |
| | | BigDecimal pensionRadix = sysLevel.getPensionRadix().multiply(BigDecimal.valueOf(sysLevel.getPensionCompanyProportion() / 100)); |
| | | BigDecimal medicalRadix = sysLevel.getMedicalRadix().multiply(BigDecimal.valueOf(sysLevel.getMedicalCompanyProportion() / 100)); |
| | | BigDecimal unemploymentRadix = sysLevel.getUnemploymentRadix().multiply(BigDecimal.valueOf(sysLevel.getUnemploymentCompanyProportion() / 100)); |
| | | BigDecimal maternityRadix = sysLevel.getMaternityRadix().multiply(BigDecimal.valueOf(sysLevel.getMaternityCompanyProportion() / 100)); |
| | | BigDecimal industrialInjuryRadix = sysLevel.getIndustrialInjuryRadix().multiply(BigDecimal.valueOf(sysLevel.getIndustrialInjuryCompanyProportion() / 100)); |
| | | |
| | | wageCost = wageCost.add(accumulationRadix.add(pensionRadix).add(medicalRadix).add(unemploymentRadix).add(maternityRadix).add(industrialInjuryRadix).multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING)); |
| | | } |
| | | |
| | | return wageCost; |
| | | } |
| | | |
| | | @Override |
| | | public ProjectCost getCost(ProjectCostQueryCriteria criteria) throws ParseException { |
| | | ProjectCost projectCost = new ProjectCost(); |
| | | // 工资 |
| | |
| | | |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findByHolidayDateBetween(simpleDateFormat.parse(criteria.getEnterProjectTime()), simpleDateFormat.parse(criteria.getExitProjectTime())); |
| | | |
| | | Map<Long, Long> sysUserLevelWageHoursMap = new HashMap<Long, Long>(); |
| | | Map<Long, Double> sysUserLevelWageHoursMap = new HashMap<Long, Double>(); |
| | | for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) { |
| | | sysUserLevelWageHoursMap.put(sysUserLevelWage.getLevelId(), 0L); |
| | | sysUserLevelWageHoursMap.put(sysUserLevelWage.getLevelId(), 0.0); |
| | | } |
| | | |
| | | Map<Long, Long> sysUserLevelInsuranceHoursMap = new HashMap<Long, Long>(); |
| | | Map<Long, Double> sysUserLevelInsuranceHoursMap = new HashMap<Long, Double>(); |
| | | for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) { |
| | | sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getLevelId(), 0L); |
| | | sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getLevelId(), 0.0); |
| | | } |
| | | |
| | | for (LocalDate currentLocalDate = enterProject.toLocalDate(); |
| | |
| | | |
| | | Date currentDate = Date.from(currentLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); |
| | | |
| | | Long costHours = 0L; |
| | | Double costHours = 0.0; |
| | | SysRosteringDto sysRostering = user.getSysRostering(); |
| | | |
| | | if (currentLocalDate.isEqual(enterProject.toLocalDate())) { |
| | |
| | | } |
| | | } |
| | | |
| | | for (Entry<Long, Long> entry : sysUserLevelWageHoursMap.entrySet()) { |
| | | for (Entry<Long, Double> entry : sysUserLevelWageHoursMap.entrySet()) { |
| | | SysLevel sysLevel = sysLevelRepository.findById(entry.getKey()).orElseGet(SysLevel::new); |
| | | wageCost = wageCost.add(sysLevel.getLevelWage().multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING)); |
| | | } |
| | | |
| | | for (Entry<Long, Long> entry : sysUserLevelInsuranceHoursMap.entrySet()) { |
| | | for (Entry<Long, Double> entry : sysUserLevelInsuranceHoursMap.entrySet()) { |
| | | SysLevel sysLevel = sysLevelRepository.findById(entry.getKey()).orElseGet(SysLevel::new); |
| | | |
| | | BigDecimal accumulationRadix = sysLevel.getAccumulationRadix().multiply(BigDecimal.valueOf(sysLevel.getAccumulationCompanyProportion() / 100)); |
| | |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.WeekFields; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | import me.zhengjie.modules.project.domain.ProjectProgress; |
| | | import me.zhengjie.modules.project.repository.ProjectProgressRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.ProjectCostService; |
| | | import me.zhengjie.modules.project.service.ProjectProgressService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectProgressDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectProgressQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectProgressMapper; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | |
| | | private final ProjectProgressMapper projectProgressMapper; |
| | | private final ProjectRepository projectRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | private final TaskRepository taskRepository; |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final ProjectCostService projectCostService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectProgressQueryCriteria criteria, Pageable pageable){ |
| | |
| | | .minusDays(7); |
| | | |
| | | Optional<ProjectProgress> projectProgressOpl = projectProgressRepository.findByBelongYearAndBelongWeekAndProjectId(localDate.get(wfs.weekBasedYear()), localDate.get(wfs.weekOfWeekBasedYear()), projectProgressDto.getProject().getId()); |
| | | |
| | | projectProgressDto.setLastProjectProcess(projectProgressOpl.orElseGet(ProjectProgress::new)); |
| | | if (!projectProgressOpl.isPresent()) { |
| | | projectProgressDto.setTimeLastCost(projectProgressDto.getTimeTotalCost()); |
| | | projectProgressDto.setWorkLastCost(projectProgressDto.getWorkTotalCost()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void generateProjectProcess(Integer year, Integer weeks, Long[] ids) { |
| | | |
| | | List<Project> projectList = null; |
| | | if (ids == null || ids.length == 0) { |
| | | projectList = projectRepository.findByProjectStatus(Constant.PROJECT_STATUS_UNDER_WAY); |
| | | } else { |
| | | projectList = projectRepository.findByProjectStatusAndIdIn(Constant.PROJECT_STATUS_UNDER_WAY, ids); |
| | | } |
| | | |
| | | WeekFields wfs = WeekFields.of(DayOfWeek.MONDAY, 4); |
| | | |
| | | // 根据项目ID查询项目信息 |
| | | LocalDate localDate = LocalDate.now() |
| | | .with(wfs.weekBasedYear(), year) |
| | | .with(wfs.weekOfWeekBasedYear(), weeks) |
| | | .with(wfs.dayOfWeek(), 1L) |
| | | .minusDays(7); |
| | | |
| | | projectList.forEach(project -> { |
| | | // 存在则更新,不存在则插入 |
| | | ProjectProgress projectProgress = projectProgressRepository.findByBelongYearAndBelongWeekAndProjectId(year, weeks, project.getId()).orElseGet(ProjectProgress::new); |
| | | if (projectProgress.getId() == null) { |
| | | projectProgress.setBelongYear(year); |
| | | projectProgress.setBelongWeek(weeks); |
| | | projectProgress.setBelongDate(Timestamp.valueOf(localDate.atStartOfDay())); |
| | | |
| | | projectProgress.setProject(project); |
| | | projectProgress.setApproveStatus(Constant.APPROVE_STATUS_UNRECOGNIZED); |
| | | } |
| | | |
| | | // 总工时 |
| | | Double timeTotalInit = 0.0; |
| | | // 总消化工时 |
| | | Double timeTotalCost = 0.0; |
| | | // 总工作量 |
| | | Double workTotalInit = 0.0; |
| | | // 总消耗工作量 |
| | | Double workTotalCost = 0.0; |
| | | // 真实时长 |
| | | Double realLastCost = 0.0; |
| | | List<Task> taskList = taskRepository.findByProjectIdUntilDate(project.getId(), projectProgress.getBelongDate()); |
| | | |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByProjectId(project.getId()); |
| | | Map<Long, List<TaskDaliy>> collectMap = taskDaliyList.stream().collect(Collectors.groupingBy(TaskDaliy::getUserId)); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | BigDecimal totalCost = BigDecimal.valueOf(0.0); |
| | | for (Entry<Long, List<TaskDaliy>> entry : collectMap.entrySet()) { |
| | | List<TaskDaliy> taskDaliyListSub = entry.getValue(); |
| | | Map<String, Double> costHourMap = new HashMap<String, Double>(); |
| | | taskDaliyListSub.forEach(taskDaliy -> { |
| | | costHourMap.put(sdf.format(taskDaliy.getFillDate()), taskDaliy.getConsumedHours()); |
| | | }); |
| | | String startDate = sdf.format(taskDaliyListSub.get(0).getFillDate()); |
| | | String endDate = sdf.format(taskDaliyListSub.get(taskDaliyListSub.size() - 1).getFillDate()); |
| | | try { |
| | | totalCost = totalCost.add(projectCostService.calcUserCostByDate(entry.getKey(), startDate + " 00:00:00", endDate + " 00:00:00", costHourMap)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | for (Task task : taskList) { |
| | | timeTotalInit = timeTotalInit + task.getPlanHours(); |
| | | workTotalInit = workTotalInit + (task.getPlanWorkload() == null ? 0.0 : task.getPlanWorkload()); |
| | | TaskDailyInterface taskDailyInterface = taskDaliyRepository.collectTaskDaliyUntilDate(task.getId(), projectProgress.getBelongDate()); |
| | | if (Constant.TASK_STATUS_COMPLETED.equals(task.getTaskStatus())) { |
| | | timeTotalCost += BigDecimal.valueOf(task.getPlanHours()).multiply(BigDecimal.valueOf(taskDailyInterface.getTaskProgress())).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_CEILING).doubleValue(); |
| | | } else { |
| | | timeTotalCost += task.getPlanHours(); |
| | | } |
| | | workTotalCost += taskDailyInterface.getConsumedWorkload(); |
| | | realLastCost += taskDailyInterface.getConsumedHours(); |
| | | } |
| | | // 真实时长 |
| | | projectProgress.setRealLastCost(realLastCost); |
| | | // 总消化工时 |
| | | projectProgress.setTimeTotalCost(timeTotalCost); |
| | | // 总工时 |
| | | projectProgress.setTimeTotalInit(timeTotalInit); |
| | | // 总消耗工作量 |
| | | projectProgress.setWorkTotalCost(workTotalCost); |
| | | // 总工作量 |
| | | projectProgress.setWorkTotalInit(workTotalInit); |
| | | // 计划总成本 |
| | | projectProgress.setMoneyTotalInit(project.getPerformancePrice().multiply(BigDecimal.valueOf(timeTotalInit))); |
| | | // 总消耗成本 |
| | | projectProgress.setMoneyTotalCost(totalCost); |
| | | |
| | | // 存在则更新,不存在则插入 |
| | | projectProgressRepository.save(projectProgress); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectProgressDto> queryAll(ProjectProgressQueryCriteria criteria){ |
| | | return projectProgressMapper.toDto(projectProgressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | |
| | | .with(wfs.weekBasedYear(), resources.getBelongYear()) |
| | | .with(wfs.weekOfWeekBasedYear(), resources.getBelongWeek()) |
| | | .with(wfs.dayOfWeek(), 1L); |
| | | resources.setBelongDate(Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())); |
| | | resources.setBelongDate(Timestamp.valueOf(localDate.atStartOfDay())); |
| | | } |
| | | return projectProgressMapper.toDto(projectProgressRepository.save(resources)); |
| | | } |
| | |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.modules.task.repository.TaskUserRepository; |
| | | import me.zhengjie.modules.task.service.TaskService; |
| | | import me.zhengjie.utils.FileUtil; |
| | |
| | | private final RoleService roleService; |
| | | private final TaskUserRepository taskUserRepository; |
| | | private final ProjectCostRepository projectCostRepository; |
| | | private final TaskRepository taskRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable){ |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateProjectAdmit(Long[] ids){ |
| | | for (Long id : ids) { |
| | | Project project = projectRepository.findByIdUpdate(id); |
| | |
| | | task.setRemarks(list.get(i).getRemarks()); |
| | | } |
| | | task.setPriority(Constant.PRIORITY_LOW); |
| | | taskService.create(task); |
| | | // 未开始 |
| | | task.setTaskStatus(Constant.TASK_STATUS_NOT_STARTED); |
| | | task.setPlanStartTime(list.get(i).getPlanStartTime()); |
| | | task.setPlanEndTime(list.get(i).getPlanEndTime()); |
| | | taskRepository.save(task); |
| | | } |
| | | } |
| | | } |
| | |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("名称", projectType.getName()); |
| | | map.put("标准单价币种", unitCurrency); |
| | | map.put("标准单价金额", projectType.getStandardUnitPrice()); |
| | | map.put("标准利润金额", projectType.getStandardProfitPrice()); |
| | | map.put("标准报价单金", projectType.getStandardQuotationPrice()); |
| | | map.put("标准绩效单金", projectType.getStandardPerformancePrice()); |
| | | map.put("标准绩效目标", projectType.getStandardPerformanceObjectives()); |
| | | map.put("标准工作量单位", workloadUnit); |
| | | map.put("备注", projectType.getRemarks()); |
| | | map.put("创建者", projectType.getCreateBy()); |
| | |
| | | package me.zhengjie.modules.quartz.task; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.WeekFields; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectProgress; |
| | | import me.zhengjie.modules.project.repository.ProjectProgressRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.modules.project.service.ProjectProgressService; |
| | | |
| | | /** |
| | | * 钉钉定时任务(取考勤记录) |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Async |
| | | public class WeekReportMethod { |
| | | |
| | | private final ProjectRepository projectRepository; |
| | | |
| | | private final ProjectProgressRepository projectProgressRepository; |
| | | |
| | | private final TaskRepository taskRepository; |
| | | |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final ProjectProgressService projectProgressService; |
| | | |
| | | /** |
| | | * 生成周报 |
| | | * @throws Exception |
| | | */ |
| | | public void createWeekReport() throws Exception { |
| | | // String date = null; |
| | | // LocalDate localDate = null; |
| | | // if (date == null) { |
| | | // localDate = LocalDate.now().with(wfs.dayOfWeek(), 1L); |
| | | // } else { |
| | | // localDate = LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | // } |
| | | |
| | | WeekFields wfs = WeekFields.of(DayOfWeek.MONDAY, 4); |
| | | LocalDate localDate = LocalDate.now().with(wfs.dayOfWeek(), 1L); |
| | |
| | | int year = localDate.minusDays(7).get(wfs.weekBasedYear()); |
| | | int weeks = localDate.minusDays(7).get(wfs.weekOfWeekBasedYear()); |
| | | |
| | | // 周初查询进行中的任务 TODO |
| | | // List<Project> projectList = projectRepository.findByProjectStatus(Constant.PROJECT_STATUS_UNDER_WAY); |
| | | List<Project> projectList = projectRepository.findAll(); |
| | | |
| | | projectList.forEach(project -> { |
| | | // 存在则更新,不存在则插入 |
| | | ProjectProgress projectProgress = projectProgressRepository.findByBelongYearAndBelongWeekAndProjectId(year, weeks, project.getId()).orElseGet(ProjectProgress::new); |
| | | if (projectProgress.getId() == null) { |
| | | projectProgress.setBelongYear(year); |
| | | projectProgress.setBelongWeek(weeks); |
| | | projectProgress.setBelongDate(Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())); |
| | | |
| | | projectProgress.setProject(project); |
| | | projectProgress.setApproveStatus(Constant.APPROVE_STATUS_UNRECOGNIZED); |
| | | } |
| | | |
| | | // 总工时 |
| | | Double timeTotalInit = 0.0; |
| | | // 总消化工时 |
| | | Double timeTotalCost = 0.0; |
| | | // 总工作量 |
| | | Double workTotalInit = 0.0; |
| | | // 总消耗工作量 |
| | | Double workTotalCost = 0.0; |
| | | // 真实时长 |
| | | Double realLastCost = 0.0; |
| | | List<Task> taskList = taskRepository.findByProjectIdUntilDate(project.getId(), projectProgress.getBelongDate()); |
| | | for (Task task : taskList) { |
| | | timeTotalInit = timeTotalInit + task.getPlanHours(); |
| | | workTotalInit = workTotalInit + (task.getPlanWorkload() == null ? 0.0 : task.getPlanWorkload()); |
| | | TaskDailyInterface taskDailyInterface = taskDaliyRepository.collectTaskDaliyUntilDate(task.getId(), projectProgress.getBelongDate()); |
| | | boolean flg = true; |
| | | if (flg) { // TODO 任务状态:未结束 task.getStatus() |
| | | timeTotalCost += BigDecimal.valueOf(task.getPlanHours()).multiply(BigDecimal.valueOf(taskDailyInterface.getTaskProgress())).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_CEILING).doubleValue(); |
| | | } else { |
| | | timeTotalCost += task.getPlanHours(); |
| | | } |
| | | workTotalCost += taskDailyInterface.getConsumedWorkload(); |
| | | realLastCost += taskDailyInterface.getConsumedHours(); |
| | | } |
| | | // 真实时长 |
| | | projectProgress.setRealLastCost(realLastCost); |
| | | // 总消化工时 |
| | | projectProgress.setTimeTotalCost(timeTotalCost); |
| | | // 总工时 |
| | | projectProgress.setTimeTotalInit(timeTotalInit); |
| | | // 总消耗工作量 |
| | | projectProgress.setWorkTotalCost(workTotalCost); |
| | | // 总工作量 |
| | | projectProgress.setWorkTotalInit(workTotalInit); |
| | | |
| | | // 存在则更新,不存在则插入 |
| | | projectProgressRepository.save(projectProgress); |
| | | }); |
| | | projectProgressService.generateProjectProcess(year, weeks, null); |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | Double getTaskProgress(); |
| | | |
| | | /** |
| | | * 员工ID |
| | | * @return |
| | | */ |
| | | Long getUserId(); |
| | | |
| | | /** |
| | | * 任务ID |
| | | * @return |
| | | */ |
| | | Long getTaskId(); |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.task.domain; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author 赵士淞 |
| | | * @date 2022-12-30 |
| | | **/ |
| | | public interface TaskDaliyCostGroupByUserInterface { |
| | | |
| | | /** |
| | | * 用户ID |
| | | * @return |
| | | */ |
| | | Long getUserId(); |
| | | |
| | | /** |
| | | * 消耗工时 |
| | | * @return |
| | | */ |
| | | Double getConsumedHours(); |
| | | } |
| | |
| | | List<TaskDaliy> findByProjectIdAndTaskId(Long projectId, Long taskId); |
| | | |
| | | /** |
| | | * 根据项目ID查询任务日报信息 |
| | | * @param projectId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM task_daliy WHERE project_id = ?1 ORDER BY user_id, fill_date ASC", nativeQuery = true) |
| | | List<TaskDaliy> findByProjectId(Long projectId); |
| | | |
| | | /** |
| | | * 根据项目ID、任务ID查询 |
| | | * @param projectId |
| | | * @param taskId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT user_id AS userId, COALESCE(SUM(consumed_hours), 0) AS consumedHours FROM task_daliy WHERE project_id = ?1 GROUP BY user_id", nativeQuery = true) |
| | | List<TaskDailyInterface> collectCostByProjectIdGroupUser(Long projectId); |
| | | |
| | | /** |
| | | * 根据项目ID、任务ID查询 |
| | | * @param projectId |
| | | * @param taskId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT user_id AS userId, task_id AS taskId, COALESCE(MAX(task_progress), 0) AS TaskProgress FROM task_daliy WHERE project_id = ?1 AND fill_date BETWEEN ?2 AND ?3 GROUP BY user_id, task_id", nativeQuery = true) |
| | | List<TaskDailyInterface> collectCostByProjectIdAndFillDateBetweenGroupUserAndTaskId(Long projectId, String sdate, String edate); |
| | | |
| | | |
| | | /** |
| | | * 根据项目ID、任务ID、用户ID查询总消耗工时、总消耗工作量、最大任务进度 |
| | | * @param projectId |
| | | * @param taskId |
| | |
| | | * @return |
| | | */ |
| | | List<TaskUser> findByTaskIdIn(List<Long> taskIds); |
| | | |
| | | /** |
| | | * 根据任务ID和员工ID查询 |
| | | * @param taskId |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | TaskUser findByTaskIdAndUserId(Long taskId, Long userId); |
| | | } |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.name" clearable placeholder="请输入名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.projectTypeId" clearable filterable placeholder="请选择项目类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.projectTypeId" clearable filterable placeholder="项目类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectTypeList" |
| | | :key="item.id" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.unitCurrency" clearable filterable placeholder="请选择单价币种" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.projectDistinguish" clearable filterable placeholder="项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.liableUserId" clearable filterable placeholder="请选择责任人" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.liableUserId" clearable filterable placeholder="责任人" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.projectStatus" clearable filterable placeholder="请选择项目状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.projectStatus" clearable filterable placeholder="项目状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[projectStatus]" |
| | | :key="item.id" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.approveStatus" clearable filterable placeholder="请选择批准状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.approveStatus" clearable filterable placeholder="批准状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[approveStatus]" |
| | | :key="item.id" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <date-range-picker v-model="query.planStartDate" class="date-item" @keyup.enter.native="crud.toQuery" /> |
| | | <date-range-picker v-model="query.planEndDate" class="date-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | |
| | | :disabled="crud.selections.length === 0" |
| | | @click="projectAdmit(crud.selections)" |
| | | >承认</el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.seeTask" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | :disabled="crud.selections.length !== 1" |
| | | style="margin-left: 4px !important;" |
| | | @click="toSeeTask(crud.selections[0])" |
| | | > |
| | | 查看任务 |
| | | </el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="690px"> |
| | | <el-form ref="form" :model="form" :rules="rules" :inline="true" size="small" label-width="110px"> |
| | | <el-divider>项目基本</el-divider> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" maxlength="100" style="width: 523px;" /> |
| | | <el-input v-model="form.name" style="width: 523px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目类型" prop="projectTypeId"> |
| | | <el-select v-model="form.projectTypeId" clearable filterable placeholder="请选择" style="width: 200px;" @change="projectTypeChange"> |
| | |
| | | <el-form-item label="需求说明"> |
| | | <el-input v-model="form.requirement" :rows="3" type="textarea" style="width: 523px;" /> |
| | | </el-form-item> |
| | | <el-divider>金额</el-divider> |
| | | <el-form-item label="报价单金" prop="quotationPrice"> |
| | | <money-input :key="random" v-model="form.quotationPrice" :width="200" /> |
| | | </el-form-item> |
| | |
| | | <money-input :key="random" v-model="form.performancePrice" :width="200" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效币种"> |
| | | <el-input value="人民币" maxlength="100" :disabled="true" style="width: 200px;" /> |
| | | <el-select v-model="standardUnitCurrencyRenminbi" clearable filterable placeholder="请选择" style="width: 200px;" disabled> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效目标" prop="performanceObjectives"> |
| | | <el-input :key="random" v-model="form.performanceObjectives" style="width: 200px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="合同金额" prop="contractPrice"> |
| | | <el-form-item label="合同总金额" prop="contractPrice"> |
| | | <money-input :key="random" v-model="form.contractPrice" :width="200" /> |
| | | </el-form-item> |
| | | <el-divider>项目其他</el-divider> |
| | | <el-form-item label="计划开始日期" prop="planStartDate"> |
| | | <el-date-picker v-model="form.planStartDate" style="width: 200px;" :picker-options="pickerOptionsStart" type="date" placeholder="选择日期" /> |
| | | <el-date-picker v-model="form.planStartDate" type="date" :picker-options="pickerOptionsStart" placeholder="选择日期" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划结束日期" prop="planEndDate"> |
| | | <el-date-picker v-model="form.planEndDate" type="date" :picker-options="pickerOptionsEnd" style="width: 200px;" placeholder="选择日期" /> |
| | | <el-date-picker v-model="form.planEndDate" type="date" :picker-options="pickerOptionsEnd" placeholder="选择日期" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="责任人"> |
| | | <el-select v-model="form.liableUserId" clearable filterable placeholder="请选择" style="width: 200px;"> |
| | |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 150%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" fixed="left" /> |
| | | <el-table-column prop="name" label="名称" show-overflow-tooltip fixed="left" width="130" /> |
| | | <el-table-column prop="projectTypeName" label="项目类型" width="130"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectTypeName" label="项目类型" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectTypeName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectDistinguish" label="项目区分" width="130"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectDistinguish" label="项目区分" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectDistinguish][scope.row.projectDistinguish] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="contractPrice" label="合同金额" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="requirement" label="需求说明" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractPrice" label="合同总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.contractPrice != null && scope.row.contractPrice != '' ? crud.toMoney(scope.row.contractPrice) : '' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="quotationPrice" label="报价金额" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="totalTaskTime" label="任务总工时" width="100" /> |
| | | <el-table-column label="报价"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="quotationPrice" label="单金" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tooltip class="item" effect="dark" :content="scope.row.quotationPrice + ' * ' + scope.row.totalTaskTime" placement="top"> |
| | | <span>{{ scope.row.quotationPrice != null && scope.row.quotationPrice != '' ? crud.toMoney(scope.row.quotationPrice * scope.row.totalTaskTime) : 0 }}</span> |
| | | </el-tooltip> |
| | | {{ crud.toMoney(scope.row.quotationPrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performancePrice" label="预算金额" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="unitCurrency" label="币种" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tooltip class="item" effect="dark" :content="scope.row.performancePrice + ' * ' + scope.row.totalTaskTime" placement="top"> |
| | | <span>{{ scope.row.performancePrice != null && scope.row.performancePrice != '' ? crud.toMoney(scope.row.performancePrice * scope.row.totalTaskTime) : 0 }}</span> |
| | | </el-tooltip> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][scope.row.unitCurrency] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="totalLaborCost" label="人力成本预算" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" label="总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.totalLaborCost != null && scope.row.totalLaborCost != '' ? crud.toMoney(scope.row.totalLaborCost) : '' }} |
| | | {{ crud.toMoney(scope.row.quotationPrice * scope.row.totalTaskTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceObjectives" label="绩效目标" width="120"> |
| | | </el-table-column> |
| | | <el-table-column label="绩效"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performancePrice" label="单金" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.performancePrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="币种" width="100"> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][standardUnitCurrencyRenminbi] }}</el-tag> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.performancePrice * scope.row.totalTaskTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performanceObjectives" label="绩效目标" width="80"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{ color: scope.row.performancePrice * scope.row.totalTaskTime * (1 - scope.row.performanceObjectives / 100) < scope.row.totalLaborCost ? 'red' : '' }"> |
| | | {{ (scope.row.performanceObjectives ? scope.row.performanceObjectives : 0) + '%' }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="liableUserName" label="责任人" width="80"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="totalLaborCost" label="项目总成本" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.liableUserName != null && scope.row.liableUserName != ''">{{ scope.row.liableUserName }}</el-tag> |
| | | <span :style="{ color: scope.row.performancePrice * scope.row.totalTaskTime < scope.row.totalLaborCost ? 'red' : '' }"> |
| | | {{ crud.toMoney(scope.row.totalLaborCost) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planStartDate" label="计划开始日期" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="liableUserName" label="责任人" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.liableUserName != null && scope.row.liableUserName != ''"> |
| | | {{ scope.row.liableUserName }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planStartDate" label="计划开始日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planStartDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planEndDate" label="计划结束日期" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planEndDate" label="计划结束日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planEndDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectStatus" label="项目状态" width="80"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectStatus" label="项目状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectStatus][scope.row.projectStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="approveStatus" label="批准状态" width="80"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="approveStatus" label="批准状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[approveStatus][scope.row.approveStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createTime" label="创建时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" width="140" /> |
| | | <el-table-column v-if="checkPer(['admin','project:edit','project:del'])" label="操作" width="180px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | |
| | | import pagination from '@crud/Pagination' |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import constant from '../../../utils/constant' |
| | | import DateRangePicker from '@/components/DateRangePicker' |
| | | |
| | | const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, liableUserId: null, planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'Project', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput, DateRangePicker }, |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.STANDARD_UNIT_CURRENCY, constant.PROJECT_DISTINGUISH, constant.PROJECT_STATUS, constant.APPROVE_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '项目', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }}) |
| | | return CRUD({ title: '项目详情', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }}) |
| | | }, |
| | | data() { |
| | | var checkUnitPrice = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('单价金额必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('单价金额必须大于0')) |
| | | } else if (value >= 10000000000) { |
| | | callback(new Error('单价金额必须小于1百亿')) |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 金额(十亿内)验证 |
| | | var priceValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 1000000000)) { |
| | | callback(new Error('请输入 十亿 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('单价金额不能为空')) |
| | | } |
| | | } |
| | | var checkTotalPrice = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('报价金额必须是数字')) |
| | | } else { |
| | | if (value < 0) { |
| | | callback(new Error('报价金额必须大于0')) |
| | | } else if (value >= 10000000000) { |
| | | callback(new Error('报价金额必须小于1百亿')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | // 比例(百内)验证 |
| | | var proportionValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d)(\.\d{1,2})?$|100$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一百 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | edit: ['admin', 'project:edit'], |
| | | del: ['admin', 'project:del'], |
| | | download: ['admin', 'project:download'], |
| | | admit: ['admin', 'project:admit'] |
| | | admit: ['admin', 'project:admit'], |
| | | seeTask: ['admin', 'project:seeTask'] |
| | | }, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | { max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | projectTypeId: [ |
| | | { required: true, message: '项目类型不能为空', trigger: 'change' } |
| | |
| | | { required: true, message: '单价币种不能为空', trigger: 'change' } |
| | | ], |
| | | quotationPrice: [ |
| | | { required: true, validator: checkUnitPrice, trigger: 'blur' } |
| | | { required: true, message: '报价单金不能为空', trigger: 'blur' }, |
| | | { validator: priceValidate, trigger: 'blur' } |
| | | ], |
| | | contractPrice: [ |
| | | { validator: checkTotalPrice, trigger: 'blur' } |
| | | performancePrice: [ |
| | | { required: true, message: '绩效单金不能为空', trigger: 'blur' }, |
| | | { validator: priceValidate, trigger: 'blur' } |
| | | ], |
| | | performanceObjectives: [ |
| | | { required: true, message: '绩效目标不能为空', trigger: 'blur' }, |
| | | { validator: proportionValidate, trigger: 'blur' } |
| | | ], |
| | | projectStatus: [ |
| | | { required: true, message: '项目状态不能为空', trigger: 'change' } |
| | |
| | | { key: 'name', display_name: '名称' }, |
| | | { key: 'projectTypeId', display_name: '项目类型' }, |
| | | { key: 'projectDistinguish', display_name: '项目区分' }, |
| | | { key: 'unitCurrency', display_name: '单价币种' }, |
| | | { key: 'liableUserId', display_name: '责任人' }, |
| | | { key: 'planStartDate', display_name: '计划开始日期' }, |
| | | { key: 'planEndDate', display_name: '计划结束日期' }, |
| | | { key: 'projectStatus', display_name: '项目状态' }, |
| | | { key: 'approveStatus', display_name: '批准状态' } |
| | | ], |
| | | // 标准单价币种 |
| | | standardUnitCurrency: constant.STANDARD_UNIT_CURRENCY, |
| | | // 标准单价币种:人民币 |
| | | standardUnitCurrencyRenminbi: constant.STANDARD_UNIT_CURRENCY_RENMINBI, |
| | | // 项目状态 |
| | | projectStatus: constant.PROJECT_STATUS, |
| | | // 批准状态 |
| | |
| | | // 选中结束时间之后不可选 |
| | | pickerOptionsStart: { |
| | | disabledDate: (time) => { |
| | | if (this.form.planEndDate) { |
| | | return time.getTime() > Date.now() || time.getTime() > this.form.planEndDate |
| | | } |
| | | return _this.form.planEndDate != null && _this.form.planEndDate !== '' ? time.getTime() > new Date(_this.form.planEndDate).getTime() : false |
| | | } |
| | | }, |
| | | // 选中开始时间之后不可选 |
| | | pickerOptionsEnd: { |
| | | disabledDate: (time) => { |
| | | return time.getTime() < this.form.planStartDate |
| | | return _this.form.planStartDate != null && _this.form.planStartDate !== '' ? time.getTime() < new Date(_this.form.planStartDate).getTime() : false |
| | | } |
| | | } |
| | | } |
| | |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取项目类型 |
| | | this.getPackageTypeAll() |
| | | // 获取责任人 |
| | | this.getUserListAll() |
| | | return true |
| | | }, |
| | |
| | | }, |
| | | // 获取项目类型 |
| | | getPackageTypeAll() { |
| | | // 获取项目类型 |
| | | crudProjectType.getAll().then(res => { |
| | | // 项目类型列表 |
| | | this.projectTypeList = res |
| | | }).catch(() => { |
| | | |
| | |
| | | }, |
| | | // 获取责任人 |
| | | getUserListAll() { |
| | | // 获取责任人 |
| | | crudUser.getAll().then(res => { |
| | | // 用户列表 |
| | | this.userList = res |
| | | }).catch(() => { |
| | | |
| | |
| | | // 单价币种赋值 |
| | | this.form.unitCurrency = res[0].standardUnitCurrency |
| | | // 单价金额赋值 |
| | | this.form.quotationPrice = res[0].standardUnitPrice |
| | | this.form.quotationPrice = res[0].standardQuotationPrice |
| | | // 单价金额赋值 |
| | | this.form.performancePrice = res[0].standardProfitPrice |
| | | this.form.performancePrice = res[0].standardPerformancePrice |
| | | // 绩效目标赋值 |
| | | this.form.performanceObjectives = res[0].standardPerformanceObjectives |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }) |
| | | }, |
| | |
| | | }, |
| | | // 项目承认 |
| | | projectAdmit(row) { |
| | | // 选中的id |
| | | this.ids = [] |
| | | // 判断是多个项目承认还是单个项目承认 |
| | | if (row.id !== undefined) { |
| | | this.$refs[`popover_${row.id}`].showPopper = false |
| | | // 选中的id |
| | | this.ids.push(row.id) |
| | | // 项目承认 |
| | | crudProject.editAdmit(this.ids).then(res => { |
| | |
| | | this.crud.refresh() |
| | | }) |
| | | } else { |
| | | // 确认框 |
| | | this.$confirm('此操作将承认' + row.length + '个项目, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'success' |
| | | }).then(() => { |
| | | // 循环选中数据 |
| | | for (let i = 0; i < row.length; i++) { |
| | | // 选中的id |
| | | this.ids.push(row[i].id) |
| | | // 判断循环是否结束 |
| | | if (i === row.length - 1) { |
| | | // 项目承认 |
| | | crudProject.editAdmit(this.ids).then(res => { |
| | | // 消息提示 |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '项目已承认!' |
| | | }) |
| | | for (let i = 0; i < row.length; i++) { |
| | | this.ids.push(row[i].id) |
| | | } |
| | | // 项目承认 |
| | | crudProject.editAdmit(this.ids).then(res => { |
| | | // 刷新数据 |
| | | this.crud.refresh() |
| | | }) |
| | | } |
| | | } |
| | | }).catch(() => { |
| | | // 消息提示 |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消项目承认' |
| | | }) |
| | | }) |
| | | } |
| | | }, |
| | | // 查看任务 |
| | | toSeeTask(data) { |
| | | // 跳转页面 |
| | | this.$router.push({ |
| | | name: 'ProjectTask', |
| | | params: { |
| | | projectId: data.id |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | |
| | | <el-tag>{{ dict.label[approveStatus][scope.row.approveStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="timeTotalInit" label="总绩效工时" align="center" width="100" /> |
| | | <el-table-column prop="timeTotalCost" label="总消耗绩效工时" align="center" width="120" /> |
| | | <el-table-column prop="timeLastCost" label="本周消化绩效工时" align="center" width="120" /> |
| | | <el-table-column prop="realLastCost" label="实际消化工时" align="center" width="100" /> |
| | | <el-table-column prop="workTotalInit" label="总工作量" align="center" width="100" /> |
| | | <el-table-column prop="workTotalCost" label="总消耗工作量" align="center" width="100" /> |
| | | <el-table-column prop="workLastCost" label="本周消化工作量" align="center" width="110" /> |
| | | <el-table-column prop="moneyTotalInit" label="计划总成本" align="center" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.moneyTotalInit != null && scope.row.moneyTotalInit != '' ? crud.toMoney(scope.row.moneyTotalInit) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.moneyTotalInit != null && scope.row.lastProjectProcess.moneyTotalInit != '' ? crud.toMoney(scope.row.moneyTotalInit - scope.row.lastProjectProcess.moneyTotalInit) : 0 }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="moneyTotalCost" label="总消耗成本" align="center" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.moneyTotalCost != null && scope.row.moneyTotalCost != '' ? crud.toMoney(scope.row.moneyTotalCost) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.moneyTotalCost != null && scope.row.lastProjectProcess.moneyTotalCost != '' ? crud.toMoney(scope.row.moneyTotalCost - scope.row.lastProjectProcess.moneyTotalCost) : 0 }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="realLastCost" label="本周消化工时" align="center" width="100" /> |
| | | <el-table-column prop="workTotalInit" label="总工作量" align="center" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.workTotalInit != null && scope.row.workTotalInit != '' ? crud.toMoney(scope.row.workTotalInit) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.workTotalInit != null && scope.row.lastProjectProcess.workTotalInit != '' ? crud.toMoney(scope.row.workTotalInit - scope.row.lastProjectProcess.workTotalInit) : 0 }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="workTotalCost" label="总消耗工作量" align="center" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.workTotalCost != null && scope.row.workTotalCost != '' ? crud.toMoney(scope.row.workTotalCost) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.workTotalCost != null && scope.row.lastProjectProcess.workTotalCost != '' ? crud.toMoney(scope.row.workTotalCost - scope.row.lastProjectProcess.workTotalCost) : 0 }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','projectProgress:edit','projectProgress:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <!-- <el-input v-model="query.projectId" clearable placeholder="项目ID" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> --> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.projectId" filterable placeholder="项目名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.projectId" clearable filterable placeholder="所属项目" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" maxlength="100" style="width: 340px;" /> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目名称" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" clearable filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务分类" prop="taskClassification"> |
| | | <el-select v-model="form.taskClassification" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-model="form.taskClassification" clearable filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[taskClassification]" |
| | | :key="item.id" |
| | |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="name" label="名称" width="180" show-overflow-tooltip /> |
| | | <el-table-column prop="projectName" label="项目名称" width="180" show-overflow-tooltip> |
| | | <el-table-column show-overflow-tooltip prop="name" label="名称" width="180" /> |
| | | <el-table-column show-overflow-tooltip prop="projectName" label="所属项目" width="180"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="taskClassification" label="任务分类" width="80" show-overflow-tooltip> |
| | | <el-table-column show-overflow-tooltip prop="taskClassification" label="任务分类" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskClassification][scope.row.taskClassification] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="description" label="描述" width="140" show-overflow-tooltip /> |
| | | <el-table-column prop="planStartTime" label="计划开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="planEndTime" label="计划结束时间" show-overflow-tooltip /> |
| | | <el-table-column prop="planHours" label="计划工时" width="100" show-overflow-tooltip /> |
| | | <el-table-column prop="planWorkload" label="计划工作量" width="100" show-overflow-tooltip /> |
| | | <el-table-column prop="planWorkloadUnit" label="计划工作量单位" width="120" show-overflow-tooltip> |
| | | <el-table-column show-overflow-tooltip prop="description" label="描述" width="140" /> |
| | | <el-table-column show-overflow-tooltip prop="planStartTime" label="计划开始时间" /> |
| | | <el-table-column show-overflow-tooltip prop="planEndTime" label="计划结束时间" /> |
| | | <el-table-column show-overflow-tooltip prop="planHours" label="计划工时" width="100" /> |
| | | <el-table-column show-overflow-tooltip prop="planWorkload" label="计划工作量" width="100" /> |
| | | <el-table-column show-overflow-tooltip prop="planWorkloadUnit" label="计划工作量单位" width="120"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="dict.label[standardWorkloadUnit][scope.row.planWorkloadUnit]!=null">{{ dict.label[standardWorkloadUnit][scope.row.planWorkloadUnit] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" width="140" /> |
| | | <el-table-column show-overflow-tooltip prop="remarks" label="备注" width="140" /> |
| | | <el-table-column show-overflow-tooltip prop="createTime" label="创建时间" width="140" /> |
| | | <el-table-column v-if="checkPer(['admin','projectTask:edit','projectTask:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | |
| | | return CRUD({ title: '项目任务', url: 'api/projectTask', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectTask }}) |
| | | }, |
| | | data() { |
| | | var planTime = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | var planWorkload = (rule, value, callback) => { |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 时长(千内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | { max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '项目名称不能为空', trigger: 'blur' } |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | ], |
| | | taskClassification: [ |
| | | { required: true, message: '任务分类不能为空', trigger: 'blur' } |
| | | { required: true, message: '任务分类不能为空', trigger: 'change' } |
| | | ], |
| | | planHours: [ |
| | | { required: true, validator: planTime, trigger: 'blur' } |
| | | { required: true, message: '计划工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | planWorkload: [ |
| | | { validator: planWorkload, trigger: 'blur' } |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectId', display_name: '项目名称' }, |
| | | { key: 'name', display_name: '名称' }, |
| | | { key: 'taskClassification', display_name: '任务分类' }, |
| | | { key: 'planStartTime', display_name: '计划开始时间' }, |
| | | { key: 'planEndTime', display_name: '计划结束时间' } |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'taskClassification', display_name: '任务分类' } |
| | | ], |
| | | // 字典:任务分类 |
| | | taskClassification: constant.TAST_CLASSIFICATION, |
| | |
| | | approveStatusAcknowledged: constant.APPROVE_STATUS_ACKNOWLEDGED, |
| | | // 项目列表 |
| | | projectList: [], |
| | | // 计划开始时间选项 |
| | | pickerOptionsStart: { |
| | | disabledDate: (time) => { |
| | | if (this.form.planEndTime) { |
| | | return time.getTime() > this.form.planEndTime |
| | | return _this.form.planEndTime != null && _this.form.planEndTime !== '' ? time.getTime() > new Date(_this.form.planEndTime).getTime() : false |
| | | } |
| | | } |
| | | }, |
| | | // 计划结束时间选项 |
| | | pickerOptionsEnd: { |
| | | disabledDate: (time) => { |
| | | return time.getTime() < this.form.planStartTime |
| | | return _this.form.planStartTime != null && _this.form.planStartTime !== '' ? time.getTime() < new Date(_this.form.planStartTime).getTime() - (86400000 - 1) : false |
| | | } |
| | | } |
| | | } |
| | |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 判断传参是否为空 |
| | | if (this.$route.params.projectId != null && this.$route.params.projectId !== '' && this.crud.query.projectId === undefined) { |
| | | // 检索条件赋值 |
| | | this.$set(this.crud.query, 'projectId', Number(this.$route.params.projectId)) |
| | | } |
| | | // 获取信息项目列表 |
| | | this.getprojectAll() |
| | | return true |
| | | }, |
| | |
| | | }, |
| | | // 获取信息项目列表 |
| | | getprojectAll() { |
| | | // 获取信息项目列表 |
| | | crudProject.getAll().then(res => { |
| | | // 项目列表 |
| | | this.projectList = res |
| | | }) |
| | | } |
| | |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.name" clearable placeholder="请输入名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.standardUnitCurrency" filterable placeholder="请选择标准单价币种" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <rrOperation /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="标准单价金额" prop="standardUnitPrice"> |
| | | <money-input :key="random" v-model="form.standardUnitPrice" :width="330" /> |
| | | <el-form-item label="标准报价单金" prop="standardQuotationPrice"> |
| | | <money-input :key="random" v-model="form.standardQuotationPrice" :width="330" /> |
| | | </el-form-item> |
| | | <el-form-item label="标准利润金额" prop="standardProfitPrice"> |
| | | <money-input :key="random" v-model="form.standardProfitPrice" :width="330" /> |
| | | <el-form-item label="标准绩效单金" prop="standardPerformancePrice"> |
| | | <money-input :key="random" v-model="form.standardPerformancePrice" :width="330" /> |
| | | </el-form-item> |
| | | <el-form-item label="标准绩效目标" prop="standardPerformanceObjectives"> |
| | | <el-input v-model="form.standardPerformanceObjectives" filterable placeholder="请输入绩效目标" style="width: 330px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="标准工作量单位" prop="standardWorkloadUnit"> |
| | | <el-select v-model="form.standardWorkloadUnit" filterable placeholder="请选择" style="width: 330px;"> |
| | |
| | | <el-tag>{{ dict.label[standardUnitCurrency][scope.row.standardUnitCurrency] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="standardUnitPrice" label="标准单价金额"> |
| | | <el-table-column prop="standardQuotationPrice" label="标准报价单金"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.standardUnitPrice) }} |
| | | {{ crud.toMoney(scope.row.standardQuotationPrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="standardProfitPrice" label="标准利润金额"> |
| | | <el-table-column prop="standardPerformancePrice" label="标准绩效单金"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.standardProfitPrice) }} |
| | | {{ crud.toMoney(scope.row.standardPerformancePrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="standardPerformanceObjectives" label="标准绩效目标"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.standardPerformanceObjectives }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="standardWorkloadUnit" label="标准工作量单位"> |
| | |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import constant from '../../../utils/constant' |
| | | |
| | | const defaultForm = { id: null, name: null, standardUnitCurrency: null, standardUnitPrice: null, standardProfitPrice: null, standardWorkloadUnit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, name: null, standardUnitCurrency: null, standardQuotationPrice: null, standardPerformancePrice: null, standardPerformanceObjectives: null, standardWorkloadUnit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'ProjectType', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | |
| | | return CRUD({ title: '项目类型', url: 'api/projectType', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectType }}) |
| | | }, |
| | | data() { |
| | | var checkStandardUnitPricet = (rule, value, callback) => { |
| | | var checkStandardQuotationPrice = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('标准单价金额必须是数字')) |
| | | callback(new Error('标准报价单金必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('标准单价金额必须大于0')) |
| | | callback(new Error('标准报价单金必须大于0')) |
| | | } else if (value >= 10000000000) { |
| | | callback(new Error('标准单价金额必须小于1百亿')) |
| | | callback(new Error('标准报价单金必须小于1百亿')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('标准单价金额不能为空')) |
| | | callback(new Error('标准报价单金不能为空')) |
| | | } |
| | | } |
| | | var checkStandardProfitPrice = (rule, value, callback) => { |
| | | var checkStandardPerformancePrice = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('标准利润金额必须是数字')) |
| | | callback(new Error('标准绩效单金必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('标准利润金额必须大于0')) |
| | | callback(new Error('标准绩效单金必须大于0')) |
| | | } else if (value >= 10000000000) { |
| | | callback(new Error('标准利润金额必须小于1百亿')) |
| | | callback(new Error('标准绩效单金必须小于1百亿')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('标准利润金额不能为空')) |
| | | callback(new Error('标准绩效单金不能为空')) |
| | | } |
| | | } |
| | | // 比例(百内)验证 |
| | | var proportionValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d)(\.\d{1,2})?$|100$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一百 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | |
| | | standardUnitCurrency: [ |
| | | { required: true, message: '标准单价币种不能为空', trigger: 'blur' } |
| | | ], |
| | | standardUnitPrice: [ |
| | | { required: true, validator: checkStandardUnitPricet, trigger: 'blur' } |
| | | standardQuotationPrice: [ |
| | | { required: true, validator: checkStandardQuotationPrice, trigger: 'blur' } |
| | | ], |
| | | standardProfitPrice: [ |
| | | { required: true, validator: checkStandardProfitPrice, trigger: 'blur' } |
| | | standardPerformancePrice: [ |
| | | { required: true, validator: checkStandardPerformancePrice, trigger: 'blur' } |
| | | ], |
| | | standardPerformanceObjectives: [ |
| | | { required: true, validator: proportionValidate, trigger: 'blur' } |
| | | ], |
| | | standardWorkloadUnit: [ |
| | | { required: true, message: '标准工作量单位不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'name', display_name: '名称' }, |
| | | { key: 'standardUnitCurrency', display_name: '标准单价币种' } |
| | | { key: 'name', display_name: '名称' } |
| | | ], |
| | | // 标准单价币种 |
| | | standardUnitCurrency: constant.STANDARD_UNIT_CURRENCY, |