Merge remote-tracking branch 'origin/1.2.0' into 1.2.0

master
OathK1per 2022-12-27 16:44:46 +08:00
commit af4b89cf02
13 changed files with 312 additions and 434 deletions

View File

@ -8,27 +8,30 @@ import lombok.Getter;
*
*/
@Getter
public enum CandidateTypeEnum {
public enum ActCandidateTypeEnum {
USER(0, "按用户设置审批人"),
ROLE(1, "按角色设置审批人"),
STARTER_LEADER(2, "按发起人部门领导设置审批人");
STARTER_LEADER(2, "按发起人部门领导设置审批人"),
DEPT_LEADER(3, "按指定的部门领导设置审批人");
private int type;
private String name;
CandidateTypeEnum(int type, String name) {
ActCandidateTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public static CandidateTypeEnum ofType(int type) {
public static ActCandidateTypeEnum 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 if (type == DEPT_LEADER.getType()) {
return DEPT_LEADER;
} else {
throw new ResponseException("不支持的类型【" + type + "】");
}

View File

@ -7,6 +7,11 @@ public class ActConstant {
*/
public static final String START_PROCESS_USERID = "startUserId";
/**
* id
*/
public static final String DEPT_LEADER_ID = "deptLeaderId";
/**
*
*/

View File

@ -123,6 +123,7 @@ public class ProcessController {
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("applyDeptSectorOptions", JSON.toJSONString(processService.filterDept()));
return "/admin/business/process-new";
}
@ -131,10 +132,11 @@ public class ProcessController {
*/
@GetMapping("/edit/{id}")
public String editProcess(Model model, @PathVariable int id) {
model.addAttribute("processId", 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);
model.addAttribute("applyDeptSectorOptions", JSON.toJSONString(processService.filterDept()));
return "/admin/business/process-edit";
}
@ -202,10 +204,13 @@ public class ProcessController {
return processService.getProjectRepaidAmount(id);
}
/**
* ,
*/
@ResponseBody
@GetMapping("/projects")
public List<Map<String, Object>> query(@RequestParam String q) {
return projectRepository.findByProjectNoOrName(q)
return projectRepository.findBudgetPassedProjects(q)
.stream()
.map(project -> {
HashMap<String, Object> map = new HashMap<>();
@ -331,10 +336,9 @@ public class ProcessController {
@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");
BeanUtils.copyProperties(form, entity, "sealTypes", "applyDate", "attachments");
entity.setApplyDate(LocalDate.parse(form.getApplyDate(), formatter));
entity.setSealTypes(SealTypeArray.of(form.getSealTypes()));
entity.setApplyDept(String.join(",", form.getApplyDept()));
Admin admin = InterfaceUtil.getAdmin();
entity.setApplyPersonId(admin.getId());
entity.setAttachmentUri(JSON.toJSONString(form.getAttachments()));

View File

@ -40,8 +40,12 @@ public interface ProjectRepository extends JpaRepository<Project,Integer> {
@Query(value = "update project set approve_id=?, approve_name=? where approve_id = ?", nativeQuery = true)
int batchUpdateApprove(int targetAdminId, String targetAdminName, int adminId);
@Query(value = "select * from project where `project_no` like concat('%', :q, '%') or `name` like concat('%', :q, '%')",
/**
*
*/
@Query(value = "select * from project where (`status` > 5 or (`status` = 5 and approve_status_budget = 2)) " +
" and (`project_no` like concat('%', :q, '%') or `name` like concat('%', :q, '%'))",
nativeQuery = true)
List<Project> findByProjectNoOrName(@Param("q") String query);
List<Project> findBudgetPassedProjects(@Param("q") String query);
}

View File

@ -60,9 +60,15 @@ public class ProjectProcess implements Serializable {
// 申请人 ID
private Integer applyPersonId;
// 申请部门
// 申请部门 部门1,部门2,部门3 (逗号分割)
private String applyDept;
// 申请部门ID(逗号分割)
private String applyDeptId;
// 申请部门领导ID
private Integer applyDeptLeaderId;
// 申请部门领导
private String applyDeptLeaderName;

View File

@ -40,10 +40,16 @@ public class ProcessCreationForm {
// 申请人
private String applyPersonName;
private String[] applyDept;
// 申请部门 部门1,部门2,部门3 (逗号分割)
private String applyDept;
// 申请部门ID(逗号分割)
private String applyDeptId;
// 申请部门领导ID
private Integer applyDeptLeaderId;
// 申请部门领导
private String applyDeptLeaderName;
// 申请人电话

View File

@ -116,7 +116,9 @@ public class ActListenerService {
processInstance.getProcessInstanceId(), businessKey, adminId);
projectInstanceService.updateApprover(Integer.parseInt(businessKey), adminId);
} else if (actUtil.isNewProcess(procDefId)) {
projectProcessService.updateAudit(Integer.parseInt(businessKey), null, enableUsers);
if (!enableUsers.isEmpty()) {
projectProcessService.updateAudit(Integer.parseInt(businessKey), null, enableUsers);
}
logger.info("**** rwcjjt 任务创建监听 更新审批2 procInsId:{}, projectId:{}, enableUsers:{} **** ",
processInstance.getProcessInstanceId(), businessKey, enableUsers);
}

View File

@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.jfunc.common.db.QueryHelper;
import top.jfunc.common.db.bean.Record;
import top.jfunc.common.db.utils.Pagination;
import java.util.*;
@ -352,7 +353,7 @@ public class ActTaskDefService {
//通过特殊类型查询
List<String> candidateTypeList = taskDef.getCandidateTypeList();
logger.info("findCandidateUsers-type-task:{}, typeList:{}", taskDef.getTaskName(), candidateTypeList);
List<String> userListByType = queryCandidatesByTypes(candidateRoleList, procInsId);
List<String> userListByType = queryCandidatesByTypes(candidateTypeList, procInsId);
logger.info("findCandidateUsers-type-task:{}, userListByType:{}", taskDef.getTaskName(), userListByType);
if (!userListByType.isEmpty()) {
res.addAll(userListByType);
@ -363,6 +364,13 @@ public class ActTaskDefService {
return resList;
}
/**
*
*
* @param types
* @param procInsId
* @return
*/
private List<String> queryCandidatesByTypes(List<String> types, String procInsId) {
if (types == null || types.isEmpty()) {
return Collections.emptyList();
@ -370,13 +378,25 @@ public class ActTaskDefService {
List<String> userIdList = new ArrayList<>();
for (String typeStr : types) {
if (CandidateTypeEnum.STARTER_LEADER.getType() == Integer.parseInt(typeStr)) {
ActCandidateTypeEnum candidateTypeEnum = ActCandidateTypeEnum.ofType(Integer.parseInt(typeStr));
if (ActCandidateTypeEnum.STARTER_LEADER == candidateTypeEnum) {
//查找发起人部门主管
String startUserId = actUtil.getStartUserId(procInsId);
int leaderId = accountService.getOneLevelDeptManagerId(Integer.parseInt(startUserId));
logger.info("queryCandidatesByType startLeader:{}, procInsId:{} ", leaderId, procInsId);
if (leaderId != 0) {
userIdList.add(String.valueOf(leaderId));
}
} else if (ActCandidateTypeEnum.DEPT_LEADER == candidateTypeEnum) {
Record record = actUtil.getVariable(ActConstant.DEPT_LEADER_ID, procInsId);
if (record != null) {
String deptLeaderId = record.getStr("text");
userIdList.add(deptLeaderId);
logger.info("queryCandidatesByType deptLeader:{}, procInsId:{} ", deptLeaderId, procInsId);
}else{
logger.error("queryCandidatesByType not find deptLeader procInsId:{} ", procInsId);
}
}
}

View File

@ -1,5 +1,7 @@
package cn.palmte.work.service;
import cn.palmte.work.config.activiti.ActConstant;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -8,9 +10,11 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
@ -18,6 +22,9 @@ import javax.persistence.TypedQuery;
import cn.palmte.work.config.activiti.ActProjectTypeEnum;
import cn.palmte.work.model.Admin;
import cn.palmte.work.model.AdminRepository;
import cn.palmte.work.model.Dept;
import cn.palmte.work.model.DeptRepository;
import cn.palmte.work.model.Project;
import cn.palmte.work.model.ProjectRepository;
import cn.palmte.work.model.enums.ProcessStatus;
@ -25,6 +32,7 @@ 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.Data;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
@ -41,6 +49,77 @@ public class ProjectProcessService {
private final ProjectInstanceService projectInstanceService;
private final ProjectRepository projectRepository;
private final DeptRepository deptRepository;
private final AdminRepository userRepository;
@Data
static class DeptReturnValue {
private int id;
private int leaderId;
private String leaderName;
private String name;
private List<DeptReturnValue> children;
public void addChildren(DeptReturnValue child) {
if (children == null) {
children = new ArrayList<>();
}
children.add(child);
}
}
public List<DeptReturnValue> filterDept() {
List<Dept> deptList = deptRepository.findEnable();
List<Dept> level1 = filterByLevel(deptList, 1);
List<Dept> level2 = filterByLevel(deptList, 2);
List<Dept> level3 = filterByLevel(deptList, 3);
List<DeptReturnValue> returnValues = new ArrayList<>();
for (Dept dept : level1) {
// 只需要一级领导
Admin leader = userRepository.getAdminById(dept.getManagerId());
String leaderName = leader.getRealName();
DeptReturnValue returnValue = createReturnValue(dept, leaderName);
for (Dept dept2 : level2) {
if (Objects.equals(dept2.getParentId(), dept.getId())) {
DeptReturnValue returnValue2 = createReturnValue(dept2, leaderName);
for (Dept dept3 : level3) {
if (Objects.equals(dept3.getParentId(), dept2.getId())) {
returnValue2.addChildren(createReturnValue(dept3, leaderName));
}
}
returnValue.addChildren(returnValue2);
}
}
returnValues.add(returnValue);
}
return returnValues;
}
private static List<Dept> filterByLevel(List<Dept> deptList, int level) {
ArrayList<Dept> ret = new ArrayList<>();
for (Dept dept : deptList) {
if (Objects.equals(dept.getLevel(), level)) {
ret.add(dept);
}
}
return ret;
}
private DeptReturnValue createReturnValue(Dept dept, String leaderName) {
DeptReturnValue returnValue = new DeptReturnValue();
returnValue.setId(dept.getId());
returnValue.setName(dept.getName());
returnValue.setLeaderId(dept.getManagerId());
returnValue.setLeaderName(leaderName);
return returnValue;
}
/**
*
*
@ -148,11 +227,13 @@ public class ProjectProcessService {
BigDecimal repaidAmount = getProjectRepaidAmount(entity.getProjectId());
variables.put("repaidAmount", repaidAmount);
// 合同金额
variables.put("amount", project.getContractAmount() == null ? 0 : project.getContractAmount());
variables.put("contractAmount", project.getContractAmount() == null ? 0 : project.getContractAmount());
// 项目类型
variables.put("projectType", project.getType());
// 合作类型
variables.put("cooperationType", project.getCooperateType() == null ? 0 : project.getCooperateType());
// 部门领导ID
variables.put(ActConstant.DEPT_LEADER_ID, entity.getApplyDeptLeaderId());
startAuditProgress(entity, variables);
}

View File

@ -5,7 +5,9 @@ create table project_process
(
id int auto_increment primary key comment 'ID',
apply_date date null comment '申请时间',
apply_dept varchar(255) null comment '申请部门',
apply_dept varchar(255) null comment '申请部门(逗号分割)',
apply_dept_id varchar(255) null comment '申请部门ID(逗号分割)',
apply_dept_leader_id int null comment '申请部门领导ID',
apply_dept_leader_name varchar(255) null comment '申请人领导',
apply_person_name varchar(255) null comment '申请人姓名',
apply_person_id int null comment '申请人ID',
@ -30,7 +32,7 @@ create table project_process
);
alter table project_process
modify current_audit_id varchar(255) null comment '当前审核人ID逗号分割';
add apply_dept_leader_id int null comment '申请部门领导ID';
# 采购合同
create table procurement_contract

View File

@ -76,7 +76,8 @@
<select multiple
data-am-selected="{btnSize: 'sm',btnWidth: '150px',maxHeight: 500,searchBox: 1}"
id="typeSelect_${list.id}">
<option value="1" <#if list.candidateTypeList?seq_contains('1')>selected</#if> >发起人部门主管</option>
<option value="2" <#if list.candidateTypeList?seq_contains('2')>selected</#if> >发起人部门领导</option>
<option value="3" <#if list.candidateTypeList?seq_contains('3')>selected</#if> >发起时指定的部门领导</option>
</select>
</td>

View File

@ -90,8 +90,9 @@
<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 label="申请部门" :rules="[{ required: true, message: '申请部门不能为空'}]" prop="applyDept">
<el-cascader :options="applyDeptSectorOptions" clearable v-model="processForm.applyDeptId"
:props="{ expandTrigger: 'hover', label:'name', value: 'id'}" @change="applyDeptSelected"></el-cascader>
</el-form-item>
<el-form-item label="申请人">
@ -359,208 +360,11 @@
},
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: '组件交互文档'
}]
}
],
applyDeptSectorOptions: [],
fileList: [],
// 销售合同收入明细
incomeDetails: [],
selectedDepts: []
}
}
@ -672,6 +476,47 @@
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("有未填写的表单,请检查表单");
}
}
}
}
}
}
if (!processForm.applyDeptId) {
this.$message.error("申请部门还未选择");
return false
}
const loading = this.$loading({
lock: true,
text: '正在提交',
@ -679,8 +524,11 @@
background: 'rgba(0, 0, 0, 0.7)'
})
const applyDeptId = processForm.applyDeptId.map(level => level.id).join(',') // (逗号分割)
const form = {
...this.processForm,
applyDeptId,
attachments: fileList.map(file => {
if (file.url) {
return {
@ -753,7 +601,46 @@
indexMethod(index) {
return index * 1;
}
},
applyDeptSelected(value) {
if (value.length === 0) {
this.processForm['applyDept'] = null
this.processForm['applyDeptId'] = null
this.processForm['applyDeptLeaderId'] = null
this.processForm['applyDeptLeaderName'] = null
return;
}
const level1Value = value[0]
const level2Value = value.length >= 2 && value[1]
const level3Value = value.length === 3 && value[2]
const find = (options, value) => {
return options.find(option => option.id === value)
}
const leveled = []
let selected = find(this.applyDeptSectorOptions, level1Value)
leveled.push(selected)
if (selected && level2Value) {
selected = find(selected.children, level2Value)
leveled.push(selected)
if (selected && level3Value) {
selected = find(selected.children, level3Value)
if (selected) {
leveled.push(selected)
}
}
}
this.selectedDepts = leveled.map(level => level.id)
this.processForm['applyDept'] = leveled.map(level => level.name).join(',') // (逗号分割)
this.processForm['applyDeptId'] = leveled.map(level => level.id).join(',') // (逗号分割)
this.processForm['applyDeptLeaderId'] = selected.leaderId
this.processForm['applyDeptLeaderName'] = selected.leaderName
},
}
new Vue({
@ -798,6 +685,7 @@
mounted() {
const processId = ${processId}
this.loadProject(processId)
this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}')
},
})

View File

@ -52,13 +52,17 @@
.el-input-number i {
line-height: unset;
}
[v-cloak] {
display: none;
}
</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>
<small v-cloak>{{subTitle}}</small></div>
</div>
<div class="am-g">
@ -90,8 +94,8 @@
<#-- 新增销售合同流程 -->
<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-u-sm-12 am-u-md-12" v-cloak v-if="isSalesContractMode || isProcurementContractMode">
<el-form :inline="true" ref="contractProcessForm" :model="processForm" label-position="right" label-width="110px">
<div class="am-form-inline">
<el-tooltip :disabled="projectSelected" effect="light" content="项目编号或名称,支持模糊查询" placement="top-end">
@ -138,8 +142,9 @@
<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 label="申请部门" prop="applyDeptId" :rules="[{ required: true, message: '申请部门不能为空'}]">
<el-cascader :options="applyDeptSectorOptions" clearable v-model="processForm.applyDeptId"
:props="{ expandTrigger: 'hover', label:'name', value: 'id'}" @change="applyDeptSelected"></el-cascader>
</el-form-item>
<el-form-item label="申请人">
@ -148,7 +153,7 @@
</el-form-item>
<el-form-item label="申请部门领导">
<span v-if="projectSelected">{{processForm.applyDeptLeaderName}}</span>
<span v-if="processForm.applyDeptLeaderName">{{processForm.applyDeptLeaderName}}</span>
<span v-else>未选择部门</span>
</el-form-item>
@ -280,6 +285,7 @@
</el-form>
<#-- 供应商比选材料 -->
<div class="am-u-sm-12 am-u-md-12 supplierChoose" v-if="isProcurementContractMode">
<el-alert title="供应商比选材料" type="success" center :closable="false"></el-alert>
@ -350,7 +356,7 @@
style="float: right;margin-top: 10px;"></el-button>
</div>
<el-row class="am-u-sm-12 am-u-md-12">
<el-row class="am-u-sm-12 am-u-md-12" v-cloak>
<el-button type="info" @click="goToHome">返回上一级</el-button>
<el-button type="primary" @click="saveDraft">保存草稿</el-button>
<el-button type="success" @click="submitForm">提交</el-button>
@ -360,7 +366,7 @@
<#-- 销售合同清单明细 -->
<div class="am-u-sm-12 am-u-md-12" v-if="isSaleContractDetailMode">
<div v-cloak 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>
@ -395,7 +401,7 @@
<#-- 选择 业务采购清单明细 -->
<div class="am-u-sm-12 am-u-md-12" v-if="isProcurementContractDetailMode">
<div v-cloak 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>
@ -468,209 +474,11 @@
},
supplierMaterialsForm: [],
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: '组件交互文档'
}]
}
],
applyDeptSectorOptions: [],
fileList: [],
// 销售合同收入明细
incomeDetails: [],
processType: ""
processType: "",
}
}
@ -766,6 +574,10 @@
this.incomeDetails = incomeDetails.map(detail => ({
...detail, type: computeType(detail.type)
}))
if (!form.projectNo || !form.projectName) {
this.$message.warning("当前选择的项目没有编号或者名称");
}
})
.catch(err => {
this.$message.error("项目'" + name + "'加载失败");
@ -789,7 +601,7 @@
},
submit() {
this.$refs["saleContractProcessForm"].validate((valid) => {
this.$refs["contractProcessForm"].validate((valid) => {
if (valid) {
const fileList = this.fileList
if (fileList.length === 0) {
@ -833,6 +645,12 @@
}
}
if (!processForm.applyDeptId) {
this.$message.error("申请部门还未选择");
return false
}
// 提交
const loading = this.$loading({
lock: true,
text: '正在提交',
@ -840,9 +658,11 @@
background: 'rgba(0, 0, 0, 0.7)'
})
const applyDeptId = processForm.applyDeptId.map(level => level.id).join(',') // (逗号分割)
const form = {
...processForm,
processType,
applyDeptId,
projectTitle: this.projectTitle,
attachments: fileList.map(file => ({
uri: file.response.data.url,
@ -915,6 +735,43 @@
this.supplierMaterialsForm.push({})
},
applyDeptSelected(value) {
if (value.length === 0) {
this.processForm['applyDept'] = null
this.processForm['applyDeptId'] = null
this.processForm['applyDeptLeaderId'] = null
this.processForm['applyDeptLeaderName'] = null
return;
}
const level1Value = value[0]
const level2Value = value.length >= 2 && value[1]
const level3Value = value.length === 3 && value[2]
const find = (options, value) => {
return options.find(option => option.id === value)
}
const leveled = []
let selected = find(this.applyDeptSectorOptions, level1Value)
leveled.push(selected)
if (selected && level2Value) {
selected = find(selected.children, level2Value)
leveled.push(selected)
if (selected && level3Value) {
selected = find(selected.children, level3Value)
if (selected) {
leveled.push(selected)
}
}
}
// applyDeptId 提交时处理
this.processForm['applyDept'] = leveled.map(level => level.name).join(',') // (逗号分割)
this.processForm['applyDeptLeaderId'] = selected.leaderId
this.processForm['applyDeptLeaderName'] = selected.leaderName
},
}
new Vue({
@ -960,8 +817,7 @@
methods,
mounted() {
// this.newProcurementContractClick();
this.handleSelectProject({ id: 135, name: '' })
this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}')
},
})