【功能优化】工作流:模型定义的列表,进行一定的简化,为后续把流程分类、流程定义融合在一个 vue 界面做准备。这样,和钉钉的界面更容易统一!
parent
28f768f3b2
commit
dc0e947334
|
@ -8,12 +8,7 @@
|
||||||
label-width="110px"
|
label-width="110px"
|
||||||
>
|
>
|
||||||
<el-form-item label="流程标识" prop="key">
|
<el-form-item label="流程标识" prop="key">
|
||||||
<el-input
|
<el-input v-model="formData.key" :disabled="!!formData.id" placeholder="请输入流标标识" />
|
||||||
v-model="formData.key"
|
|
||||||
:disabled="!!formData.id"
|
|
||||||
placeholder="请输入流标标识"
|
|
||||||
style="width: 330px"
|
|
||||||
/>
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-if="!formData.id"
|
v-if="!formData.id"
|
||||||
class="item"
|
class="item"
|
||||||
|
@ -217,10 +212,9 @@ const submitForm = async () => {
|
||||||
await ModelApi.createModel(data)
|
await ModelApi.createModel(data)
|
||||||
// 提示,引导用户做后续的操作
|
// 提示,引导用户做后续的操作
|
||||||
await ElMessageBox.alert(
|
await ElMessageBox.alert(
|
||||||
'<strong>新建模型成功!</strong>后续需要执行如下 3 个步骤:' +
|
'<strong>新建模型成功!</strong>后续需要执行如下 2 个步骤:' +
|
||||||
'<div>1. 点击【修改流程】按钮,配置流程的分类、表单信息</div>' +
|
'<div>1. 点击【设计流程】按钮,绘制流程图</div>' +
|
||||||
'<div>2. 点击【设计流程】按钮,绘制流程图</div>' +
|
'<div>2. 点击【发布流程】按钮,完成流程的最终发布</div>' +
|
||||||
'<div>3. 点击【发布流程】按钮,完成流程的最终发布</div>' +
|
|
||||||
'另外,每次流程修改后,都需要点击【发布流程】按钮,才能正式生效!!!',
|
'另外,每次流程修改后,都需要点击【发布流程】按钮,才能正式生效!!!',
|
||||||
'重要提示',
|
'重要提示',
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,21 +67,14 @@
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list">
|
<el-table v-loading="loading" :data="list">
|
||||||
<el-table-column label="流程标识" align="center" prop="key" width="200" />
|
<el-table-column label="流程名称" align="center" prop="name" min-width="200" />
|
||||||
<el-table-column label="流程名称" align="center" prop="name" width="200">
|
<el-table-column label="流程图标" align="center" prop="icon" min-width="100">
|
||||||
<template #default="scope">
|
|
||||||
<el-button type="primary" link @click="handleBpmnDetail(scope.row)">
|
|
||||||
<span>{{ scope.row.name }}</span>
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="流程图标" align="center" prop="icon" width="100">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-image :src="scope.row.icon" class="h-32px w-32px" />
|
<el-image :src="scope.row.icon" class="h-32px w-32px" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="流程分类" align="center" prop="categoryName" width="100" />
|
<el-table-column label="流程分类" align="center" prop="categoryName" min-width="100" />
|
||||||
<el-table-column label="表单信息" align="center" prop="formType" width="200">
|
<el-table-column label="表单信息" align="center" prop="formType" min-width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.formType === 10"
|
v-if="scope.row.formType === 10"
|
||||||
|
@ -102,52 +95,36 @@
|
||||||
<label v-else>暂无表单</label>
|
<label v-else>暂无表单</label>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<!-- <el-table-column label="激活状态" align="center" prop="processDefinition.version" width="85">-->
|
||||||
label="创建时间"
|
<!-- <template #default="scope">-->
|
||||||
align="center"
|
<!-- <el-switch-->
|
||||||
prop="createTime"
|
<!-- v-if="scope.row.processDefinition"-->
|
||||||
width="180"
|
<!-- v-model="scope.row.processDefinition.suspensionState"-->
|
||||||
:formatter="dateFormatter"
|
<!-- :active-value="1"-->
|
||||||
/>
|
<!-- :inactive-value="2"-->
|
||||||
<el-table-column label="最新部署的流程定义" align="center">
|
<!-- @change="handleChangeState(scope.row)"-->
|
||||||
<el-table-column
|
<!-- />-->
|
||||||
label="流程版本"
|
<!-- </template>-->
|
||||||
align="center"
|
<!-- </el-table-column>-->
|
||||||
prop="processDefinition.version"
|
<el-table-column label="最后发布" align="center" prop="deploymentTime" min-width="250">
|
||||||
width="100"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag v-if="scope.row.processDefinition">
|
|
||||||
v{{ scope.row.processDefinition.version }}
|
|
||||||
</el-tag>
|
|
||||||
<el-tag v-else type="warning">未部署</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
label="激活状态"
|
|
||||||
align="center"
|
|
||||||
prop="processDefinition.version"
|
|
||||||
width="85"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-switch
|
|
||||||
v-if="scope.row.processDefinition"
|
|
||||||
v-model="scope.row.processDefinition.suspensionState"
|
|
||||||
:active-value="1"
|
|
||||||
:inactive-value="2"
|
|
||||||
@change="handleChangeState(scope.row)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="部署时间" align="center" prop="deploymentTime" width="180">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.processDefinition">
|
<span v-if="scope.row.processDefinition">
|
||||||
{{ formatDate(scope.row.processDefinition.deploymentTime) }}
|
{{ formatDate(scope.row.processDefinition.deploymentTime) }}
|
||||||
</span>
|
</span>
|
||||||
|
<el-tag v-if="scope.row.processDefinition" class="ml-10px">
|
||||||
|
v{{ scope.row.processDefinition.version }}
|
||||||
|
</el-tag>
|
||||||
|
<el-tag v-else type="warning">未部署</el-tag>
|
||||||
|
<el-tag
|
||||||
|
v-if="scope.row.processDefinition.suspensionState === 2"
|
||||||
|
type="warning"
|
||||||
|
class="ml-10px"
|
||||||
|
>
|
||||||
|
已停用
|
||||||
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column label="操作" align="center" width="200" fixed="right">
|
||||||
<el-table-column label="操作" align="center" width="250" fixed="right">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
|
@ -159,6 +136,7 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
|
class="!ml-5px"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleDesign(scope.row)"
|
@click="handleDesign(scope.row)"
|
||||||
v-hasPermi="['bpm:model:update']"
|
v-hasPermi="['bpm:model:update']"
|
||||||
|
@ -167,28 +145,43 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
|
class="!ml-5px"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleDeploy(scope.row)"
|
@click="handleDeploy(scope.row)"
|
||||||
v-hasPermi="['bpm:model:deploy']"
|
v-hasPermi="['bpm:model:deploy']"
|
||||||
>
|
>
|
||||||
发布
|
发布
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-dropdown
|
||||||
link
|
class="!align-middle ml-5px"
|
||||||
type="primary"
|
@command="(command) => handleCommand(command, scope.row)"
|
||||||
v-hasPermi="['bpm:process-definition:query']"
|
v-hasPermi="['bpm:process-definition:query', 'bpm:model:update', 'bpm:model:delete']"
|
||||||
@click="handleDefinitionList(scope.row)"
|
>
|
||||||
|
<el-button type="primary" link>更多</el-button>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item
|
||||||
|
command="handleDefinitionList"
|
||||||
|
v-if="checkPermi(['bpm:process-definition:query'])"
|
||||||
>
|
>
|
||||||
历史
|
历史
|
||||||
</el-button>
|
</el-dropdown-item>
|
||||||
<el-button
|
<el-dropdown-item
|
||||||
link
|
command="handleChangeState"
|
||||||
|
v-if="checkPermi(['bpm:model:update'])"
|
||||||
|
>
|
||||||
|
{{ scope.row.processDefinition.suspensionState === 1 ? '停用' : '启用' }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope.row.id)"
|
command="handleDelete"
|
||||||
v-hasPermi="['bpm:model:delete']"
|
v-if="checkPermi(['bpm:model:delete'])"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -208,28 +201,17 @@
|
||||||
<Dialog title="表单详情" v-model="formDetailVisible" width="800">
|
<Dialog title="表单详情" v-model="formDetailVisible" width="800">
|
||||||
<form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" />
|
<form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" />
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
<!-- 弹窗:流程模型图的预览 -->
|
|
||||||
<Dialog title="流程图" v-model="bpmnDetailVisible" width="800">
|
|
||||||
<MyProcessViewer
|
|
||||||
key="designer"
|
|
||||||
v-model="bpmnXML"
|
|
||||||
:value="bpmnXML as any"
|
|
||||||
v-bind="bpmnControlForm"
|
|
||||||
:prefix="bpmnControlForm.prefix"
|
|
||||||
/>
|
|
||||||
</Dialog>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { dateFormatter, formatDate } from '@/utils/formatTime'
|
import { formatDate } from '@/utils/formatTime'
|
||||||
import { MyProcessViewer } from '@/components/bpmnProcessDesigner/package'
|
|
||||||
import * as ModelApi from '@/api/bpm/model'
|
import * as ModelApi from '@/api/bpm/model'
|
||||||
import * as FormApi from '@/api/bpm/form'
|
import * as FormApi from '@/api/bpm/form'
|
||||||
import ModelForm from './ModelForm.vue'
|
import ModelForm from './ModelForm.vue'
|
||||||
import { setConfAndFields2 } from '@/utils/formCreate'
|
import { setConfAndFields2 } from '@/utils/formCreate'
|
||||||
import { CategoryApi } from '@/api/bpm/category'
|
import { CategoryApi } from '@/api/bpm/category'
|
||||||
import { BpmModelType } from '@/utils/constants'
|
import { BpmModelType } from '@/utils/constants'
|
||||||
|
import { checkPermi } from '@/utils/permission'
|
||||||
|
|
||||||
defineOptions({ name: 'BpmModel' })
|
defineOptions({ name: 'BpmModel' })
|
||||||
|
|
||||||
|
@ -274,6 +256,23 @@ const resetQuery = () => {
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** '更多'操作按钮 */
|
||||||
|
const handleCommand = (command: string, row: any) => {
|
||||||
|
switch (command) {
|
||||||
|
case 'handleDefinitionList':
|
||||||
|
handleDefinitionList(row)
|
||||||
|
break
|
||||||
|
case 'handleDelete':
|
||||||
|
handleDelete(row)
|
||||||
|
break
|
||||||
|
case 'handleChangeState':
|
||||||
|
handleChangeState(row)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
/** 添加/修改操作 */
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const openForm = (type: string, id?: number) => {
|
const openForm = (type: string, id?: number) => {
|
||||||
|
@ -281,12 +280,12 @@ const openForm = (type: string, id?: number) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (id: number) => {
|
const handleDelete = async (row: any) => {
|
||||||
try {
|
try {
|
||||||
// 删除的二次确认
|
// 删除的二次确认
|
||||||
await message.delConfirm()
|
await message.delConfirm()
|
||||||
// 发起删除
|
// 发起删除
|
||||||
await ModelApi.deleteModel(id)
|
await ModelApi.deleteModel(row.id)
|
||||||
message.success(t('common.delSuccess'))
|
message.success(t('common.delSuccess'))
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
await getList()
|
await getList()
|
||||||
|
@ -294,22 +293,22 @@ const handleDelete = async (id: number) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 更新状态操作 */
|
/** 更新状态操作 */
|
||||||
const handleChangeState = async (row) => {
|
const handleChangeState = async (row: any) => {
|
||||||
const state = row.processDefinition.suspensionState
|
const state = row.processDefinition.suspensionState
|
||||||
|
const newState = state === 1 ? 2 : 1
|
||||||
try {
|
try {
|
||||||
// 修改状态的二次确认
|
// 修改状态的二次确认
|
||||||
const id = row.id
|
const id = row.id
|
||||||
const statusState = state === 1 ? '激活' : '挂起'
|
debugger
|
||||||
|
const statusState = state === 1 ? '停用' : '启用'
|
||||||
const content = '是否确认' + statusState + '流程名字为"' + row.name + '"的数据项?'
|
const content = '是否确认' + statusState + '流程名字为"' + row.name + '"的数据项?'
|
||||||
await message.confirm(content)
|
await message.confirm(content)
|
||||||
// 发起修改状态
|
// 发起修改状态
|
||||||
await ModelApi.updateModelState(id, state)
|
await ModelApi.updateModelState(id, newState)
|
||||||
|
message.success(statusState + '成功')
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
await getList()
|
await getList()
|
||||||
} catch {
|
} catch {}
|
||||||
// 取消后,进行恢复按钮
|
|
||||||
row.processDefinition.suspensionState = state === 1 ? 2 : 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 设计流程 */
|
/** 设计流程 */
|
||||||
|
@ -374,18 +373,6 @@ const handleFormDetail = async (row) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 流程图的详情按钮操作 */
|
|
||||||
const bpmnDetailVisible = ref(false)
|
|
||||||
const bpmnXML = ref(null)
|
|
||||||
const bpmnControlForm = ref({
|
|
||||||
prefix: 'flowable'
|
|
||||||
})
|
|
||||||
const handleBpmnDetail = async (row) => {
|
|
||||||
const data = await ModelApi.getModel(row.id)
|
|
||||||
bpmnXML.value = data.bpmnXml || ''
|
|
||||||
bpmnDetailVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getList()
|
await getList()
|
||||||
|
|
Loading…
Reference in New Issue