|
|
|
@ -17,28 +17,30 @@
|
|
|
|
|
|
|
|
|
|
import { genTaskCodeList } from '@/service/modules/task-definition' |
|
|
|
|
import type { Cell } from '@antv/x6' |
|
|
|
|
import { |
|
|
|
|
defineComponent, |
|
|
|
|
onMounted, |
|
|
|
|
PropType, |
|
|
|
|
inject, |
|
|
|
|
ref, |
|
|
|
|
computed |
|
|
|
|
} from 'vue' |
|
|
|
|
import { defineComponent, onMounted, PropType, inject, ref } from 'vue' |
|
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
|
import { useRoute } from 'vue-router' |
|
|
|
|
import styles from './menu.module.scss' |
|
|
|
|
import { uuid } from '@/utils/common' |
|
|
|
|
import { IWorkflowTaskInstance } from './types' |
|
|
|
|
|
|
|
|
|
const props = { |
|
|
|
|
startReadonly: { |
|
|
|
|
type: Boolean as PropType<boolean>, |
|
|
|
|
default: false |
|
|
|
|
}, |
|
|
|
|
menuReadonly: { |
|
|
|
|
type: Boolean as PropType<boolean>, |
|
|
|
|
default: false |
|
|
|
|
}, |
|
|
|
|
taskInstance: { |
|
|
|
|
type: Object as PropType<IWorkflowTaskInstance>, |
|
|
|
|
require: true |
|
|
|
|
}, |
|
|
|
|
cell: { |
|
|
|
|
type: Object as PropType<Cell>, |
|
|
|
|
require: true |
|
|
|
|
}, |
|
|
|
|
taskList: { |
|
|
|
|
type: Array as PropType<Array<any>>, |
|
|
|
|
default: [] |
|
|
|
|
}, |
|
|
|
|
visible: { |
|
|
|
|
type: Boolean as PropType<boolean>, |
|
|
|
|
default: true |
|
|
|
@ -50,10 +52,6 @@ const props = {
|
|
|
|
|
top: { |
|
|
|
|
type: Number as PropType<number>, |
|
|
|
|
default: 0 |
|
|
|
|
}, |
|
|
|
|
releaseState: { |
|
|
|
|
type: String as PropType<string>, |
|
|
|
|
default: 'OFFLINE' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -66,12 +64,6 @@ export default defineComponent({
|
|
|
|
|
const route = useRoute() |
|
|
|
|
const projectCode = Number(route.params.projectCode) |
|
|
|
|
|
|
|
|
|
const startAvailable = computed( |
|
|
|
|
() => |
|
|
|
|
route.name === 'workflow-definition-detail' && |
|
|
|
|
props.releaseState !== 'NOT_RELEASE' |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const hide = () => { |
|
|
|
|
ctx.emit('hide', false) |
|
|
|
|
} |
|
|
|
@ -85,12 +77,8 @@ export default defineComponent({
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleViewLog = () => { |
|
|
|
|
const taskCode = Number(props.cell?.id) |
|
|
|
|
const taskInstance = props.taskList.find( |
|
|
|
|
(task: any) => task.taskCode === taskCode |
|
|
|
|
) |
|
|
|
|
if (taskInstance) { |
|
|
|
|
ctx.emit('viewLog', taskInstance.id, taskInstance.taskType) |
|
|
|
|
if (props.taskInstance) { |
|
|
|
|
ctx.emit('viewLog', props.taskInstance.id, props.taskInstance.taskType) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -122,7 +110,6 @@ export default defineComponent({
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
startAvailable, |
|
|
|
|
startRunning, |
|
|
|
|
handleEdit, |
|
|
|
|
handleCopy, |
|
|
|
@ -141,7 +128,7 @@ export default defineComponent({
|
|
|
|
|
> |
|
|
|
|
<div |
|
|
|
|
class={`${styles['menu-item']} ${ |
|
|
|
|
!this.startAvailable ? styles['disabled'] : '' |
|
|
|
|
this.startReadonly ? styles['disabled'] : '' |
|
|
|
|
} `}
|
|
|
|
|
onClick={this.startRunning} |
|
|
|
|
> |
|
|
|
@ -149,7 +136,7 @@ export default defineComponent({
|
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
class={`${styles['menu-item']} ${ |
|
|
|
|
this.releaseState === 'ONLINE' ? styles['disabled'] : '' |
|
|
|
|
this.menuReadonly ? styles['disabled'] : '' |
|
|
|
|
} `}
|
|
|
|
|
onClick={this.handleEdit} |
|
|
|
|
> |
|
|
|
@ -157,7 +144,7 @@ export default defineComponent({
|
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
class={`${styles['menu-item']} ${ |
|
|
|
|
this.releaseState === 'ONLINE' ? styles['disabled'] : '' |
|
|
|
|
this.menuReadonly ? styles['disabled'] : '' |
|
|
|
|
} `}
|
|
|
|
|
onClick={this.handleCopy} |
|
|
|
|
> |
|
|
|
@ -165,13 +152,13 @@ export default defineComponent({
|
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
class={`${styles['menu-item']} ${ |
|
|
|
|
this.releaseState === 'ONLINE' ? styles['disabled'] : '' |
|
|
|
|
this.menuReadonly ? styles['disabled'] : '' |
|
|
|
|
} `}
|
|
|
|
|
onClick={this.handleDelete} |
|
|
|
|
> |
|
|
|
|
{t('project.node.delete')} |
|
|
|
|
</div> |
|
|
|
|
{this.taskList.length > 0 && ( |
|
|
|
|
{this.taskInstance && ( |
|
|
|
|
<div class={`${styles['menu-item']}`} onClick={this.handleViewLog}> |
|
|
|
|
{t('project.node.view_log')} |
|
|
|
|
</div> |
|
|
|
|