update 调整流程定义查询

This commit is contained in:
gssong 2024-12-28 19:35:08 +08:00
parent c0c5c8d7d4
commit bd5d21227a
3 changed files with 90 additions and 142 deletions

View File

@ -16,14 +16,15 @@ export const listDefinition = (query: FlowDefinitionQuery): AxiosPromise<FlowDef
}; };
/** /**
* key获取流程定义 *
* @param flowCode * @param query id
* @returns * @returns
*/ */
export const getHisListByKey = (flowCode: string) => { export const unPublishList = (query: FlowDefinitionQuery): AxiosPromise<FlowDefinitionVo[]> => {
return request({ return request({
url: `/workflow/definition/getHisListByKey/${flowCode}`, url: `/workflow/definition/unPublishList`,
method: 'get' method: 'get',
params: query
}); });
}; };

View File

@ -59,74 +59,66 @@
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar> <right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
</el-row> </el-row>
</template> </template>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-table v-loading="loading" border :data="processDefinitionList" @selection-change="handleSelectionChange"> <el-tab-pane label="流程定义" name="0"></el-tab-pane>
<el-table-column type="selection" width="55" align="center" /> <el-tab-pane label="未发布" name="1"></el-tab-pane>
<el-table-column align="center" prop="id" label="主键" v-if="false"></el-table-column> <el-table v-loading="loading" border :data="processDefinitionList" @selection-change="handleSelectionChange">
<el-table-column align="center" prop="flowName" label="流程定义名称" :show-overflow-tooltip="true"></el-table-column> <el-table-column type="selection" width="55" align="center" />
<el-table-column align="center" prop="flowCode" label="标识KEY" :show-overflow-tooltip="true"></el-table-column> <el-table-column align="center" prop="id" label="主键" v-if="false"></el-table-column>
<el-table-column align="center" prop="version" label="版本号" width="80"> <el-table-column align="center" prop="flowName" label="流程定义名称" :show-overflow-tooltip="true"></el-table-column>
<template #default="scope"> v{{ scope.row.version }}.0</template> <el-table-column align="center" prop="flowCode" label="标识KEY" :show-overflow-tooltip="true"></el-table-column>
</el-table-column> <el-table-column align="center" prop="version" label="版本号" width="80">
<el-table-column align="center" prop="activityStatus" label="激活状态" width="130"> <template #default="scope"> v{{ scope.row.version }}.0</template>
<template #default="scope"> </el-table-column>
<el-switch <el-table-column align="center" prop="activityStatus" label="激活状态" width="130">
v-model="scope.row.activityStatus" <template #default="scope">
:active-value="1" <el-switch
:inactive-value="0" v-model="scope.row.activityStatus"
@change="(status) => handleProcessDefState(scope.row, status)" :active-value="1"
/> :inactive-value="0"
</template> @change="(status) => handleProcessDefState(scope.row, status)"
</el-table-column> />
<el-table-column align="center" prop="isPublish" label="发布状态" width="100"> </template>
<template #default="scope"> </el-table-column>
<el-tag v-if="scope.row.isPublish == 0" type="danger">未发布</el-tag> <el-table-column align="center" prop="isPublish" label="发布状态" width="100">
<el-tag v-else-if="scope.row.isPublish == 1" type="success">已发布</el-tag> <template #default="scope">
<el-tag v-else type="danger">失效</el-tag> <el-tag v-if="scope.row.isPublish == 0" type="danger">未发布</el-tag>
</template> <el-tag v-else-if="scope.row.isPublish == 1" type="success">已发布</el-tag>
</el-table-column> <el-tag v-else type="danger">失效</el-tag>
<el-table-column fixed="right" label="操作" align="center" width="245" class-name="small-padding fixed-width"> </template>
<template #default="scope"> </el-table-column>
<el-row :gutter="10" class="mb8"> <el-table-column fixed="right" label="操作" align="center" width="170" class-name="small-padding fixed-width">
<el-col :span="1.5"> <template #default="scope">
<el-button <el-row :gutter="10" class="mb8">
link <el-col :span="1.5">
type="primary" <el-button link type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">删除流程</el-button>
size="small" </el-col>
icon="Document" <el-col :span="1.5">
@click="getProcessDefinitionHitoryList(scope.row.id, scope.row.flowCode)" <el-button link type="primary" size="small" icon="CopyDocument" @click="handleCopyDef(scope.row)">复制流程</el-button>
> </el-col>
历史版本 </el-row>
</el-button> <el-row :gutter="10" class="mb8">
</el-col> <el-col :span="1.5">
<el-col :span="1.5"> <el-button link type="primary" v-if="scope.row.isPublish === 0" icon="Pointer" size="small" @click="design(scope.row)"
<el-button link type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">删除流程</el-button> >流程设计</el-button
</el-col> >
</el-row> <el-button link type="primary" v-else icon="View" size="small" @click="designView(scope.row)">查看流程</el-button>
<el-row :gutter="10" class="mb8"> </el-col>
<el-col :span="1.5"> <el-col v-if="scope.row.isPublish !== 1" :span="1.5">
<el-button link type="primary" v-if="scope.row.isPublish === 0" icon="Pointer" size="small" @click="design(scope.row)" <el-button link type="primary" size="small" icon="CircleCheck" @click="handlePublish(scope.row)">发布流程</el-button>
>流程设计</el-button </el-col>
> </el-row>
<el-button link type="primary" v-else icon="View" size="small" @click="designView(scope.row)">查看流程</el-button> </template>
</el-col> </el-table-column>
<el-col v-if="scope.row.isPublish !== 1" :span="1.5"> </el-table>
<el-button link type="primary" size="small" icon="CircleCheck" @click="handlePublish(scope.row)">发布流程</el-button> <pagination
</el-col> v-show="total > 0"
<el-col :span="1.5"> v-model:page="queryParams.pageNum"
<el-button link type="primary" size="small" icon="CopyDocument" @click="handleCopyDef(scope.row)">复制流程</el-button> v-model:limit="queryParams.pageSize"
</el-col> :total="total"
</el-row> @pagination="handleQuery"
</template> />
</el-table-column> </el-tabs>
</el-table>
<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>
@ -163,55 +155,6 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 历史版本 -->
<el-dialog v-if="processDefinitionDialog.visible" v-model="processDefinitionDialog.visible" :title="processDefinitionDialog.title" width="70%">
<el-table v-loading="loading" border :data="processDefinitionHistoryList">
<el-table-column align="center" type="index" label="序号" width="60"></el-table-column>
<el-table-column align="center" prop="flowName" label="流程定义名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column align="center" prop="flowCode" label="标识KEY"></el-table-column>
<el-table-column align="center" prop="version" label="版本号" width="90">
<template #default="scope"> v{{ scope.row.version }}.0</template>
</el-table-column>
<el-table-column align="center" prop="activityStatus" label="激活状态" width="130">
<template #default="scope">
<el-switch
v-model="scope.row.activityStatus"
:active-value="1"
:inactive-value="0"
@change="(status) => handleProcessDefState(scope.row, status)"
/>
</template>
</el-table-column>
<el-table-column align="center" prop="isPublish" label="发布状态" width="100">
<template #default="scope">
<el-tag v-if="scope.row.isPublish == 0" type="danger">未发布</el-tag>
<el-tag v-else-if="scope.row.isPublish == 1" type="success">已发布</el-tag>
<el-tag v-else type="danger">失效</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="245" class-name="small-padding fixed-width">
<template #default="scope">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button link type="primary" icon="Delete" size="small" @click="handleDelete(scope.row)">删除流程</el-button>
</el-col>
<el-col v-if="scope.row.isPublish === 0" :span="1.5">
<el-button link type="primary" icon="Pointer" size="small" @click="design(scope.row)">流程设计</el-button>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button link type="primary" size="small" icon="CopyDocument" @click="handleCopyDef(scope.row)">复制流程</el-button>
</el-col>
<el-col v-if="scope.row.isPublish !== 1" :span="1.5">
<el-button link type="primary" size="small" icon="CircleCheck" @click="handlePublish(scope.row)">发布流程</el-button>
</el-col>
</el-row>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!-- 新增/编辑流程定义 --> <!-- 新增/编辑流程定义 -->
<el-dialog v-model="modelDialog.visible" :title="modelDialog.title" width="650px" append-to-body :close-on-click-modal="false"> <el-dialog v-model="modelDialog.visible" :title="modelDialog.title" width="650px" append-to-body :close-on-click-modal="false">
<template #footer> <template #footer>
@ -248,11 +191,11 @@
</template> </template>
<script lang="ts" setup name="processDefinition"> <script lang="ts" setup name="processDefinition">
import { listDefinition, deleteDefinition, active, importDef, getHisListByKey, publish, add, edit, getInfo, copy } from '@/api/workflow/definition'; import { listDefinition, deleteDefinition, active, importDef, unPublishList, publish, add, edit, getInfo, copy } from '@/api/workflow/definition';
import { categoryTree } from '@/api/workflow/category'; import { categoryTree } from '@/api/workflow/category';
import { CategoryTreeVO } from '@/api/workflow/category/types'; import { CategoryTreeVO } from '@/api/workflow/category/types';
import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types'; import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types';
import { UploadRequestOptions } from 'element-plus'; import { UploadRequestOptions, TabsPaneContext } from 'element-plus';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -268,13 +211,12 @@ const showSearch = ref(true);
const total = ref(0); const total = ref(0);
const uploadDialogLoading = ref(false); const uploadDialogLoading = ref(false);
const processDefinitionList = ref<FlowDefinitionVo[]>([]); const processDefinitionList = ref<FlowDefinitionVo[]>([]);
const processDefinitionHistoryList = ref<FlowDefinitionVo[]>([]);
const categoryOptions = ref<CategoryTreeVO[]>([]); const categoryOptions = ref<CategoryTreeVO[]>([]);
const categoryName = ref(''); const categoryName = ref('');
/** 部署文件分类选择 */ /** 部署文件分类选择 */
const selectCategory = ref(); const selectCategory = ref();
const defFormRef = ref<ElFormInstance>(); const defFormRef = ref<ElFormInstance>();
const activeName = ref('0');
const uploadDialog = reactive<DialogOption>({ const uploadDialog = reactive<DialogOption>({
visible: false, visible: false,
title: '部署流程文件' title: '部署流程文件'
@ -319,7 +261,7 @@ const form = ref<FlowDefinitionForm>({
formPath: '' formPath: ''
}); });
onMounted(() => { onMounted(() => {
getList(); handleQuery();
getTreeselect(); getTreeselect();
}); });
@ -351,11 +293,17 @@ const getTreeselect = async () => {
const res = await categoryTree(); const res = await categoryTree();
categoryOptions.value = res.data; categoryOptions.value = res.data;
}; };
const handleClick = (tab: TabsPaneContext, event: Event) => {
handleQuery();
};
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
getList(); if (activeName.value === '1') {
getList();
} else {
getUnPublishList();
}
}; };
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
@ -380,14 +328,12 @@ const getList = async () => {
total.value = resp.total; total.value = resp.total;
loading.value = false; loading.value = false;
}; };
// //
const getProcessDefinitionHitoryList = async (id: string, key: string) => { const getUnPublishList = async () => {
processDefinitionDialog.visible = true;
loading.value = true; loading.value = true;
const resp = await getHisListByKey(key); const resp = await unPublishList(queryParams.value);
if (resp.data && resp.data.length > 0) { processDefinitionList.value = resp.rows;
processDefinitionHistoryList.value = resp.data.filter((item: any) => item.id !== id); total.value = resp.total;
}
loading.value = false; loading.value = false;
}; };
@ -398,7 +344,7 @@ const handleDelete = async (row?: FlowDefinitionVo) => {
await proxy?.$modal.confirm('是否确认删除流程定义KEY为【' + defList + '】的数据项?'); await proxy?.$modal.confirm('是否确认删除流程定义KEY为【' + defList + '】的数据项?');
loading.value = true; loading.value = true;
await deleteDefinition(id).finally(() => (loading.value = false)); await deleteDefinition(id).finally(() => (loading.value = false));
await getList(); await handleQuery();
proxy?.$modal.msgSuccess('删除成功'); proxy?.$modal.msgSuccess('删除成功');
}; };
@ -410,7 +356,7 @@ const handlePublish = async (row?: FlowDefinitionVo) => {
loading.value = true; loading.value = true;
await publish(row.id).finally(() => (loading.value = false)); await publish(row.id).finally(() => (loading.value = false));
processDefinitionDialog.visible = false; processDefinitionDialog.visible = false;
await getList(); await handleQuery();
proxy?.$modal.msgSuccess('发布成功'); proxy?.$modal.msgSuccess('发布成功');
}; };
/** 挂起/激活 */ /** 挂起/激活 */
@ -425,7 +371,7 @@ const handleProcessDefState = async (row: FlowDefinitionVo, status: number | str
loading.value = true; loading.value = true;
await proxy?.$modal.confirm(msg); await proxy?.$modal.confirm(msg);
await active(row.id, !!status); await active(row.id, !!status);
await getList(); await handleQuery();
proxy?.$modal.msgSuccess('操作成功'); proxy?.$modal.msgSuccess('操作成功');
} catch (error) { } catch (error) {
row.activityStatus = status === 0 ? 1 : 0; row.activityStatus = status === 0 ? 1 : 0;
@ -519,7 +465,7 @@ const handleSubmit = async () => {
form.value.id ? await edit(form.value) : await add(form.value); form.value.id ? await edit(form.value) : await add(form.value);
proxy?.$modal.msgSuccess('操作成功'); proxy?.$modal.msgSuccess('操作成功');
modelDialog.visible = false; modelDialog.visible = false;
getList(); handleQuery();
} }
}); });
}; };
@ -533,7 +479,7 @@ const handleCopyDef = async (row: FlowDefinitionVo) => {
copy(row.id).then((resp) => { copy(row.id).then((resp) => {
if (resp.code === 200) { if (resp.code === 200) {
proxy?.$modal.msgSuccess('操作成功'); proxy?.$modal.msgSuccess('操作成功');
getList(); handleQuery();
} }
}); });
}); });

View File

@ -112,6 +112,7 @@ import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types'; import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
import processMeddle from '@/components/Process/processMeddle'; import processMeddle from '@/components/Process/processMeddle';
import { UserVO } from '@/api/system/user/types'; import { UserVO } from '@/api/system/user/types';
import { TabsPaneContext } from 'element-plus';
// //
const userSelectRef = ref<InstanceType<typeof UserSelect>>(); const userSelectRef = ref<InstanceType<typeof UserSelect>>();
// //
@ -175,7 +176,7 @@ const handleSelectionChange = (selection: any) => {
single.value = selection.length !== 1; single.value = selection.length !== 1;
multiple.value = !selection.length; multiple.value = !selection.length;
}; };
const changeTab = async (data: string) => { const changeTab = async (data: TabsPaneContext) => {
taskList.value = []; taskList.value = [];
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
if ('waiting' === data.paneName) { if ('waiting' === data.paneName) {