提取审核日志容器

main
Jing Li 2024-04-04 16:04:25 +08:00
parent de5cc232a2
commit eedcb0bbb8
6 changed files with 89 additions and 115 deletions

View File

@ -126,42 +126,31 @@ class StoreMasterCommissionController extends AdminController
public function detail(): Form
{
$detail = amis()->Property()->items([
['label' => __('finance.store_master_commission.month'), 'content' => '${month}'],
['label' => __('finance.store_master_commission.store'), 'content' => '${store.title}'],
['label' => __('finance.store_master_commission.store_master'), 'content' => '${master.name}'],
['label' => __('finance.store_master_commission.commission'), 'content' => '${commission}'],
['label' => __('finance.store_master_commission.daily_expenses'), 'content' => '${daily_expenses}'],
['label' => __('finance.store_master_commission.employee_expenses'), 'content' => '${employee_expenses}'],
['label' => __('finance.store_master_commission.other_expenses'), 'content' => '${other_expenses}'],
['label' => __('finance.store_master_commission.created_at'), 'content' => '${created_at}'],
['label' => __('workflow_log.check_status'), 'content' => amis()->Mapping()->name('workflow.check_status')->map(CheckStatus::labelMap())],
['label' => __('workflow_log.checked_at'), 'content' => '${workflow.checked_at}'],
['label' => __('workflow_log.remarks'), 'content' => '${workflow.check_remarks}', 'span' => 2],
]);
$table = amis()->Service()
->id('offical-business-checklog-table')
->initFetch(false)
->api(admin_url('api/workflow/logs?id=${workflow.id}'))
->body(
amis()->Table()->columnsTogglable(false)->itemActions([
$this->succesAction()->reload('offical-business-detail'),
$this->failAction()->reload('offical-business-detail'),
])->columns([
amis()->TableColumn()->name('batch_id')->label(__('workflow_log.batch_id')),
amis()->TableColumn()->name('check_name')->label(__('workflow_log.check_name')),
amis()->TableColumn()->name('check_user.name')->label(__('workflow_log.check_user_id')),
amis()->TableColumn()->name('check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()),
amis()->TableColumn()->name('checked_at')->label(__('workflow_log.checked_at')),
amis()->TableColumn()->name('remarks')->label(__('workflow_log.remarks')),
])
);
return $this->baseDetail()->id('offical-business-detail')->title('')->onEvent([
$detailId = 'store-master-commission-detail';
$serviceId = 'store-master-commission-workflow-service';
return $this->baseDetail()->id($detailId)->title('')->onEvent([
'inited' => [
'actions' => [
['actionType' => 'reload', 'componentId' => 'offical-business-checklog-table'],
]
]
])->body([$detail, amis()->Divider(), $table]);
['actionType' => 'reload', 'componentId' => $serviceId],
],
],
])->body([
amis()->Property()->items([
['label' => __('finance.store_master_commission.month'), 'content' => '${month}'],
['label' => __('finance.store_master_commission.store'), 'content' => '${store.title}'],
['label' => __('finance.store_master_commission.store_master'), 'content' => '${master.name}'],
['label' => __('finance.store_master_commission.commission'), 'content' => '${commission}'],
['label' => __('finance.store_master_commission.daily_expenses'), 'content' => '${daily_expenses}'],
['label' => __('finance.store_master_commission.employee_expenses'), 'content' => '${employee_expenses}'],
['label' => __('finance.store_master_commission.other_expenses'), 'content' => '${other_expenses}'],
['label' => __('finance.store_master_commission.created_at'), 'content' => '${created_at}'],
['label' => __('workflow_log.check_status'), 'content' => amis()->Mapping()->name('workflow.check_status')->map(CheckStatus::labelMap())],
['label' => __('workflow_log.checked_at'), 'content' => '${workflow.checked_at}'],
['label' => __('workflow_log.remarks'), 'content' => '${workflow.check_remarks}', 'span' => 2],
]),
amis()->Divider(),
$this->baseWorkflowLogService($detailId)->id($serviceId),
]);
}
}

View File

@ -108,6 +108,9 @@ class HolidayController extends AdminController
public function detail(): Form
{
$detailId = 'holiday-detail';
$serviceId = 'holiday-checklog-service';
$detail = amisMake()->Property()->items([
['label' => __('holiday_apply.store_id'), 'content' => '${store.title}'],
['label' => __('holiday_apply.employee_id'), 'content' => '${employee.name}'],
@ -119,29 +122,17 @@ class HolidayController extends AdminController
['label' => __('workflow_log.checked_at'), 'content' => '${workflow.checked_at}'],
['label' => __('workflow_log.remarks'), 'content' => '${workflow.check_remarks}'],
]);
$table = amisMake()->Service()
->id('holiday-checklog-table')
->initFetch(false)
->api(admin_url('api/workflow/logs') . '?id=${workflow.id}')
->body(
amisMake()->Table()->columnsTogglable(false)->itemActions([
$this->succesAction()->reload('holiday-detail'),
$this->failAction()->reload('holiday-detail'),
])->columns([
amisMake()->TableColumn()->name('batch_id')->label(__('workflow_log.batch_id')),
amisMake()->TableColumn()->name('check_name')->label(__('workflow_log.check_name')),
amisMake()->TableColumn()->name('check_user.name')->label(__('workflow_log.check_user_id')),
amisMake()->TableColumn()->name('check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()),
amisMake()->TableColumn()->name('checked_at')->label(__('workflow_log.checked_at')),
amisMake()->TableColumn()->name('remarks')->label(__('workflow_log.remarks')),
])
);
return $this->baseDetail()->id('holiday-detail')->title('')->onEvent([
return $this->baseDetail()->id($detailId)->title('')->onEvent([
'inited' => [
'actions' => [
['actionType' => 'reload', 'componentId' => 'holiday-checklog-table'],
['actionType' => 'reload', 'componentId' => $serviceId],
]
]
])->body([$detail, amisMake()->Divider(), $table]);
])->body([
$detail,
amisMake()->Divider(),
$this->baseWorkflowLogService($detailId)->id($serviceId),
]);
}
}

View File

@ -95,6 +95,9 @@ class OfficalBusinessController extends AdminController
public function detail(): Form
{
$detailId = 'offical-business-detail';
$serviceId = 'offical-business-checklog-service';
$detail = amisMake()->Property()->items([
['label' => __('offical_business.store_id'), 'content' => '${store.title}'],
['label' => __('offical_business.employee_id'), 'content' => '${employee.name}'],
@ -106,29 +109,17 @@ class OfficalBusinessController extends AdminController
['label' => __('workflow_log.checked_at'), 'content' => '${workflow.checked_at}'],
['label' => __('workflow_log.remarks'), 'content' => '${workflow.check_remarks}'],
]);
$table = amisMake()->Service()
->id('offical-business-checklog-table')
->initFetch(false)
->api(admin_url('api/workflow/logs') . '?id=${workflow.id}')
->body(
amisMake()->Table()->columnsTogglable(false)->itemActions([
$this->succesAction()->reload('offical-business-detail'),
$this->failAction()->reload('offical-business-detail'),
])->columns([
amisMake()->TableColumn()->name('batch_id')->label(__('workflow_log.batch_id')),
amisMake()->TableColumn()->name('check_name')->label(__('workflow_log.check_name')),
amisMake()->TableColumn()->name('check_user.name')->label(__('workflow_log.check_user_id')),
amisMake()->TableColumn()->name('check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()),
amisMake()->TableColumn()->name('checked_at')->label(__('workflow_log.checked_at')),
amisMake()->TableColumn()->name('remarks')->label(__('workflow_log.remarks')),
])
);
return $this->baseDetail()->id('offical-business-detail')->title('')->onEvent([
return $this->baseDetail()->id($detailId)->title('')->onEvent([
'inited' => [
'actions' => [
['actionType' => 'reload', 'componentId' => 'offical-business-checklog-table'],
['actionType' => 'reload', 'componentId' => $serviceId],
]
]
])->body([$detail, amisMake()->Divider(), $table]);
])->body([
$detail,
amisMake()->Divider(),
$this->baseWorkflowLogService($detailId)->id($serviceId),
]);
}
}

View File

@ -95,6 +95,9 @@ class OvertimeController extends AdminController
public function detail(): Form
{
$detailId = 'overtime-detail';
$serviceId = 'overtime-checklog-service';
$detail = amisMake()->Property()->items([
['label' => __('overtime_apply.store_id'), 'content' => '${store.title}'],
['label' => __('overtime_apply.employee_id'), 'content' => '${employee.name}'],
@ -108,29 +111,17 @@ class OvertimeController extends AdminController
['label' => __('workflow_log.checked_at'), 'content' => '${workflow.checked_at}'],
['label' => __('workflow_log.remarks'), 'content' => '${workflow.check_remarks}'],
]);
$table = amisMake()->Service()
->id('overtime-checklog-table')
->initFetch(false)
->api(admin_url('api/workflow/logs') . '?id=${workflow.id}')
->body(
amisMake()->Table()->columnsTogglable(false)->itemActions([
$this->succesAction()->reload('overtime-detail'),
$this->failAction()->reload('overtime-detail'),
])->columns([
amisMake()->TableColumn()->name('batch_id')->label(__('workflow_log.batch_id')),
amisMake()->TableColumn()->name('check_name')->label(__('workflow_log.check_name')),
amisMake()->TableColumn()->name('check_user.name')->label(__('workflow_log.check_user_id')),
amisMake()->TableColumn()->name('check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()),
amisMake()->TableColumn()->name('checked_at')->label(__('workflow_log.checked_at')),
amisMake()->TableColumn()->name('remarks')->label(__('workflow_log.remarks')),
])
);
return $this->baseDetail()->id('overtime-detail')->title('')->onEvent([
return $this->baseDetail()->id($detailId)->title('')->onEvent([
'inited' => [
'actions' => [
['actionType' => 'reload', 'componentId' => 'overtime-checklog-table'],
['actionType' => 'reload', 'componentId' => $serviceId],
]
]
])->body([$detail, amisMake()->Divider(), $table]);
])->body([
$detail,
amisMake()->Divider(),
$this->baseWorkflowLogService($detailId)->id($serviceId),
]);
}
}

View File

@ -102,6 +102,9 @@ class SignRepairController extends AdminController
public function detail(): Form
{
$detailId = 'sign-repair-detail';
$serviceId = 'sign-repair-checklog-service';
$detail = amisMake()->Property()->items([
['label' => __('employee_sign_repair.store_id'), 'content' => '${store.title}'],
['label' => __('employee_sign_repair.employee_id'), 'content' => '${employee.name}'],
@ -113,29 +116,17 @@ class SignRepairController extends AdminController
['label' => __('workflow_log.checked_at'), 'content' => '${workflow.checked_at}'],
['label' => __('workflow_log.check_remarks'), 'content' => '${workflow.check_remarks}'],
]);
$table = amisMake()->Service()
->id('sign-repair-checklog-table')
->initFetch(false)
->api(admin_url('api/workflow/logs') . '?id=${workflow.id}')
->body(
amisMake()->Table()->columnsTogglable(false)->itemActions([
$this->succesAction()->reload('sign-repair-detail'),
$this->failAction()->reload('sign-repair-detail'),
])->columns([
amisMake()->TableColumn()->name('batch_id')->label(__('workflow_log.batch_id')),
amisMake()->TableColumn()->name('check_name')->label(__('workflow_log.check_name')),
amisMake()->TableColumn()->name('check_user.name')->label(__('workflow_log.check_user_id')),
amisMake()->TableColumn()->name('check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()),
amisMake()->TableColumn()->name('checked_at')->label(__('workflow_log.checked_at')),
amisMake()->TableColumn()->name('remarks')->label(__('workflow_log.remarks')),
])
);
return $this->baseDetail()->id('sign-repair-detail')->title('')->onEvent([
return $this->baseDetail()->id($detailId)->title('')->onEvent([
'inited' => [
'actions' => [
['actionType' => 'reload', 'componentId' => 'sign-repair-checklog-table'],
['actionType' => 'reload', 'componentId' => $serviceId],
]
]
])->body([$detail, amisMake()->Divider(), $table]);
])->body([
$detail,
amisMake()->Divider(),
$this->baseWorkflowLogService($detailId)->id($serviceId),
]);
}
}

View File

@ -3,6 +3,7 @@
namespace App\Traits;
use App\Enums\CheckStatus;
use Slowlyo\OwlAdmin\Renderers\Service;
trait HasCheckActions
{
@ -58,4 +59,24 @@ trait HasCheckActions
))
->visibleOn('${workflow.check_status == '.CheckStatus::Processing->value.'}');
}
public function baseWorkflowLogService($reload = null): Service
{
return amis()->Service()
->initFetch(false)
->api(admin_url('api/workflow/logs?id=${workflow.id}'))
->body(
amis()->Table()->columnsTogglable(false)->columns([
amis()->TableColumn()->name('batch_id')->label(__('workflow_log.batch_id')),
amis()->TableColumn()->name('check_name')->label(__('workflow_log.check_name')),
amis()->TableColumn()->name('check_user.name')->label(__('workflow_log.check_user_id')),
amis()->TableColumn()->name('check_status')->label(__('workflow_log.check_status'))->set('type', 'mapping')->map(CheckStatus::options()),
amis()->TableColumn()->name('checked_at')->label(__('workflow_log.checked_at')),
amis()->TableColumn()->name('remarks')->label(__('workflow_log.remarks')),
])->itemActions([
$this->succesAction()->reload($reload),
$this->failAction()->reload($reload),
])
);
}
}