Files
ulthon_admin/app/admin/service/curd/templates/controller/exportMethod.code

25 lines
966 B
Plaintext

/**
* @NodeAnotation(title="导出")
*/
public function export()
{
list($page, $limit, $where) = $this->buildTableParames();
$this->model = $this->model{{relationIndexMethod}};
$fields = $this->request->param('fields', '{}', null);
$image_fields = $this->request->param('image_fields', '{}', null);
$select_fields = $this->request->param('select_fields', '{}', null);
$date_fields = $this->request->param('date_fields', '{}', null);
$fields = json_decode($fields, true);
$image_fields = json_decode($image_fields, true);
$select_fields = json_decode($select_fields, true);
$date_fields = json_decode($date_fields, true);
$content = \app\common\tools\ExcelTools::exportModel($this->model, $where, $fields, $image_fields, $select_fields, $date_fields);
return download($content, $this->model->getName() . date('YmdHis') . '.xlsx', true);
}