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 instanceId 流程实例ID
|
||||||
* @param deleteReason 删除原因
|
* @param deleteReason 删除原因
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public R delete(@RequestParam String instanceId, String deleteReason) {
|
public R delete(@RequestParam String instanceId, String deleteReason) {
|
||||||
instanceService.delete(instanceId, 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文件
|
* 读取xml文件
|
||||||
* @param processDefId 流程定义ID
|
* @param processDefId 流程定义ID
|
||||||
|
|||||||
@@ -94,6 +94,11 @@ public interface IWfProcessService {
|
|||||||
*/
|
*/
|
||||||
void startProcessByDefKey(String procDefKey, Map<String, Object> variables);
|
void startProcessByDefKey(String procDefKey, Map<String, Object> variables);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除流程实例
|
||||||
|
*/
|
||||||
|
void deleteProcessByIds(String[] instanceIds);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取xml文件
|
* 读取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文件
|
* 读取xml文件
|
||||||
* @param processDefId 流程定义ID
|
* @param processDefId 流程定义ID
|
||||||
|
|||||||
@@ -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) {
|
export function getBpmnXml(processDefId) {
|
||||||
return request({
|
return request({
|
||||||
@@ -96,11 +104,3 @@ export function stopProcess(data) {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除流程实例
|
|
||||||
export function delProcess(id) {
|
|
||||||
return request({
|
|
||||||
url: '/workflow/instance/delete/?instanceId=' + id,
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
|
v-if="scope.row.finishTime"
|
||||||
v-hasPermi="['workflow:process:remove']"
|
v-hasPermi="['workflow:process:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@@ -240,9 +241,9 @@ export default {
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map(item => item.procInsId);
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
handleAgain(row) {
|
handleAgain(row) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
@@ -275,7 +276,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.procInsId;
|
const ids = row.procInsId || this.ids;
|
||||||
this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
|
this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
|
|||||||
Reference in New Issue
Block a user