Vue3 重构:流程定义列表
This commit is contained in:
parent
b587d7634c
commit
3c6bf37879
@ -1,19 +1,19 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
|
|
||||||
export const getProcessDefinitionBpmnXMLApi = async (id: number) => {
|
export const getProcessDefinitionBpmnXML = async (id: number) => {
|
||||||
return await request.get({
|
return await request.get({
|
||||||
url: '/bpm/process-definition/get-bpmn-xml?id=' + id
|
url: '/bpm/process-definition/get-bpmn-xml?id=' + id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getProcessDefinitionPageApi = async (params) => {
|
export const getProcessDefinitionPage = async (params) => {
|
||||||
return await request.get({
|
return await request.get({
|
||||||
url: '/bpm/process-definition/page',
|
url: '/bpm/process-definition/page',
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getProcessDefinitionListApi = async (params) => {
|
export const getProcessDefinitionList = async (params) => {
|
||||||
return await request.get({
|
return await request.get({
|
||||||
url: '/bpm/process-definition/list',
|
url: '/bpm/process-definition/list',
|
||||||
params
|
params
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
|
||||||
|
|
||||||
// CrudSchema
|
|
||||||
const crudSchemas = reactive<VxeCrudSchema>({
|
|
||||||
primaryKey: 'id',
|
|
||||||
primaryType: null,
|
|
||||||
action: true,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '定义编号',
|
|
||||||
field: 'id',
|
|
||||||
table: {
|
|
||||||
width: 360
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '定义名称',
|
|
||||||
field: 'name',
|
|
||||||
table: {
|
|
||||||
// width: 120,
|
|
||||||
slots: {
|
|
||||||
default: 'name_default'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '定义分类',
|
|
||||||
field: 'category',
|
|
||||||
// dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
|
|
||||||
// dictClass: 'number',
|
|
||||||
table: {
|
|
||||||
// width: 120,
|
|
||||||
slots: {
|
|
||||||
default: 'category_default'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '表单信息',
|
|
||||||
field: 'formId',
|
|
||||||
table: {
|
|
||||||
// width: 200,
|
|
||||||
slots: {
|
|
||||||
default: 'formId_default'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '流程版本',
|
|
||||||
field: 'version',
|
|
||||||
table: {
|
|
||||||
// width: 80,
|
|
||||||
slots: {
|
|
||||||
default: 'version_default'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '激活状态',
|
|
||||||
field: 'suspensionState',
|
|
||||||
table: {
|
|
||||||
// width: 80,
|
|
||||||
slots: {
|
|
||||||
default: 'suspensionState_default'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '部署时间',
|
|
||||||
field: 'deploymentTime',
|
|
||||||
isForm: false,
|
|
||||||
formatter: 'formatDate'
|
|
||||||
// table: {
|
|
||||||
// width: 180
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
|
@ -1,54 +1,88 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<!-- 列表 -->
|
<el-table v-loading="loading" :data="list">
|
||||||
<XTable @register="registerTable">
|
<el-table-column label="定义编号" align="center" prop="id" width="400" />
|
||||||
<!-- 流程名称 -->
|
<el-table-column label="流程名称" align="center" prop="name" width="200">
|
||||||
<template #name_default="{ row }">
|
<template #default="scope">
|
||||||
<XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" />
|
<el-button type="text" @click="handleBpmnDetail(scope.row)">
|
||||||
|
<span>{{ scope.row.name }}</span>
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 流程分类 -->
|
</el-table-column>
|
||||||
<template #category_default="{ row }">
|
<el-table-column label="定义分类" align="center" prop="category" width="100">
|
||||||
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" />
|
||||||
</template>
|
</template>
|
||||||
<!-- 表单信息 -->
|
</el-table-column>
|
||||||
<template #formId_default="{ row }">
|
<el-table-column label="表单信息" align="center" prop="formType" width="200">
|
||||||
<XTextButton
|
<template #default="scope">
|
||||||
v-if="row.formType === 10"
|
<el-button
|
||||||
:title="row.formName"
|
v-if="scope.row.formType === 10"
|
||||||
@click="handleFormDetail(row)"
|
type="text"
|
||||||
|
@click="handleFormDetail(scope.row)"
|
||||||
|
>
|
||||||
|
<span>{{ scope.row.formName }}</span>
|
||||||
|
</el-button>
|
||||||
|
<el-button v-else type="text" @click="handleFormDetail(scope.row)">
|
||||||
|
<span>{{ scope.row.formCustomCreatePath }}</span>
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag v-if="scope.row">v{{ scope.row.version }}</el-tag>
|
||||||
|
<el-tag type="warning" v-else>未部署</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="version" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag type="success" v-if="scope.row.suspensionState === 1">激活</el-tag>
|
||||||
|
<el-tag type="warning" v-if="scope.row.suspensionState === 2">挂起</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="部署时间"
|
||||||
|
align="center"
|
||||||
|
prop="deploymentTime"
|
||||||
|
width="180"
|
||||||
|
:formatter="dateFormatter"
|
||||||
/>
|
/>
|
||||||
<XTextButton v-else :title="row.formCustomCreatePath" @click="handleFormDetail(row)" />
|
<el-table-column
|
||||||
</template>
|
label="定义描述"
|
||||||
<!-- 流程版本 -->
|
align="center"
|
||||||
<template #version_default="{ row }">
|
prop="description"
|
||||||
<el-tag>v{{ row.version }}</el-tag>
|
width="300"
|
||||||
</template>
|
show-overflow-tooltip
|
||||||
<!-- 激活状态 -->
|
/>
|
||||||
<template #suspensionState_default="{ row }">
|
<el-table-column label="操作" align="center" width="150" fixed="right">
|
||||||
<el-tag type="success" v-if="row.suspensionState === 1">激活</el-tag>
|
<template #default="scope">
|
||||||
<el-tag type="warning" v-if="row.suspensionState === 2">挂起</el-tag>
|
<el-button
|
||||||
</template>
|
link
|
||||||
<!-- 操作 -->
|
type="primary"
|
||||||
<template #actionbtns_default="{ row }">
|
@click="handleAssignRule(scope.row)"
|
||||||
<XTextButton
|
|
||||||
preIcon="ep:user"
|
|
||||||
title="分配规则"
|
|
||||||
v-hasPermi="['bpm:task-assign-rule:query']"
|
v-hasPermi="['bpm:task-assign-rule:query']"
|
||||||
@click="handleAssignRule(row)"
|
>
|
||||||
/>
|
分配规则
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</XTable>
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
<!-- 表单详情的弹窗 -->
|
<!-- 分页 -->
|
||||||
<XModal v-model="formDetailVisible" width="800" title="表单详情" :show-footer="false">
|
<Pagination
|
||||||
<form-create
|
:total="total"
|
||||||
:rule="formDetailPreview.rule"
|
v-model:page="queryParams.pageNo"
|
||||||
:option="formDetailPreview.option"
|
v-model:limit="queryParams.pageSize"
|
||||||
v-if="formDetailVisible"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</XModal>
|
</ContentWrap>
|
||||||
<!-- 流程模型图的预览 -->
|
|
||||||
<XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%">
|
<!-- 弹窗:表单详情 -->
|
||||||
|
<Dialog title="表单详情" v-model="formDetailVisible" width="800">
|
||||||
|
<form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" />
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<!-- 弹窗:流程模型图的预览 -->
|
||||||
|
<Dialog title="流程图" v-model="bpmnDetailVisible" width="800">
|
||||||
<my-process-viewer
|
<my-process-viewer
|
||||||
key="designer"
|
key="designer"
|
||||||
v-model="bpmnXML"
|
v-model="bpmnXML"
|
||||||
@ -56,37 +90,49 @@
|
|||||||
v-bind="bpmnControlForm"
|
v-bind="bpmnControlForm"
|
||||||
:prefix="bpmnControlForm.prefix"
|
:prefix="bpmnControlForm.prefix"
|
||||||
/>
|
/>
|
||||||
</XModal>
|
</Dialog>
|
||||||
</ContentWrap>
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
|
||||||
// 业务相关的 import
|
|
||||||
import * as DefinitionApi from '@/api/bpm/definition'
|
|
||||||
// import * as ModelApi from '@/api/bpm/model'
|
|
||||||
import { allSchemas } from './definition.data'
|
|
||||||
import { setConfAndFields2 } from '@/utils/formCreate'
|
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
|
||||||
|
|
||||||
const bpmnXML = ref(null)
|
<script setup lang="ts" name="Form">
|
||||||
const showBpmnOpen = ref(false)
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
const bpmnControlForm = ref({
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
prefix: 'flowable'
|
import * as DefinitionApi from '@/api/bpm/definition'
|
||||||
})
|
import { setConfAndFields2 } from '@/utils/formCreate'
|
||||||
// const message = useMessage() // 消息弹窗
|
const { push } = useRouter() // 路由
|
||||||
const router = useRouter() // 路由
|
|
||||||
const { query } = useRoute() // 查询参数
|
const { query } = useRoute() // 查询参数
|
||||||
|
|
||||||
// ========== 列表相关 ==========
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const list = ref([]) // 列表的数据
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
key: query.key
|
key: query.key
|
||||||
})
|
})
|
||||||
const [registerTable] = useXTable({
|
|
||||||
allSchemas: allSchemas,
|
|
||||||
getListApi: DefinitionApi.getProcessDefinitionPageApi,
|
|
||||||
params: queryParams
|
|
||||||
})
|
|
||||||
|
|
||||||
// 流程表单的详情按钮操作
|
/** 查询参数列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await DefinitionApi.getProcessDefinitionPage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 点击任务分配按钮 */
|
||||||
|
const handleAssignRule = (row) => {
|
||||||
|
push({
|
||||||
|
name: 'BpmTaskAssignRuleList',
|
||||||
|
query: {
|
||||||
|
modelId: row.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 流程表单的详情按钮操作 */
|
||||||
const formDetailVisible = ref(false)
|
const formDetailVisible = ref(false)
|
||||||
const formDetailPreview = ref({
|
const formDetailPreview = ref({
|
||||||
rule: [],
|
rule: [],
|
||||||
@ -99,32 +145,25 @@ const handleFormDetail = async (row) => {
|
|||||||
// 弹窗打开
|
// 弹窗打开
|
||||||
formDetailVisible.value = true
|
formDetailVisible.value = true
|
||||||
} else {
|
} else {
|
||||||
await router.push({
|
await push({
|
||||||
path: row.formCustomCreatePath
|
path: row.formCustomCreatePath
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 流程图的详情按钮操作
|
/** 流程图的详情按钮操作 */
|
||||||
const handleBpmnDetail = (row) => {
|
const bpmnDetailVisible = ref(false)
|
||||||
// TODO 芋艿:流程组件开发中
|
const bpmnXML = ref(null)
|
||||||
console.log(row)
|
const bpmnControlForm = ref({
|
||||||
DefinitionApi.getProcessDefinitionBpmnXMLApi(row).then((response) => {
|
prefix: 'flowable'
|
||||||
console.log(response, 'response')
|
})
|
||||||
bpmnXML.value = response
|
const handleBpmnDetail = async (row) => {
|
||||||
// 弹窗打开
|
bpmnXML.value = await DefinitionApi.getProcessDefinitionBpmnXML(row.id)
|
||||||
showBpmnOpen.value = true
|
bpmnDetailVisible.value = true
|
||||||
})
|
|
||||||
// message.success('流程组件开发中,预计 2 月底完成')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击任务分配按钮
|
/** 初始化 **/
|
||||||
const handleAssignRule = (row) => {
|
onMounted(() => {
|
||||||
router.push({
|
getList()
|
||||||
name: 'BpmTaskAssignRuleList',
|
})
|
||||||
query: {
|
|
||||||
processDefinitionId: row.id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list">
|
<el-table v-loading="loading" :data="list">
|
||||||
<el-table-column label="流程标识" align="center" prop="key" />
|
<el-table-column label="流程标识" align="center" prop="key" width="200" />
|
||||||
<el-table-column label="流程名称" align="center" prop="name" width="200">
|
<el-table-column label="流程名称" align="center" prop="name" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="text" @click="handleBpmnDetail(scope.row)">
|
<el-button type="text" @click="handleBpmnDetail(scope.row)">
|
||||||
@ -77,11 +77,15 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="表单信息" align="center" prop="formType" width="200">
|
<el-table-column label="表单信息" align="center" prop="formType" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button v-if="scope.row.formId" type="text" @click="handleFormDetail(scope.row)">
|
<el-button
|
||||||
|
v-if="scope.row.formType === 10"
|
||||||
|
type="text"
|
||||||
|
@click="handleFormDetail(scope.row)"
|
||||||
|
>
|
||||||
<span>{{ scope.row.formName }}</span>
|
<span>{{ scope.row.formName }}</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-else-if="scope.row.formCustomCreatePath"
|
v-else-if="scope.row.formType === 20"
|
||||||
type="text"
|
type="text"
|
||||||
@click="handleFormDetail(scope.row)"
|
@click="handleFormDetail(scope.row)"
|
||||||
>
|
>
|
||||||
@ -94,6 +98,7 @@
|
|||||||
label="创建时间"
|
label="创建时间"
|
||||||
align="center"
|
align="center"
|
||||||
prop="createTime"
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
:formatter="dateFormatter"
|
:formatter="dateFormatter"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="最新部署的流程定义" align="center">
|
<el-table-column label="最新部署的流程定义" align="center">
|
||||||
@ -114,7 +119,7 @@
|
|||||||
label="激活状态"
|
label="激活状态"
|
||||||
align="center"
|
align="center"
|
||||||
prop="processDefinition.version"
|
prop="processDefinition.version"
|
||||||
width="80"
|
width="85"
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
@ -134,7 +139,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" fixed="right" class-name="fixed-width">
|
<el-table-column label="操作" align="center" width="240" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
|
@ -72,7 +72,7 @@ const [registerTable] = useXTable({
|
|||||||
params: {
|
params: {
|
||||||
suspensionState: 1
|
suspensionState: 1
|
||||||
},
|
},
|
||||||
getListApi: DefinitionApi.getProcessDefinitionListApi,
|
getListApi: DefinitionApi.getProcessDefinitionList,
|
||||||
isList: true
|
isList: true
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ const handleSelect = async (row) => {
|
|||||||
setConfAndFields2(detailForm, row.formConf, row.formFields)
|
setConfAndFields2(detailForm, row.formConf, row.formFields)
|
||||||
|
|
||||||
// 加载流程图
|
// 加载流程图
|
||||||
DefinitionApi.getProcessDefinitionBpmnXMLApi(row.id).then((response) => {
|
DefinitionApi.getProcessDefinitionBpmnXML(row.id).then((response) => {
|
||||||
bpmnXML.value = response
|
bpmnXML.value = response
|
||||||
})
|
})
|
||||||
// 情况二:业务表单
|
// 情况二:业务表单
|
||||||
|
@ -411,7 +411,7 @@ const getDetail = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 加载流程图
|
// 加载流程图
|
||||||
DefinitionApi.getProcessDefinitionBpmnXMLApi(processDefinition.id).then((data) => {
|
DefinitionApi.getProcessDefinitionBpmnXML(processDefinition.id).then((data) => {
|
||||||
bpmnXML.value = data
|
bpmnXML.value = data
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -169,7 +169,6 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
label="操作"
|
label="操作"
|
||||||
align="center"
|
align="center"
|
||||||
class-name="fixed-width"
|
|
||||||
width="210"
|
width="210"
|
||||||
fixed="right"
|
fixed="right"
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user