|
@@ -15,10 +15,10 @@ class ActionProcess extends Base
|
|
|
public function getList()
|
|
|
{
|
|
|
|
|
|
- $param = $this->request->filter('trim')->only(['order_type', 'page' => 1, 'size' => 15], 'post');
|
|
|
+ $param = $this->request->filter('trim')->only(['process_id', 'page' => 1, 'size' => 15], 'post');
|
|
|
|
|
|
$val = Validate::rule([
|
|
|
- 'order_type|流程编码' => 'require',
|
|
|
+ 'process_id|流程id' => 'require|number|gt:0',
|
|
|
'page|页码' => 'require|number|gt:0',
|
|
|
'size|每页显示的页码' => 'require|number|gt:0',
|
|
|
]);
|
|
@@ -63,12 +63,11 @@ class ActionProcess extends Base
|
|
|
public function add()
|
|
|
{
|
|
|
|
|
|
- $param = $this->request->filter('trim')->only(['token', 'order_type', 'order_name', 'action_type', 'operation_type', 'status_name', 'order_process', 'next_action_ids' => '', 'remark' => ''], 'post');
|
|
|
+ $param = $this->request->filter('trim')->only(['token', 'process_id', 'action_type', 'operation_type', 'status_name', 'order_process', 'next_action_ids' => '', 'remark' => ''], 'post');
|
|
|
|
|
|
$val = Validate::rule([
|
|
|
'token' => 'require',
|
|
|
- 'order_type|流程编码' => 'require|max:255',
|
|
|
- 'order_name|流程名称' => 'require|max:255|checkProcess:',
|
|
|
+ 'process_id|流程id' => 'require|number|gt:0',
|
|
|
'action_type|节点类型' => 'require|number|between:' . APModel::$action_type_start . ',' . APModel::$action_type_end,
|
|
|
'operation_type|操作类型' => 'require|number|in:' . APModel::$operation_type_approval . ',' . APModel::$operation_type_system,
|
|
|
'status_name|节点名称' => 'require|max:255',
|
|
@@ -76,13 +75,6 @@ class ActionProcess extends Base
|
|
|
'next_action_ids|下一节点' => 'array|requireIf:action_type,' . APModel::$action_type_start . '|requireIf:action_type,' . APModel::$action_type_process,
|
|
|
]);
|
|
|
|
|
|
- $val->extend('checkProcess', function ($val, $rule, $data) {
|
|
|
- return PModel::where([
|
|
|
- 'process_name' => $val,
|
|
|
- 'process_type' => $data['order_type'],
|
|
|
- 'is_del' => PModel::$is_del_normal
|
|
|
- ])->field('id')->findOrEmpty()->isEmpty() ? '流程编码和流程名称不存在' : true;
|
|
|
- });
|
|
|
|
|
|
$val->extend('checkOrderProcess', function ($val, $rule, $data) {
|
|
|
return APModel::where([
|
|
@@ -134,13 +126,12 @@ class ActionProcess extends Base
|
|
|
public function update()
|
|
|
{
|
|
|
|
|
|
- $param = $this->request->filter('trim')->only(['token', 'id', 'order_type', 'order_name', 'action_type', 'operation_type', 'status_name', 'order_process', 'next_action_ids' => '', 'remark' => '', 'status' => '', 'is_del' => ''], 'post');
|
|
|
+ $param = $this->request->filter('trim')->only(['token', 'id', 'process_id', 'action_type', 'operation_type', 'status_name', 'order_process', 'next_action_ids' => '', 'remark' => '', 'status' => '', 'is_del' => ''], 'post');
|
|
|
|
|
|
$val = Validate::rule([
|
|
|
'token' => 'require',
|
|
|
'id|ID' => 'require|number|gt:0',
|
|
|
- 'order_type|流程编码' => 'max:255',
|
|
|
- 'order_name|流程名称' => 'max:255|checkProcess:',
|
|
|
+ 'process_id' => 'number|gt:0',
|
|
|
'action_type|节点类型' => 'number|between:' . APModel::$action_type_start . ',' . APModel::$action_type_end,
|
|
|
'operation_type|操作类型' => 'number|in:' . APModel::$operation_type_approval . ',' . APModel::$operation_type_system,
|
|
|
'status_name|节点名称' => 'max:255',
|
|
@@ -150,10 +141,6 @@ class ActionProcess extends Base
|
|
|
'status|状态' => 'in:' . APModel::$status_disable . ',' . APModel::$status_normal,
|
|
|
]);
|
|
|
|
|
|
- $val->extend('checkProcess', function ($val, $rule, $data) {
|
|
|
- if (isset($val) && isset($data['order_type'])) return PModel::where(['process_name' => $val, 'process_type' => $data['order_type'], 'is_del' => PModel::$is_del_normal])->field('id')->findOrEmpty()->isEmpty() ? '流程编码和流程名称不存在' : true;
|
|
|
- else return true;
|
|
|
- });
|
|
|
|
|
|
$val->extend('checkOrderProcess', function ($val, $rule, $data) {
|
|
|
if (isset($val) && isset($data['order_type'])) return APModel::where(['order_type' => $data['order_type'], 'order_process' => $val, 'is_del' => APModel::$is_del_normal])->where('id', '<>', $data['id'])->field('id')->findOrEmpty()->isEmpty() ? true : '同一个流程编码下该节点值已存在';
|
|
@@ -177,14 +164,14 @@ class ActionProcess extends Base
|
|
|
{
|
|
|
|
|
|
$data = PModel::where(['is_del' => PModel::$is_del_normal, 'status' => PModel::$status_normal])
|
|
|
- ->column('id,process_name,process_type', 'process_type');
|
|
|
+ ->column('id,process_name,process_type', 'id');
|
|
|
|
|
|
$action = APModel::where(['is_del' => APModel::$is_del_normal, 'status' => APModel::$status_normal])
|
|
|
- ->field('id,order_type,order_process,status_name')
|
|
|
+ ->field('id,process_id,order_process,status_name')
|
|
|
->cursor();
|
|
|
|
|
|
foreach ($action as $item) {
|
|
|
- $data[$item->order_type]['child'][] = $item->toArray();
|
|
|
+ $data[$item->process_id]['child'][] = $item->toArray();
|
|
|
}
|
|
|
|
|
|
return app_show(0, '请求成功', array_column($data,null,null));
|