8 changed files with 195 additions and 7 deletions
@ -1,3 +1,3 @@
|
||||
<template> |
||||
<div>开发中</div> |
||||
<div>开发中 definition</div> |
||||
</template> |
||||
|
@ -1,3 +1,81 @@
|
||||
<template> |
||||
<div>开发中</div> |
||||
<div> |
||||
<BasicTable @register="registerTable"> |
||||
<template #toolbar> |
||||
<a-button type="warning" v-auth="['bpm:process-instance:query']" :preIcon="IconEnum.ADD" @click="handleCreate"> 发起流程 </a-button> |
||||
</template> |
||||
<template #bodyCell="{ column, record }"> |
||||
<template v-if="column.key === 'action'"> |
||||
<TableAction |
||||
:actions="[ |
||||
{ |
||||
icon: IconEnum.VIEW, |
||||
label: t('action.detail'), |
||||
auth: 'bpm:process-instance:query', |
||||
onClick: handleDetail.bind(null, record) |
||||
}, |
||||
{ |
||||
icon: IconEnum.DELETE, |
||||
color: 'error', |
||||
label: t('action.cancel'), |
||||
ifShow: record.result === 1, |
||||
auth: 'bpm:process-instance:cancel', |
||||
popConfirm: { |
||||
title: t('action.cancel'), |
||||
placement: 'left', |
||||
confirm: handleCancel.bind(null, record) |
||||
} |
||||
} |
||||
]" |
||||
/> |
||||
</template> |
||||
</template> |
||||
</BasicTable> |
||||
</div> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
import { useGo } from '@/hooks/web/usePage' |
||||
import { useI18n } from '@/hooks/web/useI18n' |
||||
import { useMessage } from '@/hooks/web/useMessage' |
||||
import { BasicTable, useTable, TableAction } from '@/components/Table' |
||||
import { IconEnum } from '@/enums/appEnum' |
||||
import { cancelProcessInstance, getMyProcessInstancePage } from '@/api/bpm/processInstance' |
||||
import { columns, searchFormSchema } from './processInstance.data' |
||||
|
||||
defineOptions({ name: 'InfraApiErrorLog' }) |
||||
|
||||
const go = useGo() |
||||
const { t } = useI18n() |
||||
const { createMessage } = useMessage() |
||||
const [registerTable, { reload }] = useTable({ |
||||
title: '我的流程列表', |
||||
api: getMyProcessInstancePage, |
||||
columns, |
||||
formConfig: { labelWidth: 120, schemas: searchFormSchema }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
actionColumn: { |
||||
width: 140, |
||||
title: t('common.action'), |
||||
dataIndex: 'action', |
||||
fixed: 'right' |
||||
} |
||||
}) |
||||
|
||||
/** 发起流程操作 */ |
||||
function handleCreate() { |
||||
go({ name: 'BpmProcessInstanceCreate' }) |
||||
} |
||||
|
||||
/** 查看详情 */ |
||||
function handleDetail(record: Recordable) { |
||||
go({ name: 'BpmProcessInstanceDetail', query: { id: record.id } }) |
||||
} |
||||
|
||||
/** 取消按钮操作 */ |
||||
async function handleCancel(record: Recordable) { |
||||
await cancelProcessInstance(record.id, 'TODO') |
||||
createMessage.success('取消成功') |
||||
reload() |
||||
} |
||||
</script> |
||||
|
@ -0,0 +1,109 @@
|
||||
import { BasicColumn, FormSchema, useRender } from '@/components/Table' |
||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict' |
||||
|
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '流程编号', |
||||
dataIndex: 'id', |
||||
width: 260 |
||||
}, |
||||
{ |
||||
title: '流程名称', |
||||
dataIndex: 'name', |
||||
width: 100 |
||||
}, |
||||
{ |
||||
title: '流程分类', |
||||
dataIndex: 'category', |
||||
width: 120, |
||||
customRender: ({ text }) => { |
||||
return useRender.renderDict(text, DICT_TYPE.BPM_MODEL_CATEGORY) |
||||
} |
||||
}, |
||||
{ |
||||
title: '当前审批任务', |
||||
dataIndex: 'tasks', |
||||
width: 120, |
||||
customRender: ({ record }) => { |
||||
if (record.tasks && record.tasks.length > 0) { |
||||
const texts: any[] = [] |
||||
record.tasks.forEach((val) => { |
||||
texts.push(val.name) |
||||
}) |
||||
return useRender.renderTags(texts) |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
title: '状态', |
||||
dataIndex: 'status', |
||||
width: 180, |
||||
customRender: ({ text }) => { |
||||
return useRender.renderDict(text, DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS) |
||||
} |
||||
}, |
||||
{ |
||||
title: '提交时间', |
||||
dataIndex: 'createTime', |
||||
width: 180, |
||||
customRender: ({ text }) => { |
||||
return useRender.renderDate(text) |
||||
} |
||||
}, |
||||
{ |
||||
title: '结束时间', |
||||
dataIndex: 'endTime', |
||||
width: 180, |
||||
customRender: ({ text }) => { |
||||
return useRender.renderDate(text) |
||||
} |
||||
} |
||||
] |
||||
|
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
label: '流程名称', |
||||
field: 'name', |
||||
component: 'Input', |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '所属流程', |
||||
field: 'processDefinitionId', |
||||
component: 'Input', |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '流程分类', |
||||
field: 'category', |
||||
component: 'Select', |
||||
componentProps: { |
||||
options: getDictOptions(DICT_TYPE.BPM_MODEL_CATEGORY) |
||||
}, |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '状态', |
||||
field: 'status', |
||||
component: 'Select', |
||||
componentProps: { |
||||
options: getDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS) |
||||
}, |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '结果', |
||||
field: 'result', |
||||
component: 'Select', |
||||
componentProps: { |
||||
options: getDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT) |
||||
}, |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '提交时间', |
||||
field: 'createTime', |
||||
component: 'RangePicker', |
||||
colProps: { span: 8 } |
||||
} |
||||
] |
@ -1,3 +1,3 @@
|
||||
<template> |
||||
<div>开发中</div> |
||||
<div>开发中 taskAssignRule</div> |
||||
</template> |
||||
|
Reference in new issue