Skip to content

新增条件分支复制功能 #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- 生成JSON数据并生成预览页面
2. 流程节点配置(仿钉钉界面)
- 创建审批流程(发起人,审批人,条件节点,抄送人)
- 条件节点复制且复制旗下分支(防钉钉条件复制)
- 配置节点详细数据,包括条件节点表达式及期望值等
- 配置节点对表单得权限(目前并未在预览页面中做控制)
- 必填节点校验
Expand Down
48 changes: 27 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@vue/cli-plugin-babel": "~4.3.1",
"@vue/cli-plugin-router": "~4.3.1",
"@vue/cli-service": "~4.3.1",
"stylus": "^0.54.7",
"stylus": "^0.54.8",
"stylus-loader": "^3.0.2",
"svg-sprite-loader": "^4.1.6",
"vue-template-compiler": "^2.6.11"
Expand Down
9 changes: 4 additions & 5 deletions src/components/Process/FlowCard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ let nodes = {
copy: createFunc,
empty: _ => '',
condition: function(ctx, conf, h) {
// <i
// class="el-icon-document-copy icon"
// onClick={this.eventLancher.bind(ctx, "copyNode", conf, ctx.data)}
// ></i>
return (
<section
class="flow-path-card condition"
Expand All @@ -70,7 +66,10 @@ let nodes = {
</div>
<span class="priority">优先级{conf.properties.priority + 1}</span>
<div class="actions">

<i
class="el-icon-document-copy icon"
onClick={this.eventLancher.bind(ctx, "copyNode", conf, ctx.data)}
></i>
<i
class="el-icon-close icon"
onClick={this.eventLancher.bind(
Expand Down
39 changes: 34 additions & 5 deletions src/components/Process/FlowCard/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,41 @@ export class NodeUtils {
}
concatChild( prevNode, nodeData )
}
// TODO:
// static copyNode ( nodeData, processData ) {
// let prevNode = this.getPreviousNode( nodeData.prevId, processData )
// let index = prevNode.conditionNodes.findIndex( c => c.nodeId === nodeData.nodeId )

// }

/**
* 复制条件节点
*/
static copyNode ( nodeData, processData ) {
let prevNode = this.getPreviousNode( nodeData.prevId, processData );
let index = prevNode.conditionNodes.findIndex( c => c.nodeId === nodeData.nodeId )
// idGenerator
let cons = prevNode.conditionNodes
let copy = JSON.parse(JSON.stringify(prevNode.conditionNodes[index]))
copy.nodeId = this.idGenerator();
copy.properties.title += '(复制)';
let nodeIdFun = (childNode,prevId) =>{
childNode.nodeId = this.idGenerator();
if(prevId){
childNode.prevId = prevId;
}
if(childNode.childNode){
nodeIdFun(childNode.childNode,childNode.nodeId)
}
if(childNode.conditionNodes && childNode.conditionNodes.length>0){
for (let item of childNode.conditionNodes) {
nodeIdFun(item,childNode.nodeId)
}
}
}
nodeIdFun(copy);
prevNode.conditionNodes.splice(index+1,0,copy);
// 重新编排优先级
cons.forEach( ( c, i ) => c.properties.priority = i )
}



/**
* 添加审计节点(普通节点 approver)
* @param { Object } data - 目标节点数据,在该数据节点之后添加审计节点
Expand Down