98 lines
3.4 KiB
PHP
98 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\Models\ConstFlow;
|
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
|
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
|
use App\Services\Admin\ConstFlowService;
|
|
use Illuminate\Http\Request;
|
|
|
|
/**
|
|
* 费用明细
|
|
*
|
|
* @property ConstFlowService $service
|
|
*/
|
|
class ConstFlowController extends AdminController
|
|
{
|
|
protected string $serviceName = ConstFlowService::class;
|
|
|
|
public function list(): Page
|
|
{
|
|
$crud = $this->baseCRUD()
|
|
->filterTogglable(false)
|
|
->headerToolbar([
|
|
])
|
|
->filter(
|
|
$this->baseFilter()->body([
|
|
amisMake()->TextControl('name', '名称')->size('md'),
|
|
amisMake()->TextControl('card_no', '身份证')->size('md'),
|
|
amis('button')->label(__('admin.reset'))->actionType('clear-and-submit'),
|
|
amis('submit')->label(__('admin.search'))->level('primary'),
|
|
])->actions([])
|
|
)
|
|
->columns([
|
|
amisMake()->TableColumn('id', 'ID')->sortable(),
|
|
amisMake()->TableColumn('oldman.name', '客人'),
|
|
amisMake()->TableColumn('const_type', '缴费类型')->type('mapping')->map(ConstFlow::typeMapLabel())->className('text-primary'),
|
|
amisMake()->TableColumn('money', '金额'),
|
|
amisMake()->TableColumn('created_at', '办理时间')->type('datetime')->sortable(true),
|
|
amisMake()->Operation()->label(__('admin.actions'))->buttons([
|
|
$this->showFlow(),
|
|
]),
|
|
]);
|
|
|
|
return $this->baseList($crud);
|
|
}
|
|
|
|
public function form($isEdit = false): Form
|
|
{
|
|
return $this->baseForm()->body([
|
|
|
|
]);
|
|
}
|
|
|
|
public function showFlow(){
|
|
return amisMake()->DialogAction()->icon('fa-regular fa-eye')->label('费用清单')->level('link')->dialog(
|
|
amisMake()->Dialog()->title('查看详情')->body([
|
|
\amisMake()->Service()->schemaApi(admin_url('flow-list-tabs?id=${id}'))
|
|
])->size('lg')->actions([])
|
|
);
|
|
}
|
|
|
|
public function flowExtendList(Request $request)
|
|
{
|
|
$id = $request->input('id');
|
|
$rows = [];
|
|
$flow = $this->service->getDetail($id);
|
|
$rows = $this->service->makeFeelist($flow);
|
|
$page = amisMake()->CRUDTable()->affixHeader(false)
|
|
->headerToolbar([
|
|
'bulkActions',
|
|
])
|
|
->primaryField('ukey')
|
|
->bulkActions([
|
|
//打印明细
|
|
amisMake()->Button()->label('打印预览')->actionType('url')->blank(true)
|
|
->url(url('/print-const-flow').'?id=${id}&ukeys=${ids}')
|
|
])
|
|
->data([
|
|
'id' => $id,
|
|
'rows' => $rows
|
|
])
|
|
->title('')
|
|
->source('${rows}')
|
|
->combineNum(2)
|
|
->columns([
|
|
amisMake()->TableColumn()->name('name')->label('名称'),
|
|
amisMake()->TableColumn()->name('fee_name')->label('费用项'),
|
|
amisMake()->TableColumn()->name('fee_value')->label('费用')
|
|
])->affixRow([
|
|
// amis('text')->text('合计')->colSpan(2),
|
|
// amis('tpl')->tpl('${SUM(ARRAYMAP(rows, item => item.fee_value))}')
|
|
]);
|
|
return $this->response()->success($page);
|
|
}
|
|
}
|