You've already forked think-plugs-notice
[notice]通知公告
This commit is contained in:
99
src/view/broadcast/form.html
Normal file
99
src/view/broadcast/form.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<form action="{:sysuri()}" method="post" data-auto="true" class="layui-form layui-card" data-table-id="DeptTable">
|
||||
<div class="layui-card-body padding-left-40">
|
||||
<fieldset class="layui-bg-gray">
|
||||
<legend><b class="layui-badge think-bg-violet">基础信息</b></legend>
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="help-label"><b>标题</b></span>
|
||||
<input maxlength="100" class="layui-input" name="title" value='{$vo.title|default=""}' required vali-name="标题" placeholder="请输入标题">
|
||||
</label>
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="help-label"><b>类型</b></span>
|
||||
<select name="type" lay-search="{fuzzy: true}" lay-creatable="" required vali-name="类型" class="layui-select">
|
||||
<option value="">请选择或输入类型</option>
|
||||
{foreach $types as $type}{if isset($vo.type) and $type.type eq $vo.type}
|
||||
<option selected value="{$type.type}">{$type.type}</option>
|
||||
{else}
|
||||
<option value="{$type.type}">{$type.type}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</label>
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="help-label"><b>内容</b></span>
|
||||
<textarea class="layui-textarea" name="content" style="width: 100%" placeholder="请输入内容">
|
||||
{$vo.title|default=""}
|
||||
</textarea>
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset class="layui-bg-gray">
|
||||
<legend><b class="layui-badge think-bg-violet">通知人</b></legend>
|
||||
{notempty name='vo.id'}
|
||||
<input type="checkbox" lay-filter="rebroadcast" lay-skin="tag" lay-text="重新发送通知" name="rebroadcast" value='1'>
|
||||
<script>
|
||||
$(function () {
|
||||
$(".rebroadcast").hide()
|
||||
})
|
||||
</script>
|
||||
{/notempty}
|
||||
|
||||
<div class="layui-form-item rebroadcast">
|
||||
<input type="checkbox" lay-filter="to_all" lay-skin="tag" lay-text="通知所有人" name="to_all" value='1'>
|
||||
</div>
|
||||
<div class="layui-form-item rebroadcast" id="to_depts">
|
||||
<label class="layui-form-label"><span class="help-label"><b>通知部门</b></span></label>
|
||||
<div class="layui-input-block">
|
||||
{foreach $depts as $dept}
|
||||
<input type="checkbox" lay-filter="to_depts" lay-skin="tag" lay-text="{$dept.name}" name="to_depts[]" value='{$dept.id}'>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
{notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
|
||||
<input type="hidden" name="to" value='{$vo.to|default=""}'>
|
||||
|
||||
<div class="layui-form-item text-center">
|
||||
<button class="layui-btn" type='submit'>{:lang('保存数据')}</button>
|
||||
<button class="layui-btn layui-btn-danger" type='button' data-confirm="{:lang('确定要取消编辑吗?')}" data-close>{:lang('取消编辑')}</button>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
$(function () {
|
||||
layui.use(['form'], function () {
|
||||
const Form = layui.form;
|
||||
Form.on('checkbox(to_all)', function (data) {
|
||||
if (data.elem.checked) {
|
||||
$('input[name="to"]').val('所有人')
|
||||
$('#to_depts').hide()
|
||||
$('select[name="to_depts"]').attr('disabled', true)
|
||||
} else {
|
||||
$('input[name="to"]').val(
|
||||
$('input[lay-filter="to_depts"]').filter(function (index, element) {
|
||||
return element.checked;
|
||||
}).map(function (index,element) {
|
||||
return $(element).attr('title')
|
||||
}).toArray().join(',')
|
||||
)
|
||||
$('#to_depts').show()
|
||||
}
|
||||
})
|
||||
Form.on('checkbox(to_depts)', function (data) {
|
||||
$('input[name="to"]').val(
|
||||
$('input[lay-filter="to_depts"]').filter(function (index, element) {
|
||||
return element.checked;
|
||||
}).map(function (index,element) {
|
||||
return $(element).attr('title')
|
||||
}).toArray().join(',')
|
||||
)
|
||||
})
|
||||
Form.on('checkbox(rebroadcast)', function (data) {
|
||||
if (data.elem.checked) {
|
||||
$('.rebroadcast').show()
|
||||
} else {
|
||||
$('.rebroadcast').hide()
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
</script>
|
||||
50
src/view/broadcast/index.html
Normal file
50
src/view/broadcast/index.html
Normal file
@@ -0,0 +1,50 @@
|
||||
{extend name='table'}
|
||||
|
||||
{block name="button"}
|
||||
<!--{if auth("add")}-->
|
||||
<a class="layui-btn layui-btn-sm" data-modal="{:url('add')}" data-title="新增通知公告" data-height="100%">{:lang('新 增')}</a>
|
||||
<!--{/if}-->
|
||||
<!--{if auth("remove")}-->
|
||||
<a data-confirm="{:lang('确定删除这些记录吗?')}" data-table-id="FileTable" data-action='{:url("remove")}' data-rule="id#{id}" class='layui-btn layui-btn-sm layui-btn-primary'>{:lang('批量删除')}</a>
|
||||
<!--{/if}-->
|
||||
{/block}
|
||||
|
||||
{block name="content"}
|
||||
<div class="think-box-shadow" style="flex: 4">
|
||||
{include file="broadcast/index_search"}
|
||||
<table class="layui-hide" id="BroadcastTable" data-url="{:request()->url()}" data-target-search="form.form-search" lay-filter="BroadcastTable"></table>
|
||||
</div>
|
||||
<script type="text/html" id="ToolbarTpl">
|
||||
<div class="layui-btn-container">
|
||||
<!--{if auth("edit")}-->
|
||||
<a class="layui-btn layui-btn-xs" data-modal="{:url('edit')}?id={{d.id}}" data-title="编辑通知公告">{:lang('编 辑')}</a>
|
||||
<!--{/if}-->
|
||||
<!--{if auth("remove")}-->
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" data-confirm="{:lang('确定删除该记录吗?')}" data-action="{:url('remove')}" data-value="id#{{d.id}}">{:lang('删 除')}</a>
|
||||
<!--{/if}-->
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#BroadcastTable').layTable({
|
||||
height: 'full',
|
||||
sort: ['create_at', 'desc'],
|
||||
cols: [[
|
||||
{checkbox: true, fixed: true},
|
||||
{ field: 'id', title: '序号', width: 80 },
|
||||
{ field: 'title', title: '标题', width: 200 },
|
||||
{ field: 'type', title: '类型', width: 120 },
|
||||
{ field: 'content', title: '内容' },
|
||||
{ field: 'to', title: '通知用户' },
|
||||
{ field: 'create_at', title: '创建时间', width: 200, sort: true },
|
||||
{ fixed: "right", title: "操作", width: 200, align: "center", toolbar: "#ToolbarTpl"}
|
||||
]],
|
||||
page: true
|
||||
})
|
||||
layui.use(['form', 'table'], function () {
|
||||
const Table = layui.table;
|
||||
const Form = layui.form;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
{/block}
|
||||
30
src/view/broadcast/index_search.html
Normal file
30
src/view/broadcast/index_search.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<fieldset>
|
||||
<legend>{:lang('条件搜索')}</legend>
|
||||
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="post" autocomplete="off">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">{:lang('内容')}</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="name" value="{$get.content|default=''}" placeholder="{:lang('内容')}" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">{:lang('通知类型')}</label>
|
||||
<label class="layui-input-inline">
|
||||
<select name="status">
|
||||
<option value="">{:lang('请选择通知类型')}</option>
|
||||
{foreach $types as $type}
|
||||
{if isset($get.type) and $get.type eq $type.type}
|
||||
<option selected value="{$type.type}">{$type.type}</option>
|
||||
{else}
|
||||
<option value="{$type.type}">{$type.type}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-primary"><i class="layui-icon"></i> {:lang('搜 索')}</button>
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
11
src/view/broadcast/view.html
Normal file
11
src/view/broadcast/view.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">通知公告</div>
|
||||
<div class="layui-card-body">
|
||||
<h1>{$vo.title}</h1>
|
||||
<hr>
|
||||
<p>{$vo.content}</p>
|
||||
<hr>
|
||||
<p style="text-align: right">通知时间:{$vo.create_at}</p>
|
||||
<p style="text-align: right">通知人:{$vo.creator.name|default='通知人员'}</p>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user