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'], ['INNER 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' => Yii::t('ctx', 'memberCode'), 'headerOther' => ['minWidth' => '120'], ], 'FROM_DEC_LV_NAME' => [ 'header' => Yii::t('ctx', 'levelBeforeModification'), 'headerOther' => ['minWidth' => '110'], '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' => Yii::t('ctx', 'modifiedLevel'), 'headerOther' => ['minWidth' => '120'], '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' => Yii::t('ctx', 'operationAdministrator'), 'headerOther' => ['minWidth' => '100'], ], 'CREATED_AT' => [ 'header' => Yii::t('ctx', 'createAt'), 'value' => function($row) { return (new DateTime([ 'value' => $row['CREATED_AT'], ]))->result(); }, 'headerOther' => ['minWidth' => '100'], ], ]; } return $this->columns; } /** * 前台用于筛选的类型集合 * @return mixed */ public function getFilterTypes() { if(!$this->filterTypes){ $this->filterTypes = [ 'USER_NAME'=> ['isUserTable' => false,'name'=> Yii::t('ctx', 'memberCode')], 'CREATED_AT' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'createAt'), 'other' => 'date'], 'ADMIN_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'operationAdministrator')], ]; } return $this->filterTypes; } }