PHP code example of nelsonkti / componentize

1. Go to this page and download the library: Download nelsonkti/componentize library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nelsonkti / componentize example snippets


use Nelsons\Componentize\Grid;
use Nelsons\Componentize\Form;

$grid = new Grid();
$grid->column('id', 'ID')->sortAble();
$grid->column('name', '商品名称')->copyable();

# 筛选器
$grid->filter(function (Grid\Filter $filter) {
    $filter->checkbox('export_node', '导出节点')->options(array(
                '11' => '不限', '22' => '待分配订单',
        ))->canCheckAll();
    $filter->datetimeRange('order_time', '订单时间')->date()
    $filter->select('order_number2', '订单号2')->options(array(
                '不限', '待分配订单', '已分配订单', '挂起订单', '已催收订单', '催收中订单'
    ));
});

# action
$grid->action(function (Grid\Action $action) {
    $action->create('新增员工', function (Form $form) {
        $form->title('新增员工');
        $form->text('name', '用户名称')->
    });
});

# 导出
$grid->export(function (Grid\Export $export) {
   $export->title('导出')->ajax('post:xxxxx')->async();
   $export->checkbox('export_node', '导出节点')->options(array(
    '11' => '不限', '22' => '待分配订单',
    ))->canCheckAll();
    $export->column('order_number', '订单号');
    $export->datetime('创建时间', 'create_time')->format('YYYY-MM-DD');
    $export->fields(function (Grid\Export\Fields $fields) {
        $fields->checkbox('order_number2222', '订单号2')->options(array(
            '不限', '待分配订单', '已分配订单', '挂起订单', '已催收订单', '催收中订单'
        ))->canCheckAll()->default(1);
    });
});

# 导入
$grid->import(function (Grid\Import $import) {
    $import->ajax('post:xxxx');
    $import->templateFileUrl('post:xxxx');
    $import->select('collection_label', '催收标签')->options(array(
        '自定义', '盲发订单', '盲发订单'
    ));
    $import->select('collection_user_id', '催收员')->options(array(
        '王五', '张六', '刘七'
    ));
});

# 统计
$grid->panel('statistics_list')->template('xxxxx');
$grid->echarts('order_statistic')->type('line');