Commit 98bf423569ebe1df74991f1f5283df90afa5083d
1 parent
3e4d388e
bpm:增加待办任务
Showing
7 changed files
with
106 additions
and
178 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageReqVO.java
| 1 | package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task; | 1 | package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | +import cn.iocoder.yudao.framework.common.util.date.DateUtils; | ||
| 4 | import io.swagger.annotations.ApiModel; | 5 | import io.swagger.annotations.ApiModel; |
| 5 | import io.swagger.annotations.ApiModelProperty; | 6 | import io.swagger.annotations.ApiModelProperty; |
| 6 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -21,12 +22,16 @@ public class BpmTaskTodoPageReqVO extends PageParam { | @@ -21,12 +22,16 @@ public class BpmTaskTodoPageReqVO extends PageParam { | ||
| 21 | @ApiModelProperty(value = "流程任务名", example = "芋道") | 22 | @ApiModelProperty(value = "流程任务名", example = "芋道") |
| 22 | private String name; | 23 | private String name; |
| 23 | 24 | ||
| 24 | - @ApiModelProperty(value = "开始的创建收间") | ||
| 25 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 26 | - private LocalDateTime beginCreateTime; | ||
| 27 | - | ||
| 28 | - @ApiModelProperty(value = "结束的创建时间") | ||
| 29 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 30 | - private LocalDateTime endCreateTime; | 25 | + @ApiModelProperty(value = "创建时间") |
| 26 | + @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 27 | + private LocalDateTime[] createTime; | ||
| 28 | +// | ||
| 29 | +// @ApiModelProperty(value = "开始的创建收间") | ||
| 30 | +// @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 31 | +// private LocalDateTime beginCreateTime; | ||
| 32 | +// | ||
| 33 | +// @ApiModelProperty(value = "结束的创建时间") | ||
| 34 | +// @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 35 | +// private LocalDateTime endCreateTime; | ||
| 31 | 36 | ||
| 32 | } | 37 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| 1 | package cn.iocoder.yudao.module.bpm.service.task; | 1 | package cn.iocoder.yudao.module.bpm.service.task; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 5 | +import cn.hutool.core.util.ArrayUtil; | ||
| 4 | import cn.hutool.core.util.StrUtil; | 6 | import cn.hutool.core.util.StrUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; | 8 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; |
| @@ -75,11 +77,11 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -75,11 +77,11 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 75 | if (StrUtil.isNotBlank(pageVO.getName())) { | 77 | if (StrUtil.isNotBlank(pageVO.getName())) { |
| 76 | taskQuery.taskNameLike("%" + pageVO.getName() + "%"); | 78 | taskQuery.taskNameLike("%" + pageVO.getName() + "%"); |
| 77 | } | 79 | } |
| 78 | - if (pageVO.getBeginCreateTime() != null) { | ||
| 79 | - taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime())); | 80 | + if (ArrayUtil.get(pageVO.getCreateTime(), 0) != null) { |
| 81 | + taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0])); | ||
| 80 | } | 82 | } |
| 81 | - if (pageVO.getEndCreateTime() != null) { | ||
| 82 | - taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime())); | 83 | + if (ArrayUtil.get(pageVO.getCreateTime(), 1) != null) { |
| 84 | + taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1])); | ||
| 83 | } | 85 | } |
| 84 | // 执行查询 | 86 | // 执行查询 |
| 85 | List<Task> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); | 87 | List<Task> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); |
yudao-ui-admin-vue3/src/api/bpm/task/types.ts deleted
| 1 | -export type FormVO = { | ||
| 2 | - id: number | ||
| 3 | - name: string | ||
| 4 | - conf: string | ||
| 5 | - fields: string[] | ||
| 6 | - status: number | ||
| 7 | - remark: string | ||
| 8 | - createTime: string | ||
| 9 | -} | ||
| 10 | - | ||
| 11 | -export type TaskProcessVO = { | ||
| 12 | - id: string | ||
| 13 | - name: string | ||
| 14 | - startUserId: number | ||
| 15 | - startUserNickname: string | ||
| 16 | - processDefinitionId: string | ||
| 17 | -} | ||
| 18 | - | ||
| 19 | -export type TaskTodoVO = { | ||
| 20 | - id: string | ||
| 21 | - name: string | ||
| 22 | - claimTime: string | ||
| 23 | - createTime: string | ||
| 24 | - suspensionState: number | ||
| 25 | - processInstance: TaskProcessVO | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | -export type TaskDoneVO = { | ||
| 29 | - id: string | ||
| 30 | - name: string | ||
| 31 | - claimTime: string | ||
| 32 | - createTime: string | ||
| 33 | - endTime: string | ||
| 34 | - durationInMillis: number | ||
| 35 | - suspensionState: number | ||
| 36 | - result: number | ||
| 37 | - reason: string | ||
| 38 | - processInstance: TaskProcessVO | ||
| 39 | -} |
yudao-ui-admin-vue3/src/views/bpm/task/my/index.vue deleted
yudao-ui-admin-vue3/src/views/bpm/task/todo/done.data.ts deleted
| 1 | -import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas' | ||
| 2 | -const { t } = useI18n() // 国际化 | ||
| 3 | - | ||
| 4 | -// CrudSchema | ||
| 5 | -const crudSchemas = reactive<CrudSchema[]>([ | ||
| 6 | - { | ||
| 7 | - label: t('common.index'), | ||
| 8 | - field: 'id', | ||
| 9 | - type: 'index' | ||
| 10 | - }, | ||
| 11 | - { | ||
| 12 | - label: '任务名称', | ||
| 13 | - field: 'name', | ||
| 14 | - search: { | ||
| 15 | - show: true | ||
| 16 | - } | ||
| 17 | - }, | ||
| 18 | - { | ||
| 19 | - label: '所属流程', | ||
| 20 | - field: 'processInstance.name' | ||
| 21 | - }, | ||
| 22 | - { | ||
| 23 | - label: '流程发起人', | ||
| 24 | - field: 'processInstance.startUserNickname' | ||
| 25 | - }, | ||
| 26 | - { | ||
| 27 | - label: t('common.createTime'), | ||
| 28 | - field: 'createTime', | ||
| 29 | - search: { | ||
| 30 | - show: true, | ||
| 31 | - component: 'DatePicker', | ||
| 32 | - componentProps: { | ||
| 33 | - type: 'datetimerange', | ||
| 34 | - valueFormat: 'YYYY-MM-DD HH:mm:ss', | ||
| 35 | - defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)], | ||
| 36 | - shortcuts: [ | ||
| 37 | - { | ||
| 38 | - text: '近一周', | ||
| 39 | - value: () => { | ||
| 40 | - const end = new Date() | ||
| 41 | - const start = new Date() | ||
| 42 | - start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) | ||
| 43 | - return [start, end] | ||
| 44 | - } | ||
| 45 | - }, | ||
| 46 | - { | ||
| 47 | - text: '近一个月', | ||
| 48 | - value: () => { | ||
| 49 | - const end = new Date() | ||
| 50 | - const start = new Date() | ||
| 51 | - start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) | ||
| 52 | - return [start, end] | ||
| 53 | - } | ||
| 54 | - }, | ||
| 55 | - { | ||
| 56 | - text: '近三个月', | ||
| 57 | - value: () => { | ||
| 58 | - const end = new Date() | ||
| 59 | - const start = new Date() | ||
| 60 | - start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) | ||
| 61 | - return [start, end] | ||
| 62 | - } | ||
| 63 | - } | ||
| 64 | - ] | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - }, | ||
| 68 | - { | ||
| 69 | - label: t('table.action'), | ||
| 70 | - field: 'action', | ||
| 71 | - width: '100px' | ||
| 72 | - } | ||
| 73 | -]) | ||
| 74 | -export const { allSchemas } = useCrudSchemas(crudSchemas) |
yudao-ui-admin-vue3/src/views/bpm/task/todo/index.vue
| 1 | -<script setup lang="ts" name="Todo"> | ||
| 2 | -import dayjs from 'dayjs' | ||
| 3 | -import { DICT_TYPE } from '@/utils/dict' | ||
| 4 | -import { useTable } from '@/hooks/web/useTable' | ||
| 5 | -import type { TaskTodoVO } from '@/api/bpm/task/types' | ||
| 6 | -import { allSchemas } from './done.data' | ||
| 7 | -import * as TaskTodoApi from '@/api/bpm/task' | ||
| 8 | -const { push } = useRouter() | ||
| 9 | -// ========== 列表相关 ========== | ||
| 10 | -const { register, tableObject, methods } = useTable<TaskTodoVO>({ | ||
| 11 | - getListApi: TaskTodoApi.getTodoTaskPage | ||
| 12 | -}) | ||
| 13 | -const { getList, setSearchParams } = methods | ||
| 14 | - | ||
| 15 | -// 审批操作 | ||
| 16 | -const handleAudit = async (row: TaskTodoVO) => { | ||
| 17 | - push('/bpm/process-instance/detail?id=' + row.processInstance.id) | ||
| 18 | -} | ||
| 19 | - | ||
| 20 | -// ========== 初始化 ========== | ||
| 21 | -getList() | ||
| 22 | -</script> | ||
| 23 | - | ||
| 24 | <template> | 1 | <template> |
| 25 | - <!-- 搜索工作区 --> | ||
| 26 | - <ContentWrap> | ||
| 27 | - <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> | ||
| 28 | - </ContentWrap> | ||
| 29 | <ContentWrap> | 2 | <ContentWrap> |
| 30 | - <!-- 列表 --> | ||
| 31 | - <Table | ||
| 32 | - :columns="allSchemas.tableColumns" | ||
| 33 | - :selection="false" | ||
| 34 | - :data="tableObject.tableList" | ||
| 35 | - :loading="tableObject.loading" | ||
| 36 | - :pagination="{ | ||
| 37 | - total: tableObject.total | ||
| 38 | - }" | ||
| 39 | - v-model:pageSize="tableObject.pageSize" | ||
| 40 | - v-model:currentPage="tableObject.currentPage" | ||
| 41 | - @register="register" | ||
| 42 | - > | ||
| 43 | - <template #status="{ row }"> | ||
| 44 | - <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> | 3 | + <XTable @register="registerTable"> |
| 4 | + <template #suspensionState_default="{ row }"> | ||
| 5 | + <el-tag type="success" v-if="row.suspensionState === 1">激活</el-tag> | ||
| 6 | + <el-tag type="warning" v-if="row.suspensionState === 2">挂起</el-tag> | ||
| 45 | </template> | 7 | </template> |
| 46 | - <template #createTime="{ row }"> | ||
| 47 | - <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> | 8 | + <template #actionbtns_default="{ row }"> |
| 9 | + <!-- 操作: 审批进度 --> | ||
| 10 | + <XTextButton preIcon="ep:edit-pen" title="审批进度" @click="handleAudit(row)" /> | ||
| 48 | </template> | 11 | </template> |
| 49 | - <template #action="{ row }"> | ||
| 50 | - <el-button link type="primary" v-hasPermi="['bpm:task:update']" @click="handleAudit(row)"> | ||
| 51 | - <Icon icon="ep:edit" class="mr-1px" /> 审批 | ||
| 52 | - </el-button> | ||
| 53 | - </template> | ||
| 54 | - </Table> | 12 | + </XTable> |
| 55 | </ContentWrap> | 13 | </ContentWrap> |
| 56 | </template> | 14 | </template> |
| 15 | + | ||
| 16 | +<script setup lang="ts"> | ||
| 17 | +// 业务相关的 import | ||
| 18 | +import { allSchemas } from './todo.data' | ||
| 19 | +import * as TaskApi from '@/api/bpm/task' | ||
| 20 | + | ||
| 21 | +const router = useRouter() // 路由 | ||
| 22 | + | ||
| 23 | +const [registerTable] = useXTable({ | ||
| 24 | + allSchemas: allSchemas, | ||
| 25 | + getListApi: TaskApi.getTodoTaskPage | ||
| 26 | +}) | ||
| 27 | + | ||
| 28 | +// 处理审批按钮 | ||
| 29 | +const handleAudit = (row) => { | ||
| 30 | + router.push({ | ||
| 31 | + name: 'BpmProcessInstanceDetail', | ||
| 32 | + query: { | ||
| 33 | + id: row.processInstanceId | ||
| 34 | + } | ||
| 35 | + }) | ||
| 36 | +} | ||
| 37 | +</script> |
yudao-ui-admin-vue3/src/views/bpm/task/todo/todo.data.ts
0 → 100644
| 1 | +import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas' | ||
| 2 | + | ||
| 3 | +const { t } = useI18n() // 国际化 | ||
| 4 | + | ||
| 5 | +// crudSchemas | ||
| 6 | +const crudSchemas = reactive<VxeCrudSchema>({ | ||
| 7 | + primaryKey: 'id', | ||
| 8 | + primaryType: null, | ||
| 9 | + action: true, | ||
| 10 | + columns: [ | ||
| 11 | + { | ||
| 12 | + title: '任务编号', | ||
| 13 | + field: 'id', | ||
| 14 | + table: { | ||
| 15 | + width: 320 | ||
| 16 | + } | ||
| 17 | + }, | ||
| 18 | + { | ||
| 19 | + title: '任务名称', | ||
| 20 | + field: 'name', | ||
| 21 | + isSearch: true | ||
| 22 | + }, | ||
| 23 | + { | ||
| 24 | + title: '所属流程', | ||
| 25 | + field: 'processInstance.name' | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + title: '流程发起人', | ||
| 29 | + field: 'processInstance.startUserNickname' | ||
| 30 | + }, | ||
| 31 | + { | ||
| 32 | + title: t('common.createTime'), | ||
| 33 | + field: 'createTime', | ||
| 34 | + formatter: 'formatDate', | ||
| 35 | + table: { | ||
| 36 | + width: 180 | ||
| 37 | + }, | ||
| 38 | + isSearch: true, | ||
| 39 | + search: { | ||
| 40 | + show: true, | ||
| 41 | + itemRender: { | ||
| 42 | + name: 'XDataTimePicker' | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + }, | ||
| 46 | + { | ||
| 47 | + title: '任务状态', | ||
| 48 | + field: 'suspensionState', | ||
| 49 | + table: { | ||
| 50 | + slots: { | ||
| 51 | + default: 'suspensionState_default' | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + ] | ||
| 56 | +}) | ||
| 57 | +export const { allSchemas } = useVxeCrudSchemas(crudSchemas) |