feat: bpm done

pull/4/MERGE
xingyu 2023-04-12 23:04:32 +08:00
parent abd2d3de98
commit 6f6de0b393
3 changed files with 131 additions and 1 deletions

View File

@ -64,4 +64,31 @@ export function convertDate(date) {
return date
}
/**
* xx
*
* @param ms
* @returns {string}
*/
export function getDate(ms) {
const day = Math.floor(ms / (24 * 60 * 60 * 1000))
const hour = Math.floor(ms / (60 * 60 * 1000) - day * 24)
const minute = Math.floor(ms / (60 * 1000) - day * 24 * 60 - hour * 60)
const second = Math.floor(ms / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60)
if (day > 0) {
return day + '天' + hour + '小时' + minute + '分钟'
}
if (hour > 0) {
return hour + '小时' + minute + '分钟'
}
if (minute > 0) {
return minute + '分钟'
}
if (second > 0) {
return second + '秒'
} else {
return 0 + '秒'
}
}
export const dateUtil = dayjs

View File

@ -0,0 +1,78 @@
import { BasicColumn, FormSchema, useRender } from '@/components/Table'
import { getDate } from '@/utils/dateUtil'
import { DICT_TYPE } from '@/utils/dict'
export const columns: BasicColumn[] = [
{
title: '任务编号',
dataIndex: 'id',
width: 100
},
{
title: '任务名称',
dataIndex: 'name',
width: 180
},
{
title: '所属流程',
dataIndex: 'processInstance.name',
width: 180
},
{
title: '流程发起人',
dataIndex: 'processInstance.startUserNickname',
width: 180
},
{
title: '结果',
dataIndex: 'result',
width: 180,
customRender: ({ text }) => {
return useRender.renderDict(text, DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)
}
},
{
title: '审批意见',
dataIndex: 'reason',
width: 180
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 180,
customRender: ({ text }) => {
return useRender.renderDate(text)
}
},
{
title: '审批时间',
dataIndex: 'endTime',
width: 180,
customRender: ({ text }) => {
return useRender.renderDate(text)
}
},
{
title: '耗时',
dataIndex: 'durationInMillis',
width: 180,
customRender: ({ text }) => {
return getDate(text)
}
}
]
export const searchFormSchema: FormSchema[] = [
{
label: '流程名',
field: 'name',
component: 'Input',
colProps: { span: 8 }
},
{
label: '创建时间',
field: 'createTime',
component: 'RangePicker',
colProps: { span: 8 }
}
]

View File

@ -1,3 +1,28 @@
<template>
<div>开发中</div>
<div>
<BasicTable @register="registerTable" />
</div>
</template>
<script lang="ts" setup name="Done">
import { useI18n } from '@/hooks/web/useI18n'
import { BasicTable, useTable } from '@/components/Table'
import { getDoneTaskPage } from '@/api/bpm/task'
import { columns, searchFormSchema } from './done.data'
const { t } = useI18n()
const [registerTable] = useTable({
title: '审批列表',
api: getDoneTaskPage,
columns,
formConfig: { labelWidth: 120, schemas: searchFormSchema },
useSearchForm: true,
showTableSetting: true,
actionColumn: {
width: 140,
title: t('common.action'),
dataIndex: 'action',
fixed: 'right'
}
})
</script>