From edcb54fbe4c54277b4baacc413b05ed4828b0d36 Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 17 Oct 2019 15:14:44 +0800 Subject: [PATCH] * The workflow function support batch operate. --- framework/router.class.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/framework/router.class.php b/framework/router.class.php index fd1cbd4bdc..df52800bfa 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -337,11 +337,16 @@ class router extends baseRouter $this->loadModuleConfig('workflowaction'); $moduleName = 'flow'; + $methodName = $this->methodName; /* - * 工作流中除了browse、create、edit、view、delete、export外其他的方法都调用operate方法来执行。 - * In addition to browse, create, edit, view, delete and export, all methods in the workflow call the operate method to execute. + * 工作流中除了内置方法外的方法,如果是批量操作调用batchOperate方法,其它操作调用operate方法来执行。 + * In addition to the built-in methods in the workflow, if the batch operation calls the batchOperate method, other operations call the operate method to execute. */ - $methodName = in_array($this->methodName, $this->config->workflowaction->default->actions) ? $this->methodName : 'operate'; + if(!in_array($this->methodName, $this->config->workflowaction->default->actions)) + { + if($action->type == 'single') $methodName = 'operate'; + if($action->type == 'batch') $methodName = 'batchOperate'; + } $this->setFlowURI($moduleName, $methodName); } @@ -388,12 +393,13 @@ class router extends baseRouter $params = array_slice($params, 2); // $params = array(1); /* Prepend other params. */ - if($methodName == 'operate') array_unshift($params, $this->rawMethod); // $params = array('close', 1); - array_unshift($params, $this->rawModule); // $params = array($module, 'close', 1); - array_unshift($params, $methodName); // $params = array('operate', $module, 'close', 1); - array_unshift($params, $moduleName); // $params = array('flow', 'operate', $module, 'close', 1); + if($methodName == 'operate') array_unshift($params, $this->rawMethod); // $params = array('close', 1); + if($methodName == 'batchOperate') array_unshift($params, $this->rawMethod); // $params = array('close', 1); + array_unshift($params, $this->rawModule); // $params = array($module, 'close', 1); + array_unshift($params, $methodName); // $params = array('operate', $module, 'close', 1); + array_unshift($params, $moduleName); // $params = array('flow', 'operate', $module, 'close', 1); - $this->URI = implode($this->config->requestFix, $params); // $this->URI = flow-operate-$module-close-1.html; + $this->URI = implode($this->config->requestFix, $params); // $this->URI = flow-operate-$module-close-1.html; } else {