bpm:增加已办任务

This commit is contained in:
YunaiV 2023-01-22 09:47:55 +08:00
parent 98bf423569
commit 2f46e230af
2 changed files with 79 additions and 147 deletions

View File

@ -1,92 +1,52 @@
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
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: '结果',
field: 'result',
dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
dictClass: 'number'
},
{
label: '审批意见',
field: 'reason'
},
{
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]
}
}
]
// 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.status'),
field: 'result',
dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
dictClass: 'number',
isSearch: true
},
{
title: '原因',
field: 'reason'
},
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
table: {
width: 180
}
}
},
{
label: '审批时间',
field: 'endTime'
},
{
label: '耗时',
field: 'durationInMillis'
},
{
label: t('table.action'),
field: 'action',
width: '100px'
}
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -1,65 +1,37 @@
<script setup lang="ts" name="Done">
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import { DICT_TYPE } from '@/utils/dict'
import type { TaskDoneVO } from '@/api/bpm/task/types'
import { allSchemas } from './done.data'
import * as TaskDoneApi from '@/api/bpm/task'
import { useTable } from '@/hooks/web/useTable'
dayjs.extend(duration)
const { t } = useI18n() //
const { push } = useRouter()
// ========== ==========
const { register, tableObject, methods } = useTable<TaskDoneVO>({
getListApi: TaskDoneApi.getDoneTaskPage
})
const { getList, setSearchParams } = methods
//
const handleAudit = async (row: TaskDoneVO) => {
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:view" title="详情" @click="handleAudit(row)" />
</template>
<template #endTime="{ row }">
<span>{{ dayjs(row.endTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
<template #durationInMillis="{ row }">
<span>{{ dayjs.duration(row.durationInMillis).asMilliseconds() }}</span>
</template>
<template #action="{ row }">
<el-button link type="primary" v-hasPermi="['bpm:task:query']" @click="handleAudit(row)">
<Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
</el-button>
</template>
</Table>
</XTable>
</ContentWrap>
</template>
<script setup lang="ts">
// import
import { allSchemas } from './done.data'
import * as TaskApi from '@/api/bpm/task'
const router = useRouter() //
const [registerTable] = useXTable({
allSchemas: allSchemas,
getListApi: TaskApi.getDoneTaskPage
})
//
const handleAudit = (row) => {
router.push({
name: 'BpmProcessInstanceDetail',
query: {
id: row.processInstanceId
}
})
}
</script>