update 调整分类接口

This commit is contained in:
gssong 2024-12-17 19:20:26 +08:00
parent f3abcd1442
commit db244c2854
7 changed files with 34 additions and 64 deletions

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios'; import { AxiosPromise } from 'axios';
import { CategoryVO, CategoryForm, CategoryQuery } from '@/api/workflow/category/types'; import { CategoryVO, CategoryForm, CategoryQuery, CategoryTreeVO } from '@/api/workflow/category/types';
/** /**
* *
@ -61,3 +61,16 @@ export const delCategory = (categoryId: string | number | Array<string | number>
method: 'delete' method: 'delete'
}); });
}; };
/**
*
* @param query id
* @returns
*/
export const categoryTree = (query?: CategoryForm): AxiosPromise<CategoryTreeVO[]> => {
return request({
url: `/workflow/category/categoryTree`,
method: 'get',
params: query
});
};

View File

@ -1,12 +1,6 @@
import request from '@/utils/request'; import request from '@/utils/request';
import { import { FlowDefinitionQuery, definitionXmlVO, FlowDefinitionForm, FlowDefinitionVo } from '@/api/workflow/definition/types';
FlowDefinitionQuery,
definitionXmlVO,
FlowDefinitionForm,
FlowDefinitionVo
} from '@/api/workflow/definition/types';
import { AxiosPromise } from 'axios'; import { AxiosPromise } from 'axios';
import {CategoryForm, CategoryTreeVO} from "@/api/workflow/category/types";
/** /**
* *
@ -21,19 +15,6 @@ export const listDefinition = (query: FlowDefinitionQuery): AxiosPromise<FlowDef
}); });
}; };
/**
*
* @param query id
* @returns
*/
export const categoryTree = (query?: CategoryForm): AxiosPromise<CategoryTreeVO[]> => {
return request({
url: `/workflow/definition/categoryTree`,
method: 'get',
params: query
});
};
/** /**
* key获取流程定义 * key获取流程定义
* @param flowCode * @param flowCode

View File

@ -1,7 +1,7 @@
import { FlowTaskVO } from '@/api/workflow/task/types'; import { FlowTaskVO } from '@/api/workflow/task/types';
export interface FlowInstanceQuery extends PageQuery { export interface FlowInstanceQuery extends PageQuery {
category?: string; category?: string | number;
nodeName?: string; nodeName?: string;
flowCode?: string; flowCode?: string;
flowName?: string; flowName?: string;

View File

@ -262,12 +262,11 @@
</template> </template>
<script lang="ts" setup name="processDefinition"> <script lang="ts" setup name="processDefinition">
import { listDefinition, deleteDefinition, active, importDef, import { listDefinition, deleteDefinition, active, importDef, getHisListByKey, publish, add, edit, getInfo, copy } from '@/api/workflow/definition';
getHisListByKey, publish, add, edit, getInfo, copy, categoryTree } from '@/api/workflow/definition'; 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 } from 'element-plus';
import {TreeOptionProps} from "element-plus/es/components/tree/src/tree.type";
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -409,7 +408,7 @@ const getProcessDefinitionHitoryList = async (id: string, key: string) => {
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (row?: FlowDefinitionVo) => { const handleDelete = async (row?: FlowDefinitionVo) => {
const id = row?.id || ids.value; const id = row?.id || ids.value;
const defList = processDefinitionList.value.filter((x) => id.indexOf(x.id) != -1).map((x) => x.flowCode) const defList = processDefinitionList.value.filter((x) => id.indexOf(x.id) != -1).map((x) => x.flowCode);
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));

View File

@ -10,7 +10,7 @@
class="mt-2" class="mt-2"
node-key="id" node-key="id"
:data="categoryOptions" :data="categoryOptions"
:props="{ label: 'categoryName', children: 'children' }" :props="{ label: 'label', children: 'children' }"
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="filterNode" :filter-node-method="filterNode"
highlight-current highlight-current
@ -176,8 +176,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { pageByRunning, pageByFinish, deleteByInstanceIds, instanceVariable, invalid } from '@/api/workflow/instance'; import { pageByRunning, pageByFinish, deleteByInstanceIds, instanceVariable, invalid } from '@/api/workflow/instance';
import { listCategory } from '@/api/workflow/category'; import { categoryTree } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types'; import { CategoryTreeVO } from '@/api/workflow/category/types';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types'; import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import workflowCommon from '@/api/workflow/workflowCommon'; import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types'; import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
@ -251,7 +251,7 @@ const queryParams = ref<FlowInstanceQuery>({
}); });
/** 节点单击事件 */ /** 节点单击事件 */
const handleNodeClick = (data: CategoryVO) => { const handleNodeClick = (data: CategoryTreeVO) => {
queryParams.value.category = data.id; queryParams.value.category = data.id;
if (data.id === '0') { if (data.id === '0') {
queryParams.value.category = ''; queryParams.value.category = '';
@ -275,11 +275,8 @@ watchEffect(
/** 查询流程分类下拉树结构 */ /** 查询流程分类下拉树结构 */
const getTreeselect = async () => { const getTreeselect = async () => {
const res = await listCategory(); const res = await categoryTree();
categoryOptions.value = []; categoryOptions.value = res.data;
const data: CategoryOption = { id: '0', categoryName: '顶级节点', children: [] };
data.children = proxy?.handleTree<CategoryOption>(res.data, 'id', 'parentId');
categoryOptions.value.push(data);
}; };
/** 搜索按钮操作 */ /** 搜索按钮操作 */

View File

@ -1,13 +1,5 @@
<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 value="waiting">待办任务</el-radio-button>
<el-radio-button value="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 v-show="showSearch" class="mb-[10px]"> <div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
@ -23,9 +15,6 @@
<el-form-item label="流程定义名称" label-width="100" prop="flowName"> <el-form-item label="流程定义名称" label-width="100" prop="flowName">
<el-input v-model="queryParams.flowName" placeholder="请输入流程定义名称" @keyup.enter="handleQuery" /> <el-input v-model="queryParams.flowName" placeholder="请输入流程定义名称" @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="流程定义编码" label-width="100" prop="flowCode">
<el-input v-model="queryParams.flowCode" placeholder="请输入流程定义编码" @keyup.enter="handleQuery" />
</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>
<el-button icon="Refresh" @click="resetQuery">重置</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@ -37,7 +26,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">
<el-col :span="1.5"> <el-col :span="1.5" v-if="tab === 'waiting'">
<el-button type="primary" plain icon="Edit" :disabled="multiple" @click="handleUpdate">修改办理人 </el-button> <el-button type="primary" plain icon="Edit" :disabled="multiple" @click="handleUpdate">修改办理人 </el-button>
</el-col> </el-col>
<right-toolbar v-model:show-search="showSearch" @query-table="handleQuery"></right-toolbar> <right-toolbar v-model:show-search="showSearch" @query-table="handleQuery"></right-toolbar>

View File

@ -10,7 +10,7 @@
class="mt-2" class="mt-2"
node-key="id" node-key="id"
:data="categoryOptions" :data="categoryOptions"
:props="{ label: 'categoryName', children: 'children' }" :props="{ label: 'label', children: 'children' }"
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="filterNode" :filter-node-method="filterNode"
highlight-current highlight-current
@ -103,8 +103,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { pageByCurrent, deleteByInstanceIds, cancelProcessApply } from '@/api/workflow/instance'; import { pageByCurrent, deleteByInstanceIds, cancelProcessApply } from '@/api/workflow/instance';
import { listCategory } from '@/api/workflow/category'; import { categoryTree } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types'; import { CategoryTreeVO } from '@/api/workflow/category/types';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types'; import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import workflowCommon from '@/api/workflow/workflowCommon'; import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types'; import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
@ -129,15 +129,9 @@ const total = ref(0);
// //
const processInstanceList = ref<FlowInstanceVO[]>([]); const processInstanceList = ref<FlowInstanceVO[]>([]);
const categoryOptions = ref<CategoryOption[]>([]); const categoryOptions = ref<CategoryTreeVO[]>([]);
const categoryName = ref(''); const categoryName = ref('');
interface CategoryOption {
id: string;
categoryName: string;
children?: CategoryOption[];
}
const tab = ref('running'); const tab = ref('running');
// //
const queryParams = ref<FlowInstanceQuery>({ const queryParams = ref<FlowInstanceQuery>({
@ -153,7 +147,7 @@ onMounted(() => {
}); });
/** 节点单击事件 */ /** 节点单击事件 */
const handleNodeClick = (data: CategoryVO) => { const handleNodeClick = (data: CategoryTreeVO) => {
queryParams.value.category = data.id; queryParams.value.category = data.id;
if (data.id === '0') { if (data.id === '0') {
queryParams.value.category = ''; queryParams.value.category = '';
@ -177,11 +171,8 @@ watchEffect(
/** 查询流程分类下拉树结构 */ /** 查询流程分类下拉树结构 */
const getTreeselect = async () => { const getTreeselect = async () => {
const res = await listCategory(); const res = await categoryTree();
categoryOptions.value = []; categoryOptions.value = res.data;
const data: CategoryOption = { id: '0', categoryName: '顶级节点', children: [] };
data.children = proxy?.handleTree<CategoryOption>(res.data, 'id', 'parentId');
categoryOptions.value.push(data);
}; };
/** 搜索按钮操作 */ /** 搜索按钮操作 */