表单功能完善

This commit is contained in:
2020-04-12 11:29:20 +08:00
parent bf0a61798b
commit 6560f723cd
2 changed files with 47 additions and 5 deletions

View File

@@ -115,10 +115,11 @@ class Form extends Base {
$list = $this->model->order('id desc')->paginate(25);
$this->data = array(
'grid' => $this->modelInfo['grid_list'],
'meta_title' => $this->modelInfo['title'] . '列表',
'form_id' => $form_id,
'list' => $list,
'page' => $list->render()
'page' => $list->render(),
);
return $this->fetch();
}
@@ -192,7 +193,7 @@ class Form extends Base {
$data = $this->request->post();
$result = FormAttr::create($data);
if (false !== $result) {
return $this->success('添加成功!', url('admin/form/attr?form_id='.$form_id));
return $this->success('添加成功!', url('/admin/form/attr', ['form_id'=>$form_id]));
}else{
return $this->error($this->Fattr->getError());
}
@@ -218,9 +219,9 @@ class Form extends Base {
}
if ($this->request->isPost()) {
$data = $request->post();
$result = $this->Fattr->save($data, array('id'=>$data['id']));
$result = FormAttr::update($data, array('id'=>$data['id']));
if (false !== $result) {
return $this->success('修改成功!', url('admin/form/attr?form_id='.$form_id));
return $this->success('修改成功!', url('/admin/form/attr', ['form_id'=>$form_id]));
}else{
return $this->error($this->Fattr->getError());
}

View File

@@ -7,6 +7,47 @@
<a class="btn btn-warning" href="{:url('/admin/form/lists')}"><i class="fa fa-reply"></i> 导出</a>
</div>
</div>
<div class="box-body"></div>
<div class="box-body">
<table class="table table-hover">
<thead>
<tr>
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
{volist name="grid" id="item"}
<th>{$item['title']}</th>
{/volist}
<th>操作</th>
</tr>
</thead>
<tbody>
{if condition="empty($list)"}
{php}
$cow = count($grid)+2;
{/php}
<tr>
<td colspan="{$cow}" align="center">暂无数据!</td>
</tr>
{else/}
{volist name="list" id="item"}
<tr>
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
{volist name="grid" id="vo"}
{if isset($vo['format'])}
<td>{$item[$vo['field']]|$vo['format']}</td>
{else/}
<td>{$item[$vo['field']]}</td>
{/if}
{/volist}
<td>
<a href="{:url('/admin/form/editdata', ['form_id' => $form_id,'id'=>$item['id']])}" >回复</a>
<a href="{:url('/admin/form/deldata', ['form_id' => $form_id,'id'=>$item['id']])}" class="ajax-get confirm">删除</a>
</td>
</tr>
{/volist}
{/if}
</tbody>
</table>
{$page|raw}
</div>
</div>
{/block}