add 添加流程文件部署 调整流程发布
This commit is contained in:
parent
62da0c8eb4
commit
b65f6372af
@ -16,12 +16,12 @@ export const listDefinition = (query: definitionQuery): AxiosPromise<definitionV
|
|||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 按照流程定义key获取流程定义
|
* 按照流程定义key获取流程定义
|
||||||
* @param processInstanceId 流程实例id
|
* @param flowCode 流程编码
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const getListByKey = (key: string) => {
|
export const getHisListByKey = (flowCode: string) => {
|
||||||
return request({
|
return request({
|
||||||
url: `/workflow/definition/getListByKey/${key}`,
|
url: `/workflow/definition/getHisListByKey/${flowCode}`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -50,13 +50,12 @@ export const definitionXml = (definitionId: string): AxiosPromise<definitionXmlV
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除流程定义
|
* 删除流程定义
|
||||||
* @param deploymentId 部署id
|
* @param id 流程定义id
|
||||||
* @param definitionId 流程定义id
|
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const deleteDefinition = (deploymentId: string | string[], definitionId: string | string[]) => {
|
export const deleteDefinition = (id: string | string[]) => {
|
||||||
return request({
|
return request({
|
||||||
url: `/workflow/definition/${deploymentId}/${definitionId}`,
|
url: `/workflow/definition/${id}`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -89,9 +88,9 @@ export const convertToModel = (definitionId: string) => {
|
|||||||
* 通过zip或xml部署流程定义
|
* 通过zip或xml部署流程定义
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function deployProcessFile(data: any) {
|
export function importDefinition(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/workflow/definition/deployByFile',
|
url: '/workflow/definition/importDefinition',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data,
|
data: data,
|
||||||
headers: {
|
headers: {
|
||||||
@ -112,3 +111,27 @@ export const migrationDefinition = (currentdefinitionId: string, fromdefinitionI
|
|||||||
method: 'put'
|
method: 'put'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布流程定义
|
||||||
|
* @param id 流程定义id
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const publish = (id: string) => {
|
||||||
|
return request({
|
||||||
|
url: `/workflow/definition/publish/${id}`,
|
||||||
|
method: 'put'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消发布流程定义
|
||||||
|
* @param id 流程定义id
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const unPublish = (id: string) => {
|
||||||
|
return request({
|
||||||
|
url: `/workflow/definition/unPublish/${id}`,
|
||||||
|
method: 'put'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
@ -3,6 +3,7 @@ export interface ProcessDefinitionQuery extends PageQuery {
|
|||||||
key?: string;
|
key?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
categoryCode?: string;
|
categoryCode?: string;
|
||||||
|
isPublish?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FlowDefinitionVo extends BaseEntity {
|
export interface FlowDefinitionVo extends BaseEntity {
|
||||||
|
@ -69,10 +69,11 @@
|
|||||||
<el-link type="primary" @click="clickPreview(scope.row.id, 'bpmn')">{{ scope.row.diagramResourceName }}</el-link>
|
<el-link type="primary" @click="clickPreview(scope.row.id, 'bpmn')">{{ scope.row.diagramResourceName }}</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="suspensionState" label="状态" width="80">
|
<el-table-column align="center" prop="isPublish" label="状态" width="80">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.suspensionState == 1" type="success">激活</el-tag>
|
<el-tag v-if="scope.row.isPublish == 0" type="danger">未发布</el-tag>
|
||||||
<el-tag v-else 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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="deploymentTime" label="部署时间" width="120" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column align="center" prop="deploymentTime" label="部署时间" width="120" :show-overflow-tooltip="true"></el-table-column>
|
||||||
@ -98,7 +99,13 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button link type="primary" size="small" icon="Document" @click="getProcessDefinitionHitoryList(scope.row.id, scope.row.key)">
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
icon="Document"
|
||||||
|
@click="getProcessDefinitionHitoryList(scope.row.id, scope.row.flowCode)"
|
||||||
|
>
|
||||||
历史版本
|
历史版本
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -152,7 +159,7 @@
|
|||||||
multiple
|
multiple
|
||||||
accept="application/zip,application/xml,.bpmn"
|
accept="application/zip,application/xml,.bpmn"
|
||||||
:before-upload="handlerBeforeUpload"
|
:before-upload="handlerBeforeUpload"
|
||||||
:http-request="handerDeployProcessFile"
|
:http-request="handlerImportDefinition"
|
||||||
>
|
>
|
||||||
<el-icon class="UploadFilled"><upload-filled /></el-icon>
|
<el-icon class="UploadFilled"><upload-filled /></el-icon>
|
||||||
<div class="el-upload__text"><em>点击上传,选择BPMN流程文件</em></div>
|
<div class="el-upload__text"><em>点击上传,选择BPMN流程文件</em></div>
|
||||||
@ -172,7 +179,7 @@
|
|||||||
<el-table-column align="center" prop="version" label="版本号" width="90">
|
<el-table-column align="center" prop="version" label="版本号" width="90">
|
||||||
<template #default="scope"> v{{ scope.row.version }}.0</template>
|
<template #default="scope"> v{{ scope.row.version }}.0</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="resourceName" label="流程XML" min-width="80" :show-overflow-tooltip="true">
|
<!-- <el-table-column align="center" prop="resourceName" label="流程XML" min-width="80" :show-overflow-tooltip="true">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-link type="primary" @click="clickPreviewXML(scope.row.id)">{{ scope.row.resourceName }}</el-link>
|
<el-link type="primary" @click="clickPreviewXML(scope.row.id)">{{ scope.row.resourceName }}</el-link>
|
||||||
</template>
|
</template>
|
||||||
@ -181,15 +188,16 @@
|
|||||||
<template #default="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column align="center" prop="suspensionState" label="状态" min-width="70">
|
<el-table-column align="center" prop="isPublish" label="状态" width="80">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.suspensionState == 1" type="success">激活</el-tag>
|
<el-tag v-if="scope.row.isPublish == 0" type="danger">未发布</el-tag>
|
||||||
<el-tag v-else 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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="deploymentTime" label="部署时间" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column align="center" prop="deploymentTime" label="部署时间" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column fixed="right" label="操作" align="center" width="200" class-name="small-padding fixed-width">
|
<el-table-column fixed="right" label="操作" align="center" width="240" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@ -206,6 +214,18 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="text" size="small" icon="Tickets" @click="handleDefinitionConfigOpen(scope.row)">绑定业务</el-button>
|
<el-button type="text" size="small" icon="Tickets" @click="handleDefinitionConfigOpen(scope.row)">绑定业务</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.isPublish === 0 || scope.row.isPublish === 9"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
icon="CircleCheck"
|
||||||
|
@click="handlePublish(scope.row)"
|
||||||
|
>发布流程</el-button
|
||||||
|
>
|
||||||
|
<el-button v-else link type="primary" size="small" icon="CircleClose" @click="handleUnPublish(scope.row)">取消发布</el-button>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@ -258,8 +278,10 @@ import {
|
|||||||
deleteDefinition,
|
deleteDefinition,
|
||||||
updateDefinitionState,
|
updateDefinitionState,
|
||||||
convertToModel,
|
convertToModel,
|
||||||
deployProcessFile,
|
importDefinition,
|
||||||
getListByKey
|
getHisListByKey,
|
||||||
|
publish,
|
||||||
|
unPublish
|
||||||
} from '@/api/workflow/definition';
|
} from '@/api/workflow/definition';
|
||||||
import { getByTableNameNotDefId, getByDefId, saveOrUpdate } from '@/api/workflow/definitionConfig';
|
import { getByTableNameNotDefId, getByDefId, saveOrUpdate } from '@/api/workflow/definitionConfig';
|
||||||
import ProcessPreview from './components/processPreview.vue';
|
import ProcessPreview from './components/processPreview.vue';
|
||||||
@ -319,7 +341,8 @@ const queryParams = ref<ProcessDefinitionQuery>({
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
key: undefined,
|
key: undefined,
|
||||||
categoryCode: undefined
|
categoryCode: undefined,
|
||||||
|
isPublish: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@ -392,7 +415,7 @@ const getList = async () => {
|
|||||||
const getProcessDefinitionHitoryList = async (id: string, key: string) => {
|
const getProcessDefinitionHitoryList = async (id: string, key: string) => {
|
||||||
processDefinitionDialog.visible = true;
|
processDefinitionDialog.visible = true;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const resp = await getListByKey(key);
|
const resp = await getHisListByKey(key);
|
||||||
if (resp.data && resp.data.length > 0) {
|
if (resp.data && resp.data.length > 0) {
|
||||||
processDefinitionHistoryList.value = resp.data.filter((item: any) => item.id !== id);
|
processDefinitionHistoryList.value = resp.data.filter((item: any) => item.id !== id);
|
||||||
}
|
}
|
||||||
@ -414,14 +437,33 @@ const clickPreview = async (id: string, type: PreviewType) => {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (row?: FlowDefinitionVo) => {
|
const handleDelete = async (row?: FlowDefinitionVo) => {
|
||||||
const id = row?.id || ids.value;
|
const id = row?.id || ids.value;
|
||||||
const deployIds = row?.deploymentId || deploymentIds.value;
|
await proxy?.$modal.confirm('是否确认删除流程定义KEY为【' + row.flowCode + '】的数据项?');
|
||||||
const defKeys = row?.key || keys.value;
|
|
||||||
await proxy?.$modal.confirm('是否确认删除流程定义KEY为【' + defKeys + '】的数据项?');
|
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
await deleteDefinition(deployIds, id).finally(() => (loading.value = false));
|
await deleteDefinition(id).finally(() => (loading.value = false));
|
||||||
await getList();
|
await getList();
|
||||||
proxy?.$modal.msgSuccess('删除成功');
|
proxy?.$modal.msgSuccess('删除成功');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 发布流程定义 */
|
||||||
|
const handlePublish = async (row?: FlowDefinitionVo) => {
|
||||||
|
const id = row?.id || ids.value;
|
||||||
|
await proxy?.$modal.confirm(
|
||||||
|
'是否确认发布流程定义KEY为【' + row.flowCode + '】版本为【' + row.version + '】的数据项?,发布后会将已发布流程定义改为失效!'
|
||||||
|
);
|
||||||
|
loading.value = true;
|
||||||
|
await publish(row.id).finally(() => (loading.value = false));
|
||||||
|
processDefinitionDialog.visible = false;
|
||||||
|
await getList();
|
||||||
|
proxy?.$modal.msgSuccess('发布成功');
|
||||||
|
};
|
||||||
|
/** 取消发布流程定义 */
|
||||||
|
const handleUnPublish = async (row?: FlowDefinitionVo) => {
|
||||||
|
await proxy?.$modal.confirm('是否确认取消发布流程定义KEY为【' + row.flowCode + '】的数据项?');
|
||||||
|
loading.value = true;
|
||||||
|
await unPublish(row.id).finally(() => (loading.value = false));
|
||||||
|
await getList();
|
||||||
|
proxy?.$modal.msgSuccess('取消发布成功');
|
||||||
|
};
|
||||||
/** 挂起/激活 */
|
/** 挂起/激活 */
|
||||||
const handleProcessDefState = async (row: FlowDefinitionVo) => {
|
const handleProcessDefState = async (row: FlowDefinitionVo) => {
|
||||||
let msg: string;
|
let msg: string;
|
||||||
@ -456,12 +498,12 @@ const handlerBeforeUpload = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
//部署文件
|
//部署文件
|
||||||
const handerDeployProcessFile = (data: UploadRequestOptions): XMLHttpRequest => {
|
const handlerImportDefinition = (data: UploadRequestOptions): XMLHttpRequest => {
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
uploadDialogLoading.value = true;
|
uploadDialogLoading.value = true;
|
||||||
formData.append('file', data.file);
|
formData.append('file', data.file);
|
||||||
formData.append('categoryCode', selectCategory.value);
|
formData.append('categoryCode', selectCategory.value);
|
||||||
deployProcessFile(formData)
|
importDefinition(formData)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
uploadDialog.visible = false;
|
uploadDialog.visible = false;
|
||||||
proxy?.$modal.msgSuccess('部署成功');
|
proxy?.$modal.msgSuccess('部署成功');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user