[Fix][UI Next][V1.0.0-Beta] Added access to the child node function (#9518)

* Added access to the child node function

* Added access to the child node function
This commit is contained in:
labbomb 2022-04-15 18:50:52 +08:00 committed by GitHub
parent 95ccc0c855
commit 7777a6acfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 8 deletions

View File

@ -109,7 +109,7 @@ const Modal = defineComponent({
.filter((item: any) => item.show) .filter((item: any) => item.show)
.map((item: any) => { .map((item: any) => {
return ( return (
<ButtonLink onClick={item.action}> <ButtonLink onClick={item.action} disabled={item.disabled}>
{{ {{
default: () => item.text, default: () => item.text,
icon: () => item.icon() icon: () => item.icon()

View File

@ -615,6 +615,7 @@ const project = {
online: 'Online' online: 'Online'
}, },
node: { node: {
return_back: 'Return',
current_node_settings: 'Current node settings', current_node_settings: 'Current node settings',
instructions: 'Instructions', instructions: 'Instructions',
view_history: 'View history', view_history: 'View history',
@ -627,7 +628,6 @@ const project = {
workflow_name: 'Workflow Name', workflow_name: 'Workflow Name',
workflow_name_tips: 'Please select a workflow (required)', workflow_name_tips: 'Please select a workflow (required)',
child_node: 'Child Node', child_node: 'Child Node',
enter_child_node: 'Enter child node',
run_flag: 'Run flag', run_flag: 'Run flag',
normal: 'Normal', normal: 'Normal',
prohibition_execution: 'Prohibition execution', prohibition_execution: 'Prohibition execution',

View File

@ -527,6 +527,7 @@ const project = {
'目前没有任何工作流,请先创建工作流,再访问该页面' '目前没有任何工作流,请先创建工作流,再访问该页面'
}, },
task: { task: {
current_task_settings: '当前任务设置',
online: '已上线', online: '已上线',
offline: '已下线', offline: '已下线',
task_name: '任务名称', task_name: '任务名称',
@ -610,6 +611,7 @@ const project = {
online: '已上线' online: '已上线'
}, },
node: { node: {
return_back: '返回上一节点',
current_node_settings: '当前节点设置', current_node_settings: '当前节点设置',
instructions: '使用说明', instructions: '使用说明',
view_history: '查看历史', view_history: '查看历史',
@ -622,7 +624,6 @@ const project = {
workflow_name: '工作流名称', workflow_name: '工作流名称',
workflow_name_tips: '请选择工作流(必选)', workflow_name_tips: '请选择工作流(必选)',
child_node: '子节点', child_node: '子节点',
enter_child_node: '进入该子节点',
run_flag: '运行标志', run_flag: '运行标志',
normal: '正常', normal: '正常',
prohibition_execution: '禁止执行', prohibition_execution: '禁止执行',

View File

@ -64,7 +64,7 @@ export function querySubProcessInstanceByTaskCode(
code: CodeReq code: CodeReq
): any { ): any {
return axios({ return axios({
url: `/projects/${code}/process-instances/query-sub-by-parent`, url: `/projects/${code.projectCode}/process-instances/query-sub-by-parent`,
method: 'get', method: 'get',
params params
}) })

View File

@ -57,8 +57,8 @@ interface SubIdReq {
} }
interface TaskReq { interface TaskReq {
taskCode: string taskCode?: string
taskId: number taskId?: number
} }
interface LongestReq { interface LongestReq {

View File

@ -33,7 +33,8 @@ import { formatModel } from './format-data'
import { import {
HistoryOutlined, HistoryOutlined,
ProfileOutlined, ProfileOutlined,
QuestionCircleTwotone QuestionCircleTwotone,
BranchesOutlined
} from '@vicons/antd' } from '@vicons/antd'
import { NIcon } from 'naive-ui' import { NIcon } from 'naive-ui'
import { TASK_TYPES_MAP } from '../../constants/task-type' import { TASK_TYPES_MAP } from '../../constants/task-type'
@ -45,6 +46,9 @@ import type {
IWorkflowTaskInstance, IWorkflowTaskInstance,
WorkflowInstance WorkflowInstance
} from './types' } from './types'
import {
querySubProcessInstanceByTaskCode
} from '@/service/modules/process-instances'
const props = { const props = {
show: { show: {
@ -57,7 +61,8 @@ const props = {
}, },
projectCode: { projectCode: {
type: Number as PropType<number>, type: Number as PropType<number>,
required: true required: true,
default: 0
}, },
readonly: { readonly: {
type: Boolean as PropType<boolean>, type: Boolean as PropType<boolean>,
@ -147,6 +152,30 @@ const NodeDetailModal = defineComponent({
handleViewLog() handleViewLog()
}, },
icon: renderIcon(ProfileOutlined) icon: renderIcon(ProfileOutlined)
},
{
text: t('project.node.enter_this_child_node'),
show: props.data.taskType === 'SUB_PROCESS',
disabled: !props.data.id || (router.currentRoute.value.name === 'workflow-instance-detail' && !props.taskInstance),
action: () => {
if (router.currentRoute.value.name === 'workflow-instance-detail') {
querySubProcessInstanceByTaskCode({ taskId: props.taskInstance?.id }, { projectCode: props.projectCode }).then(
(res: any) => {
router.push({
name: 'workflow-instance-detail',
params: { id: res.subProcessInstanceId },
query: { code: props.data.taskParams?.processDefinitionCode }
})
}
)
} else {
router.push({
name: 'workflow-definition-detail',
params: { code: props.data.taskParams?.processDefinitionCode }
})
}
},
icon: renderIcon(BranchesOutlined)
} }
] ]
} }