bpm:完成流程实例的列表界面

This commit is contained in:
YunaiV 2023-01-23 00:03:56 +08:00
parent e6fadf073a
commit 2d6fe27b43
5 changed files with 26 additions and 56 deletions

View File

@ -45,11 +45,9 @@
</XModal>
</ContentWrap>
</template>
<script setup lang="ts">
// import
import { ref } from 'vue'
// import { DICT_TYPE, getDictOptions } from '@/utils/dict'
// import
import * as DefinitionApi from '@/api/bpm/definition'
@ -87,7 +85,7 @@ const handleFormDetail = async (row) => {
//
formDetailVisible.value = true
} else {
router.push({
await router.push({
path: row.formCustomCreatePath
})
}

View File

@ -15,7 +15,7 @@
@click="cancelLeave(row)"
/>
<!-- 操作: 详情 -->
<XTextButton preIcon="ep:delete" :title="t('action.detail')" @click="handleDetail(row)" />
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
<!-- 操作: 审批进度 -->
<XTextButton preIcon="ep:edit-pen" title="审批进度" @click="handleProcessDetail(row)" />
</template>

View File

@ -14,97 +14,69 @@
</template>
<!-- 当前审批任务 -->
<template #tasks_default="{ row }">
<el-button
v-for="task in row.tasks"
:key="task.id"
type="text"
@click="handleFormDetail(task.id)"
>
<el-button v-for="task in row.tasks" :key="task.id" type="text">
<span>{{ task.name }}</span>
</el-button>
</template>
<!-- 操作 -->
<template #actionbtns_default="{ row }">
<XButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
<XButton
type="primary"
preIcon="ep:delete"
title="取消"
v-if="row.result === 1"
preIcon="ep:delete"
@click="handleCancel(row)"
/>
<XButton type="primary" title="详情" preIcon="ep:edit-pen" @click="handleDetail(row)" />
</template>
</XTable>
</ContentWrap>
</template>
<script setup lang="ts">
// import
import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useXTable } from '@/hooks/web/useXTable'
import { useRouter } from 'vue-router'
import { ElMessageBox } from 'element-plus'
// import
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
// import { decodeFields } from '@/utils/formGenerator' // TODO
import { allSchemas } from './process.data'
const router = useRouter() //
const message = useMessage() //
const { t } = useI18n() //
// ========== ==========
const [registerTable] = useXTable({
const [registerTable, { reload }] = useXTable({
allSchemas: allSchemas,
getListApi: ProcessInstanceApi.getMyProcessInstancePageApi
})
//
const detailOpen = ref(false)
const detailForm = ref()
/** 发起流程操作 **/
const handleCreate = () => {
router.push({
name: 'BpmProcessInstanceCreate'
})
}
/** 流程表单的详情按钮操作 */
const handleFormDetail = (row) => {
// 使
if (row.formId) {
// TODO
detailForm.value = {
...JSON.parse(row.formConf),
fields: decodeFields([], row.formFields)
}
//
detailOpen.value = true
// 使
} else if (row.formCustomCreatePath) {
router.push({ path: row.formCustomCreatePath })
}
}
//
const handleDetail = (row) => {
console.log(row, 'row')
router.push({ path: '/process-instance/detail', query: { id: row.id } })
router.push({
name: 'BpmProcessInstanceDetail',
query: {
id: row.processInstanceId
}
})
}
/** 取消按钮操作 */
const handleCancel = (row) => {
const id = row.id
ElMessageBox.prompt('请输入取消原因?', '取消流程', {
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消',
ElMessageBox.prompt('请输入取消原因', '取消流程', {
confirmButtonText: t('common.ok'),
cancelButtonText: t('common.cancel'),
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, //
inputErrorMessage: '取消原因不能为空'
}).then(async ({ value }) => {
await ProcessInstanceApi.cancelProcessInstanceApi(row.id, value)
message.success('取消成功')
reload()
})
.then(({ value }) => {
return ProcessInstanceApi.cancelProcessInstanceApi(id, value)
})
.then(() => {
ElMessage({
message: '取消成功',
type: 'success'
})
})
}
</script>

View File

@ -41,7 +41,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '当前审批任务',
field: 'tasks',
table: {
width: 100,
width: 140,
slots: {
default: 'tasks_default'
}

View File

@ -58,7 +58,7 @@
</el-table-column>
<el-table-column label="当前审批任务" align="center" prop="tasks">
<template v-slot="scope">
<el-button v-for="task in scope.row.tasks" :key="task.id" type="text" @click="handleFormDetail(task.id)">
<el-button v-for="task in scope.row.tasks" :key="task.id" type="text"">
<span>{{ task.name }}</span>
</el-button>
</template>