修改apps/dmin/model/content/ormmodel.html 增加
// pbootcms二开网站建设自定义表单增加搜索字段查找
public function findFormField($table, $page, $type, $keyword)
{
return parent::table($table)
->like($type, $keyword)
->order('id ASC')
->decode(false)
->page($page)
->select();
}
// 全部字段查找
public function findFormFieldAll($table, $page, $typeall, $keyword)
{
return parent::table($table)
->like($typeall, $keyword)
->order('id ASC')
->decode(false)
->page($page)
->select();
}
修改appsdmincontrollercontentormcontroller.html
文件开始的注释 //自定义表单列表 下内容为
// 自定义表单列表
public function index()
{
if ((! ! $fcode = get('fcode', 'var')) && $form = $this->model->getFormByCode($fcode)) {
$this->assign('form', $form);
if (get('action') == 'showdata') {
$this->assign('showdata', true);
$this->assign('fields', $this->model->getFormFieldByCode($fcode)); // 获取字段
$table = $this->model->getFormTableByCode($fcode);
//查找
if (get('keyword')) {
if ($type = get('type')) {
$result = $this->model->findFormField($table, true, get('type'), get('keyword'));
} else {
$fields = $this->model->getFormFieldByCode($fcode);
foreach ($fields as $key => $value) {
$typeall = $value->name.','.$typeall;
}
$typeall = substr($typeall, 0, strlen($typeall)-1);
$result = $this->model->findFormFieldAll($table, true, $typeall, get('keyword'));
}
$this->assign('formdata', $result);
} elseif (get('export')) {
$this->assign('formdata', $this->model->getFormData($table, false));
header('Content-Type:application/vnd.ms-excel');
header('Cache-Control: max-age=0');
header("Content-Disposition:filename=" . $form->form_name . "-" . date("YmdHis") . ".xls");
$this->display('content/exform.html');
} else {
$this->assign('formdata', $this->model->getFormData($table, true));
}
}
if (get('action') == 'showfield') {
$this->assign('showfield', true);
$this->assign('fields', $this->model->getFormFieldByCode($fcode));
}
} else {
$this->assign('list', true);
if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
$result = $this->model->findForm($field, $keyword);
} else {
$result = $this->model->getList();
}
$this->assign('forms', $result);
}
$this->display('content/form.html');
}
修改 ppsdminiewdefaultcontentorm.html 文件 大概 81行
{if([$showdata])} {if}中间内容替换为
<div class="layui-tab layui-tab-brief" lay-filter="tab">
<ul class="layui-tab-title">
<li class="layui-this" lay-id="t1">{$form->form_name} — 数据</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<!--搜索-->
<form action="{url./admin/Form/index/fcode/'.[$form->fcode].'}" method="get" class="layui-form">
<div class="layui-form-item nospace">
<div class="layui-input-inline">
{$pathinfo}
{php}$type = get('type');{/php}
<select name="type">
<option value="">全部</option>
{foreach $fields(key2,value2,num2)}
<option value="[value2->name]">[value2->description]</option>
{/foreach}
</select>
</div>
<div class="layui-input-inline">
<input type="text" name="keyword" value="{$get.keyword}" placeholder="请输入搜索关键字" class="layui-input">
</div>
<div class="layui-input-inline">
<button class="layui-btn" lay-submit onclick="submit();">搜索</button>
<a class="layui-btn layui-btn-primary" href="{url./admin/Form/index/fcode/'.[$form->fcode].'/action/showdata}">清除搜索</a>
</div>
</div>
</form>
<!--搜索栏结束-->
<form action="{url./admin/Form/del/fcode/'.[$form->fcode].'}/action/deldata" method="post" id="contentForm" name="contentForm" class="layui-form" onkeydown="if(event.keyCode==13) return false;">
<input type="hidden" name="formcheck" value="{$formcheck}">
<table class="layui-table">
<thead>
<tr>
<th width="10"><input type="checkbox" class="checkbox" lay-ignore id="checkall" title="全选"></th>
<th width="30">序号</th>
{foreach $fields(key2,value2,num2)}
<th>[value2->description]</th>
{/foreach}
<th width="150">时间</th>
<th width="150">操作</th>
</tr>
</thead>
<tbody>
{foreach $formdata(key,value,num)}
<tr>
<td><input type="checkbox" class="checkbox checkitem" lay-ignore name="list[]" value="[value->id]" id="checka"></td>
<td>[num]</td>
{foreach $fields(key2,value2,num2)}
{php} $field=$value2->name {/php}
<td>[value->$field]</td>
{/foreach}
<td>[value->create_time]</td>
<td>
<a href="{url./admin/Form/del/id/'.$value->id.'/fcode/'.[$form->fcode].'/action/deldata}" onclick="return confirm('您确定要删除么?')" class="layui-btn layui-btn-xs layui-btn-danger" style="margin-bottom:0px" title="删除">删除</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
<div class="layui-btn-group">
{if(session('ucode')==10001 && [$formdata])}
<a href="{url./admin/Form/clear/fcode/'.[$form->fcode].'}" onclick='return confirm("您确定要清空么?")' class="layui-btn layui-btn-sm">清空记录</a>
{/if}
{if([$formdata])}
<a href="{url./admin/Form/index/fcode/'.[$form->fcode].'/action/showdata/export/1}" class="layui-btn layui-btn-sm">导出记录</a>
{/if}
</div>
<div class="page">{$pagebar}</div>
</form>
</div>
</div>
</div>
插件下载说明
未提供下载提取码的插件,都是站长辛苦开发,需收取费用!想免费获取辛苦开发插件的请绕道!
织梦二次开发QQ群
本站客服QQ号:3149518909(点击左边QQ号交流),群号(383578617) 如果您有任何织梦问题,请把问题发到群里,阁主将为您写解决教程!
转载请注明: 织梦模板 » pbootcms二开网站建设自定义表单增加搜索