update 优化工作流代码

This commit is contained in:
LiuHao 2024-01-15 12:02:21 +08:00
parent 2fc243c97a
commit f3f8d4a293
12 changed files with 325 additions and 239 deletions

View File

@ -2,7 +2,7 @@ export interface CategoryVO {
/** /**
* *
*/ */
id: string | number; id: string;
/** /**
* *

View File

@ -1,13 +1,14 @@
import request from '@/utils/request'; import request from '@/utils/request';
import { ProcessDefinitionQuery, ProcessDefinitionVO, ProcessDefinitionXmlVO } from '@/api/workflow/processDefinition/types';
import { AxiosPromise } from 'axios';
const baseUrl = import.meta.env.VITE_APP_BASE_API; const baseUrl = import.meta.env.VITE_APP_BASE_API;
import { getToken } from '@/utils/auth';
/** /**
* *
* @param processInstanceId id * @param query id
* @returns * @returns
*/ */
export const listProcessDefinition = (query: object) => { export const listProcessDefinition = (query: ProcessDefinitionQuery): AxiosPromise<ProcessDefinitionVO[]> => {
return request({ return request({
url: `/workflow/processDefinition/list`, url: `/workflow/processDefinition/list`,
method: 'get', method: 'get',
@ -29,7 +30,7 @@ export const getProcessDefinitionListByKey = (key: string) => {
/** /**
* id获取流程图 * id获取流程图
*/ */
export const processDefinitionImage = (processDefinitionId: string) => { export const processDefinitionImage = (processDefinitionId: string): AxiosPromise<any> => {
return request({ return request({
url: `/workflow/processDefinition/processDefinitionImage/${processDefinitionId}` + '?t' + Math.random(), url: `/workflow/processDefinition/processDefinitionImage/${processDefinitionId}` + '?t' + Math.random(),
method: 'get' method: 'get'
@ -41,7 +42,7 @@ export const processDefinitionImage = (processDefinitionId: string) => {
* @param processDefinitionId id * @param processDefinitionId id
* @returns * @returns
*/ */
export const processDefinitionXml = (processDefinitionId: string) => { export const processDefinitionXml = (processDefinitionId: string): AxiosPromise<ProcessDefinitionXmlVO> => {
return request({ return request({
url: `/workflow/processDefinition/processDefinitionXml/${processDefinitionId}`, url: `/workflow/processDefinition/processDefinitionXml/${processDefinitionId}`,
method: 'get' method: 'get'

View File

@ -0,0 +1,22 @@
export interface ProcessDefinitionQuery extends PageQuery {
key?: string;
name?: string;
categoryCode?: string;
}
export interface ProcessDefinitionVO extends BaseEntity {
id: string;
name: string;
key: string;
version: number;
suspensionState: number;
resourceName: string;
diagramResourceName: string;
deploymentId: string;
deploymentTime: string;
}
export interface ProcessDefinitionXmlVO {
xml: string[];
xmlStr: string;
}

View File

@ -1,13 +1,15 @@
import request from '@/utils/request'; import request from '@/utils/request';
import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types';
import { AxiosPromise } from 'axios';
import { string } from 'vue-types';
const baseUrl = import.meta.env.VITE_APP_BASE_API; const baseUrl = import.meta.env.VITE_APP_BASE_API;
import { getToken } from '@/utils/auth';
/** /**
* *
* @param query * @param query
* @returns {*} * @returns {*}
*/ */
export const getProcessInstanceRunningByPage = (query: object) => { export const getProcessInstanceRunningByPage = (query: ProcessInstanceQuery): AxiosPromise<ProcessInstanceVO[]> => {
return request({ return request({
url: '/workflow/processInstance/getProcessInstanceRunningByPage', url: '/workflow/processInstance/getProcessInstanceRunningByPage',
method: 'get', method: 'get',
@ -20,7 +22,7 @@ export const getProcessInstanceRunningByPage = (query: object) => {
* @param query * @param query
* @returns {*} * @returns {*}
*/ */
export const getProcessInstanceFinishByPage = (query: object) => { export const getProcessInstanceFinishByPage = (query: ProcessInstanceQuery): AxiosPromise<ProcessInstanceVO[]> => {
return request({ return request({
url: '/workflow/processInstance/getProcessInstanceFinishByPage', url: '/workflow/processInstance/getProcessInstanceFinishByPage',
method: 'get', method: 'get',
@ -68,7 +70,7 @@ export const deleteRuntimeProcessInst = (data: object) => {
* @param processInstanceId id * @param processInstanceId id
* @returns * @returns
*/ */
export const deleteRuntimeProcessAndHisInst = (processInstanceId: string) => { export const deleteRuntimeProcessAndHisInst = (processInstanceId: string | string[]) => {
return request({ return request({
url: `/workflow/processInstance/deleteRuntimeProcessAndHisInst/${processInstanceId}`, url: `/workflow/processInstance/deleteRuntimeProcessAndHisInst/${processInstanceId}`,
method: 'delete' method: 'delete'
@ -80,7 +82,7 @@ export const deleteRuntimeProcessAndHisInst = (processInstanceId: string) => {
* @param processInstanceId id * @param processInstanceId id
* @returns * @returns
*/ */
export const deleteFinishProcessAndHisInst = (processInstanceId: string) => { export const deleteFinishProcessAndHisInst = (processInstanceId: string | string[]) => {
return request({ return request({
url: `/workflow/processInstance/deleteFinishProcessAndHisInst/${processInstanceId}`, url: `/workflow/processInstance/deleteFinishProcessAndHisInst/${processInstanceId}`,
method: 'delete' method: 'delete'
@ -92,7 +94,7 @@ export const deleteFinishProcessAndHisInst = (processInstanceId: string) => {
* @param query * @param query
* @returns {*} * @returns {*}
*/ */
export const getCurrentSubmitByPage = (query: object) => { export const getCurrentSubmitByPage = (query: ProcessInstanceQuery): AxiosPromise<ProcessInstanceVO[]> => {
return request({ return request({
url: '/workflow/processInstance/getCurrentSubmitByPage', url: '/workflow/processInstance/getCurrentSubmitByPage',
method: 'get', method: 'get',

View File

@ -0,0 +1,27 @@
import { TaskVO } from '@/api/workflow/task/types';
export interface ProcessInstanceQuery extends PageQuery {
categoryCode?: string;
name?: string;
key?: string;
startUserId?: string;
businessKey?: string;
}
export interface ProcessInstanceVO extends BaseEntity {
id: string;
processDefinitionId: string;
processDefinitionName: string;
processDefinitionKey: string;
processDefinitionVersion: string;
deploymentId: string;
businessKey: string;
isSuspended?: any;
tenantId: string;
startTime: string;
endTime?: string;
startUserId: string;
businessStatus: string;
businessStatusName: string;
taskVoList: TaskVO[];
}

View File

@ -32,7 +32,7 @@ export const getTaskFinishByPage = (query: TaskQuery): AxiosPromise<TaskVO[]> =>
* @param query * @param query
* @returns {*} * @returns {*}
*/ */
export const getAllTaskWaitByPage = (query: object) => { export const getAllTaskWaitByPage = (query: TaskQuery): AxiosPromise<TaskVO[]> => {
return request({ return request({
url: '/workflow/task/getAllTaskWaitByPage', url: '/workflow/task/getAllTaskWaitByPage',
method: 'get', method: 'get',
@ -45,7 +45,7 @@ export const getAllTaskWaitByPage = (query: object) => {
* @param query * @param query
* @returns {*} * @returns {*}
*/ */
export const getAllTaskFinishByPage = (query: object) => { export const getAllTaskFinishByPage = (query: TaskQuery): AxiosPromise<TaskVO[]> => {
return request({ return request({
url: '/workflow/task/getAllTaskFinishByPage', url: '/workflow/task/getAllTaskFinishByPage',
method: 'get', method: 'get',

View File

@ -1,7 +1,7 @@
export interface TaskQuery extends PageQuery { export interface TaskQuery extends PageQuery {
name: string; name?: string;
processDefinitionKey: string; processDefinitionKey?: string;
processDefinitionName: string; processDefinitionName?: string;
} }
export interface ParticipantVo { export interface ParticipantVo {

View File

@ -4,10 +4,10 @@
<!-- 流程分类树 --> <!-- 流程分类树 -->
<el-col :lg="4" :xs="24" style=""> <el-col :lg="4" :xs="24" style="">
<el-card shadow="hover"> <el-card shadow="hover">
<el-input placeholder="请输入流程分类名" v-model="categoryName" prefix-icon="Search" clearable /> <el-input v-model="categoryName" placeholder="请输入流程分类名" prefix-icon="Search" clearable />
<el-tree <el-tree
class="mt-2"
ref="categoryTreeRef" ref="categoryTreeRef"
class="mt-2"
node-key="id" node-key="id"
:data="categoryOptions" :data="categoryOptions"
:props="{ label: 'categoryName', children: 'children' }" :props="{ label: 'categoryName', children: 'children' }"
@ -21,9 +21,9 @@
</el-col> </el-col>
<el-col :lg="20" :xs="24"> <el-col :lg="20" :xs="24">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div class="mb-[10px]" v-show="showSearch"> <div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
<el-form :model="queryParams" ref="queryFormRef" :inline="true" v-show="showSearch" label-width="120px"> <el-form v-show="showSearch" ref="queryFormRef" :model="queryParams" :inline="true" label-width="120px">
<el-form-item label="流程定义名称" prop="name"> <el-form-item label="流程定义名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入流程定义名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.name" placeholder="请输入流程定义名称" clearable @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
@ -39,7 +39,7 @@
</div> </div>
</transition> </transition>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div class="mb-[10px]" v-show="showSearch"> <div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
<el-button type="primary" icon="UploadFilled" @click="uploadDialog.visible = true">部署流程文件</el-button> <el-button type="primary" icon="UploadFilled" @click="uploadDialog.visible = true">部署流程文件</el-button>
</el-card> </el-card>
@ -49,7 +49,7 @@
<template #header> <template #header>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> </el-col> <el-col :span="1.5"> </el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
</el-row> </el-row>
</template> </template>
@ -68,14 +68,13 @@
</el-table-column> </el-table-column>
<el-table-column align="center" prop="diagramResourceName" label="流程图片" min-width="80" :show-overflow-tooltip="true"> <el-table-column align="center" prop="diagramResourceName" label="流程图片" min-width="80" :show-overflow-tooltip="true">
<template #default="scope"> <template #default="scope">
<el-link type="primary" @click="clickPreviewImg(scope.row.id)">{{ scope.row.diagramResourceName <el-link type="primary" @click="clickPreviewImg(scope.row.id)">{{ scope.row.diagramResourceName }}</el-link>
}}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="suspensionState" label="状态" min-width="70"> <el-table-column align="center" prop="suspensionState" label="状态" min-width="70">
<template #default="scope"> <template #default="scope">
<el-tag type="success" v-if="scope.row.suspensionState == 1">激活</el-tag> <el-tag v-if="scope.row.suspensionState == 1" type="success">激活</el-tag>
<el-tag type="danger" v-else>挂起</el-tag> <el-tag v-else type="danger">挂起</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="deploymentTime" label="部署时间" :show-overflow-tooltip="true"></el-table-column> <el-table-column align="center" prop="deploymentTime" label="部署时间" :show-overflow-tooltip="true"></el-table-column>
@ -83,8 +82,14 @@
<template #default="scope"> <template #default="scope">
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button link type="primary" size="small" :icon="scope.row.suspensionState === 1 ? 'Lock' : 'Unlock'" @click="handleProcessDefState(scope.row)"> <el-button
{{ scope.row.suspensionState === 1 ? "挂起流程" : "激活流程" }} link
type="primary"
size="small"
:icon="scope.row.suspensionState === 1 ? 'Lock' : 'Unlock'"
@click="handleProcessDefState(scope.row)"
>
{{ scope.row.suspensionState === 1 ? '挂起流程' : '激活流程' }}
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -96,13 +101,21 @@
<el-button link type="primary" size="small" icon="Sort" @click="handleConvertToModel(scope.row)"> 转换模型 </el-button> <el-button link type="primary" size="small" icon="Sort" @click="handleConvertToModel(scope.row)"> 转换模型 </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button link type="primary" size="small" icon="Document" @click="getProcessDefinitionHitoryList(scope.row.id, scope.row.key)"> 历史版本 </el-button> <el-button link type="primary" size="small" icon="Document" @click="getProcessDefinitionHitoryList(scope.row.id, scope.row.key)">
历史版本
</el-button>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> <pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
@ -141,8 +154,8 @@
</el-table-column> </el-table-column>
<el-table-column align="center" prop="suspensionState" label="状态" min-width="70"> <el-table-column align="center" prop="suspensionState" label="状态" min-width="70">
<template #default="scope"> <template #default="scope">
<el-tag type="success" v-if="scope.row.suspensionState == 1">激活</el-tag> <el-tag v-if="scope.row.suspensionState == 1" type="success">激活</el-tag>
<el-tag type="danger" v-else>挂起</el-tag> <el-tag v-else type="danger">挂起</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="deploymentTime" label="部署时间" :show-overflow-tooltip="true"></el-table-column> <el-table-column align="center" prop="deploymentTime" label="部署时间" :show-overflow-tooltip="true"></el-table-column>
@ -150,8 +163,14 @@
<template #default="scope"> <template #default="scope">
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button link type="primary" size="small" :icon="scope.row.suspensionState === 1 ? 'Lock' : 'Unlock'" @click="handleProcessDefState(scope.row)"> <el-button
{{ scope.row.suspensionState === 1 ? "挂起流程" : "激活流程" }} link
type="primary"
size="small"
:icon="scope.row.suspensionState === 1 ? 'Lock' : 'Unlock'"
@click="handleProcessDefState(scope.row)"
>
{{ scope.row.suspensionState === 1 ? '挂起流程' : '激活流程' }}
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -181,16 +200,17 @@ import {
deployProcessFile, deployProcessFile,
getProcessDefinitionListByKey getProcessDefinitionListByKey
} from '@/api/workflow/processDefinition'; } from '@/api/workflow/processDefinition';
import { ComponentInternalInstance } from 'vue';
import ProcessPreview from './components/processPreview.vue'; import ProcessPreview from './components/processPreview.vue';
import { listCategory } from '@/api/workflow/category'; import { listCategory } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types'; import { CategoryVO } from '@/api/workflow/category/types';
import { ElTree } from 'element-plus'; import { ProcessDefinitionQuery, ProcessDefinitionVO } from '@/api/workflow/processDefinition/types';
import { UploadRequestOptions } from 'element-plus';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const previewRef = ref<InstanceType<typeof ProcessPreview>>(); const previewRef = ref<InstanceType<typeof ProcessPreview>>();
const queryFormRef = ref(ElForm); const queryFormRef = ref<ElFormInstance>();
const categoryTreeRef = ref<ElTreeInstance>();
type CategoryOption = { type CategoryOption = {
categoryCode: string; categoryCode: string;
@ -204,12 +224,11 @@ const single = ref(true);
const multiple = ref(true); const multiple = ref(true);
const showSearch = ref(true); const showSearch = ref(true);
const total = ref(0); const total = ref(0);
const processDefinitionList = ref<Array<any>>([]); const processDefinitionList = ref<ProcessDefinitionVO[]>([]);
const processDefinitionHistoryList = ref<Array<any>>([]); const processDefinitionHistoryList = ref<ProcessDefinitionVO[]>([]);
const url = ref<Array<string>>([]); const url = ref<string[]>([]);
const categoryOptions = ref<CategoryOption[]>([]); const categoryOptions = ref<CategoryOption[]>([]);
const categoryName = ref(''); const categoryName = ref('');
const categoryTreeRef = ref(ElTree);
const uploadDialog = reactive<DialogOption>({ const uploadDialog = reactive<DialogOption>({
visible: false, visible: false,
@ -222,7 +241,7 @@ const processDefinitionDialog = reactive<DialogOption>({
}); });
// //
const queryParams = ref<Record<string, any>>({ const queryParams = ref<ProcessDefinitionQuery>({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: undefined, name: undefined,
@ -274,7 +293,7 @@ const handleQuery = () => {
}; };
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryFormRef.value.resetFields(); queryFormRef.value?.resetFields();
queryParams.value.categoryCode = ''; queryParams.value.categoryCode = '';
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
queryParams.value.pageSize = 10; queryParams.value.pageSize = 10;
@ -287,62 +306,58 @@ const handleSelectionChange = (selection: any) => {
multiple.value = !selection.length; multiple.value = !selection.length;
}; };
// //
const getList = () => { const getList = async () => {
loading.value = true; loading.value = true;
listProcessDefinition(queryParams.value).then((resp) => { const resp = await listProcessDefinition(queryParams.value);
processDefinitionList.value = resp.rows; processDefinitionList.value = resp.rows;
total.value = resp.total; total.value = resp.total;
loading.value = false; loading.value = false;
});
}; };
// //
const getProcessDefinitionHitoryList = (id: string, key: string) => { const getProcessDefinitionHitoryList = async (id: string, key: string) => {
processDefinitionDialog.visible = true processDefinitionDialog.visible = true;
loading.value = true; loading.value = true;
getProcessDefinitionListByKey(key).then((resp) => { const resp = await getProcessDefinitionListByKey(key);
if (resp.data && resp.data.length > 0) { if (resp.data && resp.data.length > 0) {
processDefinitionHistoryList.value = resp.data.filter((item: any) => item.id !== id); processDefinitionHistoryList.value = resp.data.filter((item: any) => item.id !== id);
} }
loading.value = false; loading.value = false;
});
}; };
// //
const clickPreviewImg = (id: string) => { const clickPreviewImg = async (id: string) => {
loading.value = true; loading.value = true;
processDefinitionImage(id).then((resp) => { const resp = await processDefinitionImage(id);
if (previewRef.value) { console.log(resp);
url.value = []; if (previewRef.value) {
url.value.push('data:image/png;base64,' + resp.data); url.value = [];
loading.value = false; url.value.push('data:image/png;base64,' + resp.data);
previewRef.value.openDialog(url.value, 'png'); loading.value = false;
} previewRef.value.openDialog(url.value, 'png');
}) }
}; };
//xml //xml
const clickPreviewXML = (id: string) => { const clickPreviewXML = async (id: string) => {
loading.value = true; loading.value = true;
processDefinitionXml(id).then((response) => { const resp = await processDefinitionXml(id);
if (previewRef.value) { if (previewRef.value) {
url.value = []; url.value = [];
url.value = response.data.xml; url.value = resp.data.xml;
loading.value = false; loading.value = false;
previewRef.value.openDialog(url.value, 'xml'); previewRef.value.openDialog(url.value, 'xml');
} }
});
}; };
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (row: any) => { const handleDelete = async (row: ProcessDefinitionVO) => {
await proxy?.$modal.confirm('是否确认删除流程定义key为【' + row.key + '】的数据项?'); await proxy?.$modal.confirm('是否确认删除流程定义key为【' + row.key + '】的数据项?');
loading.value = true; loading.value = true;
await deleteProcessDefinition(row.deploymentId, row.id).finally(() => (loading.value = false)); await deleteProcessDefinition(row.deploymentId, row.id).finally(() => (loading.value = false));
getList(); await getList();
proxy?.$modal.msgSuccess('删除成功'); proxy?.$modal.msgSuccess('删除成功');
}; };
/** 挂起/激活 */ /** 挂起/激活 */
const handleProcessDefState = async (row: any) => { const handleProcessDefState = async (row: ProcessDefinitionVO) => {
let msg = ''; let msg: string;
if (row.suspensionState === 1) { if (row.suspensionState === 1) {
msg = `暂停后,此流程下的所有任务都不允许往后流转,您确定挂起【${row.name || row.key}】吗?`; msg = `暂停后,此流程下的所有任务都不允许往后流转,您确定挂起【${row.name || row.key}】吗?`;
} else { } else {
@ -351,11 +366,11 @@ const handleProcessDefState = async (row: any) => {
await proxy?.$modal.confirm(msg); await proxy?.$modal.confirm(msg);
loading.value = true; loading.value = true;
await updateProcessDefState(row.id).finally(() => (loading.value = false)); await updateProcessDefState(row.id).finally(() => (loading.value = false));
getList(); await getList();
proxy?.$modal.msgSuccess('操作成功'); proxy?.$modal.msgSuccess('操作成功');
}; };
/** 流程定义转换为模型 */ /** 流程定义转换为模型 */
const handleConvertToModel = async (row: any) => { const handleConvertToModel = async (row: ProcessDefinitionVO) => {
await proxy?.$modal.confirm('是否确认转换流程定义key为【' + row.key + '】的数据项?'); await proxy?.$modal.confirm('是否确认转换流程定义key为【' + row.key + '】的数据项?');
await convertToModel(row.id).finally(() => (loading.value = false)); await convertToModel(row.id).finally(() => (loading.value = false));
getList(); getList();
@ -363,21 +378,22 @@ const handleConvertToModel = async (row: any) => {
}; };
// //
const handerDeployProcessFile = async (data: any) => { const handerDeployProcessFile = (data: UploadRequestOptions): XMLHttpRequest => {
let formData = new FormData(); let formData = new FormData();
if (queryParams.value.categoryCode === 'ALL') { if (queryParams.value.categoryCode === 'ALL') {
proxy?.$modal.msgError('顶级节点不可作为分类!'); proxy?.$modal.msgError('顶级节点不可作为分类!');
return false; return;
} }
if (!queryParams.value.categoryCode) { if (!queryParams.value.categoryCode) {
proxy?.$modal.msgError('请选择左侧要上传的分类!'); proxy?.$modal.msgError('请选择左侧要上传的分类!');
return false; return;
} }
formData.append('file', data.file); formData.append('file', data.file);
formData.append('categoryCode', queryParams.value.categoryCode); formData.append('categoryCode', queryParams.value.categoryCode);
await deployProcessFile(formData); deployProcessFile(formData).then(() => {
uploadDialog.visible = false; uploadDialog.visible = false;
proxy?.$modal.msgSuccess('部署成功'); proxy?.$modal.msgSuccess('部署成功');
handleQuery(); handleQuery();
});
}; };
</script> </script>

View File

@ -4,10 +4,10 @@
<!-- 流程分类树 --> <!-- 流程分类树 -->
<el-col :lg="4" :xs="24" style=""> <el-col :lg="4" :xs="24" style="">
<el-card shadow="hover"> <el-card shadow="hover">
<el-input placeholder="请输入流程分类名" v-model="categoryName" prefix-icon="Search" clearable /> <el-input v-model="categoryName" placeholder="请输入流程分类名" prefix-icon="Search" clearable />
<el-tree <el-tree
class="mt-2"
ref="categoryTreeRef" ref="categoryTreeRef"
class="mt-2"
node-key="id" node-key="id"
:data="categoryOptions" :data="categoryOptions"
:props="{ label: 'categoryName', children: 'children' }" :props="{ label: 'categoryName', children: 'children' }"
@ -20,27 +20,23 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="20" :xs="24"> <el-col :lg="20" :xs="24">
<div class="mb-[10px]">
<el-card shadow="hover" class="text-center">
<el-radio-group v-model="tab" @change="changeTab(tab)">
<el-radio-button label="running">运行中</el-radio-button>
<el-radio-button label="finish">已完成</el-radio-button>
</el-radio-group>
</el-card>
</div>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div class="mb-[10px]"> <div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
<center> <el-form v-show="showSearch" ref="queryFormRef" :model="queryParams" :inline="true" label-width="120px">
<el-radio-group v-model="tab" @change="changeTab(tab)">
<el-radio-button label="running">运行中</el-radio-button>
<el-radio-button label="finish">已完成</el-radio-button>
</el-radio-group>
</center>
</el-card>
</div>
</transition>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div class="mb-[10px]" v-show="showSearch">
<el-card shadow="hover">
<el-form :model="queryParams" ref="queryFormRef" :inline="true" v-show="showSearch" label-width="120px">
<el-form-item label="流程定义名称" prop="name"> <el-form-item label="流程定义名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入流程定义名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.name" placeholder="请输入流程定义名称" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="流程定义KEY" prop="name"> <el-form-item label="流程定义KEY" prop="key">
<el-input v-model="queryParams.key" placeholder="请输入流程定义KEY" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.key" placeholder="请输入流程定义KEY" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
@ -56,23 +52,23 @@
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button> <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
</el-col> </el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="handleQuery"></right-toolbar> <right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
</el-row> </el-row>
</template> </template>
<el-table v-loading="loading" :data="processInstanceList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="processInstanceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column fixed align="center" type="index" label="序号" width="50"></el-table-column> <el-table-column fixed align="center" type="index" label="序号" width="50"></el-table-column>
<el-table-column fixed align="center" prop="id" label="id" v-if="false"></el-table-column> <el-table-column v-if="false" fixed align="center" prop="id" label="id"></el-table-column>
<el-table-column fixed align="center" prop="processDefinitionName" label="流程定义名称"></el-table-column> <el-table-column fixed align="center" prop="processDefinitionName" label="流程定义名称"></el-table-column>
<el-table-column fixed align="center" prop="processDefinitionKey" label="流程定义KEY"></el-table-column> <el-table-column fixed align="center" prop="processDefinitionKey" label="流程定义KEY"></el-table-column>
<el-table-column align="center" prop="processDefinitionVersion" label="版本号" width="90"> <el-table-column align="center" prop="processDefinitionVersion" label="版本号" width="90">
<template #default="scope"> v{{ scope.row.processDefinitionVersion }}.0</template> <template #default="scope"> v{{ scope.row.processDefinitionVersion }}.0</template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="isSuspended" label="状态" min-width="70" v-if="tab === 'running'"> <el-table-column v-if="tab === 'running'" align="center" prop="isSuspended" label="状态" min-width="70">
<template #default="scope"> <template #default="scope">
<el-tag type="success" v-if="!scope.row.isSuspended">激活</el-tag> <el-tag v-if="!scope.row.isSuspended" type="success">激活</el-tag>
<el-tag type="danger" v-else>挂起</el-tag> <el-tag v-else type="danger">挂起</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="businessStatusName" label="流程状态" min-width="70"> <el-table-column align="center" prop="businessStatusName" label="流程状态" min-width="70">
@ -81,30 +77,37 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="startTime" label="启动时间" width="160"></el-table-column> <el-table-column align="center" prop="startTime" label="启动时间" width="160"></el-table-column>
<el-table-column align="center" v-if="tab === 'finish'" prop="endTime" label="结束时间" width="160"></el-table-column> <el-table-column v-if="tab === 'finish'" align="center" prop="endTime" label="结束时间" width="160"></el-table-column>
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="text" size="small" icon="Document" @click="handleApprovalRecord(scope.row)">审批记录</el-button> <el-button link type="primary" size="small" icon="Document" @click="handleApprovalRecord(scope.row)">审批记录</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="text" size="small" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> <el-button link type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="10" class="mb8" v-if="tab === 'running'"> <el-row v-if="tab === 'running'" :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="text" size="small" icon="Sort" @click="getProcessDefinitionHitoryList(scope.row.processDefinitionId, scope.row.processDefinitionKey)">切换版本</el-button> <el-button
link
type="primary"
size="small"
icon="Sort"
@click="getProcessDefinitionHitoryList(scope.row.processDefinitionId, scope.row.processDefinitionKey)"
>切换版本</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-popover trigger="click" :ref="`popoverRef${scope.$index}`" placement="left" :width="300"> <el-popover :ref="`popoverRef${scope.$index}`" trigger="click" placement="left" :width="300">
<el-input resize="none" v-model="deleteReason" :rows="3" type="textarea" placeholder="请输入作废原因" /> <el-input v-model="deleteReason" resize="none" :rows="3" type="textarea" placeholder="请输入作废原因" />
<div style="text-align: right; margin: 5px 0px 0px 0px"> <div style="text-align: right; margin: 5px 0px 0px 0px">
<el-button size="small" text @click="cancelPopover(scope.$index)">取消</el-button> <el-button size="small" text @click="cancelPopover(scope.$index)">取消</el-button>
<el-button size="small" type="primary" @click="handleInvalid(scope.row)">确认</el-button> <el-button size="small" type="primary" @click="handleInvalid(scope.row)">确认</el-button>
</div> </div>
<template #reference> <template #reference>
<el-button type="text" size="small" icon="CircleClose">作废</el-button> <el-button link type="primary" size="small" icon="CircleClose">作废</el-button>
</template> </template>
</el-popover> </el-popover>
</el-col> </el-col>
@ -112,7 +115,13 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="handleQuery" /> <pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="handleQuery"
/>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
@ -126,8 +135,8 @@
</el-table-column> </el-table-column>
<el-table-column align="center" prop="suspensionState" label="状态" min-width="70"> <el-table-column align="center" prop="suspensionState" label="状态" min-width="70">
<template #default="scope"> <template #default="scope">
<el-tag type="success" v-if="scope.row.suspensionState == 1">激活</el-tag> <el-tag v-if="scope.row.suspensionState == 1" type="success">激活</el-tag>
<el-tag type="danger" v-else>挂起</el-tag> <el-tag v-else type="danger">挂起</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="deploymentTime" label="部署时间" :show-overflow-tooltip="true"></el-table-column> <el-table-column align="center" prop="deploymentTime" label="部署时间" :show-overflow-tooltip="true"></el-table-column>
@ -151,20 +160,16 @@ import {
deleteFinishProcessAndHisInst, deleteFinishProcessAndHisInst,
deleteRuntimeProcessInst deleteRuntimeProcessInst
} from '@/api/workflow/processInstance'; } from '@/api/workflow/processInstance';
import { import { getProcessDefinitionListByKey, migrationProcessDefinition } from '@/api/workflow/processDefinition';
getProcessDefinitionListByKey,
migrationProcessDefinition
} from '@/api/workflow/processDefinition';
import { ComponentInternalInstance } from 'vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue'; import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import { listCategory } from "@/api/workflow/category"; import { listCategory } from '@/api/workflow/category';
import { ElTree } from 'element-plus';
import { CategoryVO } from '@/api/workflow/category/types'; import { CategoryVO } from '@/api/workflow/category/types';
import { string } from 'vue-types'; import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types';
// //
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const queryFormRef = ref(ElForm); const queryFormRef = ref<ElFormInstance>();
const categoryTreeRef = ref<ElTreeInstance>();
// //
const loading = ref(true); const loading = ref(true);
@ -181,11 +186,10 @@ const total = ref(0);
// id // id
const processDefinitionId = ref<string>(''); const processDefinitionId = ref<string>('');
// //
const processInstanceList = ref([]); const processInstanceList = ref<ProcessInstanceVO[]>([]);
const processDefinitionHistoryList = ref<Array<any>>([]); const processDefinitionHistoryList = ref<Array<any>>([]);
const categoryOptions = ref<CategoryOption[]>([]); const categoryOptions = ref<CategoryOption[]>([]);
const categoryName = ref(''); const categoryName = ref('');
const categoryTreeRef = ref(ElTree);
const processDefinitionDialog = reactive<DialogOption>({ const processDefinitionDialog = reactive<DialogOption>({
visible: false, visible: false,
@ -196,13 +200,13 @@ type CategoryOption = {
categoryCode: string; categoryCode: string;
categoryName: string; categoryName: string;
children?: CategoryOption[]; children?: CategoryOption[];
} };
const tab = ref('running'); const tab = ref('running');
// //
const deleteReason = ref(''); const deleteReason = ref('');
// //
const queryParams = ref<Record<string, any>>({ const queryParams = ref<ProcessInstanceQuery>({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: undefined, name: undefined,
@ -215,23 +219,24 @@ onMounted(() => {
getTreeselect(); getTreeselect();
}); });
/** 节点单击事件 */ /** 节点单击事件 */
const handleNodeClick = (data: CategoryVO) => { const handleNodeClick = (data: CategoryVO) => {
queryParams.value.categoryCode = data.categoryCode; queryParams.value.categoryCode = data.categoryCode;
if (data.categoryCode === 'ALL') { if (data.categoryCode === 'ALL') {
queryParams.value.categoryCode = '' queryParams.value.categoryCode = '';
} }
handleQuery() handleQuery();
} };
/** 通过条件过滤节点 */ /** 通过条件过滤节点 */
const filterNode = (value: string, data: any) => { const filterNode = (value: string, data: any) => {
if (!value) return true if (!value) return true;
return data.categoryName.indexOf(value) !== -1 return data.categoryName.indexOf(value) !== -1;
} };
/** 根据名称筛选部门树 */ /** 根据名称筛选部门树 */
watchEffect( watchEffect(
() => { categoryTreeRef.value.filter(categoryName.value); }, () => {
categoryTreeRef.value.filter(categoryName.value);
},
{ {
flush: 'post' // watchEffectDOMDOM flush: 'post' // watchEffectDOMDOM
} }
@ -242,9 +247,9 @@ const getTreeselect = async () => {
const res = await listCategory(); const res = await listCategory();
categoryOptions.value = []; categoryOptions.value = [];
const data: CategoryOption = { categoryCode: 'ALL', categoryName: '顶级节点', children: [] }; const data: CategoryOption = { categoryCode: 'ALL', categoryName: '顶级节点', children: [] };
data.children = proxy?.handleTree<CategoryOption>(res.data, "id", "parentId"); data.children = proxy?.handleTree<CategoryOption>(res.data, 'id', 'parentId');
categoryOptions.value.push(data); categoryOptions.value.push(data);
} };
// //
const handleApprovalRecord = (row: any) => { const handleApprovalRecord = (row: any) => {
@ -262,14 +267,14 @@ const handleQuery = () => {
}; };
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryFormRef.value.resetFields(); queryFormRef.value?.resetFields();
queryParams.value.categoryCode = ''; queryParams.value.categoryCode = '';
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
queryParams.value.pageSize = 10; queryParams.value.pageSize = 10;
handleQuery(); handleQuery();
}; };
// //
const handleSelectionChange = (selection: any) => { const handleSelectionChange = (selection: ProcessInstanceVO[]) => {
ids.value = selection.map((item: any) => item.id); ids.value = selection.map((item: any) => item.id);
single.value = selection.length !== 1; single.value = selection.length !== 1;
multiple.value = !selection.length; multiple.value = !selection.length;
@ -316,7 +321,7 @@ const changeTab = async (data: string) => {
} }
}; };
/** 作废按钮操作 */ /** 作废按钮操作 */
const handleInvalid = async (row: any) => { const handleInvalid = async (row: ProcessInstanceVO) => {
await proxy?.$modal.confirm('是否确认作废业务id为【' + row.businessKey + '】的数据项?'); await proxy?.$modal.confirm('是否确认作废业务id为【' + row.businessKey + '】的数据项?');
loading.value = true; loading.value = true;
if ('running' === tab.value) { if ('running' === tab.value) {
@ -334,8 +339,8 @@ const cancelPopover = async (index: any) => {
}; };
// //
const getProcessDefinitionHitoryList = (id: string, key: string) => { const getProcessDefinitionHitoryList = (id: string, key: string) => {
processDefinitionDialog.visible = true processDefinitionDialog.visible = true;
processDefinitionId.value = id processDefinitionId.value = id;
loading.value = true; loading.value = true;
getProcessDefinitionListByKey(key).then((resp) => { getProcessDefinitionListByKey(key).then((resp) => {
if (resp.data && resp.data.length > 0) { if (resp.data && resp.data.length > 0) {
@ -351,7 +356,7 @@ const handleChange = async (id: string) => {
migrationProcessDefinition(processDefinitionId.value, id).then((resp) => { migrationProcessDefinition(processDefinitionId.value, id).then((resp) => {
proxy?.$modal.msgSuccess('操作成功'); proxy?.$modal.msgSuccess('操作成功');
getProcessInstanceRunningList(); getProcessInstanceRunningList();
processDefinitionDialog.visible = false processDefinitionDialog.visible = false;
loading.value = false; loading.value = false;
}); });
}; };

View File

@ -1,29 +1,25 @@
<template> <template>
<div class="p-2"> <div class="p-2">
<div class="mb-[10px]">
<el-card shadow="hover" class="text-center">
<el-radio-group v-model="tab" @change="changeTab(tab)">
<el-radio-button label="waiting">待办任务</el-radio-button>
<el-radio-button label="finish">已办任务</el-radio-button>
</el-radio-group>
</el-card>
</div>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div class="mb-[10px]"> <div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
<center> <el-form v-show="showSearch" ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px">
<el-radio-group v-model="tab" @change="changeTab(tab)">
<el-radio-button label="waiting">待办任务</el-radio-button>
<el-radio-button label="finish">已办任务</el-radio-button>
</el-radio-group>
</center>
</el-card>
</div>
</transition>
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div class="mb-[10px]" v-show="showSearch">
<el-card shadow="hover">
<el-form :model="queryParams" ref="queryFormRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="任务名称" prop="name"> <el-form-item label="任务名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入任务名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.name" placeholder="请输入任务名称" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="流程定义名称" label-width="100" prop="name"> <el-form-item label="流程定义名称" label-width="100" prop="processDefinitionName">
<el-input v-model="queryParams.processDefinitionName" placeholder="请输入流程定义名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.processDefinitionName" placeholder="请输入流程定义名称" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="流程定义KEY" label-width="100" prop="name"> <el-form-item label="流程定义KEY" label-width="100" prop="processDefinitionKey">
<el-input v-model="queryParams.processDefinitionKey" placeholder="请输入流程定义KEY" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.processDefinitionKey" placeholder="请输入流程定义KEY" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
@ -36,7 +32,7 @@
<el-card shadow="hover"> <el-card shadow="hover">
<template #header> <template #header>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<right-toolbar v-model:showSearch="showSearch" @queryTable="handleQuery"></right-toolbar> <right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
</el-row> </el-row>
</template> </template>
@ -47,9 +43,9 @@
<el-table-column fixed align="center" prop="processDefinitionKey" label="流程定义KEY"></el-table-column> <el-table-column fixed align="center" prop="processDefinitionKey" label="流程定义KEY"></el-table-column>
<el-table-column fixed align="center" prop="name" label="任务名称"></el-table-column> <el-table-column fixed align="center" prop="name" label="任务名称"></el-table-column>
<el-table-column fixed align="center" prop="assigneeName" label="办理人"> <el-table-column fixed align="center" prop="assigneeName" label="办理人">
<template #default="scope" v-if="tab === 'waiting'"> <template v-if="tab === 'waiting'" #default="scope">
<template v-if="scope.row.participantVo && scope.row.assignee === null"> <template v-if="scope.row.participantVo && scope.row.assignee === null">
<el-tag type="success" v-for="(item, index) in scope.row.participantVo.candidateName" :key="index"> <el-tag v-for="(item, index) in scope.row.participantVo.candidateName" :key="index" type="success">
{{ item }} {{ item }}
</el-tag> </el-tag>
</template> </template>
@ -59,7 +55,7 @@
</el-tag> </el-tag>
</template> </template>
</template> </template>
<template #default="scope" v-else-if="tab === 'finish'"> <template v-else-if="tab === 'finish'" #default="scope">
<el-tag type="success"> <el-tag type="success">
{{ scope.row.assigneeName }} {{ scope.row.assigneeName }}
</el-tag> </el-tag>
@ -67,8 +63,8 @@
</el-table-column> </el-table-column>
<el-table-column align="center" prop="businessStatusName" label="流程状态" min-width="70"> <el-table-column align="center" prop="businessStatusName" label="流程状态" min-width="70">
<template #default="scope"> <template #default="scope">
<el-tag type="success" v-if="tab === 'waiting'">{{ scope.row.businessStatusName }}</el-tag> <el-tag v-if="tab === 'waiting'" type="success">{{ scope.row.businessStatusName }}</el-tag>
<el-tag type="success" v-else>已完成</el-tag> <el-tag v-else type="success">已完成</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="createTime" label="创建时间" width="160"></el-table-column> <el-table-column align="center" prop="createTime" label="创建时间" width="160"></el-table-column>
@ -76,41 +72,48 @@
<template #default="scope"> <template #default="scope">
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="text" size="small" icon="Document" @click="handleApprovalRecord(scope.row)">审批记录</el-button> <el-button link type="primary" size="small" icon="Document" @click="handleApprovalRecord(scope.row)">审批记录</el-button>
</el-col> </el-col>
<el-col :span="1.5" v-if="scope.row.multiInstance"> <el-col v-if="scope.row.multiInstance" :span="1.5">
<el-button type="text" size="small" icon="CirclePlus" @click="addMultiInstanceUser(scope.row)">加签</el-button> <el-button link type="primary" size="small" icon="CirclePlus" @click="addMultiInstanceUser(scope.row)">加签</el-button>
</el-col> </el-col>
<el-col :span="1.5" v-if="scope.row.multiInstance"> <el-col v-if="scope.row.multiInstance" :span="1.5">
<el-button type="text" size="small" icon="Remove" @click="deleteMultiInstanceUser(scope.row)">减签</el-button> <el-button link type="primary" size="small" icon="Remove" @click="deleteMultiInstanceUser(scope.row)">减签</el-button>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="handleQuery" /> <pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="handleQuery"
/>
</el-card> </el-card>
<!-- 审批记录 --> <!-- 审批记录 -->
<approvalRecord ref="approvalRecordRef" /> <approvalRecord ref="approvalRecordRef" />
<!-- 提交组件 --> <!-- 提交组件 -->
<submitVerify ref="submitVerifyRef" :taskId="taskId" @submitCallback="handleQuery" /> <submitVerify ref="submitVerifyRef" :task-id="taskId" @submit-callback="handleQuery" />
<!-- 加签组件 --> <!-- 加签组件 -->
<multiInstanceUser ref="multiInstanceUserRef" :title="title" @submitCallback="handleQuery" /> <multiInstanceUser ref="multiInstanceUserRef" :title="title" @submit-callback="handleQuery" />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { getAllTaskWaitByPage, getAllTaskFinishByPage } from '@/api/workflow/task'; import { getAllTaskWaitByPage, getAllTaskFinishByPage } from '@/api/workflow/task';
import { ComponentInternalInstance } from 'vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue'; import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import SubmitVerify from '@/components/Process/submitVerify.vue'; import SubmitVerify from '@/components/Process/submitVerify.vue';
import MultiInstanceUser from '@/components/Process/multiInstance-user.vue'; import MultiInstanceUser from '@/components/Process/multiInstance-user.vue';
import { TaskQuery, TaskVO } from '@/api/workflow/task/types';
// //
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
// //
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
// //
const multiInstanceUserRef = ref<InstanceType<typeof MultiInstanceUser>>(); const multiInstanceUserRef = ref<InstanceType<typeof MultiInstanceUser>>();
const queryFormRef = ref<ElFormInstance>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// //
const loading = ref(true); const loading = ref(true);
@ -129,9 +132,8 @@ const taskList = ref([]);
// id // id
const taskId = ref(''); const taskId = ref('');
const title = ref(''); const title = ref('');
const userIdList = ref<Array<any>>([]);
// //
const queryParams = ref<Record<string, any>>({ const queryParams = ref<TaskQuery>({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: undefined, name: undefined,
@ -143,20 +145,20 @@ onMounted(() => {
getWaitingList(); getWaitingList();
}); });
// //
const handleApprovalRecord = (row: any) => { const handleApprovalRecord = (row: TaskVO) => {
if (approvalRecordRef.value) { if (approvalRecordRef.value) {
approvalRecordRef.value.init(row.processInstanceId); approvalRecordRef.value.init(row.processInstanceId);
} }
}; };
// //
const addMultiInstanceUser = (row: any) => { const addMultiInstanceUser = (row: TaskVO) => {
if (multiInstanceUserRef.value) { if (multiInstanceUserRef.value) {
title.value = '加签人员'; title.value = '加签人员';
multiInstanceUserRef.value.getAddMultiInstanceList(row.id, []); multiInstanceUserRef.value.getAddMultiInstanceList(row.id, []);
} }
}; };
// //
const deleteMultiInstanceUser = (row: any) => { const deleteMultiInstanceUser = (row: TaskVO) => {
if (multiInstanceUserRef.value) { if (multiInstanceUserRef.value) {
title.value = '减签人员'; title.value = '减签人员';
multiInstanceUserRef.value.getDeleteMultiInstanceList(row.id); multiInstanceUserRef.value.getDeleteMultiInstanceList(row.id);
@ -172,7 +174,7 @@ const handleQuery = () => {
}; };
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryParams.value = {}; queryFormRef.value?.resetFields();
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
queryParams.value.pageSize = 10; queryParams.value.pageSize = 10;
handleQuery(); handleQuery();

View File

@ -109,10 +109,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { getTaskWaitByPage, getTaskFinishByPage, claim, returnTask } from '@/api/workflow/task'; import { getTaskWaitByPage, getTaskFinishByPage, claim, returnTask } from '@/api/workflow/task';
import { ComponentInternalInstance } from 'vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue'; import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import SubmitVerify from '@/components/Process/submitVerify.vue'; import SubmitVerify from '@/components/Process/submitVerify.vue';
import { TaskQuery } from '@/api/workflow/task/types'; import { TaskQuery, TaskVO } from '@/api/workflow/task/types';
// //
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
// //
@ -146,7 +145,7 @@ onMounted(() => {
getWaitingList(); getWaitingList();
}); });
// //
const handleApprovalRecord = (row: any) => { const handleApprovalRecord = (row: TaskVO) => {
if (approvalRecordRef.value) { if (approvalRecordRef.value) {
approvalRecordRef.value.init(row.processInstanceId); approvalRecordRef.value.init(row.processInstanceId);
} }

View File

@ -4,20 +4,28 @@
<!-- 流程分类树 --> <!-- 流程分类树 -->
<el-col :lg="4" :xs="24" style=""> <el-col :lg="4" :xs="24" style="">
<el-card shadow="hover"> <el-card shadow="hover">
<el-input placeholder="请输入流程分类名" v-model="categoryName" prefix-icon="Search" clearable /> <el-input v-model="categoryName" placeholder="请输入流程分类名" prefix-icon="Search" clearable />
<el-tree class="mt-2" ref="categoryTreeRef" node-key="id" :data="categoryOptions" <el-tree
:props="{ label: 'categoryName', children: 'children' }" :expand-on-click-node="false" ref="categoryTreeRef"
:filter-node-method="filterNode" highlight-current default-expand-all @node-click="handleNodeClick"></el-tree> class="mt-2"
node-key="id"
:data="categoryOptions"
:props="{ label: 'categoryName', children: 'children' }"
:expand-on-click-node="false"
:filter-node-method="filterNode"
highlight-current
default-expand-all
@node-click="handleNodeClick"
></el-tree>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="20" :xs="24"> <el-col :lg="20" :xs="24">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
:leave-active-class="proxy?.animate.searchAnimate.leave"> <div v-show="showSearch" class="mb-[10px]">
<div class="mb-[10px]" v-show="showSearch">
<el-card shadow="hover"> <el-card shadow="hover">
<el-form :model="queryParams" ref="queryFormRef" :inline="true" v-show="showSearch" label-width="120px"> <el-form v-show="showSearch" ref="queryFormRef" :model="queryParams" :inline="true" label-width="120px">
<el-form-item label="流程定义名称" prop="name"> <el-form-item label="流程定义名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入流程定义名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.name" placeholder="请输入流程定义名称" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
@ -30,23 +38,23 @@
<el-card shadow="hover"> <el-card shadow="hover">
<template #header> <template #header>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<right-toolbar v-model:showSearch="showSearch" @queryTable="handleQuery"></right-toolbar> <right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
</el-row> </el-row>
</template> </template>
<el-table v-loading="loading" :data="processInstanceList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="processInstanceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column fixed align="center" type="index" label="序号" width="50"></el-table-column> <el-table-column fixed align="center" type="index" label="序号" width="50"></el-table-column>
<el-table-column fixed align="center" prop="id" label="id" v-if="false"></el-table-column> <el-table-column v-if="false" fixed align="center" prop="id" label="id"></el-table-column>
<el-table-column fixed align="center" prop="processDefinitionName" label="流程定义名称"></el-table-column> <el-table-column fixed align="center" prop="processDefinitionName" label="流程定义名称"></el-table-column>
<el-table-column fixed align="center" prop="processDefinitionKey" label="流程定义KEY"></el-table-column> <el-table-column fixed align="center" prop="processDefinitionKey" label="流程定义KEY"></el-table-column>
<el-table-column align="center" prop="processDefinitionVersion" label="版本号" width="90"> <el-table-column align="center" prop="processDefinitionVersion" label="版本号" width="90">
<template #default="scope"> v{{ scope.row.processDefinitionVersion }}.0</template> <template #default="scope"> v{{ scope.row.processDefinitionVersion }}.0</template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="isSuspended" label="状态" min-width="70" v-if="tab === 'running'"> <el-table-column v-if="tab === 'running'" align="center" prop="isSuspended" label="状态" min-width="70">
<template #default="scope"> <template #default="scope">
<el-tag type="success" v-if="!scope.row.isSuspended">激活</el-tag> <el-tag v-if="!scope.row.isSuspended" type="success">激活</el-tag>
<el-tag type="danger" v-else>挂起</el-tag> <el-tag v-else type="danger">挂起</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="businessStatusName" label="流程状态" min-width="70"> <el-table-column align="center" prop="businessStatusName" label="流程状态" min-width="70">
@ -55,58 +63,63 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="startTime" label="启动时间" width="160"></el-table-column> <el-table-column align="center" prop="startTime" label="启动时间" width="160"></el-table-column>
<el-table-column align="center" v-if="tab === 'finish'" prop="endTime" label="结束时间" <el-table-column v-if="tab === 'finish'" align="center" prop="endTime" label="结束时间" width="160"></el-table-column>
width="160"></el-table-column>
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="text" size="small" icon="Document" <el-button link type="primary" size="small" icon="Document" @click="handleApprovalRecord(scope.row.id)">审批记录</el-button>
@click="handleApprovalRecord(scope.row.id)">审批记录</el-button>
</el-col> </el-col>
<el-col :span="1.5" <el-col
v-if="scope.row.businessStatus === 'draft' || scope.row.businessStatus === 'cancel' || scope.row.businessStatus === 'back'"> v-if="scope.row.businessStatus === 'draft' || scope.row.businessStatus === 'cancel' || scope.row.businessStatus === 'back'"
<el-button type="text" size="small" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> :span="1.5"
>
<el-button link type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</el-col> </el-col>
<el-col :span="1.5" v-if="scope.row.businessStatus === 'waiting'"> <el-col v-if="scope.row.businessStatus === 'waiting'" :span="1.5">
<el-button type="text" size="small" icon="Notification" <el-button link type="primary" size="small" icon="Notification" @click="handleCancelProcessApply(scope.row.id)">撤销</el-button>
@click="handleCancelProcessApply(scope.row.id)">撤销</el-button>
</el-col> </el-col>
<el-col :span="1.5" <el-col
v-if="scope.row.businessStatus === 'draft' || scope.row.businessStatus === 'cancel' || scope.row.businessStatus === 'back'"> v-if="scope.row.businessStatus === 'draft' || scope.row.businessStatus === 'cancel' || scope.row.businessStatus === 'back'"
<el-button type="text" size="small" icon="Edit" :span="1.5"
@click="submitVerifyOpen(scope.row.taskVoList[0].id)">提交</el-button> >
<el-button link type="primary" size="small" icon="Edit" @click="submitVerifyOpen(scope.row.taskVoList[0].id)">提交</el-button>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" <pagination
v-model:limit="queryParams.pageSize" @pagination="getList" /> v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
<!-- 审批记录 --> <!-- 审批记录 -->
<approvalRecord ref="approvalRecordRef" /> <approvalRecord ref="approvalRecordRef" />
<!-- 提交组件 --> <!-- 提交组件 -->
<submitVerify ref="submitVerifyRef" @submitCallback="getList" /> <submitVerify ref="submitVerifyRef" @submit-callback="getList" />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { getCurrentSubmitByPage, deleteRuntimeProcessAndHisInst, cancelProcessApply } from '@/api/workflow/processInstance'; import { getCurrentSubmitByPage, deleteRuntimeProcessAndHisInst, cancelProcessApply } from '@/api/workflow/processInstance';
import { ComponentInternalInstance } from 'vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue'; import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import SubmitVerify from '@/components/Process/submitVerify.vue'; import SubmitVerify from '@/components/Process/submitVerify.vue';
import { listCategory } from '@/api/workflow/category'; import { listCategory } from '@/api/workflow/category';
import { ElTree } from 'element-plus';
import { CategoryVO } from '@/api/workflow/category/types'; import { CategoryVO } from '@/api/workflow/category/types';
import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types';
// //
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
// //
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const queryFormRef = ref(ElForm); const queryFormRef = ref<ElFormInstance>();
const categoryTreeRef = ref<ElTreeInstance>();
// //
const loading = ref(true); const loading = ref(true);
@ -121,21 +134,20 @@ const showSearch = ref(true);
// //
const total = ref(0); const total = ref(0);
// //
const processInstanceList = ref([]); const processInstanceList = ref<ProcessInstanceVO[]>([]);
const categoryOptions = ref<CategoryOption[]>([]); const categoryOptions = ref<CategoryOption[]>([]);
const categoryName = ref(''); const categoryName = ref('');
const categoryTreeRef = ref(ElTree);
type CategoryOption = { interface CategoryOption {
categoryCode: string; categoryCode: string;
categoryName: string; categoryName: string;
children?: CategoryOption[]; children?: CategoryOption[];
}; }
const tab = ref('running'); const tab = ref('running');
// //
const queryParams = ref<Record<string, any>>({ const queryParams = ref<ProcessInstanceQuery>({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: undefined, name: undefined,
@ -191,14 +203,14 @@ const handleQuery = () => {
}; };
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryFormRef.value.resetFields(); queryFormRef.value?.resetFields();
queryParams.value.categoryCode = ''; queryParams.value.categoryCode = '';
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
queryParams.value.pageSize = 10; queryParams.value.pageSize = 10;
handleQuery(); handleQuery();
}; };
// //
const handleSelectionChange = (selection: any) => { const handleSelectionChange = (selection: ProcessInstanceVO[]) => {
ids.value = selection.map((item: any) => item.id); ids.value = selection.map((item: any) => item.id);
single.value = selection.length !== 1; single.value = selection.length !== 1;
multiple.value = !selection.length; multiple.value = !selection.length;
@ -214,7 +226,7 @@ const getList = () => {
}; };
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (row: any) => { const handleDelete = async (row: ProcessInstanceVO) => {
const id = row.id || ids.value; const id = row.id || ids.value;
await proxy?.$modal.confirm('是否确认删除id为【' + id + '】的数据项?'); await proxy?.$modal.confirm('是否确认删除id为【' + id + '】的数据项?');
loading.value = true; loading.value = true;