model = new ProductConfigModel(); $this->assign('varietyList', StockConfig::where('type_id', 'variety_name')->column('title', 'id')); $this->assign('packSpecsList', PackSpecsModel::column('title', 'id')); } //删除 #[Route('GET,JSON', 'index')] public function index() { if (false === $this->request->isAjax()) { return $this->fetch(); } if ($this->request->post('selectpage')) { return $this->selectpage(); } [$where, $order, $limit, $with] = $this->buildparams(); $list = $this->model ->alias('p') ->leftJoin('pack_specs s',"p.pack_specs_id = s.id") ->field('p.*,s.title as pack_specs_title,s.labor_cost_money,s.one_surcharge_money,s.two_surcharge_money') ->where($where) ->order($order) ->paginate($limit) ->each(function ($item, $key) { return $item; }); $result = ['total' => $list->total(), 'rows' => $list->items()]; return json($result); } //导入 #[Route("GET", "import")] public function import() { return "导入"; } //下载 #[Route("GET", "download")] public function download() { return "下载"; } }