update 重构流程分类表
This commit is contained in:
parent
f832a6b3be
commit
aa1bceeafb
@ -1,13 +1,16 @@
|
|||||||
|
export interface CategoryTreeVO {
|
||||||
|
id: number | string;
|
||||||
|
label: string;
|
||||||
|
parentId: number | string;
|
||||||
|
weight: number;
|
||||||
|
children: CategoryTreeVO[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface CategoryVO {
|
export interface CategoryVO {
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
id: string;
|
categoryId: string | number;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分类名称
|
|
||||||
*/
|
|
||||||
categoryName: string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父级id
|
* 父级id
|
||||||
@ -15,33 +18,60 @@ export interface CategoryVO {
|
|||||||
parentId: string | number;
|
parentId: string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 父类别名称
|
||||||
*/
|
*/
|
||||||
sortNum: number;
|
parentName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
ancestors: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类名称
|
||||||
|
*/
|
||||||
|
categoryName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示顺序
|
||||||
|
*/
|
||||||
|
orderNum: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程分类状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
status: number;
|
||||||
|
|
||||||
|
children: CategoryVO[];
|
||||||
|
|
||||||
children?: CategoryVO[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CategoryForm extends BaseEntity {
|
export interface CategoryForm extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
id?: string | number;
|
categoryId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级id
|
||||||
|
*/
|
||||||
|
parentId: string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类名称
|
* 分类名称
|
||||||
*/
|
*/
|
||||||
categoryName?: string;
|
categoryName?: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* 父级id
|
|
||||||
*/
|
|
||||||
parentId?: string | number;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
*/
|
*/
|
||||||
sortNum?: number;
|
orderNum?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程分类状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
status: number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CategoryQuery extends PageQuery {
|
export interface CategoryQuery extends PageQuery {
|
||||||
|
@ -1,19 +1,39 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import { FlowDefinitionQuery, definitionXmlVO, FlowDefinitionForm } from '@/api/workflow/definition/types';
|
import {
|
||||||
|
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";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取流程定义列表
|
* 获取流程定义列表
|
||||||
* @param query 流程实例id
|
* @param query 流程实例id
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const listDefinition = (query: FlowDefinitionQuery): AxiosPromise<FlowDefinitionQuery[]> => {
|
export const listDefinition = (query: FlowDefinitionQuery): AxiosPromise<FlowDefinitionVo[]> => {
|
||||||
return request({
|
return request({
|
||||||
url: `/workflow/definition/list`,
|
url: `/workflow/definition/list`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取流程分类树列表
|
||||||
|
* @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 流程编码
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
export interface FlowDefinitionQuery extends PageQuery {
|
export interface FlowDefinitionQuery extends PageQuery {
|
||||||
flowCode?: string;
|
flowCode?: string;
|
||||||
flowName?: string;
|
flowName?: string;
|
||||||
category: string;
|
category: string | number;
|
||||||
isPublish?: number;
|
isPublish?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
ref="categoryTableRef"
|
ref="categoryTableRef"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="categoryList"
|
:data="categoryList"
|
||||||
row-key="id"
|
row-key="categoryId"
|
||||||
:default-expand-all="isExpandAll"
|
:default-expand-all="isExpandAll"
|
||||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||||
>
|
>
|
||||||
@ -58,8 +58,8 @@
|
|||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="form.parentId"
|
v-model="form.parentId"
|
||||||
:data="categoryOptions"
|
:data="categoryOptions"
|
||||||
:props="{ value: 'id', label: 'categoryName', children: 'children' }"
|
:props="{ value: 'categoryId', label: 'categoryName', children: 'children' }"
|
||||||
value-key="id"
|
value-key="categoryId"
|
||||||
placeholder="请选择父级id"
|
placeholder="请选择父级id"
|
||||||
check-strictly
|
check-strictly
|
||||||
/>
|
/>
|
||||||
@ -67,8 +67,8 @@
|
|||||||
<el-form-item label="分类名称" prop="categoryName">
|
<el-form-item label="分类名称" prop="categoryName">
|
||||||
<el-input v-model="form.categoryName" placeholder="请输入分类名称" />
|
<el-input v-model="form.categoryName" placeholder="请输入分类名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="sortNum">
|
<el-form-item label="排序" prop="orderNum">
|
||||||
<el-input-number v-model="form.sortNum" placeholder="请输入排序" controls-position="right" :min="0" />
|
<el-input-number v-model="form.orderNum" placeholder="请输入排序" controls-position="right" :min="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@ -86,8 +86,9 @@ import { listCategory, getCategory, delCategory, addCategory, updateCategory } f
|
|||||||
import { CategoryVO, CategoryQuery, CategoryForm } from '@/api/workflow/category/types';
|
import { CategoryVO, CategoryQuery, CategoryForm } from '@/api/workflow/category/types';
|
||||||
|
|
||||||
type CategoryOption = {
|
type CategoryOption = {
|
||||||
id: number;
|
categoryId: string | number;
|
||||||
categoryName: string;
|
categoryName: string;
|
||||||
|
parentId: string | number;
|
||||||
children?: CategoryOption[];
|
children?: CategoryOption[];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -110,10 +111,11 @@ const dialog = reactive<DialogOption>({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const initFormData: CategoryForm = {
|
const initFormData: CategoryForm = {
|
||||||
id: undefined,
|
categoryId: undefined,
|
||||||
categoryName: undefined,
|
categoryName: undefined,
|
||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
sortNum: 0
|
orderNum: 0,
|
||||||
|
status: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
const data = reactive<PageData<CategoryForm, CategoryQuery>>({
|
const data = reactive<PageData<CategoryForm, CategoryQuery>>({
|
||||||
@ -136,7 +138,7 @@ const { queryParams, form, rules } = toRefs(data);
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await listCategory(queryParams.value);
|
const res = await listCategory(queryParams.value);
|
||||||
const data = proxy?.handleTree<CategoryVO>(res.data, 'id', 'parentId');
|
const data = proxy?.handleTree<CategoryVO>(res.data, 'categoryId', 'parentId');
|
||||||
if (data) {
|
if (data) {
|
||||||
categoryList.value = data;
|
categoryList.value = data;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@ -147,9 +149,10 @@ const getList = async () => {
|
|||||||
const getTreeselect = async () => {
|
const getTreeselect = async () => {
|
||||||
const res = await listCategory();
|
const res = await listCategory();
|
||||||
categoryOptions.value = [];
|
categoryOptions.value = [];
|
||||||
const data: CategoryOption = { id: 0, categoryName: '顶级节点', children: [] };
|
const data: CategoryOption = { categoryId: 0, categoryName: '顶级节点', parentId: 0, children: [] };
|
||||||
data.children = proxy?.handleTree<CategoryOption>(res.data, 'id', 'parentId');
|
data.children = proxy?.handleTree<CategoryOption>(res.data, 'categoryId', 'parentId');
|
||||||
categoryOptions.value.push(data);
|
categoryOptions.value.push(data);
|
||||||
|
console.log(categoryOptions.value)
|
||||||
};
|
};
|
||||||
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
@ -182,8 +185,8 @@ const handleAdd = (row?: CategoryVO) => {
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
reset();
|
reset();
|
||||||
getTreeselect();
|
getTreeselect();
|
||||||
if (row != null && row.id) {
|
if (row != null && row.categoryId) {
|
||||||
form.value.parentId = row.id;
|
form.value.parentId = row.categoryId;
|
||||||
} else {
|
} else {
|
||||||
form.value.parentId = 0;
|
form.value.parentId = 0;
|
||||||
}
|
}
|
||||||
@ -213,9 +216,9 @@ const handleUpdate = (row: CategoryVO) => {
|
|||||||
reset();
|
reset();
|
||||||
await getTreeselect();
|
await getTreeselect();
|
||||||
if (row != null) {
|
if (row != null) {
|
||||||
form.value.parentId = row.id;
|
form.value.parentId = row.categoryId;
|
||||||
}
|
}
|
||||||
const res = await getCategory(row.id);
|
const res = await getCategory(row.categoryId);
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
});
|
});
|
||||||
@ -226,7 +229,7 @@ const submitForm = () => {
|
|||||||
categoryFormRef.value.validate(async (valid: boolean) => {
|
categoryFormRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
if (form.value.id) {
|
if (form.value.categoryId) {
|
||||||
await updateCategory(form.value).finally(() => (buttonLoading.value = false));
|
await updateCategory(form.value).finally(() => (buttonLoading.value = false));
|
||||||
} else {
|
} else {
|
||||||
await addCategory(form.value).finally(() => (buttonLoading.value = false));
|
await addCategory(form.value).finally(() => (buttonLoading.value = false));
|
||||||
@ -240,9 +243,9 @@ const submitForm = () => {
|
|||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (row: CategoryVO) => {
|
const handleDelete = async (row: CategoryVO) => {
|
||||||
await proxy?.$modal.confirm('是否确认删除流程分类编号为"' + row.id + '"的数据项?');
|
await proxy?.$modal.confirm('是否确认删除流程分类编号为"' + row.categoryId + '"的数据项?');
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
await delCategory(row.id).finally(() => (loading.value = false));
|
await delCategory(row.categoryId).finally(() => (loading.value = false));
|
||||||
await getList();
|
await getList();
|
||||||
proxy?.$modal.msgSuccess('删除成功');
|
proxy?.$modal.msgSuccess('删除成功');
|
||||||
};
|
};
|
||||||
|
@ -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="{ value: 'id', 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
|
||||||
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
<el-table v-loading="loading" border :data="processDefinitionList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" border :data="processDefinitionList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column align="center" prop="id" label="主键" v-if="true" ></el-table-column>
|
<el-table-column align="center" prop="id" label="主键" v-if="false" ></el-table-column>
|
||||||
<el-table-column align="center" prop="flowName" label="流程定义名称" :show-overflow-tooltip="true"></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" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column align="center" prop="flowCode" label="标识KEY" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column align="center" prop="version" label="版本号" width="80">
|
<el-table-column align="center" prop="version" label="版本号" width="80">
|
||||||
@ -146,7 +146,7 @@
|
|||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="selectCategory"
|
v-model="selectCategory"
|
||||||
:data="categoryOptions"
|
:data="categoryOptions"
|
||||||
:props="{ value: 'id', label: 'categoryName', children: 'children' }"
|
:props="{ value: 'id', label: 'label', children: 'children' }"
|
||||||
filterable
|
filterable
|
||||||
value-key="id"
|
value-key="id"
|
||||||
:render-after-expand="false"
|
:render-after-expand="false"
|
||||||
@ -234,7 +234,7 @@
|
|||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="form.category"
|
v-model="form.category"
|
||||||
:data="categoryOptions"
|
:data="categoryOptions"
|
||||||
:props="{ value: 'id', label: 'categoryName', children: 'children' }"
|
:props="{ value: 'id', label: 'label', children: 'children' }"
|
||||||
filterable
|
filterable
|
||||||
value-key="id"
|
value-key="id"
|
||||||
:render-after-expand="false"
|
:render-after-expand="false"
|
||||||
@ -262,9 +262,9 @@
|
|||||||
</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,
|
||||||
import { listCategory } from '@/api/workflow/category';
|
getHisListByKey, publish, add, edit, getInfo, copy, categoryTree } from '@/api/workflow/definition';
|
||||||
import { CategoryVO } 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';
|
||||||
|
|
||||||
@ -273,12 +273,6 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|||||||
const queryFormRef = ref<ElFormInstance>();
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
const categoryTreeRef = ref<ElTreeInstance>();
|
const categoryTreeRef = ref<ElTreeInstance>();
|
||||||
|
|
||||||
type CategoryOption = {
|
|
||||||
id: string;
|
|
||||||
categoryName: string;
|
|
||||||
children?: CategoryOption[];
|
|
||||||
};
|
|
||||||
|
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const ids = ref<Array<any>>([]);
|
const ids = ref<Array<any>>([]);
|
||||||
const flowCodeList = ref<Array<any>>([]);
|
const flowCodeList = ref<Array<any>>([]);
|
||||||
@ -289,7 +283,7 @@ 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 processDefinitionHistoryList = ref<FlowDefinitionVo[]>([]);
|
||||||
const categoryOptions = ref<CategoryOption[]>([]);
|
const categoryOptions = ref<CategoryTreeVO[]>([]);
|
||||||
const categoryName = ref('');
|
const categoryName = ref('');
|
||||||
/** 部署文件分类选择 */
|
/** 部署文件分类选择 */
|
||||||
const selectCategory = ref();
|
const selectCategory = ref();
|
||||||
@ -344,7 +338,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 = '';
|
||||||
@ -368,10 +362,10 @@ watchEffect(
|
|||||||
|
|
||||||
/** 查询流程分类下拉树结构 */
|
/** 查询流程分类下拉树结构 */
|
||||||
const getTreeselect = async () => {
|
const getTreeselect = async () => {
|
||||||
const res = await listCategory();
|
const res = await categoryTree();
|
||||||
categoryOptions.value = [];
|
categoryOptions.value = [];
|
||||||
const data: CategoryOption = { id: '0', categoryName: '顶级节点', children: [] };
|
const data: CategoryTreeVO = { id: '0', parentId: '0', label: '顶级节点', weight: 0, children: [] };
|
||||||
data.children = proxy?.handleTree<CategoryOption>(res.data, 'id', 'parentId');
|
data.children = res.data
|
||||||
categoryOptions.value.push(data);
|
categoryOptions.value.push(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user