fix(办公模块): 修复 批量删除我的流程显示undefined的问题,限制不能删除进行中的流程(需要取消流程后删除)。[I6PS1N](https://gitee.com/KonBAI-Q/ruoyi-flowable-plus/issues/I6PS1N)
This commit is contained in:
@@ -51,6 +51,7 @@ public class WfInstanceController {
|
||||
* @param instanceId 流程实例ID
|
||||
* @param deleteReason 删除原因
|
||||
*/
|
||||
@Deprecated
|
||||
@DeleteMapping(value = "/delete")
|
||||
public R delete(@RequestParam String instanceId, String deleteReason) {
|
||||
instanceService.delete(instanceId, deleteReason);
|
||||
|
||||
@@ -206,6 +206,17 @@ public class WfProcessController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程实例
|
||||
*
|
||||
* @param instanceIds 流程实例ID串
|
||||
*/
|
||||
@DeleteMapping("/instance/{instanceIds}")
|
||||
public R<Void> delete(@PathVariable String[] instanceIds) {
|
||||
processService.deleteProcessByIds(instanceIds);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取xml文件
|
||||
* @param processDefId 流程定义ID
|
||||
|
||||
@@ -94,6 +94,11 @@ public interface IWfProcessService {
|
||||
*/
|
||||
void startProcessByDefKey(String procDefKey, Map<String, Object> variables);
|
||||
|
||||
/**
|
||||
* 删除流程实例
|
||||
*/
|
||||
void deleteProcessByIds(String[] instanceIds);
|
||||
|
||||
|
||||
/**
|
||||
* 读取xml文件
|
||||
|
||||
@@ -613,6 +613,20 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteProcessByIds(String[] instanceIds) {
|
||||
List<String> ids = Arrays.asList(instanceIds);
|
||||
// 校验流程是否结束
|
||||
long activeInsCount = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceIds(new HashSet<>(ids)).active().count();
|
||||
if (activeInsCount > 0) {
|
||||
throw new ServiceException("不允许删除进行中的流程实例");
|
||||
}
|
||||
// 删除历史流程实例
|
||||
historyService.bulkDeleteHistoricProcessInstances(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取xml文件
|
||||
* @param processDefId 流程定义ID
|
||||
@@ -764,7 +778,7 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
|
||||
.eq(WfDeployForm::getDeployId, historicProcIns.getDeploymentId())
|
||||
.eq(WfDeployForm::getFormKey, formKey)
|
||||
.eq(localScope, WfDeployForm::getNodeKey, flowElement.getId()));
|
||||
|
||||
|
||||
//@update by Brath:避免空集合导致的NULL空指针
|
||||
WfDeployFormVo formInfo = formInfoList.stream().findFirst().orElse(null);
|
||||
|
||||
|
||||
@@ -27,6 +27,14 @@ export function startProcess(processDefId, data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 删除流程实例
|
||||
export function delProcess(ids) {
|
||||
return request({
|
||||
url: '/workflow/process/instance/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取流程图
|
||||
export function getBpmnXml(processDefId) {
|
||||
return request({
|
||||
@@ -96,11 +104,3 @@ export function stopProcess(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除流程实例
|
||||
export function delProcess(id) {
|
||||
return request({
|
||||
url: '/workflow/instance/delete/?instanceId=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
size="mini"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-if="scope.row.finishTime"
|
||||
v-hasPermi="['workflow:process:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
@@ -240,9 +241,9 @@ export default {
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
this.ids = selection.map(item => item.procInsId);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
handleAgain(row) {
|
||||
this.$router.push({
|
||||
@@ -275,7 +276,7 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.procInsId;
|
||||
const ids = row.procInsId || this.ids;
|
||||
this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
|
||||
Reference in New Issue
Block a user