Merge remote-tracking branch 'origin/1.2.0' into 1.2.0
commit
6609b8e5f6
|
@ -1,5 +1,7 @@
|
|||
package cn.palmte.work.bean;
|
||||
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
|
||||
/**
|
||||
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
|
||||
*/
|
||||
|
@ -48,4 +50,21 @@ public enum StatusEnum {
|
|||
}
|
||||
throw new IllegalArgumentException("Unkown status:"+status);
|
||||
}
|
||||
|
||||
|
||||
public static StatusEnum parseByProcDefId(String proDefId){
|
||||
if(proDefId.startsWith(ActProcessKeyEnum.ESTIMATE.getKey())){
|
||||
return ESTIMATE_ACCOUNTS;
|
||||
}
|
||||
if(proDefId.startsWith(ActProcessKeyEnum.BUDGET.getKey())){
|
||||
return BUDGET_ACCOUNTS;
|
||||
}
|
||||
if(proDefId.startsWith(ActProcessKeyEnum.SETTLE.getKey())){
|
||||
return SETTLE_ACCOUNTS;
|
||||
}
|
||||
if(proDefId.startsWith(ActProcessKeyEnum.FINAL.getKey())){
|
||||
return FINAL_ACCOUNTS;
|
||||
}
|
||||
throw new IllegalArgumentException("Unkown proDefId:"+ proDefId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程审批类型枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ActApproveTypeEnum {
|
||||
APPROVAL_PASSED(2, "审核通过"),
|
||||
APPROVAL_UN_PASS(3, "审核不通过");
|
||||
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
||||
ActApproveTypeEnum(int type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ActApproveTypeEnum ofType(int type) {
|
||||
if (type == APPROVAL_PASSED.getType()) {
|
||||
return APPROVAL_PASSED;
|
||||
} else if (type == APPROVAL_UN_PASS.getType()) {
|
||||
return APPROVAL_UN_PASS;
|
||||
} else {
|
||||
throw new ResponseException("不支持的审批类型【" + type + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,33 +7,6 @@ public class ActConstant {
|
|||
*/
|
||||
public static final String START_PROCESS_USERID = "startUserId";
|
||||
|
||||
|
||||
public static final String PROC_INS_ID = "procInsId";
|
||||
public static final String PROC_DEF_KEY = "procDefKey";
|
||||
|
||||
|
||||
/**
|
||||
* 结束节点
|
||||
*/
|
||||
public static final int TASK_INDEX_END = -1;
|
||||
|
||||
|
||||
/**
|
||||
* 0-未知或者其他节点
|
||||
*/
|
||||
public static final int TASK_INDEX_OTHER = 0;
|
||||
|
||||
/**
|
||||
* 开始节点
|
||||
*/
|
||||
public static final int TASK_INDEX_START = 1;
|
||||
|
||||
/**
|
||||
* 发起审批节点
|
||||
*/
|
||||
public static final int TASK_INDEX_FIRST_USER_TASK = 2;
|
||||
|
||||
|
||||
/**
|
||||
* 单实例 或签
|
||||
*/
|
||||
|
@ -44,60 +17,12 @@ public class ActConstant {
|
|||
public static final int TASK_TYPE_MULTI = 1;
|
||||
|
||||
|
||||
/**
|
||||
* 会签任务总数
|
||||
*/
|
||||
public static final String NUMBER_OF_INSTANCES = "nrOfInstances";
|
||||
|
||||
/**
|
||||
* 活动的会签任务数
|
||||
*/
|
||||
public static final String NUMBER_OF_ACTIVE_INSTANCES = "nrOfActiveInstances";
|
||||
|
||||
/**
|
||||
* 完成会签任务数
|
||||
*/
|
||||
public static final String NUMBER_OF_COMPLETED_INSTANCES = "nrOfCompletedInstances";
|
||||
|
||||
|
||||
/**
|
||||
* 概算
|
||||
*/
|
||||
public static final String PROCESS_DEFKEY_ESTIMATE = "estimate";
|
||||
|
||||
public static final String PROCESS_TASKS_ESTIMATE = "填报概算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
||||
public static final String PROCESS_TASKS_BUDGET = "填报预算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
||||
public static final String PROCESS_TASKS_SETTLE = "填报结算#财务总监";
|
||||
public static final String PROCESS_TASKS_FINAL = "填报决算#工程管理部#产品系统集成部#财务人员#财务总监#总经理#执行董事";
|
||||
|
||||
/**
|
||||
* 预算
|
||||
*/
|
||||
public static final String PROCESS_DEFKEY_BUDGET = "budget";
|
||||
/**
|
||||
* 结算
|
||||
*/
|
||||
public static final String PROCESS_DEFKEY_SETTLE = "settle";
|
||||
/**
|
||||
* 决算
|
||||
*/
|
||||
public static final String PROCESS_DEFKEY_FINAL = "final";
|
||||
|
||||
public static final String KEY_PROJECT_ID = "projectId";
|
||||
public static final String KEY_PROJECT_TYPE = "projectType";
|
||||
|
||||
public static final String PROCESS_DEFKEY_SALE_CONTRACT = "saleContract";
|
||||
public static final String PROCESS_DEFKEY_BUSINESS_PURCHASE = "businessPurchase";
|
||||
|
||||
|
||||
//发起人部门主管
|
||||
public static final int CANDIDATE_TYPE_START_USER_LEADER = 1;
|
||||
|
||||
|
||||
//四算项目
|
||||
public static final int PROJECT_TYPE_FOURCAL = 0;
|
||||
//销售合同
|
||||
public static final int PROJECT_TYPE_SALE_CONTRACT = 1;
|
||||
//业务采购
|
||||
public static final int PROJECT_TYPE_BUSINESS_PURCHASE = 2;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程定义key枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ActProcessKeyEnum {
|
||||
ESTIMATE("estimate", "概算审批流程"),
|
||||
BUDGET("budget", "预算审批流程"),
|
||||
SETTLE("settle", "结算审批流程"),
|
||||
FINAL("final", "决算审批流程"),
|
||||
SALE_CONTRACT("saleContract", "销售合同审批流程"),
|
||||
BUSINESS_PURCHASE("businessPurchase", "业务采购审批流程");
|
||||
|
||||
|
||||
private String key;
|
||||
private String name;
|
||||
|
||||
ActProcessKeyEnum(String key, String name) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ActProcessKeyEnum ofKey(String key) {
|
||||
if (ESTIMATE.getKey().equals(key)) {
|
||||
return ESTIMATE;
|
||||
} else if (BUDGET.getKey().equals(key)) {
|
||||
return BUDGET;
|
||||
} else if (SETTLE.getKey().equals(key)) {
|
||||
return SETTLE;
|
||||
} else if (FINAL.getKey().equals(key)) {
|
||||
return FINAL;
|
||||
} else if (SALE_CONTRACT.getKey().equals(key)) {
|
||||
return SALE_CONTRACT;
|
||||
} else if (BUSINESS_PURCHASE.getKey().equals(key)) {
|
||||
return BUSINESS_PURCHASE;
|
||||
} else {
|
||||
throw new ResponseException("不支持的流程key【" + key + "】");
|
||||
}
|
||||
}
|
||||
|
||||
public static ActProcessKeyEnum ofProcDefId(String proDefId) {
|
||||
if (proDefId.startsWith(ESTIMATE.getKey())) {
|
||||
return ESTIMATE;
|
||||
} else if (proDefId.startsWith(BUDGET.getKey())) {
|
||||
return BUDGET;
|
||||
} else if (proDefId.startsWith(SETTLE.getKey())) {
|
||||
return SETTLE;
|
||||
} else if (proDefId.startsWith(FINAL.getKey())) {
|
||||
return FINAL;
|
||||
} else if (proDefId.startsWith(SALE_CONTRACT.getKey())) {
|
||||
return SALE_CONTRACT;
|
||||
} else if (proDefId.startsWith(BUSINESS_PURCHASE.getKey())) {
|
||||
return BUSINESS_PURCHASE;
|
||||
} else {
|
||||
throw new ResponseException("不支持的流程key【" + proDefId + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程里的项目类型枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ActProjectTypeEnum {
|
||||
FOURCAL(0, "四算项目"),
|
||||
SALE_CONTRACT(1, "销售合同项目"),
|
||||
BUSINESS_PURCHASE(2, "业务采购项目");
|
||||
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
||||
ActProjectTypeEnum(int type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ActProjectTypeEnum ofType(int type) {
|
||||
if (type == FOURCAL.getType()) {
|
||||
return FOURCAL;
|
||||
} else if (type == SALE_CONTRACT.getType()) {
|
||||
return SALE_CONTRACT;
|
||||
} else if (type == BUSINESS_PURCHASE.getType()) {
|
||||
return BUSINESS_PURCHASE;
|
||||
} else {
|
||||
throw new ResponseException("不支持的项目类型【" + type + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程里的节点类型枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum ActTaskIndexEnum {
|
||||
END(-1, "结束节点"),
|
||||
COMMON(0, "除发起审批外的用户节点"),
|
||||
START(1, "开始节点"),
|
||||
FIRST_USER_TASK(2, "发起审批节点");
|
||||
|
||||
|
||||
private int index;
|
||||
private String name;
|
||||
|
||||
ActTaskIndexEnum(int index, String name) {
|
||||
this.index = index;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ActTaskIndexEnum ofIndex(int index) {
|
||||
if (index == END.getIndex()) {
|
||||
return END;
|
||||
} else if (index == COMMON.getIndex()) {
|
||||
return COMMON;
|
||||
} else if (index == START.getIndex()) {
|
||||
return START;
|
||||
} else if (index == FIRST_USER_TASK.getIndex()) {
|
||||
return FIRST_USER_TASK;
|
||||
} else {
|
||||
throw new ResponseException("不支持的节点类型【" + index + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package cn.palmte.work.config.activiti;
|
||||
|
||||
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 审批人设置枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum CandidateTypeEnum {
|
||||
USER(0, "按用户设置审批人"),
|
||||
ROLE(1, "按角色设置审批人"),
|
||||
STARTER_LEADER(2, "按发起人部门领导设置审批人");
|
||||
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
||||
CandidateTypeEnum(int type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static CandidateTypeEnum ofType(int type) {
|
||||
if (type == USER.getType()) {
|
||||
return USER;
|
||||
} else if (type == ROLE.getType()) {
|
||||
return ROLE;
|
||||
} else if (type == STARTER_LEADER.getType()) {
|
||||
return STARTER_LEADER;
|
||||
} else {
|
||||
throw new ResponseException("不支持的类型【" + type + "】");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -76,7 +76,7 @@ public class ActTaskDefController extends BaseController {
|
|||
|
||||
|
||||
/**
|
||||
* 完成某个任务
|
||||
* 管理员完成某个任务
|
||||
* 审批通过或者驳回
|
||||
*
|
||||
* @return
|
||||
|
|
|
@ -9,28 +9,27 @@ import org.springframework.data.domain.ExampleMatcher;
|
|||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -41,15 +40,19 @@ import javax.persistence.TypedQuery;
|
|||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import cn.palmte.work.config.activiti.ActApproveTypeEnum;
|
||||
import cn.palmte.work.config.activiti.ActProjectTypeEnum;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.model.DeptRepository;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.model.ProjectBudgetIncomeDetail;
|
||||
import cn.palmte.work.model.ProjectRepository;
|
||||
import cn.palmte.work.model.ProjectTaskRecord;
|
||||
import cn.palmte.work.model.enums.CooperationType;
|
||||
import cn.palmte.work.model.enums.Enumerable;
|
||||
import cn.palmte.work.model.enums.ProcessStatus;
|
||||
import cn.palmte.work.model.enums.ProcessType;
|
||||
import cn.palmte.work.model.enums.ProcurementMode;
|
||||
import cn.palmte.work.model.enums.ProjectType;
|
||||
import cn.palmte.work.model.enums.SealType;
|
||||
import cn.palmte.work.model.process.ProcessAttachment;
|
||||
|
@ -59,11 +62,12 @@ import cn.palmte.work.model.process.ProjectProcessRepository;
|
|||
import cn.palmte.work.model.process.SaleContract;
|
||||
import cn.palmte.work.model.process.SealTypeArray;
|
||||
import cn.palmte.work.model.process.form.ProcessQueryForm;
|
||||
import cn.palmte.work.model.process.form.SaleContractDetailForm;
|
||||
import cn.palmte.work.model.process.form.SaleContractProcessForm;
|
||||
import cn.palmte.work.model.process.form.ProcessUpdateForm;
|
||||
import cn.palmte.work.model.process.form.ProcessCreationForm;
|
||||
import cn.palmte.work.service.ProjectBudgetService;
|
||||
import cn.palmte.work.service.ProjectInstanceService;
|
||||
import cn.palmte.work.service.ProjectProcessService;
|
||||
import cn.palmte.work.service.ProjectTaskRecordService;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -89,6 +93,7 @@ public class ProcessController {
|
|||
private final ProjectProcessRepository repository;
|
||||
private final ProjectInstanceService projectInstanceService;
|
||||
private final ProjectProcessService processService;
|
||||
private final ProjectTaskRecordService projectTaskRecordService;
|
||||
|
||||
static class FormMetadata {
|
||||
// 部门
|
||||
|
@ -116,10 +121,23 @@ public class ProcessController {
|
|||
@GetMapping("/new")
|
||||
public String newProcess(Model model) {
|
||||
model.addAttribute("sealTypes", SealType.values());
|
||||
model.addAttribute("procurementMode", ProcurementMode.values());
|
||||
model.addAttribute("taxRate", Arrays.asList(0, 1, 3, 4, 5, 6, 9, 10, 13));
|
||||
return "/admin/business/process-new";
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑流程
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String editProcess(Model model, @PathVariable int id) {
|
||||
model.addAttribute("sealTypes", SealType.values());
|
||||
model.addAttribute("procurementMode", ProcurementMode.values());
|
||||
model.addAttribute("taxRate", Arrays.asList(0, 1, 3, 4, 5, 6, 9, 10, 13));
|
||||
model.addAttribute("processId", id);
|
||||
return "/admin/business/process-edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 已办流程
|
||||
*/
|
||||
|
@ -164,7 +182,7 @@ public class ProcessController {
|
|||
model.addAttribute("contract", contract);
|
||||
break;
|
||||
}
|
||||
case business_procurement: {
|
||||
case procurement_contract: {
|
||||
TypedQuery<ProcurementContract> query = entityManager.createQuery(
|
||||
"from ProcurementContract where processId=:processId", ProcurementContract.class);
|
||||
query.setParameter("processId", process.getId());
|
||||
|
@ -181,9 +199,7 @@ public class ProcessController {
|
|||
}
|
||||
|
||||
private BigDecimal getRepaidAmount(int id) {
|
||||
Map<String, Object> map = jdbcTemplate.queryForMap(
|
||||
"select ifnull(sum(underwritten_plan), 0) repaidAmount from project_budget_plan_detail where project_id = ?", id);
|
||||
return (BigDecimal) map.values().iterator().next();
|
||||
return processService.getProjectRepaidAmount(id);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
|
@ -232,6 +248,9 @@ public class ProcessController {
|
|||
|
||||
// 预算毛利率
|
||||
public BigDecimal budgetGrossMargin;
|
||||
|
||||
public Object contract;
|
||||
public ProjectProcess process;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
|
@ -261,16 +280,56 @@ public class ProcessController {
|
|||
.build();
|
||||
}
|
||||
|
||||
private static String isPrepaid(Project project) {
|
||||
return project.getUnderwrittenMode() == 2 || project.getUnderwrittenMode() == 3 ? "是" : "否";
|
||||
private String isPrepaid(Project project) {
|
||||
return processService.isProjectPrepaid(project) ? "是" : "否";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("/{id}")
|
||||
public ProjectReturnValue get(@PathVariable int id) {
|
||||
ProjectProcess process = processService.getById(id);
|
||||
Project project = projectRepository.findById(process.getProjectId());
|
||||
BigDecimal repaidAmount = getRepaidAmount(id);
|
||||
Object contract;
|
||||
switch (process.getProcessType()) {
|
||||
case sale_contract: {
|
||||
contract = processService.findSaleContract(process.getId());
|
||||
break;
|
||||
}
|
||||
case procurement_contract: {
|
||||
contract = processService.findProcurementContract(process.getId());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new UnsupportedOperationException("还不支持");
|
||||
}
|
||||
|
||||
// 可以在对应表数据查询 是否存在再启用
|
||||
List<ProjectBudgetIncomeDetail> incomeDetails = projectBudgetService.getBudgetIncomeDetail(project);
|
||||
return ProjectReturnValue.builder()
|
||||
.process(process)
|
||||
.contract(contract)
|
||||
.isPrepaid(isPrepaid(project))
|
||||
.projectId(project.getId())
|
||||
.incomeDetails(incomeDetails)
|
||||
.projectName(project.getName())
|
||||
.repaidAmount(repaidAmount + "元")
|
||||
.budgetGrossMargin(project.getGrossProfitMargin())
|
||||
.projectNo(project.getProjectNo())
|
||||
.applyPersonName(process.getApplyPersonName())
|
||||
.contractAmount(project.getContractAmount())
|
||||
.terminalCustomer(project.getTerminalCustomer())
|
||||
.projectType(Enumerable.of(ProjectType.class, project.getType()).getDescription())
|
||||
.cooperationType(Enumerable.of(CooperationType.class, project.getCooperateType()).getDescription())
|
||||
.build();
|
||||
}
|
||||
|
||||
// 销售合同流程
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping
|
||||
@Transactional
|
||||
public void post(@RequestBody @Valid SaleContractProcessForm form) throws Exception {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void post(@RequestBody @Valid ProcessCreationForm form) throws Exception {
|
||||
ProjectProcess entity = new ProjectProcess();
|
||||
BeanUtils.copyProperties(form, entity, "sealTypes", "applyDate", "applyDept", "attachments");
|
||||
entity.setApplyDate(LocalDate.parse(form.getApplyDate(), formatter));
|
||||
|
@ -280,63 +339,74 @@ public class ProcessController {
|
|||
entity.setApplyPersonId(admin.getId());
|
||||
entity.setAttachmentUri(JSON.toJSONString(form.getAttachments()));
|
||||
|
||||
if (entity.getStatus() == null) {
|
||||
entity.setStatus(ProcessStatus.to_be_audit);
|
||||
}
|
||||
|
||||
entityManager.persist(entity);
|
||||
|
||||
HashMap<String, Object> variables = new HashMap<>();
|
||||
if (entity.getProcessType() != null) {
|
||||
switch (entity.getProcessType()) {
|
||||
case sale_contract:
|
||||
SaleContract saleContract = SaleContract.from(form);
|
||||
saleContract.setProcessId(entity.getId());
|
||||
entityManager.persist(saleContract);
|
||||
variables.put("contract", saleContract);
|
||||
break;
|
||||
case business_procurement:
|
||||
case procurement_contract:
|
||||
ProcurementContract procurementContract = ProcurementContract.from(form);
|
||||
procurementContract.setProcessId(entity.getId());
|
||||
entityManager.persist(procurementContract);
|
||||
variables.put("contract", procurementContract);
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("还不支持");
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.getStatus() == ProcessStatus.to_be_audit) {
|
||||
variables.put("process", entity);
|
||||
switch (entity.getProcessType()) {
|
||||
case sale_contract:
|
||||
projectInstanceService.startSaleContractProcess(entity.getId(), variables);
|
||||
break;
|
||||
case business_procurement:
|
||||
projectInstanceService.startBusinessPurchaseProcess(entity.getId(), variables);
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("还不支持");
|
||||
processService.updateIncomeDetails(form.getIncomeDetails());
|
||||
|
||||
if (form.getStatus() == ProcessStatus.to_be_audit) {
|
||||
// 发起流程
|
||||
processService.startAuditProgress(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PutMapping
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(@RequestBody @Valid ProcessUpdateForm form) throws Exception {
|
||||
ProjectProcess entity = processService.getById(form.getId());
|
||||
|
||||
entity.setTaxRate(form.getTaxRate());
|
||||
entity.setContractNo(form.getContractNo());
|
||||
entity.setContractName(form.getContractName());
|
||||
|
||||
entity.setSealTypes(SealTypeArray.of(form.getSealTypes()));
|
||||
entity.setApplyDept(String.join(",", form.getApplyDept()));
|
||||
entity.setAttachmentUri(JSON.toJSONString(form.getAttachments()));
|
||||
|
||||
entityManager.merge(entity);
|
||||
|
||||
switch (entity.getProcessType()) {
|
||||
case sale_contract: {
|
||||
SaleContract contract = processService.findSaleContract(form.getId());
|
||||
contract.setClientName(form.getClientName());
|
||||
contract.setPaymentTerms(form.getPaymentTerms());
|
||||
contract.setApplyPersonPhone(form.getApplyPersonPhone());
|
||||
entityManager.merge(contract);
|
||||
break;
|
||||
}
|
||||
case procurement_contract: {
|
||||
ProcurementContract contract = processService.findProcurementContract(form.getId());
|
||||
contract.setMode(form.getProcurementMode());
|
||||
contract.setPaymentTerms(form.getPaymentTerms());
|
||||
contract.setSupplierName(form.getSupplierName());
|
||||
entityManager.merge(contract);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new UnsupportedOperationException("还不支持");
|
||||
}
|
||||
|
||||
List<SaleContractDetailForm> incomeDetails = form.getIncomeDetails();
|
||||
if (!CollectionUtils.isEmpty(incomeDetails)) {
|
||||
jdbcTemplate.batchUpdate("update project_budget_income_detail set expiration_date =? where id =? ",
|
||||
new BatchPreparedStatementSetter() {
|
||||
processService.updateIncomeDetails(form.getIncomeDetails());
|
||||
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps, int i) throws SQLException {
|
||||
SaleContractDetailForm detailForm = incomeDetails.get(i);
|
||||
ps.setString(1, detailForm.getExpirationDate());
|
||||
ps.setInt(2, detailForm.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBatchSize() {
|
||||
return incomeDetails.size();
|
||||
}
|
||||
});
|
||||
if (form.getStatus() == ProcessStatus.to_be_audit) {
|
||||
processService.startAuditProgress(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,7 +414,8 @@ public class ProcessController {
|
|||
@PostMapping("/query")
|
||||
public Page<ProjectProcess> list(@RequestBody ProcessQueryForm form, Pageable pageable) {
|
||||
// 从 0 开始
|
||||
PageRequest pageRequest = new PageRequest(pageable.getPageNumber() - 1, pageable.getPageSize());
|
||||
PageRequest pageRequest = new PageRequest(pageable.getPageNumber() - 1, pageable.getPageSize(),
|
||||
new Sort(Sort.Direction.DESC, "createAt"));
|
||||
|
||||
ProjectProcess projectProcess = new ProjectProcess();
|
||||
BeanUtils.copyProperties(form, projectProcess);
|
||||
|
@ -382,15 +453,14 @@ public class ProcessController {
|
|||
@PostMapping("/audit")
|
||||
public void audit(@RequestBody @Valid AuditForm form) {
|
||||
ProjectProcess process = repository.findOne(form.processId);
|
||||
// 2-通过 3-不通过
|
||||
int approveType = form.processStatus == ProcessStatus.audit_passed ? 2 :
|
||||
form.processStatus == ProcessStatus.audit_not_passed ? 3 : -1;
|
||||
ActApproveTypeEnum approveType = form.processStatus == ProcessStatus.audit_passed ? ActApproveTypeEnum.APPROVAL_PASSED :
|
||||
ActApproveTypeEnum.APPROVAL_UN_PASS;
|
||||
switch (process.getProcessType()) {
|
||||
case business_procurement:
|
||||
projectInstanceService.completeBusinessPurchaseTask(process.getId(), approveType, form.auditOpinion);
|
||||
case procurement_contract:
|
||||
projectInstanceService.completeTaskByProjectId(process.getId(), ActProjectTypeEnum.BUSINESS_PURCHASE, approveType, form.auditOpinion);
|
||||
break;
|
||||
case sale_contract:
|
||||
projectInstanceService.completeSaleContractTask(process.getId(), approveType, form.auditOpinion);
|
||||
projectInstanceService.completeTaskByProjectId(process.getId(), ActProjectTypeEnum.SALE_CONTRACT, approveType, form.auditOpinion);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -419,14 +489,22 @@ public class ProcessController {
|
|||
@ResponseBody
|
||||
@GetMapping("/audits/{id}")
|
||||
public List<Map<String, String>> showAudits(@PathVariable("id") int id) {
|
||||
ArrayList<Map<String, String>> ret = new ArrayList<>();
|
||||
// ArrayList<Map<String, String>> ret = new ArrayList<>();
|
||||
// ret.add(create("2021-01-03 12:07:45", "提交审核"));
|
||||
// ret.add(create("2021-01-28 12:15:05", "工程运维管理部孙果审核已通过"));
|
||||
// ret.add(create("2021-02-03 22:01:12", "系统产品集成部尹浩审核已通过"));
|
||||
// ret.add(create("2021-03-03 22:05:12", "财务部主管何丹审核已通过"));
|
||||
|
||||
ret.add(create("2021-01-03 12:07:45", "提交审核"));
|
||||
ret.add(create("2021-01-28 12:15:05", "工程运维管理部孙果审核已通过"));
|
||||
ret.add(create("2021-02-03 22:01:12", "系统产品集成部尹浩审核已通过"));
|
||||
ret.add(create("2021-03-03 22:05:12", "财务部主管何丹审核已通过"));
|
||||
|
||||
return ret;
|
||||
ProjectProcess process = processService.getById(id);
|
||||
ProcessType processType = process.getProcessType();
|
||||
List<ProjectTaskRecord> projectTaskRecords = projectTaskRecordService.listV2(id,
|
||||
processType == ProcessType.sale_contract ? ActProjectTypeEnum.SALE_CONTRACT : ActProjectTypeEnum.BUSINESS_PURCHASE);
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return projectTaskRecords.stream()
|
||||
.map(item -> {
|
||||
Date createTime = item.getCreateTime();
|
||||
return create(format.format(createTime), item.getTaskName() + ": " + item.getTaskComment());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Map<String, String> create(String timestamp, String content) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cn.palmte.work.model;
|
||||
|
||||
import cn.palmte.work.bean.StatusEnum;
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
@ -15,6 +14,7 @@ import java.util.Date;
|
|||
@Table(name = "project_task_record")
|
||||
public class ProjectTaskRecord {
|
||||
|
||||
//状态 1-提交审批 2-审批通过 3-审批不通过 4-管理员退回 5-指定承接人
|
||||
public static final int STATUS_ROLLBACK = 4;//管理员退回
|
||||
public static final int STATUS_RE_ASSIGNEE = 5; //指定承接人
|
||||
|
||||
|
@ -113,28 +113,10 @@ public class ProjectTaskRecord {
|
|||
@Transient
|
||||
private String procDefKey= "";
|
||||
|
||||
public StatusEnum getStatusByProDefId() {
|
||||
if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_BUDGET)) {
|
||||
return StatusEnum.BUDGET_ACCOUNTS;
|
||||
}else if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_SETTLE)) {
|
||||
return StatusEnum.SETTLE_ACCOUNTS;
|
||||
}else if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_FINAL)) {
|
||||
return StatusEnum.FINAL_ACCOUNTS;
|
||||
}else{
|
||||
return StatusEnum.ESTIMATE_ACCOUNTS;
|
||||
}
|
||||
}
|
||||
|
||||
public String getProcDefName() {
|
||||
if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_BUDGET)) {
|
||||
return "预算审批流程";
|
||||
}else if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_SETTLE)) {
|
||||
return "结算审批流程";
|
||||
}else if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_FINAL)) {
|
||||
return "决算审批流程";
|
||||
}else{
|
||||
return "概算审批流程";
|
||||
}
|
||||
ActProcessKeyEnum keyEnum = ActProcessKeyEnum.ofProcDefId(procDefId);
|
||||
return keyEnum.getName();
|
||||
}
|
||||
|
||||
public void setProcDefName(String procDefName) {
|
||||
|
@ -142,15 +124,8 @@ public class ProjectTaskRecord {
|
|||
}
|
||||
|
||||
public String getProcDefKey() {
|
||||
if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_BUDGET)) {
|
||||
return ActConstant.PROCESS_DEFKEY_BUDGET;
|
||||
}else if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_SETTLE)) {
|
||||
return ActConstant.PROCESS_DEFKEY_SETTLE;
|
||||
}else if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_FINAL)) {
|
||||
return ActConstant.PROCESS_DEFKEY_FINAL;
|
||||
}else{
|
||||
return ActConstant.PROCESS_DEFKEY_ESTIMATE;
|
||||
}
|
||||
ActProcessKeyEnum keyEnum = ActProcessKeyEnum.ofProcDefId(procDefId);
|
||||
return keyEnum.getKey();
|
||||
}
|
||||
|
||||
public void setProcDefKey(String procDefKey) {
|
||||
|
|
|
@ -6,7 +6,7 @@ package cn.palmte.work.model.enums;
|
|||
*/
|
||||
public enum ProcessType implements Enumerable<String> {
|
||||
sale_contract("销售合同流程"),
|
||||
business_procurement("业务采购流程");
|
||||
procurement_contract("业务采购流程");
|
||||
|
||||
private final String description;
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package cn.palmte.work.model.process;
|
|||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
|
@ -9,7 +11,7 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
|
||||
import cn.palmte.work.model.enums.ProcurementMode;
|
||||
import cn.palmte.work.model.process.form.SaleContractProcessForm;
|
||||
import cn.palmte.work.model.process.form.ProcessCreationForm;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
@ -21,7 +23,7 @@ import lombok.Data;
|
|||
@Data
|
||||
@Entity
|
||||
@Table(name = "procurement_contract")
|
||||
public class ProcurementContract {
|
||||
public class ProcurementContract implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -37,7 +39,7 @@ public class ProcurementContract {
|
|||
|
||||
private Integer processId;
|
||||
|
||||
public static ProcurementContract from(SaleContractProcessForm form) {
|
||||
public static ProcurementContract from(ProcessCreationForm form) {
|
||||
ProcurementContract contract = new ProcurementContract();
|
||||
contract.setMode(form.getProcurementMode());
|
||||
contract.setPaymentTerms(form.getPaymentTerms());
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
@ -14,6 +20,7 @@ import javax.persistence.Enumerated;
|
|||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import cn.palmte.work.model.enums.ProcessStatus;
|
||||
|
@ -29,7 +36,7 @@ import lombok.Data;
|
|||
@Data
|
||||
@Entity
|
||||
@Table(name = "project_process")
|
||||
public class ProjectProcess {
|
||||
public class ProjectProcess implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -66,6 +73,7 @@ public class ProjectProcess {
|
|||
private String contractName;
|
||||
|
||||
// 用印类型
|
||||
@JsonSerialize(using = SealTypeArraySerializer.class)
|
||||
@Convert(converter = SealTypeArrayConverter.class)
|
||||
private SealTypeArray sealTypes;
|
||||
|
||||
|
@ -105,4 +113,18 @@ public class ProjectProcess {
|
|||
// 合作类型
|
||||
// @Enumerated(EnumType.STRING)
|
||||
// private CooperationType cooperationType;
|
||||
|
||||
@PrePersist
|
||||
void prePersist() {
|
||||
this.createAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
static class SealTypeArraySerializer extends JsonSerializer<SealTypeArray> {
|
||||
|
||||
@Override
|
||||
public void serialize(SealTypeArray value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||
serializers.defaultSerializeValue(value.getList(), gen);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,13 +2,15 @@ package cn.palmte.work.model.process;
|
|||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import cn.palmte.work.model.process.form.SaleContractProcessForm;
|
||||
import cn.palmte.work.model.process.form.ProcessCreationForm;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +22,7 @@ import lombok.Data;
|
|||
@Data
|
||||
@Entity
|
||||
@Table(name = "sale_contract")
|
||||
public class SaleContract {
|
||||
public class SaleContract implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -38,7 +40,7 @@ public class SaleContract {
|
|||
|
||||
private Integer processId;
|
||||
|
||||
public static SaleContract from(SaleContractProcessForm form) {
|
||||
public static SaleContract from(ProcessCreationForm form) {
|
||||
SaleContract contract = new SaleContract();
|
||||
contract.setClientName(form.getClientName());
|
||||
contract.setPaymentTerms(form.getPaymentTerms());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -16,31 +17,30 @@ import cn.palmte.work.model.enums.SealType;
|
|||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/14 16:35
|
||||
*/
|
||||
//@JsonSerialize
|
||||
@Convert(converter = SealTypeArrayConverter.class)
|
||||
public class SealTypeArray {
|
||||
public class SealTypeArray implements Serializable {
|
||||
public static final SealTypeArray EMPTY = new SealTypeArray();
|
||||
|
||||
private final List<SealType> sealTypes = new ArrayList<>();
|
||||
private final List<SealType> list = new ArrayList<>();
|
||||
|
||||
public SealTypeArray() { }
|
||||
|
||||
public SealTypeArray(SealType... sealTypes) {
|
||||
Collections.addAll(this.sealTypes, sealTypes);
|
||||
public SealTypeArray(SealType... list) {
|
||||
Collections.addAll(this.list, list);
|
||||
}
|
||||
|
||||
public List<SealType> getSealTypes() {
|
||||
return sealTypes;
|
||||
public List<SealType> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setSealTypes(List<SealType> sealTypes) {
|
||||
this.sealTypes.clear();
|
||||
this.sealTypes.addAll(sealTypes);
|
||||
public void setList(List<SealType> list) {
|
||||
this.list.clear();
|
||||
this.list.addAll(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return sealTypes.stream()
|
||||
return list.stream()
|
||||
.map(SealType::getDescription)
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class SealTypeArray {
|
|||
|
||||
public static SealTypeArray of(Collection<SealType> sealTypes) {
|
||||
SealTypeArray sealTypeArray = new SealTypeArray();
|
||||
sealTypeArray.sealTypes.addAll(sealTypes);
|
||||
sealTypeArray.list.addAll(sealTypes);
|
||||
return sealTypeArray;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class SealTypeArrayConverter implements AttributeConverter<SealTypeArray,
|
|||
|
||||
@Override
|
||||
public String convertToDatabaseColumn(SealTypeArray attribute) {
|
||||
List<SealType> sealTypes = attribute.getSealTypes();
|
||||
List<SealType> sealTypes = attribute.getList();
|
||||
if (sealTypes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package cn.palmte.work.model.process;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/26 17:34
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "procurement_contract_supplier_material")
|
||||
public class SupplierMaterial {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
||||
private Integer id;
|
||||
|
||||
private String companyName;
|
||||
private String totalAmount;
|
||||
private String serviceTerms;
|
||||
private String paymentTerms;
|
||||
private String taxRate;
|
||||
private String remark;
|
||||
|
||||
private String attachment;
|
||||
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package cn.palmte.work.model.process.form;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
@ -9,16 +8,17 @@ import cn.palmte.work.model.enums.ProcessStatus;
|
|||
import cn.palmte.work.model.enums.ProcessType;
|
||||
import cn.palmte.work.model.enums.ProcurementMode;
|
||||
import cn.palmte.work.model.process.ProcessAttachment;
|
||||
import cn.palmte.work.model.process.SupplierMaterial;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 销售合同流程
|
||||
* 合同流程新建表单
|
||||
*
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/14 17:05
|
||||
*/
|
||||
@Data
|
||||
public class SaleContractProcessForm {
|
||||
public class ProcessCreationForm {
|
||||
|
||||
@NotNull
|
||||
private Integer projectId;
|
||||
|
@ -67,8 +67,12 @@ public class SaleContractProcessForm {
|
|||
// 收款条件
|
||||
private String paymentTerms;
|
||||
|
||||
// 备注
|
||||
private String remark;
|
||||
|
||||
private ProcessStatus status;
|
||||
|
||||
@NotNull(message = "流程类型不能为空")
|
||||
private ProcessType processType;
|
||||
|
||||
private List<SaleContractDetailForm> incomeDetails;
|
||||
|
@ -78,4 +82,7 @@ public class SaleContractProcessForm {
|
|||
private String supplierName;
|
||||
|
||||
private List<ProcessAttachment> attachments;
|
||||
|
||||
private List<SupplierMaterial> supplierMaterials;
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package cn.palmte.work.model.process.form;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import cn.palmte.work.model.enums.ProcessStatus;
|
||||
import cn.palmte.work.model.enums.ProcurementMode;
|
||||
import cn.palmte.work.model.process.ProcessAttachment;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程合同更新
|
||||
*
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
* @since 2.0 2022/12/23 16:39
|
||||
*/
|
||||
@Data
|
||||
public class ProcessUpdateForm {
|
||||
|
||||
@NotNull
|
||||
private Integer id;
|
||||
|
||||
private String[] applyDept;
|
||||
|
||||
// 合同编号
|
||||
private String contractNo;
|
||||
|
||||
// 合同名称
|
||||
private String contractName;
|
||||
|
||||
// 用印类型
|
||||
private String[] sealTypes;
|
||||
|
||||
// 税率
|
||||
private String taxRate;
|
||||
|
||||
// 收款条件
|
||||
private String paymentTerms;
|
||||
// 备注
|
||||
private String remark;
|
||||
|
||||
// 客户名称
|
||||
private String clientName;
|
||||
|
||||
private ProcessStatus status;
|
||||
|
||||
// 申请人电话
|
||||
private String applyPersonPhone;
|
||||
|
||||
private ProcurementMode procurementMode;
|
||||
|
||||
private String supplierName;
|
||||
|
||||
private List<ProcessAttachment> attachments;
|
||||
|
||||
private List<SaleContractDetailForm> incomeDetails;
|
||||
}
|
|
@ -21,4 +21,5 @@ public class ActProcIns {
|
|||
private Date endTime;
|
||||
|
||||
private String projectName;
|
||||
private String projectTitle;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.config.activiti.ActTaskIndexEnum;
|
||||
import cn.palmte.work.model.ActTaskDef;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.model.AdminRepository;
|
||||
import cn.palmte.work.model.enums.ProcessStatus;
|
||||
import cn.palmte.work.utils.ActUtil;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.delegate.DelegateExecution;
|
||||
|
@ -42,6 +43,9 @@ public class ActListenerService {
|
|||
@Autowired
|
||||
private AdminRepository adminRepository;
|
||||
|
||||
@Autowired
|
||||
ProjectProcessService projectProcessService;
|
||||
|
||||
/**
|
||||
* 任务节点创建后监听 动态设置审批人
|
||||
*
|
||||
|
@ -84,7 +88,7 @@ public class ActListenerService {
|
|||
String procDefId = processInstance.getProcessDefinitionId();
|
||||
if (actUtil.isNewProcess(procDefId)) {
|
||||
logger.info("**** lcjsjt 流程结束监听 更新项目状态为审批通过 **** procInsId:{}, procDefId:{}, projectId:{}", procInsId, procDefId, projectId);
|
||||
//todo updateNewProcess 更新项目状态为审批通过
|
||||
projectProcessService.updateProcessStatus(projectId, ProcessStatus.audit_passed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +105,7 @@ public class ActListenerService {
|
|||
ActTaskDef actTaskDef = actTaskDefService.findFirstByProcDefIdAndTaskKey(procDefId, taskDefKey);
|
||||
//找到当前有效的用户
|
||||
List<Integer> enableUsers = currentEnableUsers(candidateUsers);
|
||||
boolean isFirstUserTask = actTaskDef != null && actTaskDef.getTaskIndex() != ActConstant.TASK_INDEX_FIRST_USER_TASK;
|
||||
boolean isFirstUserTask = actTaskDef != null && actTaskDef.getTaskIndex() != ActTaskIndexEnum.FIRST_USER_TASK.getIndex();
|
||||
|
||||
if (actUtil.isFourcalProcess(procDefId)) {
|
||||
int adminId = 0;//默认审批人设置为空
|
||||
|
@ -112,7 +116,7 @@ public class ActListenerService {
|
|||
processInstance.getProcessInstanceId(), businessKey, adminId);
|
||||
projectInstanceService.updateApprover(Integer.parseInt(businessKey), adminId);
|
||||
} else if (actUtil.isNewProcess(procDefId)) {
|
||||
//todo updateNewProcess 更新流程审批人
|
||||
projectProcessService.updateAudit(Integer.parseInt(businessKey), null, enableUsers);
|
||||
logger.info("**** rwcjjt 任务创建监听 更新审批2 procInsId:{}, projectId:{}, enableUsers:{} **** ",
|
||||
processInstance.getProcessInstanceId(), businessKey, enableUsers);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.config.activiti.ActTaskIndexEnum;
|
||||
import cn.palmte.work.model.ActTaskDef;
|
||||
import cn.palmte.work.model.ActTaskDefRepository;
|
||||
import cn.palmte.work.pojo.ActModel;
|
||||
|
@ -147,7 +148,7 @@ public class ActModelService {
|
|||
setTaskListener(userTaskElement);
|
||||
|
||||
if (i == 1) {//画流程图时,要保证第一个用户任务一定要先画
|
||||
taskDef.setTaskIndex(ActConstant.TASK_INDEX_FIRST_USER_TASK);
|
||||
taskDef.setTaskIndex(ActTaskIndexEnum.FIRST_USER_TASK.getIndex());
|
||||
first = taskDef;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package cn.palmte.work.service;
|
|||
|
||||
import cn.palmte.work.bean.ApproveStatusEnum;
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.config.activiti.ActTaskIndexEnum;
|
||||
import cn.palmte.work.model.ActTaskDefRepository;
|
||||
import cn.palmte.work.model.ProjectTaskRecord;
|
||||
import cn.palmte.work.pojo.ActProcIns;
|
||||
|
@ -105,7 +106,7 @@ public class ActProcInsService {
|
|||
taskService.complete(taskId);
|
||||
|
||||
projectTaskRecordService.saveTaskRecord(Integer.parseInt(instance.getBusinessKey()),
|
||||
task, ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus(), ActConstant.TASK_INDEX_FIRST_USER_TASK, comment);
|
||||
task, ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus(), ActTaskIndexEnum.FIRST_USER_TASK.getIndex(), comment);
|
||||
|
||||
return instance.getId();
|
||||
}
|
||||
|
@ -165,11 +166,12 @@ public class ActProcInsService {
|
|||
"h.start_time_ as startTime,h.end_time_ as endTime,p.key_ as procKey," +
|
||||
"p.name_ as procName,p.NAME_ as dgrmResourceName,p.version_ as version," +
|
||||
" GROUP_CONCAT(t.NAME_) as currentTask, GROUP_CONCAT(t.ID_) as currentTaskId," +
|
||||
" pjct.name as projectName";
|
||||
" pjct.name as projectName,pp.project_title AS projectTitle";
|
||||
QueryHelper queryHelper = new QueryHelper(select, " act_hi_procinst h " +
|
||||
"left join ACT_RE_PROCDEF p on h.PROC_DEF_ID_ =p.ID_ " +
|
||||
"LEFT JOIN act_ru_task t on t.PROC_INST_ID_=h.proc_inst_id_ " +
|
||||
"LEFT JOIN project pjct on pjct.id=h.BUSINESS_KEY_");
|
||||
"LEFT JOIN project pjct on pjct.id=h.BUSINESS_KEY_ " +
|
||||
"LEFT JOIN project_process pp on pp.id=h.BUSINESS_KEY_ ");
|
||||
queryHelper.addGroupProperty("h.PROC_INST_ID_");
|
||||
queryHelper.addOrderProperty("h.start_time_", false);
|
||||
Page<ActProcIns> paginate = pagination.paginate(queryHelper.getSql(), ActProcIns.class, pageNumber, pageSize);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.ApproveStatusEnum;
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.config.activiti.*;
|
||||
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.model.enums.ProcessStatus;
|
||||
import cn.palmte.work.pojo.ActHisTask;
|
||||
import cn.palmte.work.utils.ActUtil;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
|
@ -45,10 +45,12 @@ public class ActTaskDefService {
|
|||
private ProjectInstanceService projectInstanceService;
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
@Autowired
|
||||
private ProjectProcessService projectProcessService;
|
||||
|
||||
|
||||
/**
|
||||
* 审批任务
|
||||
* 管理员完成某个任务
|
||||
*
|
||||
* @param json
|
||||
*/
|
||||
|
@ -58,10 +60,10 @@ public class ActTaskDefService {
|
|||
String message = json.getString("message");
|
||||
int type = json.getInteger("type");
|
||||
|
||||
completeTask(taskId, procInsId, message, type, "");
|
||||
completeTask(taskId, procInsId, message, ActApproveTypeEnum.ofType(type), "");
|
||||
}
|
||||
|
||||
private void completeTask(String taskId, String procInsId, String message, int type, String fileUrl) {
|
||||
private void completeTask(String taskId, String procInsId, String message, ActApproveTypeEnum approveEnum, String fileUrl) {
|
||||
String userId = InterfaceUtil.getAdminId() + "";
|
||||
Authentication.setAuthenticatedUserId(userId);
|
||||
taskService.addComment(taskId, procInsId, message);
|
||||
|
@ -72,13 +74,13 @@ public class ActTaskDefService {
|
|||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(procInsId).singleResult();
|
||||
taskService.setAssignee(taskId, userId);
|
||||
if (ActConstant.TASK_TYPE_SINGE == actTaskDef.getTaskType()) {
|
||||
handleSinge(processInstance, taskId, type, actTaskDef);
|
||||
handleSinge(processInstance, taskId, approveEnum, actTaskDef);
|
||||
}
|
||||
|
||||
|
||||
//保存审批记录
|
||||
projectTaskRecordService.saveTaskRecordWithFileUrl(Integer.parseInt(processInstance.getBusinessKey()),
|
||||
currentTask, type, actTaskDef.getTaskIndex(), message, fileUrl);
|
||||
currentTask, approveEnum.getType(), actTaskDef.getTaskIndex(), message, fileUrl);
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,13 +88,13 @@ public class ActTaskDefService {
|
|||
* 通过流程实列id完成任务
|
||||
*
|
||||
* @param procInsId
|
||||
* @param type
|
||||
* @param approveEnum
|
||||
* @param comment
|
||||
*/
|
||||
public void completeTaskByProcInsId(String procInsId, int type, String comment) {
|
||||
public void completeTaskByProcInsId(String procInsId, ActApproveTypeEnum approveEnum, String comment) {
|
||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
|
||||
for (Task task : taskList) {
|
||||
completeTask(task.getId(), procInsId, comment, type, "");
|
||||
completeTask(task.getId(), procInsId, comment, approveEnum, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +105,7 @@ public class ActTaskDefService {
|
|||
*/
|
||||
public ResponseMsg skipTaskByProcInsId(String procInsId, String fileUrl, String comment) {
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(procInsId).singleResult();
|
||||
if (!ActConstant.PROCESS_DEFKEY_BUDGET.equals(processInstance.getProcessDefinitionKey())) {
|
||||
if (!ActProcessKeyEnum.BUDGET.getKey().equals(processInstance.getProcessDefinitionKey())) {
|
||||
return ResponseMsg.buildFailedMsg("只有预算审批流程才能执行会签");
|
||||
}
|
||||
|
||||
|
@ -112,12 +114,12 @@ public class ActTaskDefService {
|
|||
if ("执行董事".equals(task.getName())) {
|
||||
return ResponseMsg.buildFailedMsg("当前状态不能用会签功能,请使用审批功能。");
|
||||
}
|
||||
completeTask(task.getId(), procInsId, comment, ApproveStatusEnum.APPROVAL_PASSED.getApproveStatus(), fileUrl);
|
||||
completeTask(task.getId(), procInsId, comment, ActApproveTypeEnum.APPROVAL_PASSED, fileUrl);
|
||||
|
||||
//非执行董事节点自动跳过
|
||||
task = taskService.createTaskQuery().processInstanceId(procInsId).singleResult();
|
||||
while (!"执行董事".equals(task.getName())) {
|
||||
completeSkipTask(task, processInstance, "会签,任务自动审批通过", ApproveStatusEnum.APPROVAL_PASSED.getApproveStatus());
|
||||
completeSkipTask(task, processInstance, "会签,任务自动审批通过");
|
||||
task = taskService.createTaskQuery().processInstanceId(procInsId).singleResult();
|
||||
}
|
||||
|
||||
|
@ -135,8 +137,7 @@ public class ActTaskDefService {
|
|||
while (!skipToTaskName.equals(task.getName())) {
|
||||
logger.info("skipTaskByProcInsIdAndTaskName completeSkipTask:{}", task.getName());
|
||||
|
||||
completeSkipTask(task, processInstance, "任务由系统自动审批通过",
|
||||
ApproveStatusEnum.APPROVAL_PASSED.getApproveStatus());
|
||||
completeSkipTask(task, processInstance, "任务由系统自动审批通过");
|
||||
|
||||
task = taskService.createTaskQuery().processInstanceId(procInsId).singleResult();
|
||||
logger.info("skipTaskByProcInsIdAndTaskName currentTaskName:{}, skipToTaskName:{}", task.getName(), skipToTaskName);
|
||||
|
@ -145,11 +146,11 @@ public class ActTaskDefService {
|
|||
}
|
||||
|
||||
|
||||
private void completeSkipTask(Task task, ProcessInstance processInstance, String message, int type) {
|
||||
private void completeSkipTask(Task task, ProcessInstance processInstance, String message) {
|
||||
String taskId = task.getId();
|
||||
ActTaskDef actTaskDef = findFirstByProcDefIdAndTaskKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
|
||||
|
||||
if (actTaskDef.getTaskIndex() != ActConstant.TASK_INDEX_FIRST_USER_TASK) {
|
||||
if (actTaskDef.getTaskIndex() != ActTaskIndexEnum.FIRST_USER_TASK.getIndex()) {
|
||||
//不是发起节点 增加comment
|
||||
Authentication.setAuthenticatedUserId("-1");
|
||||
taskService.addComment(taskId, processInstance.getProcessInstanceId(), message);
|
||||
|
@ -158,7 +159,7 @@ public class ActTaskDefService {
|
|||
taskService.setAssignee(taskId, "-1");
|
||||
|
||||
if (ActConstant.TASK_TYPE_SINGE == actTaskDef.getTaskType()) {
|
||||
handleSinge(processInstance, taskId, type, actTaskDef);
|
||||
handleSinge(processInstance, taskId, ActApproveTypeEnum.APPROVAL_PASSED, actTaskDef);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,12 +168,12 @@ public class ActTaskDefService {
|
|||
*
|
||||
* @param taskId
|
||||
* @param processInstance
|
||||
* @param type
|
||||
* @param approveEnum
|
||||
* @param actTaskDef
|
||||
*/
|
||||
private void handleSinge(ProcessInstance processInstance, String taskId, int type, ActTaskDef actTaskDef) {
|
||||
private void handleSinge(ProcessInstance processInstance, String taskId, ActApproveTypeEnum approveEnum, ActTaskDef actTaskDef) {
|
||||
String procDefKey = actTaskDef.getProcDefKey();
|
||||
if (ApproveStatusEnum.APPROVAL_PASSED.getApproveStatus() == type) {
|
||||
if (ActApproveTypeEnum.APPROVAL_PASSED == approveEnum) {
|
||||
//审批通过
|
||||
taskService.complete(taskId);
|
||||
|
||||
|
@ -180,7 +181,7 @@ public class ActTaskDefService {
|
|||
//四算项目 最后一个任务完成后 更新项目状态为审批通过 其他项目通过监听器更新
|
||||
updateProjectPassed(processInstance, actTaskDef, procDefKey);
|
||||
}
|
||||
} else if (ApproveStatusEnum.APPROVAL_UNPASS.getApproveStatus() == type) {
|
||||
} else if (ActApproveTypeEnum.APPROVAL_UN_PASS == approveEnum) {
|
||||
//驳回
|
||||
String rollbackTaskKey = actTaskDef.getRollbackTaskKey();
|
||||
actUtil.jumpToTargetTask(taskId, rollbackTaskKey);
|
||||
|
@ -188,9 +189,9 @@ public class ActTaskDefService {
|
|||
//驳回后 更新项目状态为审批不通过
|
||||
int projectId = Integer.parseInt(processInstance.getBusinessKey());
|
||||
if (actUtil.isFourcalProcess(processInstance.getProcessDefinitionId())) {
|
||||
projectInstanceService.updateApproveStatus(projectId, procDefKey, ApproveStatusEnum.APPROVAL_UNPASS);
|
||||
projectInstanceService.updateApproveStatus(projectId, procDefKey, ActApproveTypeEnum.APPROVAL_UN_PASS);
|
||||
} else if (actUtil.isNewProcess(processInstance.getProcessDefinitionId())) {
|
||||
//todo updateNewProcess 更新流程状态为不通过
|
||||
projectProcessService.updateProcessStatus(projectId, ProcessStatus.audit_not_passed);
|
||||
}
|
||||
logger.info("updateProjectUnPassed projectId:{}, proDefKey:{}", projectId, procDefKey);
|
||||
|
||||
|
@ -206,17 +207,17 @@ public class ActTaskDefService {
|
|||
*/
|
||||
private void updateProjectPassed(ProcessInstance processInstance, ActTaskDef actTaskDef, String procDefKey) {
|
||||
int projectId = Integer.parseInt(processInstance.getBusinessKey());
|
||||
if (ActConstant.PROCESS_DEFKEY_SETTLE.equals(procDefKey)) {
|
||||
if (ActProcessKeyEnum.SETTLE.getKey().equals(procDefKey)) {
|
||||
//结算流程 财务总监审批完流程结束
|
||||
if ("财务总监".equals(actTaskDef.getTaskName())) {
|
||||
logger.info("updateProjectPassed1 projectId:{}, proDefKey:{}", projectId, procDefKey);
|
||||
projectInstanceService.updateApproveStatus(projectId, procDefKey, ApproveStatusEnum.APPROVAL_PASSED);
|
||||
projectInstanceService.updateApproveStatus(projectId, procDefKey, ActApproveTypeEnum.APPROVAL_PASSED);
|
||||
}
|
||||
} else {
|
||||
//其余流程 执行董事审批完流程结束
|
||||
if ("执行董事".equals(actTaskDef.getTaskName())) {
|
||||
logger.info("updateProjectPassed2 projectId:{}, proDefKey:{}", projectId, procDefKey);
|
||||
projectInstanceService.updateApproveStatus(projectId, procDefKey, ApproveStatusEnum.APPROVAL_PASSED);
|
||||
projectInstanceService.updateApproveStatus(projectId, procDefKey, ActApproveTypeEnum.APPROVAL_PASSED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,7 +321,7 @@ public class ActTaskDefService {
|
|||
*/
|
||||
public List<String> findCandidateUsers(String procDefId, String procInsId, String taskDefKey) {
|
||||
ActTaskDef taskDef = findFirstByProcDefIdAndTaskKey(procDefId, taskDefKey);
|
||||
if (taskDef.getTaskIndex() == ActConstant.TASK_INDEX_FIRST_USER_TASK) {
|
||||
if (taskDef.getTaskIndex() == ActTaskIndexEnum.FIRST_USER_TASK.getIndex()) {
|
||||
//任务驳回到发起节点 审批人设置为发起人
|
||||
String startUserId = actUtil.getStartUserId(procInsId);
|
||||
List<String> res = new ArrayList<>(1);
|
||||
|
@ -369,7 +370,7 @@ public class ActTaskDefService {
|
|||
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
for (String typeStr : types) {
|
||||
if (ActConstant.CANDIDATE_TYPE_START_USER_LEADER == Integer.parseInt(typeStr)) {
|
||||
if (CandidateTypeEnum.STARTER_LEADER.getType() == Integer.parseInt(typeStr)) {
|
||||
//查找发起人部门主管
|
||||
String startUserId = actUtil.getStartUserId(procInsId);
|
||||
int leaderId = accountService.getOneLevelDeptManagerId(Integer.parseInt(startUserId));
|
||||
|
@ -450,7 +451,8 @@ public class ActTaskDefService {
|
|||
taskService.setAssignee(currentTask.getId(), targetAdmin.getId() + "");
|
||||
|
||||
//保存一条指定承接人记录
|
||||
projectTaskRecordService.saveTaskRecord(projectId, currentTask, ProjectTaskRecord.STATUS_RE_ASSIGNEE, ActConstant.TASK_INDEX_OTHER,
|
||||
projectTaskRecordService.saveTaskRecord(projectId, currentTask,
|
||||
ProjectTaskRecord.STATUS_RE_ASSIGNEE, ActTaskIndexEnum.COMMON.getIndex(),
|
||||
"指定承接人【" + targetAdmin.getRealName() + "]");
|
||||
} else {
|
||||
logger.error("setTaskAssignAndSaveRecordError task is null, projectId:{}", projectId);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.*;
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.utils.DateKit;
|
||||
import cn.palmte.work.utils.StrKit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -876,7 +876,7 @@ public class ProjectBudgetService {
|
|||
}
|
||||
|
||||
public void budgetApprove(Integer approveStatusBudget, Project projectInDb, Admin admin) throws Exception {
|
||||
projectInstanceService.startBudgetProcessInstance(projectInDb, admin);
|
||||
projectInstanceService.startFourcalProcess(projectInDb, ActProcessKeyEnum.BUDGET);
|
||||
// int type = projectInDb.getType();
|
||||
// List<SysUserRole> userIds = new ArrayList<>();
|
||||
// if (type == 1) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.*;
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
import cn.palmte.work.model.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -355,7 +356,7 @@ public class ProjectEstimateService {
|
|||
}
|
||||
|
||||
public void estimateApprove(Integer approveStatusEstimate, Project projectInDb, Admin admin) throws Exception {
|
||||
projectInstanceService.startEstimateProcessInstance(projectInDb, admin);
|
||||
projectInstanceService.startFourcalProcess(projectInDb, ActProcessKeyEnum.ESTIMATE);
|
||||
int type = projectInDb.getType();
|
||||
List<SysUserRole> userIds = new ArrayList<>();
|
||||
if (type == 1) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.*;
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -69,7 +69,7 @@ public class ProjectFinalSevice {
|
|||
//更新项目和审批状态
|
||||
projectService.updateStatusAndApproveStatus(project.getId(), StatusEnum.FINAL_ACCOUNTS, ApproveStatusEnum.APPROVAL_PENDING, project.getOtherName());
|
||||
//发起流程
|
||||
projectInstanceService.startFinalProcessInstance(project.getId(), InterfaceUtil.getAdmin());
|
||||
projectInstanceService.startFourcalProcess(project, ActProcessKeyEnum.FINAL);
|
||||
}
|
||||
|
||||
public void clearAndSave(Project project, FinalBean finalBean) {
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.ApproveStatusEnum;
|
||||
|
||||
import cn.palmte.work.config.activiti.ActApproveTypeEnum;
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
import cn.palmte.work.config.activiti.ActProjectTypeEnum;
|
||||
import cn.palmte.work.exception.ResponseException;
|
||||
import cn.palmte.work.model.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -30,151 +34,98 @@ public class ProjectInstanceService {
|
|||
|
||||
|
||||
/**
|
||||
* 开启一个概算流程实例
|
||||
*/
|
||||
public void startEstimateProcessInstance(Project project, Admin admin) throws Exception {
|
||||
startProcess(project, admin, ActConstant.PROCESS_DEFKEY_ESTIMATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启一个预算流程实例
|
||||
*/
|
||||
public void startBudgetProcessInstance(Project project, Admin admin) throws Exception {
|
||||
startProcess(project, admin, ActConstant.PROCESS_DEFKEY_BUDGET);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启一个结算流程实例
|
||||
*/
|
||||
public void startSettleProcessInstance(Project project, Admin admin) throws Exception {
|
||||
startProcess(project, admin, ActConstant.PROCESS_DEFKEY_SETTLE);
|
||||
}
|
||||
/**
|
||||
* 开启一个决算流程实例
|
||||
*/
|
||||
public void startFinalProcessInstance(int projectId, Admin admin) throws Exception {
|
||||
Project project = projectRepository.findOne(projectId);
|
||||
startProcess(project, admin, ActConstant.PROCESS_DEFKEY_FINAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起销售合同流程实例
|
||||
* 通过项目id发起流程实例
|
||||
*
|
||||
* @param projectId 项目唯一id
|
||||
* @param map 流程变量
|
||||
* @param projectId
|
||||
* @param projectEnum
|
||||
* @param map
|
||||
* @throws Exception
|
||||
*/
|
||||
public void startSaleContractProcess(int projectId, Map<String, Object> map) throws Exception {
|
||||
String processDefkey = ActConstant.PROCESS_DEFKEY_SALE_CONTRACT;
|
||||
public void startProcessByProjectId(int projectId, ActProjectTypeEnum projectEnum, Map<String, Object> map) throws Exception {
|
||||
ActProcessKeyEnum keyEnum;
|
||||
if (projectEnum == ActProjectTypeEnum.SALE_CONTRACT) {
|
||||
keyEnum = ActProcessKeyEnum.SALE_CONTRACT;
|
||||
} else if (projectEnum == ActProjectTypeEnum.BUSINESS_PURCHASE) {
|
||||
keyEnum = ActProcessKeyEnum.BUSINESS_PURCHASE;
|
||||
}else{
|
||||
throw new ResponseException("不支持的项目类型");
|
||||
}
|
||||
String processDefkey = keyEnum.getKey();
|
||||
String businessKey = String.valueOf(projectId);
|
||||
logger.info("startSaleContractProcess processDefkey:{}, businessKey:{}", processDefkey, businessKey);
|
||||
String processInstanceId = actProcInsService.startProcessInstance(processDefkey, businessKey, map);
|
||||
saveRelation(projectId, processDefkey, processInstanceId);
|
||||
|
||||
saveProjectInstance(projectId, processInstanceId, keyEnum, projectEnum);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发起业务采购流程实例
|
||||
* 通过项目id和项目类型完成审批任务
|
||||
*
|
||||
* @param projectId 项目唯一id
|
||||
* @param map 流程变量
|
||||
* @throws Exception
|
||||
*/
|
||||
public void startBusinessPurchaseProcess(int projectId, Map<String, Object> map) throws Exception {
|
||||
String processDefkey = ActConstant.PROCESS_DEFKEY_BUSINESS_PURCHASE;
|
||||
String businessKey = String.valueOf(projectId);
|
||||
logger.info("startBusinessPurchaseProcess processDefkey:{}, businessKey:{}", processDefkey, businessKey);
|
||||
String processInstanceId = actProcInsService.startProcessInstance(processDefkey, businessKey, map);
|
||||
|
||||
//保存流程实例id与项目的关联关系
|
||||
saveRelation(projectId, processDefkey, processInstanceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 销售合同流程 审批(通过或者不通过)
|
||||
*
|
||||
* @param projectId 项目唯一id
|
||||
* @param approveType 2-通过 3-不通过
|
||||
* @param projectEnum 项目类型
|
||||
* @param approveEnum 审批状态
|
||||
* @param message 审批意见
|
||||
* @return
|
||||
*/
|
||||
public boolean completeSaleContractTask(int projectId, int approveType, String message) {
|
||||
ProjectInstanceRelation projectInstance = projectInstanceRelationRepository.findByProjectIdAndProjectType(projectId, ActConstant.PROJECT_TYPE_SALE_CONTRACT);
|
||||
public boolean completeTaskByProjectId(int projectId, ActProjectTypeEnum projectEnum,
|
||||
ActApproveTypeEnum approveEnum, String message) {
|
||||
ProjectInstanceRelation projectInstance = projectInstanceRelationRepository.findByProjectIdAndProjectType(
|
||||
projectId, projectEnum.getType());
|
||||
if (projectInstance == null) {
|
||||
return false;
|
||||
}
|
||||
actTaskDefService.completeTaskByProcInsId(projectInstance.getProcessInsId(), approveType, message);
|
||||
|
||||
actTaskDefService.completeTaskByProcInsId(projectInstance.getProcessInsId(), approveEnum, message);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 业务采购流程 审批(通过或者不通过)
|
||||
*
|
||||
* @param projectId 项目唯一id
|
||||
* @param approveType 2-通过 3-不通过
|
||||
* @param message 审批意见
|
||||
* @return
|
||||
*/
|
||||
public boolean completeBusinessPurchaseTask(int projectId, int approveType, String message) {
|
||||
ProjectInstanceRelation projectInstance = projectInstanceRelationRepository.findByProjectIdAndProjectType(projectId, ActConstant.PROJECT_TYPE_SALE_CONTRACT);
|
||||
if (projectInstance == null) {
|
||||
return false;
|
||||
}
|
||||
actTaskDefService.completeTaskByProcInsId(projectInstance.getProcessInsId(), approveType, message);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void saveRelation(int projectId, String processDefkey, String processInstanceId) {
|
||||
private void saveProjectInstance(int projectId, String processInstanceId,
|
||||
ActProcessKeyEnum keyEnum, ActProjectTypeEnum projectTypeEnum) {
|
||||
//保存流程实例id与项目的关联关系
|
||||
ProjectInstanceRelation relation = new ProjectInstanceRelation();
|
||||
relation.setProjectId(projectId);
|
||||
relation.setProjectType(ActConstant.PROJECT_TYPE_SALE_CONTRACT);
|
||||
relation.setProcessType(processDefkey);
|
||||
relation.setProjectType(projectTypeEnum.getType());
|
||||
relation.setProcessType(keyEnum.getKey());
|
||||
relation.setProcessInsId(processInstanceId);
|
||||
relation.setCreateTime(new Date());
|
||||
projectInstanceRelationRepository.saveAndFlush(relation);
|
||||
}
|
||||
|
||||
private void startProcess(Project project, Admin admin, String processDefkey) throws Exception {
|
||||
/**
|
||||
* 发起四算项目流程
|
||||
*
|
||||
* @param project
|
||||
* @param keyEnum
|
||||
* @throws Exception
|
||||
*/
|
||||
public void startFourcalProcess(Project project, ActProcessKeyEnum keyEnum) throws Exception {
|
||||
HashMap<String, Object> variables = new HashMap<>();
|
||||
variables.put(ActConstant.KEY_PROJECT_TYPE, project.getType());
|
||||
String businessKey = String.valueOf(project.getId());
|
||||
logger.info("startProcess processDefkey:{}, businessKey:{}", processDefkey, businessKey);
|
||||
String processInstanceId = actProcInsService.startProcessInstance(processDefkey, businessKey, variables);
|
||||
logger.info("startProcess processDefkey:{}, businessKey:{}", keyEnum.getKey(), businessKey);
|
||||
String processInstanceId = actProcInsService.startProcessInstance(keyEnum.getKey(), businessKey, variables);
|
||||
|
||||
saveProjectInstance(project, processDefkey, processInstanceId);
|
||||
saveProjectInstance(project.getId(), processInstanceId, keyEnum, ActProjectTypeEnum.FOURCAL);
|
||||
}
|
||||
|
||||
|
||||
public String startProcessBySystem(Project project, String processDefkey, ProjectTaskRecord taskRecord) throws Exception {
|
||||
public String startProcessBySystem(Project project, ActProcessKeyEnum keyEnum, ProjectTaskRecord taskRecord) throws Exception {
|
||||
HashMap<String, Object> variables = new HashMap<>();
|
||||
variables.put(ActConstant.KEY_PROJECT_TYPE, project.getType());
|
||||
String businessKey = String.valueOf(project.getId());
|
||||
logger.info("startProcessBySystem processDefkey:{}, businessKey:{}", processDefkey, businessKey);
|
||||
logger.info("startProcessBySystem processDefkey:{}, businessKey:{}", keyEnum.getKey(), businessKey);
|
||||
|
||||
String processInstanceId = actProcInsService.startProcessInstanceBySystem(
|
||||
processDefkey, businessKey, variables, taskRecord);
|
||||
keyEnum.getKey(), businessKey, variables, taskRecord);
|
||||
|
||||
saveProjectInstance(project, processDefkey, processInstanceId);
|
||||
saveProjectInstance(project.getId(), processInstanceId, keyEnum, ActProjectTypeEnum.FOURCAL);
|
||||
return processInstanceId;
|
||||
}
|
||||
|
||||
private void saveProjectInstance(Project project, String processDefkey, String processInstanceId) {
|
||||
//保存流程实例id与项目的关联关系
|
||||
ProjectInstanceRelation relation = new ProjectInstanceRelation();
|
||||
relation.setProjectId(project.getId());
|
||||
relation.setProcessType(processDefkey);
|
||||
relation.setProcessInsId(processInstanceId);
|
||||
relation.setCreateTime(new Date());
|
||||
projectInstanceRelationRepository.saveAndFlush(relation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新审批人,用于在任务监听器中更新下个审批人
|
||||
*
|
||||
* @param projectId 项目id
|
||||
* @param adminId 审批人id
|
||||
*/
|
||||
|
@ -197,24 +148,21 @@ public class ProjectInstanceService {
|
|||
/**
|
||||
* 更新审批状态
|
||||
* @param processKey 审批类型
|
||||
* @see ActConstant#PROCESS_DEFKEY_ESTIMATE
|
||||
* @see ActConstant#PROCESS_DEFKEY_BUDGET
|
||||
* @see ActConstant#PROCESS_DEFKEY_SETTLE
|
||||
* @see ActConstant#PROCESS_DEFKEY_FINAL
|
||||
* @see ActProcessKeyEnum
|
||||
*/
|
||||
public void updateApproveStatus(int projectId, String processKey, ApproveStatusEnum approveStatusEnum){
|
||||
public void updateApproveStatus(int projectId, String processKey, ActApproveTypeEnum approveTypeEnum){
|
||||
Project project = projectRepository.findOne(projectId);
|
||||
if(ActConstant.PROCESS_DEFKEY_ESTIMATE.equals(processKey)){
|
||||
project.setApproveStatusEstimate(approveStatusEnum.getApproveStatus());
|
||||
}else if(ActConstant.PROCESS_DEFKEY_BUDGET.equals(processKey)){
|
||||
project.setApproveStatusBudget(approveStatusEnum.getApproveStatus());
|
||||
}else if(ActConstant.PROCESS_DEFKEY_SETTLE.equals(processKey)){
|
||||
project.setApproveStatusSettle(approveStatusEnum.getApproveStatus());
|
||||
}else if(ActConstant.PROCESS_DEFKEY_FINAL.equals(processKey)){
|
||||
project.setApproveStatusFinal(approveStatusEnum.getApproveStatus());
|
||||
if(ActProcessKeyEnum.ESTIMATE.getKey().equals(processKey)){
|
||||
project.setApproveStatusEstimate(approveTypeEnum.getType());
|
||||
}else if(ActProcessKeyEnum.BUDGET.getKey().equals(processKey)){
|
||||
project.setApproveStatusBudget(approveTypeEnum.getType());
|
||||
}else if(ActProcessKeyEnum.SETTLE.getKey().equals(processKey)){
|
||||
project.setApproveStatusSettle(approveTypeEnum.getType());
|
||||
}else if(ActProcessKeyEnum.FINAL.getKey().equals(processKey)){
|
||||
project.setApproveStatusFinal(approveTypeEnum.getType());
|
||||
}
|
||||
|
||||
if (approveStatusEnum.getApproveStatus() == ApproveStatusEnum.APPROVAL_PASSED.getApproveStatus()) {
|
||||
if (approveTypeEnum == ActApproveTypeEnum.APPROVAL_PASSED) {
|
||||
//审批通过设置审批人为空
|
||||
project.setApproveId(0);
|
||||
project.setApproveName("");
|
||||
|
|
|
@ -1,18 +1,32 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import cn.palmte.work.config.activiti.ActProjectTypeEnum;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.model.ProjectRepository;
|
||||
import cn.palmte.work.model.enums.ProcessStatus;
|
||||
import cn.palmte.work.model.process.ProcurementContract;
|
||||
import cn.palmte.work.model.process.ProjectProcess;
|
||||
import cn.palmte.work.model.process.SaleContract;
|
||||
import cn.palmte.work.model.process.form.SaleContractDetailForm;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
|
||||
|
@ -24,6 +38,8 @@ public class ProjectProcessService {
|
|||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final EntityManager entityManager;
|
||||
private final ProjectInstanceService projectInstanceService;
|
||||
private final ProjectRepository projectRepository;
|
||||
|
||||
/**
|
||||
* 更新流程 审批人,和状态
|
||||
|
@ -61,4 +77,110 @@ public class ProjectProcessService {
|
|||
jdbcTemplate.update("update project_process set `status`=? where id=?", status.getValue(), processId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程ID查询销售合同
|
||||
*
|
||||
* @param processId 流程ID
|
||||
* @return 销售合同
|
||||
*/
|
||||
public SaleContract findSaleContract(int processId) {
|
||||
TypedQuery<SaleContract> query = entityManager.createQuery(
|
||||
"from SaleContract where processId=:processId", SaleContract.class);
|
||||
query.setParameter("processId", processId);
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程ID查询采购合同
|
||||
*
|
||||
* @param processId 流程ID
|
||||
* @return 采购合同
|
||||
*/
|
||||
public ProcurementContract findProcurementContract(int processId) {
|
||||
TypedQuery<ProcurementContract> query = entityManager.createQuery(
|
||||
"from ProcurementContract where processId=:processId", ProcurementContract.class);
|
||||
query.setParameter("processId", processId);
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
public ProjectProcess getById(int id) {
|
||||
return entityManager.find(ProjectProcess.class, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新 销售合同 的 质保期
|
||||
*/
|
||||
public void updateIncomeDetails(List<SaleContractDetailForm> incomeDetails) {
|
||||
if (!CollectionUtils.isEmpty(incomeDetails)) {
|
||||
jdbcTemplate.batchUpdate("update project_budget_income_detail set expiration_date =? where id =? ",
|
||||
new BatchPreparedStatementSetter() {
|
||||
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps, int i) throws SQLException {
|
||||
SaleContractDetailForm detailForm = incomeDetails.get(i);
|
||||
ps.setString(1, detailForm.getExpirationDate());
|
||||
ps.setInt(2, detailForm.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBatchSize() {
|
||||
return incomeDetails.size();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public BigDecimal getProjectRepaidAmount(int projectId) {
|
||||
Map<String, Object> map = jdbcTemplate.queryForMap(
|
||||
"select ifnull(sum(underwritten_plan), 0) repaidAmount from project_budget_plan_detail where project_id = ?", projectId);
|
||||
return (BigDecimal) map.values().iterator().next();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起流程审批
|
||||
*/
|
||||
public void startAuditProgress(ProjectProcess entity) {
|
||||
HashMap<String, Object> variables = new HashMap<>();
|
||||
Project project = projectRepository.findById(entity.getProjectId());
|
||||
// 是否垫资
|
||||
variables.put("isPrepaid", isProjectPrepaid(project));
|
||||
// 垫资金额
|
||||
BigDecimal repaidAmount = getProjectRepaidAmount(entity.getProjectId());
|
||||
variables.put("repaidAmount", repaidAmount);
|
||||
// 合同金额
|
||||
variables.put("amount", project.getContractAmount() == null ? 0 : project.getContractAmount());
|
||||
// 项目类型
|
||||
variables.put("projectType", project.getType());
|
||||
// 合作类型
|
||||
variables.put("cooperationType", project.getCooperateType() == null ? 0 : project.getCooperateType());
|
||||
|
||||
startAuditProgress(entity, variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否垫资
|
||||
*/
|
||||
public boolean isProjectPrepaid(Project project) {
|
||||
return project.getUnderwrittenMode() == 2 || project.getUnderwrittenMode() == 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起流程审批
|
||||
*/
|
||||
@SneakyThrows
|
||||
public void startAuditProgress(ProjectProcess entity, Map<String, Object> variables) {
|
||||
if (entity.getStatus() == ProcessStatus.to_be_audit) {
|
||||
switch (entity.getProcessType()) {
|
||||
case sale_contract:
|
||||
projectInstanceService.startProcessByProjectId(entity.getId(), ActProjectTypeEnum.SALE_CONTRACT, variables);
|
||||
break;
|
||||
case procurement_contract:
|
||||
projectInstanceService.startProcessByProjectId(entity.getId(), ActProjectTypeEnum.BUSINESS_PURCHASE, variables);
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("还不支持");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.*;
|
||||
import cn.palmte.work.config.activiti.ActApproveTypeEnum;
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -536,8 +537,9 @@ public class ProjectService {
|
|||
}
|
||||
ProjectInstanceRelation projectInstanceRelation = relationList.get(0);
|
||||
JSONObject obj = JSON.parseObject(json);
|
||||
ActApproveTypeEnum approveTypeEnum = ActApproveTypeEnum.ofType(obj.getIntValue("type"));
|
||||
actTaskDefService.completeTaskByProcInsId(projectInstanceRelation.getProcessInsId(),
|
||||
obj.getIntValue("type"), obj.getString("message"));
|
||||
approveTypeEnum, obj.getString("message"));
|
||||
|
||||
return ResponseMsg.buildSuccessMsg("审核成功",approvetype);
|
||||
}
|
||||
|
@ -764,10 +766,10 @@ public class ProjectService {
|
|||
projectBudgetService.budgetApprove(approveStatusBudget, project, admin);
|
||||
project.setApproveStatusBudget(ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus());
|
||||
} else if (project.getApproveStatusSettle() == ApproveStatusEnum.APPROVAL_UNCOMMIT.getApproveStatus()) {
|
||||
projectInstanceService.startSettleProcessInstance(project, InterfaceUtil.getAdmin());
|
||||
projectInstanceService.startFourcalProcess(project, ActProcessKeyEnum.SETTLE);
|
||||
project.setApproveStatusSettle(ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus());
|
||||
} else if (project.getApproveStatusFinal() == ApproveStatusEnum.APPROVAL_UNCOMMIT.getApproveStatus()) {
|
||||
projectInstanceService.startFinalProcessInstance(project.getId(), InterfaceUtil.getAdmin());
|
||||
projectInstanceService.startFourcalProcess(project, ActProcessKeyEnum.FINAL);
|
||||
project.setApproveStatusFinal(ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus());
|
||||
} else {
|
||||
return ;
|
||||
|
@ -860,7 +862,7 @@ public class ProjectService {
|
|||
|
||||
int projectId = one.getProjectId();
|
||||
int taskStatus = one.getTaskStatus();
|
||||
StatusEnum statusEnum = one.getStatusByProDefId();
|
||||
StatusEnum statusEnum = StatusEnum.parseByProcDefId(one.getProcDefId());
|
||||
String proDefKey = one.getProcDefKey();
|
||||
|
||||
//是否回退到发起节点
|
||||
|
@ -893,7 +895,8 @@ public class ProjectService {
|
|||
projectTaskRecordService.saveTaskRecordWithRollback(projectId, one, message, rollbackDesc);
|
||||
|
||||
//启动流程
|
||||
String processInstanceId = projectInstanceService.startProcessBySystem(project, proDefKey, one);
|
||||
ActProcessKeyEnum keyEnum = ActProcessKeyEnum.ofKey(proDefKey);
|
||||
String processInstanceId = projectInstanceService.startProcessBySystem(project, keyEnum, one);
|
||||
logger.info("rollbackTask startProcessBySystem : {}", processInstanceId);
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.*;
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -54,7 +54,7 @@ public class ProjectSettleService {
|
|||
projectService.updateStatusAndApproveStatus(project.getId(), StatusEnum.SETTLE_ACCOUNTS, ApproveStatusEnum.APPROVAL_PENDING, project.getOtherName());
|
||||
|
||||
//发起结算流程
|
||||
projectInstanceService.startSettleProcessInstance(project, InterfaceUtil.getAdmin());
|
||||
projectInstanceService.startFourcalProcess(project, ActProcessKeyEnum.SETTLE);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.StatusEnum;
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
import cn.palmte.work.config.activiti.ActProjectTypeEnum;
|
||||
import cn.palmte.work.config.activiti.ActTaskIndexEnum;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.model.ProjectTaskRecord;
|
||||
import cn.palmte.work.model.ProjectTaskRecordRepository;
|
||||
|
@ -61,7 +63,7 @@ public class ProjectTaskRecordService {
|
|||
record.setTaskStatus(ProjectTaskRecord.STATUS_ROLLBACK);
|
||||
record.setAssigneeId(InterfaceUtil.getAdminId() + "");
|
||||
record.setAssigneeName(InterfaceUtil.getAdmin().getRealName());
|
||||
record.setTaskIndex(ActConstant.TASK_INDEX_OTHER);
|
||||
record.setTaskIndex(ActTaskIndexEnum.COMMON.getIndex());
|
||||
record.setCreateTime(new Date());
|
||||
record.setRollbackRecordId(oldRecord.getId());
|
||||
record.setRollbackDesc(rollbackDesc);
|
||||
|
@ -84,13 +86,13 @@ public class ProjectTaskRecordService {
|
|||
record.setProcDefId(procDefId);
|
||||
record.setProcInsId(task.getProcessInstanceId());
|
||||
|
||||
int projectType = ActConstant.PROJECT_TYPE_FOURCAL;
|
||||
if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_SALE_CONTRACT)) {
|
||||
projectType = ActConstant.PROJECT_TYPE_SALE_CONTRACT;
|
||||
} else if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_BUSINESS_PURCHASE)) {
|
||||
projectType = ActConstant.PROJECT_TYPE_BUSINESS_PURCHASE;
|
||||
ActProjectTypeEnum projectTypeEnum = ActProjectTypeEnum.FOURCAL;
|
||||
if (procDefId.startsWith(ActProcessKeyEnum.SALE_CONTRACT.getKey())) {
|
||||
projectTypeEnum = ActProjectTypeEnum.SALE_CONTRACT;
|
||||
} else if (procDefId.startsWith(ActProcessKeyEnum.BUSINESS_PURCHASE.getKey())) {
|
||||
projectTypeEnum = ActProjectTypeEnum.BUSINESS_PURCHASE;
|
||||
}
|
||||
record.setProjectType(projectType);
|
||||
record.setProjectType(projectTypeEnum.getType());
|
||||
record.setTaskDefKey(task.getTaskDefinitionKey());
|
||||
record.setTaskName(task.getName());
|
||||
record.setTaskComment(comment);
|
||||
|
@ -102,10 +104,26 @@ public class ProjectTaskRecordService {
|
|||
return record;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据项目id查询审批任务记录
|
||||
*
|
||||
* @param projectId
|
||||
* @param typeEnum
|
||||
* @return
|
||||
*/
|
||||
public List<ProjectTaskRecord> listV2(int projectId, ActProjectTypeEnum typeEnum) {
|
||||
String select = "tr.*, su.role_name";
|
||||
QueryHelper queryHelper = new QueryHelper(select, " project_task_record tr LEFT JOIN sys_user su on su.id=tr.assignee_id ");
|
||||
queryHelper.addCondition("tr.project_id=?", projectId);
|
||||
queryHelper.addCondition("tr.project_type=?", typeEnum.getType());
|
||||
queryHelper.addOrderProperty("tr.create_time", true);
|
||||
return pagination.find(queryHelper.getSql(), ProjectTaskRecord.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据项目id查询审批任务记录 四算项目使用
|
||||
*
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
|
@ -113,6 +131,7 @@ public class ProjectTaskRecordService {
|
|||
String select = "tr.*, su.role_name";
|
||||
QueryHelper queryHelper = new QueryHelper(select, " project_task_record tr LEFT JOIN sys_user su on su.id=tr.assignee_id ");
|
||||
queryHelper.addCondition("tr.project_id=?", project.getId());
|
||||
queryHelper.addCondition("tr.project_type=?", ActProjectTypeEnum.FOURCAL.getType());
|
||||
queryHelper.addOrderProperty("tr.create_time", true);
|
||||
List<ProjectTaskRecord> projectTaskRecords = pagination.find(queryHelper.getSql(), ProjectTaskRecord.class);
|
||||
|
||||
|
@ -121,7 +140,7 @@ public class ProjectTaskRecordService {
|
|||
//预算流程可能有多个 找到最新的一个预算流程 最新的预算流程才能退回
|
||||
String lastProcInsId = "";
|
||||
Optional<String> lastProcInsIdOp = projectTaskRecords.stream()
|
||||
.filter(r -> r.getProcDefId().startsWith(ActConstant.PROCESS_DEFKEY_BUDGET))
|
||||
.filter(r -> r.getProcDefId().startsWith(ActProcessKeyEnum.BUDGET.getKey()))
|
||||
.map(ProjectTaskRecord::getProcInsId).max(Comparator.naturalOrder());
|
||||
if (lastProcInsIdOp.isPresent()) {
|
||||
lastProcInsId = lastProcInsIdOp.get();
|
||||
|
@ -138,7 +157,7 @@ public class ProjectTaskRecordService {
|
|||
|
||||
|
||||
//只能往当前任务之前退回
|
||||
StatusEnum statusEnum = record.getStatusByProDefId();
|
||||
StatusEnum statusEnum = StatusEnum.parseByProcDefId(record.getProcDefId());
|
||||
if (statusEnum.getStatus() > projectStatus) {
|
||||
//大于当前状态 不能退回
|
||||
continue;
|
||||
|
@ -151,7 +170,7 @@ public class ProjectTaskRecordService {
|
|||
}
|
||||
}
|
||||
|
||||
if (!record.getProcDefId().startsWith(ActConstant.PROCESS_DEFKEY_BUDGET)) {
|
||||
if (!record.getProcDefId().startsWith(ActProcessKeyEnum.BUDGET.getKey())) {
|
||||
//非预算流程全部支持退回
|
||||
record.setCanRollback(true);
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.palmte.work.utils;
|
||||
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.config.activiti.ActProcessKeyEnum;
|
||||
import cn.palmte.work.config.activiti.DeleteTaskCommand;
|
||||
import cn.palmte.work.config.activiti.JumpCommand;
|
||||
import cn.palmte.work.model.ProjectInstanceRelation;
|
||||
|
@ -54,15 +55,15 @@ public class ActUtil {
|
|||
|
||||
|
||||
public boolean isFourcalProcess(String procDefId) {
|
||||
return procDefId.startsWith(ActConstant.PROCESS_DEFKEY_ESTIMATE)
|
||||
|| procDefId.startsWith(ActConstant.PROCESS_DEFKEY_BUDGET)
|
||||
|| procDefId.startsWith(ActConstant.PROCESS_DEFKEY_SETTLE)
|
||||
|| procDefId.startsWith(ActConstant.PROCESS_DEFKEY_FINAL);
|
||||
return procDefId.startsWith(ActProcessKeyEnum.ESTIMATE.getKey())
|
||||
|| procDefId.startsWith(ActProcessKeyEnum.BUDGET.getKey())
|
||||
|| procDefId.startsWith(ActProcessKeyEnum.SETTLE.getKey())
|
||||
|| procDefId.startsWith(ActProcessKeyEnum.FINAL.getKey());
|
||||
}
|
||||
|
||||
public boolean isNewProcess(String procDefId) {
|
||||
return procDefId.startsWith(ActConstant.PROCESS_DEFKEY_SALE_CONTRACT)
|
||||
|| procDefId.startsWith(ActConstant.PROCESS_DEFKEY_BUSINESS_PURCHASE);
|
||||
return procDefId.startsWith(ActProcessKeyEnum.SALE_CONTRACT.getKey())
|
||||
|| procDefId.startsWith(ActProcessKeyEnum.BUSINESS_PURCHASE.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,13 +76,13 @@ public class ActUtil {
|
|||
*/
|
||||
public boolean targetBigThanCurrent(String procDefId, String targetTaskName, String currentTaskName) {
|
||||
String taskNames = ActConstant.PROCESS_TASKS_ESTIMATE;
|
||||
if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_BUDGET)) {
|
||||
if (procDefId.startsWith(ActProcessKeyEnum.BUDGET.getKey())) {
|
||||
taskNames = ActConstant.PROCESS_TASKS_BUDGET;
|
||||
}
|
||||
if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_SETTLE)) {
|
||||
if (procDefId.startsWith(ActProcessKeyEnum.SETTLE.getKey())) {
|
||||
taskNames = ActConstant.PROCESS_TASKS_SETTLE;
|
||||
}
|
||||
if (procDefId.startsWith(ActConstant.PROCESS_DEFKEY_FINAL)) {
|
||||
if (procDefId.startsWith(ActProcessKeyEnum.FINAL.getKey())) {
|
||||
taskNames = ActConstant.PROCESS_TASKS_FINAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,5 +51,15 @@ create table sale_contract
|
|||
payment_terms text null comment '收款条件',
|
||||
process_id int null comment '流程ID'
|
||||
);
|
||||
create table procurement_contract_supplier_material
|
||||
(
|
||||
id int auto_increment primary key comment 'ID',
|
||||
company_name varchar(255) null comment '公司名称',
|
||||
total_amount varchar(255) null comment '合计金额',
|
||||
service_terms varchar(255) null comment '服务条款',
|
||||
payment_terms varchar(255) null comment '付款条件',
|
||||
taxRate varchar(255) null comment '税率',
|
||||
remark varchar(255) null comment '备注',
|
||||
attachment varchar(1000) null comment '附件'
|
||||
|
||||
|
||||
);
|
|
@ -35,7 +35,7 @@
|
|||
<td>${list.procName!}</td>
|
||||
<td>${list.procKey!}</td>
|
||||
<td>${list.version!}</td>
|
||||
<td>${list.projectName!}</td>
|
||||
<td>${list.projectName!}${list.projectTitle!}</td>
|
||||
<td>${list.user!}</td>
|
||||
<td>${list.startTime?datetime}</td>
|
||||
<td>${list.currentTask!}</td>
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
<el-option label="${processType.description}"
|
||||
value="${processType.name()}"></el-option>
|
||||
</#list>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
@ -105,8 +104,9 @@
|
|||
v-if="scope.row.status==='audit_passed' || scope.row.status==='audit_not_passed' || scope.row.status==='to_be_audit'"
|
||||
type="text" @click="showDetail(scope.row, scope)">查看详情
|
||||
</el-button>
|
||||
<el-button v-if="scope.row.status==='audit_passed' || scope.row.status==='audit_not_passed'"
|
||||
type="text" @click="showAuditDetail(scope.row, scope)">查看审核流程
|
||||
<el-button
|
||||
v-if="scope.row.status==='audit_passed' || scope.row.status==='audit_not_passed' || scope.row.status==='to_be_audit'"
|
||||
type="text" @click="showAuditDetail(scope.row, scope)">查看审核流程
|
||||
</el-button>
|
||||
<el-button v-if="scope.row.status==='draft' || scope.row.status==='audit_not_passed'"
|
||||
type="text" @click="editProcess(scope.row, scope)">编辑
|
||||
|
@ -184,12 +184,10 @@
|
|||
|
||||
const methods = {
|
||||
showDetail(row, scope) {
|
||||
console.log(row)
|
||||
console.log(scope)
|
||||
window.location = "${base}/process/detail/" + row.id;
|
||||
},
|
||||
editProcess(row, scope) {
|
||||
|
||||
window.location = "${base}/process/edit/" + row.id;
|
||||
},
|
||||
deleteProcess(row, scope) {
|
||||
this.$confirm('您确认要删除审批流程吗?', '删除', {
|
||||
|
@ -390,7 +388,7 @@
|
|||
return this.mode === BUTTON
|
||||
},
|
||||
isBusinessProcurementContractProcessMode() {
|
||||
return this.mode === newBusinessProcurementContractProcess
|
||||
return this.mode === procurementContractProcess
|
||||
},
|
||||
isSalesContractProcessMode() {
|
||||
return this.mode === saleContractProcess
|
||||
|
@ -406,7 +404,7 @@
|
|||
return "新增销售合同流程"
|
||||
case saleContractDetail:
|
||||
return "销售合同清单明细"
|
||||
case newBusinessProcurementContractProcess:
|
||||
case procurementContractProcess:
|
||||
return "新增业务采购合同流程"
|
||||
}
|
||||
}
|
||||
|
@ -434,7 +432,7 @@
|
|||
switch (value) {
|
||||
case 'sale_contract':
|
||||
return "销售合同流程"
|
||||
case 'business_procurement':
|
||||
case 'procurement_contract':
|
||||
return "业务采购流程"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
<#assign base=request.contextPath />
|
||||
<#import "../../common/defaultLayout.ftl" as defaultLayout>
|
||||
<@defaultLayout.layout>
|
||||
<#-- <link rel="stylesheet" href="../assets/css/amazeui.switch.css"/>-->
|
||||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
||||
<style>
|
||||
|
||||
#businessPurchaseDetailsModal {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#businessPurchaseDetailsModal > table {
|
||||
|
||||
}
|
||||
|
||||
#newBusinessProcurementContractProcess {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.el-upload__input {
|
||||
display: none !important;
|
||||
}
|
||||
|
@ -36,145 +23,196 @@
|
|||
.el-upload-list__item-name [class^="el-icon"] {
|
||||
height: unset;
|
||||
}
|
||||
|
||||
.el-tag--small {
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="admin-content" id="app">
|
||||
<div class="admin-content-body">
|
||||
<div class="am-cf am-padding">
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">业务应用</strong> /
|
||||
<small>流程详情</small></div>
|
||||
<small>${process.processType.description}详情</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<#-- 新增销售合同流程 -->
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12">
|
||||
<el-form :inline="true" ref="saleContractProcessForm" :model="processForm" label-position="right" label-width="100px">
|
||||
|
||||
<div class="am-form-inline">
|
||||
<el-descriptions title="${process.processType.description}详情">
|
||||
<el-descriptions-item label="项目编号">${process.projectNo}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目标题">${process.projectTitle}</el-descriptions-item>
|
||||
<el-descriptions-item label="申请时间">${process.applyDate}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目类型">${projectType}</el-descriptions-item>
|
||||
<el-descriptions-item label="合作类型">${cooperationType}</el-descriptions-item>
|
||||
|
||||
<el-form-item label="项目标题">
|
||||
<span>${process.projectNo}</span>
|
||||
</el-form-item>
|
||||
<el-descriptions-item label="申请部门">${process.applyDept}</el-descriptions-item>
|
||||
<el-descriptions-item label="申请人">${process.applyPersonName}</el-descriptions-item>
|
||||
<el-descriptions-item label="申请部门领导">${process.applyDeptLeaderName}</el-descriptions-item>
|
||||
<el-descriptions-item label="申请人电话">${contract.applyPersonPhone}</el-descriptions-item>
|
||||
|
||||
<el-tooltip effect="light" :content="projectTitle" placement="top-start">
|
||||
<el-form-item label="项目标题">
|
||||
<span>${process.projectTitle}</span>
|
||||
<el-descriptions-item label="合同编号">${process.contractNo}</el-descriptions-item>
|
||||
<el-descriptions-item label="合同名称">${process.contractName}</el-descriptions-item>
|
||||
<el-descriptions-item label="合同金额">${project.contractAmount}</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="客户名称">${contract.clientName}</el-descriptions-item>
|
||||
<el-descriptions-item label="最终用户名称">${project.terminalCustomer}</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="用印类型">
|
||||
<#list process.sealTypes.list as item>
|
||||
<el-tag size="small">${item.description}</el-tag>
|
||||
</#list>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="税率">${process.taxRate}%</el-descriptions-item>
|
||||
<el-descriptions-item label="是否垫资">${isPrepaid}</el-descriptions-item>
|
||||
<el-descriptions-item label="垫资金额">${repaidAmount}元</el-descriptions-item>
|
||||
<el-descriptions-item label="预算毛利率">${project.grossProfitMargin}</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="收款条件">${contract.paymentTerms}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">${process.remark}</el-descriptions-item>
|
||||
<el-descriptions-item label="附件">
|
||||
<#list attachments as attachment>
|
||||
<el-tag size="small">
|
||||
<a href="${attachment.uri}">
|
||||
<i class="el-icon-document"></i> ${attachment.name}
|
||||
</a>
|
||||
</el-tag>
|
||||
</#list>
|
||||
</el-descriptions-item>
|
||||
|
||||
</el-descriptions>
|
||||
|
||||
<#--
|
||||
<el-form :inline="true" ref="saleContractProcessForm" :model="processForm" label-position="right" label-width="100px">
|
||||
|
||||
<div class="am-form-inline">
|
||||
|
||||
<el-form-item label="项目编号">
|
||||
<span>${process.projectNo}</span>
|
||||
</el-form-item>
|
||||
</el-tooltip>
|
||||
|
||||
<el-form-item label="申请时间">
|
||||
<span>${process.applyDate}</span>
|
||||
</el-form-item>
|
||||
<el-tooltip effect="light" :content="projectTitle" placement="top-start">
|
||||
<el-form-item label="项目标题">
|
||||
<span>${process.projectTitle}</span>
|
||||
</el-form-item>
|
||||
</el-tooltip>
|
||||
|
||||
<el-form-item label="项目类型">
|
||||
<span>${projectType}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请时间">
|
||||
<span>${process.applyDate}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="合作类型">
|
||||
<span>${cooperationType}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目类型">
|
||||
<span>${projectType}</span>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
<el-form-item label="合作类型">
|
||||
<span>${cooperationType}</span>
|
||||
</el-form-item>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
|
||||
<el-form-item label="申请部门">
|
||||
<span>${process.applyDept}</span>
|
||||
</el-form-item>
|
||||
<div>
|
||||
|
||||
<el-form-item label="申请人">
|
||||
<span>${process.applyPersonName}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请部门">
|
||||
<span>${process.applyDept}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="申请部门领导">
|
||||
<span>${process.applyDeptLeaderName}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人">
|
||||
<span>${process.applyPersonName}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="申请人电话" prop="applyPersonPhone">
|
||||
<span>${contract.applyPersonPhone}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请部门领导">
|
||||
<span>${process.applyDeptLeaderName}</span>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
<el-form-item label="申请人电话" prop="applyPersonPhone">
|
||||
<span>${contract.applyPersonPhone}</span>
|
||||
</el-form-item>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
|
||||
<el-form-item label="合同编号">
|
||||
<span>${process.contractNo}</span>
|
||||
</el-form-item>
|
||||
<div>
|
||||
|
||||
<el-form-item label="合同名称">
|
||||
<span>${process.contractName}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同编号">
|
||||
<span>${process.contractNo}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="合同金额">
|
||||
<span>${project.contractAmount}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同名称">
|
||||
<span>${process.contractName}</span>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
<el-form-item label="合同金额">
|
||||
<span>${project.contractAmount}</span>
|
||||
</el-form-item>
|
||||
|
||||
<div>
|
||||
<el-form-item label="客户名称" :rules="[{ required: true, message: '客户名称不能为空'}]">
|
||||
<span>${contract.clientName}</span>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item label="最终用户名称">
|
||||
<span>${project.terminalCustomer}</span>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div>
|
||||
<el-form-item label="客户名称">
|
||||
<span>${contract.clientName}</span>
|
||||
</el-form-item>
|
||||
|
||||
<div>
|
||||
<el-form-item label="用印类型" :rules="[{ required: true, message: '用印类型不能为空'}]">
|
||||
<span>${process.sealTypes}</span>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="最终用户名称">
|
||||
<span>${project.terminalCustomer}</span>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<el-form-item label="用印类型">
|
||||
<#list process.sealTypes.sealTypes as item>
|
||||
<el-tag size="small">${item.description}</el-tag>
|
||||
</#list>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item label="税率">
|
||||
<span>${process.taxRate}%</span>
|
||||
</el-form-item>
|
||||
<div>
|
||||
|
||||
<el-form-item label="是否垫资">
|
||||
<span>${isPrepaid}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="税率">
|
||||
<span>${process.taxRate}%</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="垫资金额">
|
||||
<span>${repaidAmount}元</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否垫资">
|
||||
<span>${isPrepaid}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="预算毛利率">
|
||||
<span>${project.grossProfitMargin}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="垫资金额">
|
||||
<span>${repaidAmount}元</span>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
<el-form-item label="预算毛利率">
|
||||
<span>${project.grossProfitMargin}</span>
|
||||
</el-form-item>
|
||||
|
||||
<div>
|
||||
<el-form-item label="收款条件">
|
||||
<div>${contract.paymentTerms}</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item label="备注">
|
||||
<div>${process.remark}</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div>
|
||||
<el-form-item label="收款条件">
|
||||
<div>${contract.paymentTerms}</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item label="附件">
|
||||
<#list attachments as attachment>
|
||||
<a href="${attachment.uri}">${attachment.name}</a>
|
||||
</#list>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div>
|
||||
<el-form-item label="备注">
|
||||
<div>${process.remark}</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
</el-form>
|
||||
<div>
|
||||
<el-form-item label="附件">
|
||||
<#list attachments as attachment>
|
||||
<a href="${attachment.uri}">
|
||||
<i class="el-icon-document"></i> ${attachment.name}
|
||||
</a>
|
||||
</#list>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
</el-form>
|
||||
-->
|
||||
|
||||
<#-- <el-row justify="space-around" type="flex" class="row-bg">-->
|
||||
<el-row>
|
||||
<el-button type="info" @click="goToHome">返回上一级</el-button>
|
||||
<el-button type="primary" @click="saveDraft">保存草稿</el-button>
|
||||
<el-button type="success" @click="submit">提交</el-button>
|
||||
<el-button type="info" @click="backLastPage">返回上一级</el-button>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
|
@ -190,11 +228,6 @@
|
|||
|
||||
<script>
|
||||
|
||||
const newBusinessProcurementContractProcess = "newBusinessProcurementContractProcess"
|
||||
const saleContractProcess = "saleContractProcess"
|
||||
const saleContractDetail = "saleContractDetail"
|
||||
const BUTTON = "btn"
|
||||
|
||||
const isEmpty = (obj) => {
|
||||
return !obj || (obj.length && obj.length === 0)
|
||||
}
|
||||
|
@ -212,429 +245,19 @@
|
|||
}
|
||||
|
||||
const data = () => {
|
||||
return {
|
||||
mode: "btn", // btn , newBusinessProcurementContractProcess
|
||||
processForm: {
|
||||
sealTypes: [],
|
||||
},
|
||||
projectSelected: false,
|
||||
applySectorOptions: [
|
||||
{
|
||||
value: 'zhinan',
|
||||
label: '指南',
|
||||
children: [{
|
||||
value: 'shejiyuanze',
|
||||
label: '设计原则',
|
||||
children: [{
|
||||
value: 'yizhi',
|
||||
label: '一致'
|
||||
}, {
|
||||
value: 'fankui',
|
||||
label: '反馈'
|
||||
}, {
|
||||
value: 'xiaolv',
|
||||
label: '效率'
|
||||
}, {
|
||||
value: 'kekong',
|
||||
label: '可控'
|
||||
}]
|
||||
}, {
|
||||
value: 'daohang',
|
||||
label: '导航',
|
||||
children: [{
|
||||
value: 'cexiangdaohang',
|
||||
label: '侧向导航'
|
||||
}, {
|
||||
value: 'dingbudaohang',
|
||||
label: '顶部导航'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'zujian',
|
||||
label: '组件',
|
||||
children: [{
|
||||
value: 'basic',
|
||||
label: 'Basic',
|
||||
children: [{
|
||||
value: 'layout',
|
||||
label: 'Layout 布局'
|
||||
}, {
|
||||
value: 'color',
|
||||
label: 'Color 色彩'
|
||||
}, {
|
||||
value: 'typography',
|
||||
label: 'Typography 字体'
|
||||
}, {
|
||||
value: 'icon',
|
||||
label: 'Icon 图标'
|
||||
}, {
|
||||
value: 'button',
|
||||
label: 'Button 按钮'
|
||||
}]
|
||||
}, {
|
||||
value: 'form',
|
||||
label: 'Form',
|
||||
children: [{
|
||||
value: 'radio',
|
||||
label: 'Radio 单选框'
|
||||
}, {
|
||||
value: 'checkbox',
|
||||
label: 'Checkbox 多选框'
|
||||
}, {
|
||||
value: 'input',
|
||||
label: 'Input 输入框'
|
||||
}, {
|
||||
value: 'input-number',
|
||||
label: 'InputNumber 计数器'
|
||||
}, {
|
||||
value: 'select',
|
||||
label: 'Select 选择器'
|
||||
}, {
|
||||
value: 'cascader',
|
||||
label: 'Cascader 级联选择器'
|
||||
}, {
|
||||
value: 'switch',
|
||||
label: 'Switch 开关'
|
||||
}, {
|
||||
value: 'slider',
|
||||
label: 'Slider 滑块'
|
||||
}, {
|
||||
value: 'time-picker',
|
||||
label: 'TimePicker 时间选择器'
|
||||
}, {
|
||||
value: 'date-picker',
|
||||
label: 'DatePicker 日期选择器'
|
||||
}, {
|
||||
value: 'datetime-picker',
|
||||
label: 'DateTimePicker 日期时间选择器'
|
||||
}, {
|
||||
value: 'upload',
|
||||
label: 'Upload 上传'
|
||||
}, {
|
||||
value: 'rate',
|
||||
label: 'Rate 评分'
|
||||
}, {
|
||||
value: 'form',
|
||||
label: 'Form 表单'
|
||||
}]
|
||||
}, {
|
||||
value: 'data',
|
||||
label: 'Data',
|
||||
children: [{
|
||||
value: 'table',
|
||||
label: 'Table 表格'
|
||||
}, {
|
||||
value: 'tag',
|
||||
label: 'Tag 标签'
|
||||
}, {
|
||||
value: 'progress',
|
||||
label: 'Progress 进度条'
|
||||
}, {
|
||||
value: 'tree',
|
||||
label: 'Tree 树形控件'
|
||||
}, {
|
||||
value: 'pagination',
|
||||
label: 'Pagination 分页'
|
||||
}, {
|
||||
value: 'badge',
|
||||
label: 'Badge 标记'
|
||||
}]
|
||||
}, {
|
||||
value: 'notice',
|
||||
label: 'Notice',
|
||||
children: [{
|
||||
value: 'alert',
|
||||
label: 'Alert 警告'
|
||||
}, {
|
||||
value: 'loading',
|
||||
label: 'Loading 加载'
|
||||
}, {
|
||||
value: 'message',
|
||||
label: 'Message 消息提示'
|
||||
}, {
|
||||
value: 'message-box',
|
||||
label: 'MessageBox 弹框'
|
||||
}, {
|
||||
value: 'notification',
|
||||
label: 'Notification 通知'
|
||||
}]
|
||||
}, {
|
||||
value: 'navigation',
|
||||
label: 'Navigation',
|
||||
children: [{
|
||||
value: 'menu',
|
||||
label: 'NavMenu 导航菜单'
|
||||
}, {
|
||||
value: 'tabs',
|
||||
label: 'Tabs 标签页'
|
||||
}, {
|
||||
value: 'breadcrumb',
|
||||
label: 'Breadcrumb 面包屑'
|
||||
}, {
|
||||
value: 'dropdown',
|
||||
label: 'Dropdown 下拉菜单'
|
||||
}, {
|
||||
value: 'steps',
|
||||
label: 'Steps 步骤条'
|
||||
}]
|
||||
}, {
|
||||
value: 'others',
|
||||
label: 'Others',
|
||||
children: [{
|
||||
value: 'dialog',
|
||||
label: 'Dialog 对话框'
|
||||
}, {
|
||||
value: 'tooltip',
|
||||
label: 'Tooltip 文字提示'
|
||||
}, {
|
||||
value: 'popover',
|
||||
label: 'Popover 弹出框'
|
||||
}, {
|
||||
value: 'card',
|
||||
label: 'Card 卡片'
|
||||
}, {
|
||||
value: 'carousel',
|
||||
label: 'Carousel 走马灯'
|
||||
}, {
|
||||
value: 'collapse',
|
||||
label: 'Collapse 折叠面板'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'ziyuan',
|
||||
label: '资源',
|
||||
children: [{
|
||||
value: 'axure',
|
||||
label: 'Axure Components'
|
||||
}, {
|
||||
value: 'sketch',
|
||||
label: 'Sketch Templates'
|
||||
}, {
|
||||
value: 'jiaohu',
|
||||
label: '组件交互文档'
|
||||
}]
|
||||
}
|
||||
],
|
||||
fileList: [],
|
||||
// 销售合同收入明细
|
||||
incomeDetails: [],
|
||||
attachmentUri: [],
|
||||
attachmentMap: {}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
const methods = {
|
||||
changeMode(mode) {
|
||||
this.mode = mode
|
||||
},
|
||||
|
||||
render(obj) {
|
||||
console.log(obj)
|
||||
},
|
||||
|
||||
initForm(form) {
|
||||
this.processForm = { ...form, sealTypes: [] }
|
||||
},
|
||||
|
||||
queryProject(q, callback) {
|
||||
if (isBlank(q)) {
|
||||
return
|
||||
}
|
||||
fetch("${base}/process/projects?q=" + q)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
if (data.length === 0) {
|
||||
callback([{
|
||||
name: '未搜索到结果'
|
||||
}])
|
||||
}
|
||||
else {
|
||||
callback(data)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error('项目搜索失败');
|
||||
})
|
||||
},
|
||||
handleSelectProject(selected) {
|
||||
const { id, name } = selected
|
||||
if (!id) {
|
||||
this.initForm({})
|
||||
return
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在加载项目',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
fetch("${base}/process/projects/" + id)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
const { incomeDetails, ...form } = data
|
||||
// 转换数据
|
||||
// @formatter:off
|
||||
const computeType = (type) => {
|
||||
switch (type) {
|
||||
case 1: return '设备'
|
||||
case 2: return '工程'
|
||||
case 3: return '服务'
|
||||
default: return '未知'
|
||||
}
|
||||
}
|
||||
// @formatter:on
|
||||
|
||||
this.initForm(form)
|
||||
this.projectSelected = true
|
||||
this.incomeDetails = incomeDetails.map(detail => ({
|
||||
...detail, type: computeType(detail.type)
|
||||
}))
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error("项目'" + name + "'加载失败");
|
||||
})
|
||||
.finally(() => loading.close())
|
||||
},
|
||||
clearProjectProcess() {
|
||||
this.projectSelected = false
|
||||
this.initForm({})
|
||||
this.incomeDetails = []
|
||||
},
|
||||
|
||||
saveDraft() {
|
||||
this.processForm.status = 'draft'
|
||||
this.submit()
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.$refs["saleContractProcessForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
const fileList = this.fileList
|
||||
console.log(fileList)
|
||||
if (fileList.length === 0) {
|
||||
this.$message.error("未上传附件");
|
||||
return false
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在提交',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
const form = {
|
||||
...this.processForm,
|
||||
processType: 'sale_contract',
|
||||
projectTitle: this.projectTitle,
|
||||
attachmentUri: fileList.map(file => (file.response.data.url)),
|
||||
incomeDetails: this.incomeDetails.map(detail => ({
|
||||
id: detail.id, expirationDate: detail.expirationDate
|
||||
}))
|
||||
}
|
||||
|
||||
fetch("${base}/process", {
|
||||
method: 'POST', // or 'PUT'
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(form),
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '提交成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
else {
|
||||
return Promise.reject("失败")
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error("项目提交失败");
|
||||
}).finally(() => loading.close())
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
submitToSaleContractProcess() {
|
||||
this.goToSaleContractProcess()
|
||||
},
|
||||
|
||||
handleRemove(file, fileList) {
|
||||
this.fileList = fileList
|
||||
},
|
||||
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning("当前限制选择只能选择10个文件");
|
||||
this.fileList = fileList
|
||||
},
|
||||
|
||||
beforeRemove(file, fileList) {
|
||||
return this.$confirm("确定移除 " + file.name + "?");
|
||||
},
|
||||
|
||||
handleFileUploaded(response, file, fileList) {
|
||||
if (response.success) {
|
||||
this.fileList = fileList
|
||||
}
|
||||
else {
|
||||
this.$message.warning("上传失败");
|
||||
}
|
||||
},
|
||||
|
||||
indexMethod(index) {
|
||||
return index * 1;
|
||||
backLastPage() {
|
||||
window.history.back();
|
||||
}
|
||||
}
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data,
|
||||
computed: {
|
||||
projectTitle() {
|
||||
const { projectNo, projectName, applyPersonName, applyDate } = this.processForm
|
||||
if (projectNo && projectName) {
|
||||
return projectNo.trim() + "-" + projectName.trim() + "-" + applyPersonName + "-" + applyDate
|
||||
}
|
||||
return ""
|
||||
},
|
||||
isButtonMode() {
|
||||
return this.mode === BUTTON
|
||||
},
|
||||
isBusinessProcurementContractProcessMode() {
|
||||
return this.mode === newBusinessProcurementContractProcess
|
||||
},
|
||||
isSalesContractProcessMode() {
|
||||
return this.mode === saleContractProcess
|
||||
},
|
||||
isSaleContractDetailMode() {
|
||||
return this.mode === saleContractDetail
|
||||
},
|
||||
subTitle() {
|
||||
switch (this.mode) {
|
||||
case BUTTON:
|
||||
return "新增流程"
|
||||
case saleContractProcess:
|
||||
return "新增销售合同流程"
|
||||
case saleContractDetail:
|
||||
return "销售合同清单明细"
|
||||
case newBusinessProcurementContractProcess:
|
||||
return "新增业务采购合同流程"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods,
|
||||
|
||||
mounted() {
|
||||
this.handleSelectProject({ id: 135, name: '' })
|
||||
},
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,807 @@
|
|||
<#assign base=request.contextPath />
|
||||
<#import "../../common/defaultLayout.ftl" as defaultLayout>
|
||||
<@defaultLayout.layout>
|
||||
<#-- <link rel="stylesheet" href="../assets/css/amazeui.switch.css"/>-->
|
||||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
||||
<style>
|
||||
|
||||
#businessPurchaseDetailsModal {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#businessPurchaseDetailsModal > table {
|
||||
|
||||
}
|
||||
|
||||
#newBusinessProcurementContractProcess {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.el-upload__input {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.el-textarea .el-input__count {
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.admin-content-body {
|
||||
margin-bottom: 100px;
|
||||
}
|
||||
|
||||
.el-table__empty-block {
|
||||
height: 60px !important;
|
||||
}
|
||||
|
||||
.el-upload-list__item-name [class^="el-icon"] {
|
||||
height: unset;
|
||||
}
|
||||
|
||||
.el-checkbox {
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="admin-content" id="app">
|
||||
<div class="admin-content-body">
|
||||
<div class="am-cf am-padding">
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">业务应用</strong> /
|
||||
<small>{{subTitle}}</small></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g">
|
||||
<#-- 新增销售合同流程 -->
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12" v-if="isSalesContractMode">
|
||||
<el-form :inline="true" ref="saleContractProcessForm" :model="processForm" label-position="right" label-width="100px">
|
||||
|
||||
<div class="am-form-inline">
|
||||
<el-form-item label="项目编号">
|
||||
<span>{{processForm.projectNo}}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-tooltip :disabled="!projectSelected" effect="light" :content="projectTitle" placement="top-start">
|
||||
<el-form-item label="项目标题">
|
||||
<span>{{projectTitle}}</span>
|
||||
</el-form-item>
|
||||
</el-tooltip>
|
||||
|
||||
<el-form-item label="申请时间">
|
||||
<span>{{processForm.applyDate}}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="采购模式" v-if="isProcurementContractMode">
|
||||
<el-select v-model="processForm.procurementMode" placeholder="请选择采购模式">
|
||||
<#list procurementMode as item>
|
||||
<el-option label="${item.description}" value="${item.name()}"></el-option>
|
||||
</#list>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目类型" v-if="isSalesContractMode">
|
||||
<span>{{processForm.projectType}}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="合作类型">
|
||||
<span>{{processForm.cooperationType}}</span>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<el-form-item label="申请部门" :rules="[{ required: true, message: '申请部门电话不能为空'}]" prop="applyDept">
|
||||
<el-cascader :options="applySectorOptions" clearable v-model="processForm.applyDept"></el-cascader>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="申请人">
|
||||
<span>{{processForm.applyPersonName}}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="申请部门领导">
|
||||
<span>{{processForm.applyDeptLeaderName}}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="申请人电话" :rules="[{ required: true, message: '申请人电话不能为空'}]" prop="applyPersonPhone">
|
||||
<el-input placeholder="请输入内容" v-model="processForm.applyPersonPhone"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<el-form-item label="合同编号" :rules="[{ required: true, message: '合同编号不能为空'}]" prop="contractNo">
|
||||
<el-input placeholder="请输入合同编号" v-model="processForm.contractNo"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="isSalesContractMode" label="合同名称" :rules="[{ required: true, message: '合同名称不能为空'}]"
|
||||
prop="contractName">
|
||||
<el-input placeholder="请输入合同名称" v-model="processForm.contractName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="isProcurementContractMode" label="采购合同名称"
|
||||
:rules="[{ required: true, message: '采购合同名称不能为空'}]" prop="contractName">
|
||||
<el-input placeholder="请输入采购合同名称" v-model="processForm.contractName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="合同金额">
|
||||
<span>{{processForm.contractAmount}}元</span>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item v-if="isSalesContractMode" label="客户名称" :rules="[{ required: true, message: '客户名称不能为空'}]">
|
||||
<el-input placeholder="请输入客户名称" v-model="processForm.clientName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="isProcurementContractMode" label="供应商名称" :rules="[{ required: true, message: '供应商名称不能为空'}]">
|
||||
<el-input placeholder="请输入供应商" v-model="processForm.supplierName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="最终用户名称">
|
||||
<span>{{processForm.terminalCustomer}}</span>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item label="用印类型" :rules="[{ required: true, message: '用印类型不能为空'}]">
|
||||
<el-checkbox-group v-model="processForm.sealTypes">
|
||||
<#list sealTypes as sealType>
|
||||
<el-checkbox label="${sealType.name()}" key="key-${sealType.name()}">${sealType.description}</el-checkbox>
|
||||
</#list>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<el-form-item label="税率" :rules="[{ required: true, message: '税率不能为空'}]" prop="taxRate">
|
||||
<el-select v-model="processForm.taxRate" placeholder="请选择税率">
|
||||
<#list taxRate as rate>
|
||||
<el-option label="${rate}%" value="${rate}"></el-option>
|
||||
</#list>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="是否垫资">
|
||||
<span>{{processForm.isPrepaid}}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="垫资金额">
|
||||
<span>{{processForm.repaidAmount}}</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="预算毛利率">
|
||||
<span>{{processForm.budgetGrossMargin}}</span>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item v-if="isSalesContractMode" label="收款条件" :rules="[{ required: true, message: '收款条件不能为空'}]"
|
||||
prop="paymentTerms">
|
||||
<el-input type="textarea" :autosize="{ minRows: 3, maxRows: 10}" cols="90" maxlength="5000" show-word-limit
|
||||
v-model="processForm.paymentTerms" placeholder="请输入收款条件(限制5000字)"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="isProcurementContractMode" label="付款条件" :rules="[{ required: true, message: '付款条件不能为空'}]"
|
||||
prop="paymentTerms">
|
||||
<el-input type="textarea" :autosize="{ minRows: 3, maxRows: 10}" cols="90" maxlength="5000" show-word-limit
|
||||
v-model="processForm.paymentTerms" placeholder="请输入付款条件(限制5000字)"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item label="备注">
|
||||
<el-input type="textarea" :autosize="{ minRows: 3, maxRows: 10}" maxlength="5000" show-word-limit
|
||||
v-model="processForm.remark" placeholder="请输入备注(限制5000字)" cols="90"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item label="上传附件" :rules="[{ required: true, message: '未上传附件'}]">
|
||||
<el-upload class="upload-demo"
|
||||
action="${base}/file/upload"
|
||||
name="files[]"
|
||||
:on-remove="handleRemove"
|
||||
:before-remove="beforeRemove"
|
||||
:on-success="handleFileUploaded"
|
||||
:limit="10" :file-list="fileList"
|
||||
:on-exceed="handleExceed">
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传PDF、excel、word、图片、压缩包,且不超过50MB</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item label="合同清单明细">
|
||||
<el-button type="text" @click="goToSaleContractDetail">详细清单</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div v-if="isProcurementContractMode">
|
||||
供应商比选材料
|
||||
<div class="am-u-sm-12 am-u-md-12" v-if="isProcurementContractMode">
|
||||
<el-table style="width: 100%" border>
|
||||
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
|
||||
|
||||
<el-table-column prop="fee" label="公司名称" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="合计金额" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="服务条款" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="付款条件" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="税率(%)" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="备注"></el-table-column>
|
||||
<el-table-column prop="fee" label="附件"></el-table-column>
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</el-form>
|
||||
|
||||
|
||||
<el-row>
|
||||
<el-button type="info" @click="backLastPage">返回上一级</el-button>
|
||||
<el-button type="primary" @click="saveDraft">保存草稿</el-button>
|
||||
<el-button type="success" @click="submitForm">提交</el-button>
|
||||
</el-row>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<#-- 销售合同清单明细 -->
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12" v-if="isSaleContractDetailMode">
|
||||
<el-table border :data="incomeDetails">
|
||||
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
|
||||
<el-table-column prop="name" label="名称" fixed width="120"></el-table-column>
|
||||
<el-table-column prop="type" label="类别"></el-table-column>
|
||||
<el-table-column prop="spec" label="规格型号"></el-table-column>
|
||||
<el-table-column prop="param" label="参数"></el-table-column>
|
||||
<el-table-column prop="unit" label="单位"></el-table-column>
|
||||
<el-table-column prop="amount" label="数量"></el-table-column>
|
||||
<el-table-column prop="price" label="单价" width="120"></el-table-column>
|
||||
<el-table-column prop="taxRate" label="税率"></el-table-column>
|
||||
<el-table-column prop="totalTaxInclude" label="含税金额" width="120"></el-table-column>
|
||||
<el-table-column prop="totalTaxExclude" label="不含税金额" width="120"></el-table-column>
|
||||
<el-table-column prop="totalTax" label="税金"></el-table-column>
|
||||
|
||||
<el-table-column prop="expirationDate" label="质保期" fixed="right" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input maxlength="5" size="mini" placeholder="请输入质保期"
|
||||
v-model="scope.row.expirationDate"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
<el-row style="margin: 20px 0">
|
||||
<el-button type="info" @click="goToSaleContractProcess">返回上一级</el-button>
|
||||
<el-button type="primary" @click="submitToSaleContractProcess">保存并返回上一级</el-button>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
|
||||
<#-- 选择 业务采购清单明细 -->
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12" v-if="isProcurementContractMode">
|
||||
<el-table style="width: 100%" border>
|
||||
|
||||
<el-table-column prop="fee" label="费用项目" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="采购类别" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="产品名称" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="单位" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="数量" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="预算单价" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="税率(%)" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="含税总金额(元)" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="不含税金额(元)" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="税金(元)" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="是否垫资" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="支出时间" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="支出金额(元)" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="已采购数量" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="本次采购数量" width="180"></el-table-column>
|
||||
<el-table-column prop="fee" label="未采购数量" width="180"></el-table-column>
|
||||
|
||||
|
||||
<el-table-column prop="fee" label="供应商名称"></el-table-column>
|
||||
<el-table-column prop="fee" label="设备厂商名称"></el-table-column>
|
||||
<el-table-column prop="fee" label="对应采购清单"></el-table-column>
|
||||
<el-table-column prop="fee" label="规格型号"></el-table-column>
|
||||
<el-table-column prop="fee" label="对应采购数目"></el-table-column>
|
||||
<el-table-column prop="fee" label="采购单价"></el-table-column>
|
||||
<el-table-column prop="fee" label="含税总金额(元)"></el-table-column>
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
|
||||
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
const newBusinessProcurementContractProcess = "newBusinessProcurementContractProcess"
|
||||
const newBusinessProcurementContractDetail = "newBusinessProcurementContractDetail"
|
||||
const saleContractProcess = "saleContractProcess"
|
||||
const saleContractDetail = "saleContractDetail"
|
||||
const BUTTON = "btn"
|
||||
|
||||
const isEmpty = (obj) => {
|
||||
return !obj || (obj.length && obj.length === 0)
|
||||
}
|
||||
|
||||
const isNotEmpty = (obj) => {
|
||||
return !isEmpty(obj)
|
||||
}
|
||||
|
||||
const isBlank = (obj) => {
|
||||
return isEmpty(obj) || (obj.trim && isEmpty(obj.trim()))
|
||||
}
|
||||
|
||||
const hasText = (obj) => {
|
||||
return !isBlank(obj)
|
||||
}
|
||||
|
||||
const data = () => {
|
||||
return {
|
||||
mode: "btn", // btn , newBusinessProcurementContractProcess
|
||||
processForm: {
|
||||
sealTypes: [],
|
||||
},
|
||||
processType: '',
|
||||
projectSelected: false,
|
||||
applySectorOptions: [
|
||||
{
|
||||
value: 'zhinan',
|
||||
label: '指南',
|
||||
children: [{
|
||||
value: 'shejiyuanze',
|
||||
label: '设计原则',
|
||||
children: [{
|
||||
value: 'yizhi',
|
||||
label: '一致'
|
||||
}, {
|
||||
value: 'fankui',
|
||||
label: '反馈'
|
||||
}, {
|
||||
value: 'xiaolv',
|
||||
label: '效率'
|
||||
}, {
|
||||
value: 'kekong',
|
||||
label: '可控'
|
||||
}]
|
||||
}, {
|
||||
value: 'daohang',
|
||||
label: '导航',
|
||||
children: [{
|
||||
value: 'cexiangdaohang',
|
||||
label: '侧向导航'
|
||||
}, {
|
||||
value: 'dingbudaohang',
|
||||
label: '顶部导航'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'zujian',
|
||||
label: '组件',
|
||||
children: [{
|
||||
value: 'basic',
|
||||
label: 'Basic',
|
||||
children: [{
|
||||
value: 'layout',
|
||||
label: 'Layout 布局'
|
||||
}, {
|
||||
value: 'color',
|
||||
label: 'Color 色彩'
|
||||
}, {
|
||||
value: 'typography',
|
||||
label: 'Typography 字体'
|
||||
}, {
|
||||
value: 'icon',
|
||||
label: 'Icon 图标'
|
||||
}, {
|
||||
value: 'button',
|
||||
label: 'Button 按钮'
|
||||
}]
|
||||
}, {
|
||||
value: 'form',
|
||||
label: 'Form',
|
||||
children: [{
|
||||
value: 'radio',
|
||||
label: 'Radio 单选框'
|
||||
}, {
|
||||
value: 'checkbox',
|
||||
label: 'Checkbox 多选框'
|
||||
}, {
|
||||
value: 'input',
|
||||
label: 'Input 输入框'
|
||||
}, {
|
||||
value: 'input-number',
|
||||
label: 'InputNumber 计数器'
|
||||
}, {
|
||||
value: 'select',
|
||||
label: 'Select 选择器'
|
||||
}, {
|
||||
value: 'cascader',
|
||||
label: 'Cascader 级联选择器'
|
||||
}, {
|
||||
value: 'switch',
|
||||
label: 'Switch 开关'
|
||||
}, {
|
||||
value: 'slider',
|
||||
label: 'Slider 滑块'
|
||||
}, {
|
||||
value: 'time-picker',
|
||||
label: 'TimePicker 时间选择器'
|
||||
}, {
|
||||
value: 'date-picker',
|
||||
label: 'DatePicker 日期选择器'
|
||||
}, {
|
||||
value: 'datetime-picker',
|
||||
label: 'DateTimePicker 日期时间选择器'
|
||||
}, {
|
||||
value: 'upload',
|
||||
label: 'Upload 上传'
|
||||
}, {
|
||||
value: 'rate',
|
||||
label: 'Rate 评分'
|
||||
}, {
|
||||
value: 'form',
|
||||
label: 'Form 表单'
|
||||
}]
|
||||
}, {
|
||||
value: 'data',
|
||||
label: 'Data',
|
||||
children: [{
|
||||
value: 'table',
|
||||
label: 'Table 表格'
|
||||
}, {
|
||||
value: 'tag',
|
||||
label: 'Tag 标签'
|
||||
}, {
|
||||
value: 'progress',
|
||||
label: 'Progress 进度条'
|
||||
}, {
|
||||
value: 'tree',
|
||||
label: 'Tree 树形控件'
|
||||
}, {
|
||||
value: 'pagination',
|
||||
label: 'Pagination 分页'
|
||||
}, {
|
||||
value: 'badge',
|
||||
label: 'Badge 标记'
|
||||
}]
|
||||
}, {
|
||||
value: 'notice',
|
||||
label: 'Notice',
|
||||
children: [{
|
||||
value: 'alert',
|
||||
label: 'Alert 警告'
|
||||
}, {
|
||||
value: 'loading',
|
||||
label: 'Loading 加载'
|
||||
}, {
|
||||
value: 'message',
|
||||
label: 'Message 消息提示'
|
||||
}, {
|
||||
value: 'message-box',
|
||||
label: 'MessageBox 弹框'
|
||||
}, {
|
||||
value: 'notification',
|
||||
label: 'Notification 通知'
|
||||
}]
|
||||
}, {
|
||||
value: 'navigation',
|
||||
label: 'Navigation',
|
||||
children: [{
|
||||
value: 'menu',
|
||||
label: 'NavMenu 导航菜单'
|
||||
}, {
|
||||
value: 'tabs',
|
||||
label: 'Tabs 标签页'
|
||||
}, {
|
||||
value: 'breadcrumb',
|
||||
label: 'Breadcrumb 面包屑'
|
||||
}, {
|
||||
value: 'dropdown',
|
||||
label: 'Dropdown 下拉菜单'
|
||||
}, {
|
||||
value: 'steps',
|
||||
label: 'Steps 步骤条'
|
||||
}]
|
||||
}, {
|
||||
value: 'others',
|
||||
label: 'Others',
|
||||
children: [{
|
||||
value: 'dialog',
|
||||
label: 'Dialog 对话框'
|
||||
}, {
|
||||
value: 'tooltip',
|
||||
label: 'Tooltip 文字提示'
|
||||
}, {
|
||||
value: 'popover',
|
||||
label: 'Popover 弹出框'
|
||||
}, {
|
||||
value: 'card',
|
||||
label: 'Card 卡片'
|
||||
}, {
|
||||
value: 'carousel',
|
||||
label: 'Carousel 走马灯'
|
||||
}, {
|
||||
value: 'collapse',
|
||||
label: 'Collapse 折叠面板'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'ziyuan',
|
||||
label: '资源',
|
||||
children: [{
|
||||
value: 'axure',
|
||||
label: 'Axure Components'
|
||||
}, {
|
||||
value: 'sketch',
|
||||
label: 'Sketch Templates'
|
||||
}, {
|
||||
value: 'jiaohu',
|
||||
label: '组件交互文档'
|
||||
}]
|
||||
}
|
||||
],
|
||||
fileList: [],
|
||||
// 销售合同收入明细
|
||||
incomeDetails: [],
|
||||
}
|
||||
}
|
||||
|
||||
const methods = {
|
||||
changeMode(mode) {
|
||||
this.mode = mode
|
||||
},
|
||||
|
||||
businessProcurementProcessClick() {
|
||||
const that = this
|
||||
},
|
||||
|
||||
backLastPage() {
|
||||
window.history.back();
|
||||
},
|
||||
|
||||
goToSaleContractProcess() {
|
||||
this.changeMode(saleContractProcess)
|
||||
},
|
||||
goToSaleContractDetail() {
|
||||
const { projectId } = this.processForm
|
||||
if (projectId) {
|
||||
this.changeMode(saleContractDetail)
|
||||
}
|
||||
else {
|
||||
this.$message.warning("项目还未选择")
|
||||
}
|
||||
},
|
||||
|
||||
render(obj) {
|
||||
console.log(obj)
|
||||
},
|
||||
|
||||
initForm(form) {
|
||||
this.processForm = { ...form }
|
||||
console.log(form)
|
||||
},
|
||||
|
||||
loadProject(id) {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在加载项目',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
fetch("${base}/process/" + id)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
const { incomeDetails, process, contract, ...form } = data
|
||||
// 转换数据
|
||||
// @formatter:off
|
||||
const computeType = (type) => {
|
||||
switch (type) {
|
||||
case 1: return '设备'
|
||||
case 2: return '工程'
|
||||
case 3: return '服务'
|
||||
default: return '未知'
|
||||
}
|
||||
}
|
||||
// @formatter:on
|
||||
|
||||
const applyDept = process.applyDept.split(',')
|
||||
this.initForm({ ...form, ...process, ...contract, applyDept })
|
||||
this.projectSelected = true
|
||||
this.processType = process.processType
|
||||
this.incomeDetails = incomeDetails.map(detail => ({
|
||||
...detail, type: computeType(detail.type)
|
||||
}))
|
||||
this.fileList = JSON.parse(process.attachmentUri).map(item => ({
|
||||
name: item.name, url: item.uri
|
||||
}))
|
||||
|
||||
|
||||
if (process.processType === 'sale_contract') {
|
||||
this.changeMode(saleContractProcess)
|
||||
}
|
||||
else if (process.processType === 'business_procurement') {
|
||||
this.changeMode(newBusinessProcurementContractProcess)
|
||||
}
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error("项目'" + name + "'加载失败");
|
||||
})
|
||||
.finally(() => loading.close())
|
||||
},
|
||||
clearProjectProcess() {
|
||||
this.projectSelected = false
|
||||
this.initForm({})
|
||||
this.incomeDetails = []
|
||||
},
|
||||
|
||||
saveDraft() {
|
||||
this.processForm.status = 'draft'
|
||||
this.submit()
|
||||
},
|
||||
|
||||
submitForm() {
|
||||
this.processForm.status = 'to_be_audit'
|
||||
this.submit()
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.$refs["saleContractProcessForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
const fileList = this.fileList
|
||||
if (fileList.length === 0) {
|
||||
this.$message.error("未上传附件");
|
||||
return false
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在提交',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
const form = {
|
||||
...this.processForm,
|
||||
attachments: fileList.map(file => {
|
||||
if (file.url) {
|
||||
return {
|
||||
uri: file.url,
|
||||
name: file.name
|
||||
}
|
||||
}
|
||||
return {
|
||||
uri: file.response.data.url,
|
||||
name: file.name
|
||||
}
|
||||
}),
|
||||
incomeDetails: this.incomeDetails.map(detail => ({
|
||||
id: detail.id, expirationDate: detail.expirationDate
|
||||
}))
|
||||
}
|
||||
|
||||
fetch("${base}/process", {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(form),
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '提交成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
else {
|
||||
return Promise.reject("失败")
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error("项目提交失败");
|
||||
}).finally(() => loading.close())
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
submitToSaleContractProcess() {
|
||||
this.goToSaleContractProcess()
|
||||
},
|
||||
|
||||
handleRemove(file, fileList) {
|
||||
this.fileList = fileList
|
||||
},
|
||||
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning("当前限制选择只能选择10个文件");
|
||||
this.fileList = fileList
|
||||
},
|
||||
|
||||
beforeRemove(file, fileList) {
|
||||
return this.$confirm("确定移除 " + file.name + "?");
|
||||
},
|
||||
|
||||
handleFileUploaded(response, file, fileList) {
|
||||
if (response.success) {
|
||||
this.fileList = fileList
|
||||
}
|
||||
else {
|
||||
this.$message.warning("上传失败");
|
||||
}
|
||||
},
|
||||
|
||||
indexMethod(index) {
|
||||
return index * 1;
|
||||
}
|
||||
}
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data,
|
||||
computed: {
|
||||
projectTitle() {
|
||||
const { projectNo, projectName, applyPersonName, applyDate } = this.processForm
|
||||
if (projectNo && projectName) {
|
||||
return projectNo.trim() + "-" + projectName.trim() + "-" + applyPersonName + "-" + applyDate
|
||||
}
|
||||
return ""
|
||||
},
|
||||
isButtonMode() {
|
||||
return this.mode === BUTTON
|
||||
},
|
||||
isProcurementContractMode() {
|
||||
return this.mode === newBusinessProcurementContractProcess
|
||||
},
|
||||
isSalesContractMode() {
|
||||
return this.mode === saleContractProcess
|
||||
},
|
||||
isSaleContractDetailMode() {
|
||||
return this.mode === saleContractDetail
|
||||
},
|
||||
subTitle() {
|
||||
switch (this.mode) {
|
||||
case BUTTON:
|
||||
return "新增流程"
|
||||
case saleContractProcess:
|
||||
return "编辑销售合同流程"
|
||||
case saleContractDetail:
|
||||
return "销售合同清单明细"
|
||||
case newBusinessProcurementContractProcess:
|
||||
return "编辑业务采购合同流程"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods,
|
||||
|
||||
mounted() {
|
||||
const processId = ${processId}
|
||||
this.loadProject(processId)
|
||||
},
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
</@defaultLayout.layout>
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
}
|
||||
|
||||
#newBusinessProcurementContractProcess {
|
||||
#procurementContractProcess {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,22 @@
|
|||
.el-upload-list__item-name [class^="el-icon"] {
|
||||
height: unset;
|
||||
}
|
||||
.el-checkbox{
|
||||
|
||||
.el-checkbox {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.supplierChoose {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.el-input-number--mini .el-input-number__decrease, .el-input-number--mini .el-input-number__increase {
|
||||
height: 93%;
|
||||
}
|
||||
|
||||
.el-input-number i {
|
||||
line-height: unset;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="admin-content" id="app">
|
||||
|
@ -54,7 +67,7 @@
|
|||
<img src="${base}/assets/process/销售合同流程@3x.png" width="36"/>
|
||||
销售合同流程
|
||||
</button>
|
||||
<button type="button" class="am-btn" @click="businessProcurementProcessClick">
|
||||
<button type="button" class="am-btn" @click="newProcurementContractClick">
|
||||
<img src="${base}/assets/process/业务采购流程@3x.png" width="39"/>
|
||||
业务采购流程
|
||||
</button>
|
||||
|
@ -77,8 +90,8 @@
|
|||
|
||||
<#-- 新增销售合同流程 -->
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12" v-if="isSalesContractProcessMode">
|
||||
<el-form :inline="true" ref="saleContractProcessForm" :model="processForm" label-position="right" label-width="100px">
|
||||
<div class="am-u-sm-12 am-u-md-12" v-if="isSalesContractMode || isProcurementContractMode">
|
||||
<el-form :inline="true" ref="saleContractProcessForm" :model="processForm" label-position="right" label-width="110px">
|
||||
|
||||
<div class="am-form-inline">
|
||||
<el-tooltip :disabled="projectSelected" effect="light" content="项目编号或名称,支持模糊查询" placement="top-end">
|
||||
|
@ -102,7 +115,16 @@
|
|||
<span v-else>未选择项目</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目类型">
|
||||
<el-form-item :rules="[{ required: true, message: '采购模式不能为空'}]"
|
||||
label="采购模式" prop="procurementMode" v-if="isProcurementContractMode">
|
||||
<el-select v-model="processForm.procurementMode" placeholder="请选择采购模式">
|
||||
<#list procurementMode as item>
|
||||
<el-option label="${item.description}" value="${item.name()}"></el-option>
|
||||
</#list>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目类型" v-if="isSalesContractMode">
|
||||
<span v-if="projectSelected">{{processForm.projectType}}</span>
|
||||
<span v-else>未选择项目</span>
|
||||
</el-form-item>
|
||||
|
@ -142,10 +164,17 @@
|
|||
<el-input placeholder="请输入合同编号" v-model="processForm.contractNo"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="合同名称" :rules="[{ required: true, message: '合同名称不能为空'}]" prop="contractName">
|
||||
<el-form-item :rules="[{ required: true, message: '合同名称不能为空'}]"
|
||||
label="合同名称" prop="contractName" v-if="isSalesContractMode">
|
||||
<el-input placeholder="请输入合同名称" v-model="processForm.contractName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="isProcurementContractMode" label="采购合同名称"
|
||||
:rules="[{ required: true, message: '采购合同名称不能为空'}]" prop="contractName">
|
||||
<el-input placeholder="请输入采购合同名称" v-model="processForm.contractName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="合同金额">
|
||||
<span v-if="projectSelected">{{processForm.contractAmount}}元</span>
|
||||
<span v-else>未选择项目</span>
|
||||
|
@ -154,10 +183,14 @@
|
|||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item label="客户名称" :rules="[{ required: true, message: '客户名称不能为空'}]">
|
||||
<el-form-item v-if="isSalesContractMode" label="客户名称" :rules="[{ required: true, message: '客户名称不能为空'}]">
|
||||
<el-input placeholder="请输入客户名称" v-model="processForm.clientName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="isProcurementContractMode" label="供应商名称" :rules="[{ required: true, message: '供应商名称不能为空'}]">
|
||||
<el-input placeholder="请输入供应商" v-model="processForm.supplierName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="最终用户名称">
|
||||
<#--TODO 最终用户名称-->
|
||||
<span v-if="projectSelected">{{processForm.terminalCustomer}}</span>
|
||||
|
@ -203,10 +236,17 @@
|
|||
</div>
|
||||
|
||||
<div>
|
||||
<el-form-item label="收款条件" :rules="[{ required: true, message: '收款条件不能为空'}]" prop="paymentTerms">
|
||||
<el-form-item v-if="isSalesContractMode" label="收款条件" :rules="[{ required: true, message: '收款条件不能为空'}]"
|
||||
prop="paymentTerms">
|
||||
<el-input type="textarea" :autosize="{ minRows: 3, maxRows: 10}" cols="90" maxlength="5000" show-word-limit
|
||||
v-model="processForm.paymentTerms" placeholder="请输入收款条件(限制5000字)"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="isProcurementContractMode" label="付款条件" :rules="[{ required: true, message: '付款条件不能为空'}]"
|
||||
prop="paymentTerms">
|
||||
<el-input type="textarea" :autosize="{ minRows: 3, maxRows: 10}" cols="90" maxlength="5000" show-word-limit
|
||||
v-model="processForm.paymentTerms" placeholder="请输入付款条件(限制5000字)"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
@ -234,20 +274,88 @@
|
|||
|
||||
<div>
|
||||
<el-form-item label="合同清单明细">
|
||||
<el-button type="text" @click="goToSaleContractDetail">详细清单</el-button>
|
||||
<el-button type="text" @click="goToContractDetail">详细清单</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
</el-form>
|
||||
|
||||
<#-- <el-row justify="space-around" type="flex" class="row-bg">-->
|
||||
<el-row>
|
||||
<div class="am-u-sm-12 am-u-md-12 supplierChoose" v-if="isProcurementContractMode">
|
||||
<el-alert title="供应商比选材料" type="success" center :closable="false"></el-alert>
|
||||
|
||||
<el-table style="width: 100%" border :data="supplierMaterialsForm" v-model="supplierMaterialsForm" empty-text="暂无">
|
||||
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
|
||||
|
||||
<el-table-column prop="companyName" label="公司名称" width="180" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input size="mini" placeholder="请输入公司名称" v-model="scope.row.companyName"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="totalAmount" label="合计金额" width="180" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number size="mini" :precision="2" :step="0.1" :max="100" :min="0"
|
||||
v-model="scope.row.totalAmount"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="serviceTerms" label="服务条款" width="180" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input size="mini" placeholder="请输入服务条款" v-model="scope.row.serviceTerms"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="paymentTerms" label="付款条件" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input size="mini" placeholder="请输入付款条件" v-model="scope.row.paymentTerms"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="taxRate" label="税率(%)" width="180" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number size="mini" :precision="2" :step="0.1" :max="100" :min="0"
|
||||
v-model="scope.row.taxRate"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" align="center">
|
||||
<template slot-scope="scope">
|
||||
<#--
|
||||
<el-input type="textarea" size="mini" maxlength="100"
|
||||
v-model="scope.row.remark" placeholder="请输入备注(限制100字)" cols="90"></el-input>
|
||||
-->
|
||||
<el-input size="mini" placeholder="请输入备注"
|
||||
v-model="scope.row.remark"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="attachment" label="附件" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.attachment">
|
||||
<a :href="scope.row.attachment.uri">
|
||||
<i class="el-icon-document"></i> {{scope.row.attachment.name}}
|
||||
</a>
|
||||
</el-tag>
|
||||
<el-upload v-else class="upload-demo"
|
||||
action="${base}/file/upload"
|
||||
name="files[]"
|
||||
:on-remove="handleRemove"
|
||||
:before-remove="beforeRemove"
|
||||
:on-success="handleFileUploaded"
|
||||
:limit="1"
|
||||
size="mini">
|
||||
<el-button size="small" type="text">上传附件</el-button>
|
||||
</el-upload>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
<el-button type="primary" icon="el-icon-plus" circle size="mini" @click="addSupplierRow"
|
||||
style="float: right;margin-top: 10px;"></el-button>
|
||||
</div>
|
||||
|
||||
<el-row class="am-u-sm-12 am-u-md-12">
|
||||
<el-button type="info" @click="goToHome">返回上一级</el-button>
|
||||
<el-button type="primary" @click="saveDraft">保存草稿</el-button>
|
||||
<el-button type="success" @click="submit">提交</el-button>
|
||||
<el-button type="success" @click="submitForm">提交</el-button>
|
||||
</el-row>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<#-- 销售合同清单明细 -->
|
||||
|
@ -285,73 +393,9 @@
|
|||
|
||||
<#-- 新增业务采购合同流程 -->
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12" id="newBusinessProcurementContractProcess" v-if="isBusinessProcurementContractProcessMode">
|
||||
<form role="form" id="newBusinessProcurementContractProcessForm">
|
||||
<div class="am-form-inline">
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-u-md-3 am-form-label">项目编号</label>
|
||||
|
||||
<el-autocomplete v-model="processForm.serialNumber" :fetch-suggestions="queryProject"
|
||||
placeholder="请输入内容" @select="handleSelectProject"></el-autocomplete>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-u-md-3 am-form-label">项目标题</label>
|
||||
<el-input placeholder="请输入内容" v-model="processForm.title" clearable></el-input>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-u-md-3 am-form-label">申请时间</label>
|
||||
<input type="text" class="am-form-field am-u-sm-2" :value="processForm.time"/>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-u-sm-3 am-form-label">采购模式</label>
|
||||
<input type="text" class="am-form-field" :value="processForm.time"/>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-u-md-3 am-form-label">合作类型</label>
|
||||
<input type="text" class="am-form-field" :value="processForm.time"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="am-form-inline">
|
||||
|
||||
<div class="am-form-group am-u-md-4">
|
||||
<label class="am-form-label">申请部门</label>
|
||||
<input type="text" class="am-form-field" :value="processForm.title"/>
|
||||
<input type="text" class="am-form-field" :value="processForm.time"/>
|
||||
<input type="text" class="am-form-field" :value="processForm.time"/>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-md-4">
|
||||
<label class="am-form-label">申请人</label>
|
||||
<input type="text" class="am-form-field" value="周瑾"/>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-md-4">
|
||||
<label class="am-form-label">申请部门领导</label>
|
||||
<input type="text" class="am-form-field" value="尹浩"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="am-form-inline">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="am-form-inline">
|
||||
<button type="submit" class="am-btn am-btn-default">登录</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<#-- 选择 业务采购清单明细 -->
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-12" v-if="isBusinessProcurementContractProcessMode">
|
||||
<div class="am-u-sm-12 am-u-md-12" v-if="isProcurementContractDetailMode">
|
||||
<el-table style="width: 100%" border>
|
||||
|
||||
<el-table-column prop="fee" label="费用项目" width="180"></el-table-column>
|
||||
|
@ -394,7 +438,8 @@
|
|||
|
||||
<script>
|
||||
|
||||
const newBusinessProcurementContractProcess = "newBusinessProcurementContractProcess"
|
||||
const procurementContractProcess = "procurementContractProcess"
|
||||
const procurementContractDetail = "procurementContractDetail"
|
||||
const saleContractProcess = "saleContractProcess"
|
||||
const saleContractDetail = "saleContractDetail"
|
||||
const BUTTON = "btn"
|
||||
|
@ -417,10 +462,11 @@
|
|||
|
||||
const data = () => {
|
||||
return {
|
||||
mode: "btn", // btn , newBusinessProcurementContractProcess
|
||||
mode: "btn", // btn , procurementContractProcess
|
||||
processForm: {
|
||||
sealTypes: [],
|
||||
},
|
||||
supplierMaterialsForm: [],
|
||||
projectSelected: false,
|
||||
applySectorOptions: [
|
||||
{
|
||||
|
@ -624,8 +670,7 @@
|
|||
fileList: [],
|
||||
// 销售合同收入明细
|
||||
incomeDetails: [],
|
||||
attachmentUri: [],
|
||||
attachmentMap: {}
|
||||
processType: ""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,8 +679,9 @@
|
|||
this.mode = mode
|
||||
},
|
||||
|
||||
businessProcurementProcessClick() {
|
||||
const that = this
|
||||
newProcurementContractClick() {
|
||||
this.changeMode(procurementContractProcess)
|
||||
this.processType = 'procurement_contract'
|
||||
},
|
||||
|
||||
goToHome() {
|
||||
|
@ -644,8 +690,11 @@
|
|||
|
||||
goToSaleContractProcess() {
|
||||
this.changeMode(saleContractProcess)
|
||||
this.processType = 'sale_contract'
|
||||
},
|
||||
goToSaleContractDetail() {
|
||||
|
||||
goToContractDetail() {
|
||||
// TODO 分情况展示
|
||||
const { projectId } = this.processForm
|
||||
if (projectId) {
|
||||
this.changeMode(saleContractDetail)
|
||||
|
@ -734,15 +783,56 @@
|
|||
this.submit()
|
||||
},
|
||||
|
||||
submitForm() {
|
||||
this.processForm.status = 'to_be_audit'
|
||||
this.submit()
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.$refs["saleContractProcessForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
const fileList = this.fileList
|
||||
console.log(fileList)
|
||||
if (fileList.length === 0) {
|
||||
this.$message.error("未上传附件");
|
||||
return false
|
||||
}
|
||||
|
||||
// 采购合同需要验证 供应商比选材料
|
||||
const processType = this.processType
|
||||
const processForm = this.processForm
|
||||
if (processType === 'procurement_contract') {
|
||||
const { procurementMode } = processForm
|
||||
|
||||
// specify_purchase("指定采购"),
|
||||
// simple_price_comparison("简单比价"),
|
||||
// price_comparison("比价"),
|
||||
// competitive_evaluation("竞争性评估");
|
||||
// 当“采购模式”为“指定采购”“简单比价”时,本模块为非必填模块,当为“比价”“竞争性评估”时,本模块为必填项(“备注”除外)
|
||||
if (procurementMode === 'price_comparison'
|
||||
|| procurementMode === 'competitive_evaluation') {
|
||||
|
||||
for (const item in this.supplierMaterialsForm) {
|
||||
for (const [key, value] of Object.entries(item)) {
|
||||
if (value) {
|
||||
if (typeof value === 'string') {
|
||||
if (isBlank(value)) {
|
||||
this.$message.error("有未填写的表单,请检查表单");
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 没有值
|
||||
if (key !== 'remark') {
|
||||
this.$message.error("有未填写的表单,请检查表单");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在提交',
|
||||
|
@ -751,13 +841,14 @@
|
|||
})
|
||||
|
||||
const form = {
|
||||
...this.processForm,
|
||||
processType: 'sale_contract',
|
||||
...processForm,
|
||||
processType,
|
||||
projectTitle: this.projectTitle,
|
||||
attachments: fileList.map(file => ({
|
||||
uri: file.response.data.url,
|
||||
name: file.response.data.originName
|
||||
})),
|
||||
supplierMaterials: this.supplierMaterialsForm,
|
||||
incomeDetails: this.incomeDetails.map(detail => ({
|
||||
id: detail.id, expirationDate: detail.expirationDate
|
||||
}))
|
||||
|
@ -818,7 +909,12 @@
|
|||
|
||||
indexMethod(index) {
|
||||
return index * 1;
|
||||
}
|
||||
},
|
||||
|
||||
addSupplierRow() {
|
||||
this.supplierMaterialsForm.push({})
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
new Vue({
|
||||
|
@ -835,10 +931,13 @@
|
|||
isButtonMode() {
|
||||
return this.mode === BUTTON
|
||||
},
|
||||
isBusinessProcurementContractProcessMode() {
|
||||
return this.mode === newBusinessProcurementContractProcess
|
||||
isProcurementContractMode() {
|
||||
return this.mode === procurementContractProcess
|
||||
},
|
||||
isSalesContractProcessMode() {
|
||||
isProcurementContractDetailMode() {
|
||||
return this.mode === procurementContractDetail
|
||||
},
|
||||
isSalesContractMode() {
|
||||
return this.mode === saleContractProcess
|
||||
},
|
||||
isSaleContractDetailMode() {
|
||||
|
@ -852,7 +951,7 @@
|
|||
return "新增销售合同流程"
|
||||
case saleContractDetail:
|
||||
return "销售合同清单明细"
|
||||
case newBusinessProcurementContractProcess:
|
||||
case procurementContractProcess:
|
||||
return "新增业务采购合同流程"
|
||||
}
|
||||
}
|
||||
|
@ -861,6 +960,7 @@
|
|||
methods,
|
||||
|
||||
mounted() {
|
||||
// this.newProcurementContractClick();
|
||||
this.handleSelectProject({ id: 135, name: '' })
|
||||
},
|
||||
})
|
||||
|
|
|
@ -295,7 +295,7 @@
|
|||
return this.mode === BUTTON
|
||||
},
|
||||
isBusinessProcurementContractProcessMode() {
|
||||
return this.mode === newBusinessProcurementContractProcess
|
||||
return this.mode === procurementContractProcess
|
||||
},
|
||||
isSalesContractProcessMode() {
|
||||
return this.mode === saleContractProcess
|
||||
|
@ -311,7 +311,7 @@
|
|||
return "新增销售合同流程"
|
||||
case saleContractDetail:
|
||||
return "销售合同清单明细"
|
||||
case newBusinessProcurementContractProcess:
|
||||
case procurementContractProcess:
|
||||
return "新增业务采购合同流程"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue