listData = DecLevelLog::lists($this->condition, $this->params, [ 'select' => 'LL.*, CU.USER_NAME,ADM.ADMIN_NAME', 'orderBy' => 'LL.CREATED_AT DESC, LL.ID DESC', 'from' => DecLevelLog::tableName() . ' AS LL', 'join' => [ ['LEFT JOIN', Admin::tableName() . ' AS ADM', 'LL.ADMIN_ID=ADM.ID'], ['LEFT JOIN', User::tableName() . ' AS CU', 'LL.USER_ID=CU.ID'], ], 'page' => $this->page, 'pageSize' => $this->pageSize, ]); } /** * 要展示和导出的所有字段 * @return array */ public function getColumn(){ $decLevelConfig = Cache::getDecLevelConfig(); if(!$this->columns){ $this->columns = [ 'ID' => null, 'USER_ID' => null, 'USER_NAME' => [ 'header' => '会员编号', 'headerOther' => ['width' => '150'], ], 'FROM_DEC_LV_NAME' => [ 'header' => '修改前级别', // 'headerOther' => [ // 'width' => '120', // ], 'value' => function($row) use($decLevelConfig) { return $decLevelConfig[$row['FROM_ID']]['LEVEL_NAME']; }, 'valueOther' => [ 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border'] ], ], 'TO_DEC_LV_NAME' => [ 'header' => '修改后级别', // 'headerOther' => [ // 'width' => '130', // ], 'value' => function($row) use($decLevelConfig) { return isset($decLevelConfig[$row['TO_ID']])?$decLevelConfig[$row['TO_ID']]['LEVEL_NAME']:''; }, 'valueOther' => [ 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border'] ], ], 'ADMIN_NAME' => [ 'header' => '操作管理员', // 'headerOther' => ['width' => '120'], ], 'CREATED_AT' => [ 'header' => '创建时间', 'value' => function($row) { return (new DateTime([ 'value' => $row['CREATED_AT'], ]))->result(); }, // 'headerOther' => ['width' => '170'], ], ]; } return $this->columns; } /** * 前台用于筛选的类型集合 * @return mixed */ public function getFilterTypes() { if(!$this->filterTypes){ $this->filterTypes = [ 'USER_NAME'=> ['isUserTable' => false,'name'=> '会员编号'], 'CREATED_AT' => ['isUserTable' => false, 'name' => '创建时间', 'other' => 'date'], 'ADMIN_NAME' => ['isUserTable' => false, 'name' => '操作管理员'], ]; } return $this->filterTypes; } }