update 流程定义增加表单路径与编辑功能 修复一些其他bug

This commit is contained in:
疯狂的狮子Li 2024-12-16 10:43:58 +08:00
parent df129b08bf
commit f832a6b3be
7 changed files with 86 additions and 24 deletions

View File

@ -130,6 +130,31 @@ export const add = (data: FlowDefinitionForm) => {
}); });
}; };
/**
*
* @param data
* @returns
*/
export const edit = (data: FlowDefinitionForm) => {
return request({
url: `/workflow/definition`,
method: 'put',
data: data
});
};
/**
*
* @param id
* @returns
*/
export const getInfo = (id: number | string) => {
return request({
url: `/workflow/definition/${id}`,
method: 'get'
});
};
/** /**
* *
* @param id id * @param id id

View File

@ -9,6 +9,7 @@ export interface FlowDefinitionVo {
id: string; id: string;
flowName: string; flowName: string;
flowCode: string; flowCode: string;
formPath: string;
version: string; version: string;
isPublish: number; isPublish: number;
activityStatus: number; activityStatus: number;
@ -17,9 +18,11 @@ export interface FlowDefinitionVo {
} }
export interface FlowDefinitionForm { export interface FlowDefinitionForm {
id: string;
flowName: string; flowName: string;
flowCode: string; flowCode: string;
category: string; category: string;
formPath: string;
} }
export interface definitionXmlVO { export interface definitionXmlVO {

View File

@ -24,6 +24,8 @@ export interface FlowTaskVO {
nodeName: string; nodeName: string;
flowCode: string; flowCode: string;
flowStatus: string; flowStatus: string;
formCustom: string;
formPath: string;
nodeType: number; nodeType: number;
nodeRatio: string | number; nodeRatio: string | number;
version?: string; version?: string;

View File

@ -5,7 +5,7 @@ export default {
proxy.$tab.closePage(proxy.$route); proxy.$tab.closePage(proxy.$route);
console.log(routerJumpVo); console.log(routerJumpVo);
proxy.$router.push({ proxy.$router.push({
path: `/workflow/leaveEdit/index`, path: routerJumpVo.formPath,
query: { query: {
id: routerJumpVo.businessKey, id: routerJumpVo.businessKey,
type: routerJumpVo.type, type: routerJumpVo.type,

View File

@ -2,6 +2,8 @@ export interface RouterJumpVo {
businessKey: string; businessKey: string;
taskId: string | number; taskId: string | number;
type: string; type: string;
formCustom: string;
formPath: string;
} }
export interface StartProcessBo { export interface StartProcessBo {

View File

@ -44,6 +44,9 @@
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" icon="Plus" @click="handleAdd()">添加</el-button> <el-button type="primary" icon="Plus" @click="handleAdd()">添加</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button type="success" icon="Edit" :disabled="single" @click="handleUpdate()">修改</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="danger" icon="Delete" :disabled="multiple" @click="handleDelete()">删除</el-button> <el-button type="danger" icon="Delete" :disabled="multiple" @click="handleDelete()">删除</el-button>
</el-col> </el-col>
@ -51,7 +54,7 @@
<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-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" icon="Download" :disabled="single" @click="handleExportDef">导出</el-button> <el-button type="warning" icon="Download" :disabled="single" @click="handleExportDef">导出</el-button>
</el-col> </el-col>
<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>
@ -59,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" type="index" label="序号" width="60"></el-table-column> <el-table-column align="center" prop="id" label="主键" v-if="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="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">
@ -223,7 +226,7 @@
</el-table> </el-table>
</el-dialog> </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>
<el-form ref="defFormRef" :model="form" :rules="rules" label-width="110px"> <el-form ref="defFormRef" :model="form" :rules="rules" label-width="110px">
@ -245,10 +248,13 @@
<el-form-item label="流程名称" prop="flowName"> <el-form-item label="流程名称" prop="flowName">
<el-input v-model="form.flowName" placeholder="请输入流程名称" maxlength="100" show-word-limit /> <el-input v-model="form.flowName" placeholder="请输入流程名称" maxlength="100" show-word-limit />
</el-form-item> </el-form-item>
<el-form-item label="表单路径" prop="flowName">
<el-input v-model="form.formPath" placeholder="请输入表单路径" maxlength="100" show-word-limit />
</el-form-item>
</el-form> </el-form>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="modelDialog.visible = false">取消</el-button> <el-button @click="modelDialog.visible = false">取消</el-button>
<el-button type="primary" @click="handleAddSubmit">保存</el-button> <el-button type="primary" @click="handleSubmit">保存</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
@ -256,7 +262,7 @@
</template> </template>
<script lang="ts" setup name="processDefinition"> <script lang="ts" setup name="processDefinition">
import { listDefinition, deleteDefinition, active, importDef, getHisListByKey, publish, add, copy } from '@/api/workflow/definition'; import { listDefinition, deleteDefinition, active, importDef, getHisListByKey, publish, add, edit, getInfo, copy } from '@/api/workflow/definition';
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 { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types'; import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types';
@ -281,7 +287,7 @@ const multiple = ref(true);
const showSearch = ref(true); const showSearch = ref(true);
const total = ref(0); const total = ref(0);
const uploadDialogLoading = ref(false); const uploadDialogLoading = ref(false);
const processDefinitionList = ref<FlowDefinitionQuery[]>([]); const processDefinitionList = ref<FlowDefinitionVo[]>([]);
const processDefinitionHistoryList = ref<FlowDefinitionVo[]>([]); const processDefinitionHistoryList = ref<FlowDefinitionVo[]>([]);
const categoryOptions = ref<CategoryOption[]>([]); const categoryOptions = ref<CategoryOption[]>([]);
const categoryName = ref(''); const categoryName = ref('');
@ -301,7 +307,7 @@ const processDefinitionDialog = reactive<DialogOption>({
const modelDialog = reactive<DialogOption>({ const modelDialog = reactive<DialogOption>({
visible: false, visible: false,
title: '新增流程' title: ''
}); });
// //
@ -317,11 +323,20 @@ const rules = {
flowName: [{ required: true, message: '流程定义名称不能为空', trigger: 'blur' }], flowName: [{ required: true, message: '流程定义名称不能为空', trigger: 'blur' }],
flowCode: [{ required: true, message: '流程定义编码不能为空', trigger: 'blur' }] flowCode: [{ required: true, message: '流程定义编码不能为空', trigger: 'blur' }]
}; };
// const initFormData: FlowDefinitionForm = {
const form = ref<FlowDefinitionForm>({ id: '',
flowName: '', flowName: '',
flowCode: '', flowCode: '',
category: '' category: '',
formPath: ''
};
//
const form = ref<FlowDefinitionForm>({
id: '',
flowName: '',
flowCode: '',
category: '',
formPath: ''
}); });
onMounted(() => { onMounted(() => {
getList(); getList();
@ -402,7 +417,8 @@ 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;
await proxy?.$modal.confirm('是否确认删除流程定义KEY为【' + row.flowCode + '】的数据项?'); const defList = processDefinitionList.value.filter((x) => id.indexOf(x.id) != -1).map((x) => x.flowCode)
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 getList();
@ -490,26 +506,38 @@ const designView = async (row: FlowDefinitionVo) => {
} }
}); });
}; };
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
defFormRef.value?.resetFields();
};
/** /**
* 新增 * 新增
*/ */
const handleAdd = async () => { const handleAdd = async () => {
defFormRef.value?.resetFields(); reset();
modelDialog.visible = true; modelDialog.visible = true;
modelDialog.title = '新增流程';
}; };
// /** 修改按钮操作 */
const handleAddSubmit = async () => { const handleUpdate = async (row?: FlowDefinitionVo) => {
reset();
const id = row?.id || ids.value[0];
const res = await getInfo(id);
Object.assign(form.value, res.data);
modelDialog.visible = true;
modelDialog.title = '修改流程';
};
const handleSubmit = async () => {
defFormRef.value.validate(async (valid: boolean) => { defFormRef.value.validate(async (valid: boolean) => {
if (valid) { if (valid) {
add(form.value).then((resp) => { form.value.id ? await edit(form.value) : await add(form.value);
if (resp.code === 200) {
proxy?.$modal.msgSuccess('操作成功'); proxy?.$modal.msgSuccess('操作成功');
modelDialog.visible = false; modelDialog.visible = false;
getList(); getList();
} }
}); });
}
});
}; };
// //
const handleCopyDef = async (row: FlowDefinitionVo) => { const handleCopyDef = async (row: FlowDefinitionVo) => {
@ -526,7 +554,7 @@ const handleCopyDef = async (row: FlowDefinitionVo) => {
}); });
}); });
}; };
//
/** 导出按钮操作 */ /** 导出按钮操作 */
const handleExportDef = () => { const handleExportDef = () => {
proxy?.download(`/workflow/definition/exportDef/${ids.value[0]}`, {}, `${flowCodeList.value[0]}.xml`); proxy?.download(`/workflow/definition/exportDef/${ids.value[0]}`, {}, `${flowCodeList.value[0]}.xml`);

View File

@ -156,7 +156,9 @@ const handleOpen = async (row: FlowTaskVO) => {
const routerJumpVo = reactive<RouterJumpVo>({ const routerJumpVo = reactive<RouterJumpVo>({
businessKey: row.businessId, businessKey: row.businessId,
taskId: row.id, taskId: row.id,
type: 'approval' type: 'approval',
formCustom: row.formCustom,
formPath: row.formPath
}); });
workflowCommon.routerJump(routerJumpVo, proxy); workflowCommon.routerJump(routerJumpVo, proxy);
}; };