feat:发布新版本流程时,校验是否存在进行中的单据

This commit is contained in:
lizhixian 2025-02-12 09:45:29 +08:00
parent c039696288
commit bc33acfad4
3 changed files with 7 additions and 20 deletions

View File

@ -78,11 +78,11 @@ export const cleanModel = async (id: number) => {
} }
/** /**
* *
* @param processDefinitionId id * @param modelId id
* @returns true/false * @returns true/false
*/ */
export const getProcessInstance = async (processDefinitionId: string) => { export const getProcessInstance = async (modelId: string) => {
return await request.get({ return await request.get({
url: '/bpm/task/manager-list?processDefinitionId=' + processDefinitionId url: '/bpm/task/manager-list?modelId=' + modelId
}) })
} }

View File

@ -445,13 +445,10 @@ const handleChangeState = async (row: any) => {
/** 发布流程 */ /** 发布流程 */
const handleDeploy = async (row: any) => { const handleDeploy = async (row: any) => {
try { try {
//
await message.confirm('是否发布该流程!!')
// //
const res = await ModelApi.getProcessInstance(row.id) const res = await ModelApi.getProcessInstance(row.id)
if (res) { if (res) {
message.error('当前版本下存在正在进行中的单据,请先结束单据后再发布') await message.confirm('流程下存在进行中的单据,是否确认发布该流程?')
return
} }
// //
await ModelApi.deployModel(row.id) await ModelApi.deployModel(row.id)

View File

@ -179,8 +179,6 @@ const userList = ref<UserApi.UserVO[]>([])
/** 初始化数据 */ /** 初始化数据 */
const initData = async () => { const initData = async () => {
console.log(route.params);
const modelId = route.params.id as string const modelId = route.params.id as string
if (modelId) { if (modelId) {
// //
@ -297,7 +295,7 @@ const handleSave = async () => {
// //
await router.push({ await router.push({
name: 'BpmModelUpdate', name: 'BpmModelUpdate',
params: { id: formData.value.id} params: { id: formData.value.id }
}) })
} catch { } catch {
// //
@ -314,21 +312,16 @@ const handleSave = async () => {
/** 发布操作 */ /** 发布操作 */
const handleDeploy = async () => { const handleDeploy = async () => {
console.log(route.params);
try { try {
// //
if (!formData.value.id) { if (!formData.value.id) {
await message.confirm('是否确认发布该流程?') await message.confirm('是否确认发布该流程?')
} }
// //
const res = await ModelApi.getProcessInstance(formData.value.id) const res = await ModelApi.getProcessInstance(formData.value.id)
if (res) { if (res) {
message.error('当前版本下存在正在进行中的单据,请先结束单据后再发布') await message.confirm('流程下存在进行中的单据,是否确认发布该流程?')
return
} }
// //
await validateAllSteps() await validateAllSteps()
@ -350,10 +343,7 @@ const handleDeploy = async () => {
message.success('发布成功') message.success('发布成功')
// //
await router.push({ name: 'BpmModel' }) await router.push({ name: 'BpmModel' })
} catch (error: any) { } catch (error: any) {}
console.error('发布失败:', error)
message.warning(error.message || '发布失败')
}
} }
/** 步骤切换处理 */ /** 步骤切换处理 */