fixed
This commit is contained in:
@@ -34,4 +34,39 @@ class Hdrquestionnaireanswer extends Backend
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['hdrquestionnairequestion'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
$row->visible(['id','answer','create_time']);
|
||||
$row->visible(['hdrquestionnairequestion']);
|
||||
$row->getRelation('hdrquestionnairequestion')->visible(['question']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ return [
|
||||
'Hdrquestionnairequestion_id' => '问卷问题ID',
|
||||
'Answer' => '问卷答案',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '更新时间'
|
||||
'Update_time' => '更新时间',
|
||||
'Hdrquestionnairequestion.question' => '问卷问题'
|
||||
];
|
||||
|
||||
@@ -37,4 +37,8 @@ class Hdrquestionnaireanswer extends Model
|
||||
|
||||
|
||||
|
||||
public function hdrquestionnairequestion()
|
||||
{
|
||||
return $this->belongsTo('Hdrquestionnairequestion', 'hdrquestionnairequestion_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'hdrquestionnairequestion_id', title: __('Hdrquestionnairequestion_id')},
|
||||
{field: 'answer', title: __('Answer'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'hdrquestionnairequestion.question', title: __('Hdrquestionnairequestion.question'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user