[BD]列表筛选-远程下拉的实现

85 阅读1分钟

一.后端

app\admin\controller\Api.php

<?php
    public function getGoodsStatus()
    {
        $list = $this->newProduct->getStatus();
        return $this->success('', [
            'list'   => $list,
            'total'  => count($list),
            'remark' => get_route_remark(),
        ]);
    }

二.前端表格

        column: [
            { type: 'selection', align: 'center', operator: false },
            { label: t('goods.id'), prop: 'id', align: 'center', width: 70, operator: false, sortable: 'custom' },
            // 远程下拉选择框
            { label: '状态', prop: 'status', comSearchRender: 'remoteSelect', remote: {
                // 主键,下拉 value
                pk: 'id',
                field: 'title',
                remoteUrl: '/index.php/admin/api/getGoodsStatus',
            }},
           ,
        ],