bpm:增加待办任务

This commit is contained in:
YunaiV 2023-01-22 09:21:22 +08:00
parent 3e4d388e70
commit 98bf423569
7 changed files with 106 additions and 178 deletions

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -21,12 +22,16 @@ public class BpmTaskTodoPageReqVO extends PageParam {
@ApiModelProperty(value = "流程任务名", example = "芋道")
private String name;
@ApiModelProperty(value = "开始的创建收间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime beginCreateTime;
@ApiModelProperty(value = "结束的创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime endCreateTime;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
//
// @ApiModelProperty(value = "开始的创建收间")
// @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
// private LocalDateTime beginCreateTime;
//
// @ApiModelProperty(value = "结束的创建时间")
// @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
// private LocalDateTime endCreateTime;
}

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.bpm.service.task;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
@ -75,11 +77,11 @@ public class BpmTaskServiceImpl implements BpmTaskService {
if (StrUtil.isNotBlank(pageVO.getName())) {
taskQuery.taskNameLike("%" + pageVO.getName() + "%");
}
if (pageVO.getBeginCreateTime() != null) {
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime()));
if (ArrayUtil.get(pageVO.getCreateTime(), 0) != null) {
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
}
if (pageVO.getEndCreateTime() != null) {
taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime()));
if (ArrayUtil.get(pageVO.getCreateTime(), 1) != null) {
taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1]));
}
// 执行查询
List<Task> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());

View File

@ -1,39 +0,0 @@
export type FormVO = {
id: number
name: string
conf: string
fields: string[]
status: number
remark: string
createTime: string
}
export type TaskProcessVO = {
id: string
name: string
startUserId: number
startUserNickname: string
processDefinitionId: string
}
export type TaskTodoVO = {
id: string
name: string
claimTime: string
createTime: string
suspensionState: number
processInstance: TaskProcessVO
}
export type TaskDoneVO = {
id: string
name: string
claimTime: string
createTime: string
endTime: string
durationInMillis: number
suspensionState: number
result: number
reason: string
processInstance: TaskProcessVO
}

View File

@ -1,4 +0,0 @@
<template>
<div>index</div>
</template>
<script setup lang="ts" name="My"></script>

View File

@ -1,74 +0,0 @@
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
const { t } = useI18n() // 国际化
// CrudSchema
const crudSchemas = reactive<CrudSchema[]>([
{
label: t('common.index'),
field: 'id',
type: 'index'
},
{
label: '任务名称',
field: 'name',
search: {
show: true
}
},
{
label: '所属流程',
field: 'processInstance.name'
},
{
label: '流程发起人',
field: 'processInstance.startUserNickname'
},
{
label: t('common.createTime'),
field: 'createTime',
search: {
show: true,
component: 'DatePicker',
componentProps: {
type: 'datetimerange',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)],
shortcuts: [
{
text: '近一周',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
return [start, end]
}
},
{
text: '近一个月',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
return [start, end]
}
},
{
text: '近三个月',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
return [start, end]
}
}
]
}
}
},
{
label: t('table.action'),
field: 'action',
width: '100px'
}
])
export const { allSchemas } = useCrudSchemas(crudSchemas)

View File

@ -1,56 +1,37 @@
<script setup lang="ts" name="Todo">
import dayjs from 'dayjs'
import { DICT_TYPE } from '@/utils/dict'
import { useTable } from '@/hooks/web/useTable'
import type { TaskTodoVO } from '@/api/bpm/task/types'
import { allSchemas } from './done.data'
import * as TaskTodoApi from '@/api/bpm/task'
const { push } = useRouter()
// ========== ==========
const { register, tableObject, methods } = useTable<TaskTodoVO>({
getListApi: TaskTodoApi.getTodoTaskPage
})
const { getList, setSearchParams } = methods
//
const handleAudit = async (row: TaskTodoVO) => {
push('/bpm/process-instance/detail?id=' + row.processInstance.id)
}
// ========== ==========
getList()
</script>
<template>
<!-- 搜索工作区 -->
<ContentWrap>
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<ContentWrap>
<!-- 列表 -->
<Table
:columns="allSchemas.tableColumns"
:selection="false"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
@register="register"
>
<template #status="{ row }">
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
<XTable @register="registerTable">
<template #suspensionState_default="{ row }">
<el-tag type="success" v-if="row.suspensionState === 1">激活</el-tag>
<el-tag type="warning" v-if="row.suspensionState === 2">挂起</el-tag>
</template>
<template #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
<template #actionbtns_default="{ row }">
<!-- 操作: 审批进度 -->
<XTextButton preIcon="ep:edit-pen" title="审批进度" @click="handleAudit(row)" />
</template>
<template #action="{ row }">
<el-button link type="primary" v-hasPermi="['bpm:task:update']" @click="handleAudit(row)">
<Icon icon="ep:edit" class="mr-1px" /> 审批
</el-button>
</template>
</Table>
</XTable>
</ContentWrap>
</template>
<script setup lang="ts">
// import
import { allSchemas } from './todo.data'
import * as TaskApi from '@/api/bpm/task'
const router = useRouter() //
const [registerTable] = useXTable({
allSchemas: allSchemas,
getListApi: TaskApi.getTodoTaskPage
})
//
const handleAudit = (row) => {
router.push({
name: 'BpmProcessInstanceDetail',
query: {
id: row.processInstanceId
}
})
}
</script>

View File

@ -0,0 +1,57 @@
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
const { t } = useI18n() // 国际化
// crudSchemas
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: null,
action: true,
columns: [
{
title: '任务编号',
field: 'id',
table: {
width: 320
}
},
{
title: '任务名称',
field: 'name',
isSearch: true
},
{
title: '所属流程',
field: 'processInstance.name'
},
{
title: '流程发起人',
field: 'processInstance.startUserNickname'
},
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
table: {
width: 180
},
isSearch: true,
search: {
show: true,
itemRender: {
name: 'XDataTimePicker'
}
}
},
{
title: '任务状态',
field: 'suspensionState',
table: {
slots: {
default: 'suspensionState_default'
}
}
}
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)