mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-05-22 06:49:15 +08:00
修改新闻处理
This commit is contained in:
parent
0d2871b732
commit
96f2c438a2
@ -7,6 +7,8 @@ use app\data\model\DataNewsMark;
|
||||
use app\data\service\NewsService;
|
||||
use think\admin\Controller;
|
||||
use think\admin\extend\CodeExtend;
|
||||
use think\admin\helper\QueryHelper;
|
||||
use think\admin\model\SystemBase;
|
||||
|
||||
/**
|
||||
* 文章内容管理
|
||||
@ -25,24 +27,14 @@ class Item extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->title = '文章内容管理';
|
||||
$query = DataNewsItem::mQuery();
|
||||
$query->like('mark,name')->dateBetween('create_at');
|
||||
$query->where(['deleted' => 0])->order('sort desc,id desc')->page();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章内容选择器
|
||||
* @login true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function select()
|
||||
{
|
||||
$query = DataNewsItem::mQuery();
|
||||
$query->equal('status')->like('name')->dateBetween('create_at');
|
||||
$query->where(['deleted' => 0])->order('sort desc,id desc')->page();
|
||||
$this->type = input('get.type', 'index');
|
||||
DataNewsItem::mQuery($this->get)->layTable(function () {
|
||||
$this->title = '文章内容管理';
|
||||
$this->marks = DataNewsMark::items();
|
||||
}, function (QueryHelper $query) {
|
||||
$query->where(['status' => intval($this->type === 'index'), 'deleted' => 0]);
|
||||
$query->like('name')->like('mark', ',')->dateBetween('create_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,4 +118,17 @@ class Item extends Controller
|
||||
{
|
||||
DataNewsItem::mDelete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章内容选择
|
||||
* @login true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function select()
|
||||
{
|
||||
$this->get['status'] = 1;
|
||||
$this->index();
|
||||
}
|
||||
}
|
@ -10,6 +10,19 @@ use think\admin\Model;
|
||||
*/
|
||||
class DataNewsMark extends Model
|
||||
{
|
||||
/**
|
||||
* 获取标签数据
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public static function items(): array
|
||||
{
|
||||
$query = static::mk()->where(['status' => 1, 'deleted' => 0]);
|
||||
return $query->field('id,name,remark')->order('sort desc,id desc')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化创建时间
|
||||
* @param string $value
|
||||
|
@ -86,7 +86,7 @@
|
||||
};
|
||||
if (data.value === '#') return input.val('#');
|
||||
if (data.value === 'LK') return /^https?:\/\//.test(input.val()) || input.val('#').focus();
|
||||
if (data.value === 'NS') return this.openModel('{:url("data/base.news/select")}');
|
||||
if (data.value === 'NS') return this.openModel('{:url("data/news.item/select")}');
|
||||
return window.setItemValue();
|
||||
});
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
{extend name="../../admin/view/main"}
|
||||
|
||||
{block name='content'}
|
||||
<form action="{:sysuri()}" class="layui-form layui-card" data-auto="true" method="post">
|
||||
<form action="{:sysuri()}" class="layui-card layui-form" data-auto="true" method="post">
|
||||
<div class="layui-card-body">
|
||||
|
||||
{notempty name='marks'}
|
||||
<div class="layui-form-item">
|
||||
<span class="help-label"><b>文章标签</b>Mark Name</span>
|
||||
<!--{notempty name='marks'}-->
|
||||
<div class="layui-form-item label-required-prev">
|
||||
<span class="help-label"><b>资讯标签</b>News Mark</span>
|
||||
<div class="layui-textarea help-checks">
|
||||
{foreach $marks as $tag}{if isset($vo.mark) && is_array($vo.mark) && in_array($tag.name, $vo.mark)}
|
||||
<label class="think-checkbox notselect"><input checked lay-ignore name="mark[]" type="checkbox" value="{$tag.name}"> {$tag.name}</label>
|
||||
@ -15,37 +15,30 @@
|
||||
{/if}{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/notempty}
|
||||
<!--{/notempty}-->
|
||||
|
||||
<div class="layui-form-item label-required-prev">
|
||||
<span class="help-label"><b>文章封面</b>Conver Image</span>
|
||||
<span class="help-label"><b>资讯封面</b>News Conver</span>
|
||||
<div class="relative block label-required-null">
|
||||
<input class="layui-input think-bg-gray" readonly name="cover" placeholder="请上传文章封面" required value='{$vo.cover|default=""}'>
|
||||
<a class="input-right-icon layui-icon layui-icon-upload" data-field="cover" data-file data-type="png,jpg,gif"></a>
|
||||
<script>$('[name="cover"]').uploadOneImage()</script>
|
||||
<input class="layui-input think-bg-gray" name="cover" placeholder="请上传资讯封面" readonly required value='{$vo.cover|default=""}'>
|
||||
<a class="layui-icon layui-icon-upload input-right-icon" data-file data-field="cover" data-type="gif,png,jpg,jpeg"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="help-label"><b>文章标题</b>Article Name</span>
|
||||
<input class="layui-input" name="name" placeholder="请输入文章标题" required value='{$vo.name|default=""}'>
|
||||
</label>
|
||||
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="help-label"><b>简介描述</b>Article Remark</span>
|
||||
<textarea class="layui-textarea" name="remark" placeholder="请输入简介描述" required>{$vo.remark|default=''}</textarea>
|
||||
<span class="help-label"><b>资讯标题</b>News Title</span>
|
||||
<input class="layui-input" name="name" placeholder="请输入资讯标题" required value='{$vo.name|default=""}'>
|
||||
</label>
|
||||
|
||||
<div class="layui-form-item label-required-prev">
|
||||
<span class="help-label"><b>富文本内容</b>Article Content</span>
|
||||
<span class="help-label"><b>资讯内容</b>News Content</span>
|
||||
<label class="relative block">
|
||||
<textarea class="layui-textarea" name="content" placeholder="请输入文章内容">{$vo.content|default=''}</textarea>
|
||||
<textarea class="layui-hide" name="content" placeholder="请输入资讯内容">{$vo.content|default=''}</textarea>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
{notempty name='vo.id'}<input name='id' type='hidden' value='{$vo.id}'>{/notempty}
|
||||
{notempty name='vo.code'}<input name='code' type='hidden' value='{$vo.code}'>{/notempty}
|
||||
|
||||
<div class="layui-form-item text-center">
|
||||
<button class="layui-btn" type="submit">保存数据</button>
|
||||
@ -57,7 +50,8 @@
|
||||
|
||||
<script>
|
||||
require(['ckeditor'], function () {
|
||||
window.createEditor('[name=content]', {height: 300});
|
||||
$('input[name="cover"]').uploadOneImage();
|
||||
window.createEditor('[name=content]', {height: 350});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
{/block}
|
||||
|
@ -1,78 +1,98 @@
|
||||
{extend name="../../admin/view/main"}
|
||||
{extend name='../../admin/view/table'}
|
||||
|
||||
{block name="button"}
|
||||
<!--{if auth("add")}-->
|
||||
<button class='layui-btn layui-btn-sm layui-btn-primary' data-open='{:url("add")}'>添加文章</button>
|
||||
<button data-open='{:url("add")}' class='layui-btn layui-btn-sm layui-btn-primary'>添加资讯</button>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("remove")}-->
|
||||
<button class='layui-btn layui-btn-sm layui-btn-primary' data-action='{:url("remove")}' data-confirm="确定要删除这些文章吗?" data-rule="id#{key}">删除文章</button>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("news.mark/index")}-->
|
||||
<button class='layui-btn layui-btn-sm layui-btn-primary' data-modal='{:url("news.mark/index")}' data-title="标签管理" data-width="900px">标签管理</button>
|
||||
<button data-action='{:url("remove")}' data-table-id="NewsTable" data-rule="id#{id}" data-confirm="确定要批量删除资讯吗?" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</button>
|
||||
<!--{/if}-->
|
||||
{/block}
|
||||
|
||||
{block name='content'}
|
||||
<div class="think-box-shadow">
|
||||
{include file='news/item/index_search'}
|
||||
<table class="layui-table margin-top-10" lay-skin="line">
|
||||
{notempty name='list'}
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='list-table-check-td think-checkbox'>
|
||||
<label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
|
||||
</th>
|
||||
<th class='list-table-sort-td'>
|
||||
<button class="layui-btn layui-btn-xs" data-reload type="button">刷 新</button>
|
||||
</th>
|
||||
<th class="text-left nowrap">文章编号</th>
|
||||
<th class="text-left nowrap">文章名称</th>
|
||||
<th class="text-left nowrap">搜索标签</th>
|
||||
<th class="text-left nowrap">文章状态</th>
|
||||
<th class="text-left nowrap">创建时间</th>
|
||||
<th class="text-left nowrap"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
{/notempty}
|
||||
<tbody>
|
||||
{foreach $list as $key=>$vo}
|
||||
<tr>
|
||||
<td class='list-table-check-td think-checkbox'>
|
||||
<label><input class="list-check-box" type='checkbox' value='{$vo.id}'></label>
|
||||
</td>
|
||||
<td class='list-table-sort-td'>
|
||||
<label><input class="list-sort-input" data-action-blur="{:sysuri()}" data-loading="false" data-value="id#{$vo.id};action#sort;sort#{value}" value="{$vo.sort}"></label>
|
||||
</td>
|
||||
<td class="text-left nowrap">{$vo.code|default=''}</td>
|
||||
<td class="text-left nowrap">{$vo.name|default=''}</td>
|
||||
<td class="text-left nowrap">{notempty name='vo.mark'}{foreach $vo.mark as $tag}<span class="margin-right-5 layui-badge layui-bg-cyan">{$tag}</span>{/foreach}{/notempty}<br></td>
|
||||
<td class="text-left nowrap">{if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">已激活</span>{/if}</td>
|
||||
<td class="text-left nowrap">{$vo.create_at|format_datetime}</td>
|
||||
<td class='text-left nowrap'>
|
||||
|
||||
<!--{if auth("edit")}-->
|
||||
<a class="layui-btn layui-btn-sm" data-open="{:url('edit')}?id={$vo.id}">编 辑</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("state") and $vo.status eq 1}-->
|
||||
<a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#0">禁 用</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("state") and $vo.status eq 0}-->
|
||||
<a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#1">激 活</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("remove")}-->
|
||||
<a class="layui-btn layui-btn-sm layui-btn-danger" data-action="{:url('remove')}" data-confirm="确定要删除该文章吗?" data-value="id#{$vo.id}">删 除</a>
|
||||
<!--{/if}-->
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
|
||||
{block name="content"}
|
||||
<div class="layui-tab layui-tab-card">
|
||||
<ul class="layui-tab-title">
|
||||
{foreach ['index'=>'资讯管理','recycle'=>'回 收 站'] as $k=>$v}{if isset($type) and $type eq $k}
|
||||
<li data-open="{:url('index')}?type={$k}" class="layui-this color-green">{$v}</li>
|
||||
{else}
|
||||
<li data-open="{:url('index')}?type={$k}">{$v}</li>
|
||||
{/if}{/foreach}
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
{include file='news/item/index_search'}
|
||||
<table id="NewsTable" data-url="{:sysuri()}" data-target-search="form.form-search"></table>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name='script'}
|
||||
<script>
|
||||
$(function () {
|
||||
// 初始化表格组件
|
||||
$('#NewsTable').layTable({
|
||||
even: true, height: 'full',
|
||||
sort: {field: 'sort desc,code', type: 'desc'},
|
||||
where: {type: '{$type|default="index"}'},
|
||||
cols: [[
|
||||
{checkbox: true, fixed: true},
|
||||
{field: 'sort', title: '排序权重', align: 'center', width: 100, sort: true, templet: '#SortInputTpl'},
|
||||
{field: 'id', title: 'ID', align: "left", width: 80},
|
||||
/* {notempty name='marks'} */
|
||||
{
|
||||
field: 'mark', title: '资讯标签', align: 'left', minWidth: 100, templet: function (d) {
|
||||
return (d.html = ''), d.mark.forEach(function (val) {
|
||||
d.html += '<span class="layui-badge layui-bg-blue">' + val + '</span>';
|
||||
}), d.html;
|
||||
}
|
||||
},
|
||||
/* {/marks} */
|
||||
{field: 'name', title: '资讯标题', align: 'left', minWidth: 140},
|
||||
{field: 'num_read', title: '阅读数', align: 'center', minWidth: 80, sort: true, style: 'color:blue;font-size:16px'},
|
||||
{field: 'status', title: '状态', align: 'center', minWidth: 110, templet: '#StatusSwitchTpl'},
|
||||
{field: 'create_at', title: '创建时间', align: 'center', minWidth: 170, sort: true},
|
||||
{toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 160, fixed: 'right'},
|
||||
]]
|
||||
});
|
||||
|
||||
// 数据状态切换操作
|
||||
layui.form.on('switch(StatusSwitch)', function (obj) {
|
||||
var data = {id: obj.value, status: obj.elem.checked > 0 ? 1 : 0};
|
||||
$.form.load("{:url('state')}", data, 'post', function (ret) {
|
||||
if (ret.code < 1) $.msg.error(ret.info, 3, function () {
|
||||
$('#NewsTable').trigger('reload');
|
||||
}); else {
|
||||
$('#NewsTable').trigger('reload');
|
||||
}
|
||||
return false;
|
||||
}, false);
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<!-- 列表排序权重模板 -->
|
||||
<script type="text/html" id="SortInputTpl">
|
||||
<input type="number" min="0" data-blur-number="0" data-action-blur="{:sysuri()}" data-value="id#{{d.id}};action#sort;sort#{value}" data-loading="false" value="{{d.sort}}" class="layui-input text-center">
|
||||
</script>
|
||||
|
||||
<!-- 数据状态切换模板 -->
|
||||
<script type="text/html" id="StatusSwitchTpl">
|
||||
<!--{if auth("state")}-->
|
||||
<input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="已激活|已禁用" lay-filter="StatusSwitch" {{d.status>0?'checked':''}}>
|
||||
<!--{else}-->
|
||||
{{d.status ? '<b class="color-green">已启用</b>' : '<b class="color-red">已禁用</b>'}}
|
||||
<!--{/if}-->
|
||||
</script>
|
||||
|
||||
<!-- 数据操作工具条模板 -->
|
||||
<script type="text/html" id="toolbar">
|
||||
<!--{if auth("edit") and isset($type) and $type eq 'index'}-->
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm" data-open='{:url("edit")}?id={{d.id}}'>编 辑</a>
|
||||
<!--{/if}-->
|
||||
|
||||
<!--{if auth("remove") and isset($type) and $type neq 'index'}-->
|
||||
<a class="layui-btn layui-btn-danger layui-btn-sm" data-action="{:url('remove')}" data-value="id#{{d.id}}" data-confirm="确定要删除资讯吗?">删 除</a>
|
||||
<!--{/if}-->
|
||||
</script>
|
||||
{/block}
|
@ -1,17 +1,27 @@
|
||||
<fieldset>
|
||||
<legend>条件搜索</legend>
|
||||
<form action="{:sysuri()}" autocomplete="off" class="layui-form layui-form-pane form-search" method="get" onsubmit="return false">
|
||||
|
||||
<!-- {notempty name='marks'} -->
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">文章标题</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" name="name" placeholder="请输入文章标题" value="{$get.name|default=''}">
|
||||
</label>
|
||||
<label class="layui-form-label">资讯标签</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="mark" lay-search class="layui-select">
|
||||
<option value=''>-- 资讯标签 --</option>
|
||||
{foreach $marks as $mark}{if isset($get.mark) and $mark eq $get.mark}
|
||||
<option selected value="{$mark.name}">{$mark.name}</option>
|
||||
{else}
|
||||
<option value="{$mark.name}">{$mark.name}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- {/notempty} -->
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">搜索标签</label>
|
||||
<label class="layui-form-label">资讯标题</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" name="mark" placeholder="请输入搜索标签" value="{$get.mark|default=''}">
|
||||
<input class="layui-input" name="name" placeholder="请输入资讯标题" value="{$get.name|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -20,8 +30,8 @@
|
||||
<div class="layui-input-inline">
|
||||
<select class="layui-select" name="status">
|
||||
<option value=''>-- 全部 --</option>
|
||||
{foreach ['显示禁止的文章', '显示正常的文章'] as $k=>$v}
|
||||
{if $k.'' eq input('status')}
|
||||
{foreach ['显示禁用的资讯', '显示正常的资讯'] as $k=>$v}
|
||||
{if isset($get.status) and $get.status eq $k.''}
|
||||
<option selected value="{$k}">{$v}</option>
|
||||
{else}
|
||||
<option value="{$k}">{$v}</option>
|
||||
|
@ -1,41 +1,77 @@
|
||||
{extend name="../../admin/view/full"}
|
||||
{block name="content"}
|
||||
<div class="iframe-pagination notfooter">
|
||||
<fieldset>
|
||||
<legend>条件搜索</legend>
|
||||
<form action="{:sysuri()}" id="NewsTableSearch" autocomplete="off" class="layui-form layui-form-pane form-search" method="get" onsubmit="return false">
|
||||
|
||||
{block name='content'}
|
||||
<div class="iframe-pagination">
|
||||
{include file='news/item/select_search'}
|
||||
<table class="layui-table" lay-skin="line">
|
||||
{notempty name='list'}
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文章标题</th>
|
||||
<th>文章状态</th>
|
||||
<th>创建时间</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
{/notempty}
|
||||
<tbody>
|
||||
{foreach $list as $key => $vo}
|
||||
<tr>
|
||||
<td class="nowrap">{$vo.name|default=''}</td>
|
||||
<td>{if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">已激活</span>{/if}</td>
|
||||
<td>{$vo.create_at|format_datetime}</td>
|
||||
<td class='text-right'><a class="layui-btn layui-btn-sm layui-btn-normal" data-item="{$vo.code}">选择文章</a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">资讯标签</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="mark" class="layui-select" lay-search>
|
||||
<option value=''>-- 资讯标签 --</option>
|
||||
{foreach $marks as $mark}{if isset($get.mark) and $mark.code eq $get.mark}
|
||||
<option selected value="{$mark.code}">{$mark.name} ( {$mark.code} )</option>
|
||||
{else}
|
||||
<option value="{$mark.code}">{$mark.name} ( {$mark.code} )</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">资讯标题</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" name="name" placeholder="请输入资讯标题" value="{$get.name|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">创建时间</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" data-date-range name="create_at" placeholder="请选择创建时间" value="{$get.create_at|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-primary"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
<table id="NewsTable" data-url="{:sysuri()}" data-target-search="#NewsTableSearch"></table>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name='script'}
|
||||
<script>
|
||||
$(function () {
|
||||
$.form.reInit(), $('[data-item]').on('click', function () {
|
||||
top.setItemValue(this.getAttribute('data-item') || '');
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
// 初始化表格组件
|
||||
$('#NewsTable').layTable({
|
||||
even: true, height: 'full',
|
||||
sort: {field: 'sort desc,id', type: 'desc'},
|
||||
cols: [[
|
||||
{field: 'id', title: 'ID', align: 'center', width: 60, sort: true},
|
||||
{field: 'mark', title: '资讯标签', align: 'center', width: 100},
|
||||
{field: 'name', title: '资讯标题', align: 'left', minWidth: 140},
|
||||
{field: 'num_read', title: '阅读数', align: 'center', width: 80, sort: true, style: 'color:blue;font-size:16px'},
|
||||
{field: 'status', title: '状态', align: 'center', width: 80, templet: '#StatusSwitchTpl'},
|
||||
{field: 'create_at', title: '创建时间', align: 'center', width: 170, sort: true},
|
||||
{toolbar: '#toolbar', title: '操作', align: 'center', width: 100}
|
||||
]]
|
||||
}).trigger('tool', function (item) {
|
||||
window.setItemValue(item.data.id, item.data.name);
|
||||
item.tr.parents('div.layui-layer-page').find('a.layui-layer-close').trigger('click');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- 操作工具条模板 -->
|
||||
<script type="text/html" id="toolbar">
|
||||
<a class="layui-btn layui-btn-sm" lay-event="select">选 择</a>
|
||||
</script>
|
||||
|
||||
<!-- 数据状态切换模板 -->
|
||||
<script type="text/html" id="StatusSwitchTpl">
|
||||
{{d.status ? '<b class="color-green">已激活</b>' : '<b class="color-red">已禁用</b>'}}
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
|
@ -1,36 +0,0 @@
|
||||
<fieldset>
|
||||
<legend>条件搜索</legend>
|
||||
<form action="{:sysuri()}" autocomplete="off" class="layui-form layui-form-pane form-search" method="get" onsubmit="return false">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">文章标题</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" name="name" placeholder="请输入文章标题" value="{$get.name|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">使用状态</label>
|
||||
<div class="layui-input-inline">
|
||||
<select class="layui-select" name="status">
|
||||
{foreach [''=>'-- 全部 --','0'=>'显示禁止的文章','1'=>'显示正常的文章'] as $k=>$v}
|
||||
{if $k.'' eq input('status')}
|
||||
<option selected value="{$k}">{$v}</option>
|
||||
{else}
|
||||
<option value="{$k}">{$v}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">创建时间</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" data-date-range name="create_at" placeholder="请选择创建时间" value="{$get.create_at|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-primary"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
Loading…
x
Reference in New Issue
Block a user