121 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			121 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {extend name="../../base/view/common/base" /}
 | |
| {block name="breadcrumb"}
 | |
| <span class="layui-breadcrumb">
 | |
| 	<a href="http://www.meteteme.com/" target="_blank">江苏美天科技</a>
 | |
| 	<a href="/home/user/setting">信息设置</a>
 | |
| 	<a><cite>企业公告</cite></a>
 | |
| </span>
 | |
| {/block}
 | |
| <!-- 主体 -->
 | |
| {block name="body"}
 | |
| <div class="main-content">
 | |
| 	{include file="../../base/view/common/submenu" /}
 | |
| 	<div class="main-page-content">
 | |
| 		<div class="layui-form-bar">
 | |
| 			<button class="layui-btn layui-btn-sm add">+ 添加公告</button>
 | |
| 		</div>
 | |
| 		<table class="layui-hide" id="test" lay-filter="test"></table>
 | |
| 	</div>
 | |
| </div>
 | |
| <script type="text/html" id="barDemo">
 | |
| <div class="layui-btn-group"><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">查看</span><span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span></div>
 | |
| </script>
 | |
| {/block}
 | |
| <!-- /主体 -->
 | |
| 
 | |
| <!-- 脚本 -->
 | |
| {block name="script"}
 | |
| <script>
 | |
| const moduleInit = ['tool','editormd'];
 | |
| 	function gouguInit() {
 | |
| 		var table = layui.table,
 | |
| 			tool = layui.tool,
 | |
| 			form = layui.form;
 | |
| 
 | |
| 		layui.pageTable = table.render({
 | |
| 			elem: '#test',
 | |
| 			title: '公告列表',
 | |
| 			url: "/admin/note/index", //数据接口	
 | |
| 			page: true, //开启分页
 | |
| 			limit: 20,
 | |
| 			height: 'full-104',			
 | |
| 			cols: [
 | |
| 				[
 | |
| 					{
 | |
| 						field: 'id',
 | |
| 						title: '编号ID',
 | |
| 						align: 'center',
 | |
| 						width: 80,
 | |
| 						templet: function (d) {
 | |
| 							var html = 'N' + d.id;
 | |
| 							return html;
 | |
| 						}
 | |
| 					}, {
 | |
| 						field: 'sort',
 | |
| 						title: '排序',
 | |
| 						align: 'center',
 | |
| 						width: 80
 | |
| 					}, {
 | |
| 						field: 'cate_title',
 | |
| 						title: '公告分类',
 | |
| 						align: 'center',
 | |
| 						width: 100
 | |
| 					}, {
 | |
| 						field: 'title',
 | |
| 						title: '公告标题'
 | |
| 					}, {
 | |
| 						field: 'cate_title',
 | |
| 						title: '公告展示期间',
 | |
| 						align: 'center',
 | |
| 						width: 200,
 | |
| 						templet: function (d) {
 | |
| 							var html = d.start_time + ' ~ ' + d.end_time;
 | |
| 							return html;
 | |
| 						}
 | |
| 					}, {
 | |
| 						field: 'right',
 | |
| 						title: '操作',
 | |
| 						toolbar: '#barDemo',
 | |
| 						width: 136,
 | |
| 						align: 'center'
 | |
| 					}
 | |
| 				]
 | |
| 			]
 | |
| 		});
 | |
| 
 | |
| 		//表头工具栏事件
 | |
| 		$('.add').on('click', function () {
 | |
| 			tool.open('/admin/note/add');
 | |
| 		});
 | |
| 
 | |
| 		//监听行工具事件
 | |
| 		table.on('tool(test)', function (obj) {
 | |
| 			var data = obj.data;
 | |
| 			if (obj.event === 'view') {
 | |
| 				tool.open('/admin/note/view?id=' + data.id);
 | |
| 				return;
 | |
| 			}
 | |
| 			if (obj.event === 'edit') {
 | |
| 				tool.open('/admin/note/add?id=' + data.id);
 | |
| 				return;
 | |
| 			}
 | |
| 			if (obj.event === 'del') {
 | |
| 				layer.confirm('确定删除该公告吗?', {
 | |
| 					icon: 3,
 | |
| 					title: '提示'
 | |
| 				}, function (index) {
 | |
| 					let callback = function (e) {
 | |
| 						layer.msg(e.msg);
 | |
| 						if (e.code == 0) {
 | |
| 							obj.del();
 | |
| 						}
 | |
| 					}
 | |
| 					tool.delete("/admin/note/delete", { id: obj.data.id }, callback);
 | |
| 					layer.close(index);
 | |
| 				});
 | |
| 			}
 | |
| 		});
 | |
| 	}
 | |
| </script>
 | |
| {/block}
 | |
| <!-- /脚本 --> |