This commit is contained in:
charlesxie
2022-02-11 17:28:16 +08:00
parent c2fe6a5537
commit e7c99e91c2
9 changed files with 64 additions and 19 deletions

View File

@@ -36,3 +36,10 @@ PIPELINE_STATE_TO_FLOW_STATE = {
StateType.CREATED: "positive",
}
class NodeTemplateType:
# 空节点模板
EmptyTemplate = "0"
# 带内容的节点模板
ContentTemplate = "2"

View File

@@ -0,0 +1,5 @@
import django_filters as filters
class NodeTemplateFilter(filters.FilterSet):
template_type = filters.CharFilter(lookup_expr="iexact")

View File

@@ -4,7 +4,7 @@ from django.db import models
from django.forms import BooleanField
from django_mysql.models import JSONField
from applications.flow.constants import FAIL_OFFSET_UNIT_CHOICE
from applications.flow.constants import FAIL_OFFSET_UNIT_CHOICE, NodeTemplateType
class Category(models.Model):
@@ -101,4 +101,4 @@ class NodeRun(BaseNode):
class NodeTemplate(BaseNode):
template_type = models.CharField("节点模板类型", max_length=1, default="2")
template_type = models.CharField("节点模板类型", max_length=1, default=NodeTemplateType.ContentTemplate)

View File

@@ -6,6 +6,7 @@ from rest_framework import mixins
from rest_framework.decorators import action
from rest_framework.response import Response
from applications.flow.filters import NodeTemplateFilter
from applications.flow.models import Process, Node, ProcessRun, NodeRun, NodeTemplate
from applications.flow.serializers import ProcessViewSetsSerializer, ListProcessViewSetsSerializer, \
RetrieveProcessViewSetsSerializer, ExecuteProcessSerializer, ListProcessRunViewSetsSerializer, \
@@ -93,6 +94,7 @@ class NodeTemplateViewSet(mixins.ListModelMixin,
GenericViewSet):
queryset = NodeTemplate.objects.order_by("-id")
serializer_class = NodeTemplateSerializer
filterset_class = NodeTemplateFilter
# Create your views here.

View File

@@ -112,10 +112,6 @@ export default G6 => {
if (targetNode._cfg.model.nodeType === 0 && sourceNode._cfg.model.nodeType !== 3) {
return this.graph.emit('before-edge-add', false, {msg: '禁止从开始节点结束!'})
}
//从作业流节点结束
if (targetNode._cfg.model.nodeType === 3) {
return this.graph.emit('before-edge-add', false, {msg: '禁止从作业流节点结束!'})
}
let msg = ''
this.graph.getEdges().forEach(line => {
//重复连线

View File

@@ -671,11 +671,6 @@
this.graph.emit('before-edge-add', false, {msg: '禁止从开始节点结束!'})
return false
}
// 从作业流节点结束
if (targetNode._cfg.model.nodeType === 3) {
this.graph.emit('before-edge-add', false, {msg: '禁止从作业流节点结束!'})
return false
}
let msg = ''
this.graph.getEdges().forEach(line => {
// 重复连线

View File

@@ -306,7 +306,8 @@
}
})
// 删除作业流节点及连线,避免干扰
const flag = this.deleteFlowNode(paramData)
// const flag = this.deleteFlowNode(paramData)
const flag = true
if (!flag) {
this.validatorFlag = false
return false

View File

@@ -131,7 +131,7 @@
getJobFlowList(str) {
this.jobListLoading = true
const params = {
category: this.form.system_id
page_size: 20
}
if (str === 'search') {
params.name = this.form.name
@@ -156,7 +156,8 @@
getNodeTemplateList(str) {
this.jobListLoading = true
const params = {
category: this.form.system_id
template_type: this.form.makeType,
page_size: 999
}
if (str === 'search') {
params.name = this.form.name
@@ -274,12 +275,50 @@
},
// 处理查询
handleSearch() {
if (!this.form.makeType) {
// 当前作业为未编排,查询获取作业列表
this.getJobList('search')
} else {
// 当前作业为已编排,查询获取作业流列表
if (this.form.makeType === 0) {
this.getNodeTemplateList('search')
} else if (this.form.makeType === 1) {
// 编排类型切换成已编排时记录此时的跑批id
this.midRunId = this.form.system_id
// 编排类型切换为已编排时当前跑批系统id不为空默认获取作业流列表
this.getJobFlowList('search')
} else if (this.form.makeType === 2) {
this.getNodeTemplateList('search')
} else if (this.form.makeType === 3) {
this.jobList = [
{
'id': 45,
'creator': 'product',
'name': '条件网关',
'type': 4,
'nodeType': 4,
'icon': 'e6d9'
},
{
'id': 46,
'creator': 'product',
'name': '并行网关',
'type': 4,
'nodeType': 4,
'icon': 'e6d9'
},
{
'id': 47,
'creator': 'product',
'name': '汇聚网关',
'type': 4,
'nodeType': 4,
'icon': 'e6d9'
},
{
'id': 48,
'creator': 'product',
'name': '条件并行网关',
'type': 4,
'nodeType': 4,
'icon': 'e6d9'
}
]
}
},
// 处理跑批系统id变化