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 { ProcessDefinitionQuery, ProcessDefinitionVO, ProcessDefinitionXmlVO } from '@/api/workflow/processDefinition/types';
import { AxiosPromise } from 'axios';
const baseUrl = import.meta.env.VITE_APP_BASE_API;
import { getToken } from '@/utils/auth';
/**
*
* @param processInstanceId id
* @param query id
* @returns
*/
export const listProcessDefinition = (query: object) => {
export const listProcessDefinition = (query: ProcessDefinitionQuery): AxiosPromise<ProcessDefinitionVO[]> => {
return request({
url: `/workflow/processDefinition/list`,
method: 'get',
@ -29,7 +30,7 @@ export const getProcessDefinitionListByKey = (key: string) => {
/**
* id获取流程图
*/
export const processDefinitionImage = (processDefinitionId: string) => {
export const processDefinitionImage = (processDefinitionId: string): AxiosPromise<any> => {
return request({
url: `/workflow/processDefinition/processDefinitionImage/${processDefinitionId}` + '?t' + Math.random(),
method: 'get'
@ -41,7 +42,7 @@ export const processDefinitionImage = (processDefinitionId: string) => {
* @param processDefinitionId id
* @returns
*/
export const processDefinitionXml = (processDefinitionId: string) => {
export const processDefinitionXml = (processDefinitionId: string): AxiosPromise<ProcessDefinitionXmlVO> => {
return request({
url: `/workflow/processDefinition/processDefinitionXml/${processDefinitionId}`,
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 { 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;
import { getToken } from '@/utils/auth';
/**
*
* @param query
* @returns {*}
*/
export const getProcessInstanceRunningByPage = (query: object) => {
export const getProcessInstanceRunningByPage = (query: ProcessInstanceQuery): AxiosPromise<ProcessInstanceVO[]> => {
return request({
url: '/workflow/processInstance/getProcessInstanceRunningByPage',
method: 'get',
@ -20,7 +22,7 @@ export const getProcessInstanceRunningByPage = (query: object) => {
* @param query
* @returns {*}
*/
export const getProcessInstanceFinishByPage = (query: object) => {
export const getProcessInstanceFinishByPage = (query: ProcessInstanceQuery): AxiosPromise<ProcessInstanceVO[]> => {
return request({
url: '/workflow/processInstance/getProcessInstanceFinishByPage',
method: 'get',
@ -68,7 +70,7 @@ export const deleteRuntimeProcessInst = (data: object) => {
* @param processInstanceId id
* @returns
*/
export const deleteRuntimeProcessAndHisInst = (processInstanceId: string) => {
export const deleteRuntimeProcessAndHisInst = (processInstanceId: string | string[]) => {
return request({
url: `/workflow/processInstance/deleteRuntimeProcessAndHisInst/${processInstanceId}`,
method: 'delete'
@ -80,7 +82,7 @@ export const deleteRuntimeProcessAndHisInst = (processInstanceId: string) => {
* @param processInstanceId id
* @returns
*/
export const deleteFinishProcessAndHisInst = (processInstanceId: string) => {
export const deleteFinishProcessAndHisInst = (processInstanceId: string | string[]) => {
return request({
url: `/workflow/processInstance/deleteFinishProcessAndHisInst/${processInstanceId}`,
method: 'delete'
@ -92,7 +94,7 @@ export const deleteFinishProcessAndHisInst = (processInstanceId: string) => {
* @param query
* @returns {*}
*/
export const getCurrentSubmitByPage = (query: object) => {
export const getCurrentSubmitByPage = (query: ProcessInstanceQuery): AxiosPromise<ProcessInstanceVO[]> => {
return request({
url: '/workflow/processInstance/getCurrentSubmitByPage',
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
* @returns {*}
*/
export const getAllTaskWaitByPage = (query: object) => {
export const getAllTaskWaitByPage = (query: TaskQuery): AxiosPromise<TaskVO[]> => {
return request({
url: '/workflow/task/getAllTaskWaitByPage',
method: 'get',
@ -45,7 +45,7 @@ export const getAllTaskWaitByPage = (query: object) => {
* @param query
* @returns {*}
*/
export const getAllTaskFinishByPage = (query: object) => {
export const getAllTaskFinishByPage = (query: TaskQuery): AxiosPromise<TaskVO[]> => {
return request({
url: '/workflow/task/getAllTaskFinishByPage',
method: 'get',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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