feat: 工作流

This commit is contained in:
shaohuzhang1 2024-06-19 10:58:47 +08:00
parent 5f82b0d010
commit 2d3a3bd0c6
3 changed files with 380 additions and 829 deletions

File diff suppressed because it is too large Load Diff

View File

@ -142,7 +142,10 @@ class ApplicationWorkflowSerializer(serializers.Serializer):
def get_base_node_work_flow(work_flow):
node_list = work_flow.get('nodes')
[node for node in node_list if node.get('id') == '']
base_node_list = [node for node in node_list if node.get('id') == 'base-node']
if len(base_node_list) > 0:
return base_node_list[-1]
return None
class ApplicationSerializer(serializers.Serializer):
@ -535,6 +538,13 @@ class ApplicationSerializer(serializers.Serializer):
if work_flow is None:
raise AppApiException(500, "work_flow是必填字段")
Flow.new_instance(work_flow).is_valid()
base_node = get_base_node_work_flow(work_flow)
if base_node is not None:
node_data = base_node.get('properties').get('node_data')
if node_data is not None:
application.name = node_data.get('name')
application.desc = node_data.get('desc')
application.prologue = node_data.get('prologue')
application.work_flow = work_flow
application.save()
work_flow_version = WorkFlowVersion(work_flow=work_flow, application=application)

View File

@ -11,7 +11,7 @@
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { ref, onMounted } from 'vue'
import { iconComponent } from '../icons/utils'
const props = defineProps<{
nodeModel: any
@ -44,5 +44,8 @@ function getIncomingNode(id: string) {
})
}
}
onMounted(() => {
getIncomingNode(props.nodeModel.id)
})
</script>
<style scoped></style>