<!DOCTYPE html>
|
<html lang="en">
|
<head>
|
<meta charset="utf-8">
|
<title></title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all">
|
<!-- <link rel="stylesheet" href="../../static/css/cool.css" media="all">-->
|
<!-- <link rel="stylesheet" href="../../static/css/common.css" media="all">-->
|
<!--[if lt IE 9]>
|
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
<![endif]-->
|
</head>
|
<body>
|
|
<!-- 正文开始 -->
|
<div class="layui-fluid">
|
<div class="layui-card">
|
<div class="layui-card-body">
|
<!-- 表格顶部工具栏 -->
|
<div class="layui-form toolbar">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label w-auto">课程名称:</label>
|
<div class="layui-input-inline mr0">
|
<input name="experimentTypeName" class="layui-input" type="text" placeholder="输入课程名称"/>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<button class="layui-btn icon-btn" lay-filter="eCourseTbSearch" lay-submit>
|
<i class="layui-icon"></i>搜索
|
</button>
|
<button id="eCourseAddBtn" class="layui-btn icon-btn"><i class="layui-icon"></i>添加
|
</button>
|
</div>
|
</div>
|
</div>
|
<table id="eCourseTable" lay-filter="eCourseTable"></table>
|
</div>
|
</div>
|
</div>
|
|
|
<!-- 搜索栏 -->
|
<div id="search-box" class="layui-form layui-card-header">
|
<div class="layui-inline">
|
<div class="layui-input-inline">
|
<input class="layui-input" type="text" name="bill_no" placeholder="单据编号" autocomplete="off">
|
</div>
|
</div>
|
<!-- 日期范围 -->
|
<div class="layui-inline" style="width: 300px">
|
<div class="layui-input-inline">
|
<input class="layui-input layui-laydate-range" id="modi_time" name="modi_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<div class="layui-input-inline">
|
<input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
|
</div>
|
</div>
|
<!-- 待添加 -->
|
<div id="data-search-btn" class="layui-btn-container layui-form-item">
|
<button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button>
|
<button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button>
|
</div>
|
</div>
|
|
<!-- 表格 -->
|
<div class="layui-form">
|
<table class="layui-hide" id="waitMatin" lay-filter="waitMatin"></table>
|
</div>
|
<script type="text/html" id="toolbar">
|
<div class="layui-btn-container">
|
<button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>
|
<button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>
|
<button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button>
|
</div>
|
</script>
|
|
<script type="text/html" id="operate">
|
<a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a>
|
<a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a>
|
</script>
|
|
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
|
<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
|
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
|
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
|
<script type="text/javascript" src="../../static/js/waitMatin/waitMatin.js" charset="utf-8"></script>
|
<script>
|
layui.use(['layer', 'form', 'table', 'util', 'admin'], function () {
|
var $ = layui.jquery;
|
var layer = layui.layer;
|
var form = layui.form;
|
var table = layui.table;
|
var util = layui.util;
|
var admin = layui.admin;
|
|
// 渲染表格
|
var insTb = table.render({
|
elem: '#waitMatin',
|
url: baseUrl+'/waitMatin/head/page/auth',
|
page: true,
|
cellMinWidth: 100,
|
cols: [[
|
{type: 'numbers'},
|
{field: 'billNo', title: '单据编号', sort: true},
|
{field: 'billType$', align: 'center', title: '类型'},
|
// {align: 'center', title: '星期', templet: '#eCourseTbWeek', minWidth: 350, width: 350},
|
{align: 'center', title: '明细', toolbar: '#eCourseTbLook', minWidth: 140, width: 140},
|
{
|
field: 'createTime', title: '创建时间', sort: true, templet: function (d) {
|
return util.toDateString(d.createTime);
|
}, width: 180
|
},
|
{align: 'center', title: '操作', toolbar: '#eCourseTbBar', minWidth: 130, width: 130}
|
]]
|
});
|
|
// 搜索
|
form.on('submit(eCourseTbSearch)', function (data) {
|
insTb.reload({where: data.field, page: {curr: 1}});
|
});
|
|
// 添加
|
$("#eCourseAddBtn").click(function () {
|
showEditModel();
|
});
|
|
// 工具条点击事件
|
table.on('tool(eCourseTable)', function (obj) {
|
var data = obj.data;
|
var layEvent = obj.event;
|
if (layEvent == 'edit') {
|
showEditModel(data);
|
} else if (layEvent == 'del') {
|
doDel(data.experimentTypeId);
|
} else if (layEvent == 'look') {
|
var $a = $(obj.tr).find('a[lay-event="look"]');
|
var offset = $a.offset();
|
var top = offset.top;
|
var left = offset.left;
|
layer.open({
|
type: 1,
|
title: false,
|
area: '530px',
|
offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'],
|
shade: .01,
|
shadeClose: true,
|
fixed: false,
|
content: '<table id="lookSSXMTable" lay-filter="lookSSXMTable"></table>',
|
success: function (layero) {
|
table.render({
|
elem: '#lookSSXMTable',
|
url: '../../json/e-course-tb2.json?experimentTypeId=' + data.experimentTypeId,
|
page: true,
|
cellMinWidth: 100,
|
cols: [[
|
{type: 'numbers'},
|
{field: 'experimentName', title: '项目名称', sort: true},
|
{
|
field: 'createTime', title: '创建时间', sort: true, templet: function (d) {
|
return util.toDateString(d.createTime);
|
}
|
}
|
]],
|
done: function () {
|
$(layero).find('.layui-table-view').css('margin', '0');
|
},
|
size: ''
|
});
|
}
|
});
|
}
|
});
|
|
// 显示表单弹窗
|
function showEditModel(expTpe) {
|
admin.open({
|
type: 1,
|
title: (expTpe ? '修改' : '添加') + '实验课程',
|
content: $('#eCourseEditDialog').html(),
|
area: '700px',
|
success: function (layero, dIndex) {
|
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
var url = expTpe ? '../../json/ok.json' : '../../json/ok.json';
|
var isExpAdd = expTpe ? false : true;
|
// 回显数据
|
form.val('eCourseEditForm', expTpe);
|
// 表单提交事件
|
form.on('submit(eCourseEditSubmit)', function (data) {
|
if (isExpAdd) {
|
if (xxDataList.length <= 0) {
|
layer.tips('请添加实验项目', '#demoEDeCourseAddBtnComment', {tips: [1, '#ff4c4c']});
|
return false;
|
}
|
var nList = admin.util.deepClone(xxDataList);
|
for (var xi = 0; xi < nList.length; xi++) {
|
nList[xi].experimentId = undefined;
|
}
|
data.field.expListJson = JSON.stringify(nList);
|
}
|
layer.load(2);
|
$.get(url, data.field, function (res) {
|
layer.closeAll('loading');
|
if (res.code == 200) {
|
layer.close(dIndex);
|
insTb.reload({page: {curr: 1}});
|
layer.msg(res.msg, {icon: 1});
|
} else {
|
layer.msg(res.msg, {icon: 2});
|
}
|
}, 'json');
|
return false;
|
});
|
//
|
var xxDataList = [];
|
var tbOptions = {
|
elem: '#formSSXMTable',
|
data: xxDataList,
|
page: true,
|
height: '350px;',
|
cellMinWidth: 100,
|
cols: [[
|
{type: 'numbers'},
|
{field: 'experimentName', title: '项目名称', sort: true},
|
{
|
field: 'createTime', title: '创建时间', sort: true, templet: function (d) {
|
return util.toDateString(d.createTime);
|
}
|
},
|
{align: 'center', title: '操作', toolbar: '#eCourseCouTbBar', minWidth: 120, width: 120}
|
]],
|
done: function () {
|
$(layero).find('.layui-table-view').css('margin', '0');
|
},
|
size: ''
|
};
|
if (isExpAdd) {
|
|
} else {
|
tbOptions.data = undefined;
|
tbOptions.url = '../../json/e-course-tb2.json?experimentTypeId=' + expTpe.experimentTypeId;
|
}
|
var insTbSSXM = table.render(tbOptions);
|
// 工具条点击事件
|
table.on('tool(formSSXMTable)', function (obj) {
|
var data = obj.data;
|
var layEvent = obj.event;
|
if (layEvent == 'edit') {
|
showEditModel2(data);
|
} else if (layEvent == 'del') {
|
layer.confirm('确定要删除吗?', {
|
shade: .1,
|
skin: 'layui-layer-admin'
|
}, function (i) {
|
layer.close(i);
|
if (isExpAdd) { // 前端处理删除
|
for (var j = 0; j < xxDataList.length; j++) {
|
if (xxDataList[j].experimentId = data.experimentId) {
|
xxDataList.splice(j, 1);
|
}
|
}
|
insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
|
} else { // 后端处理删除
|
layer.load(2);
|
$.get('../../json/ok.json', {
|
experimentId: data.experimentId
|
}, function (res) {
|
layer.closeAll('loading');
|
if (res.code == 200) {
|
layer.msg(res.msg, {icon: 1});
|
insTb.reload({page: {curr: 1}});
|
insTbSSXM.reload({page: {curr: 1}});
|
} else {
|
layer.msg(res.msg, {icon: 2});
|
}
|
}, 'json');
|
}
|
});
|
}
|
});
|
//
|
$('#demoEDeCourseAddBtnComment').click(function () {
|
showEditModel2();
|
});
|
|
// 显示表单弹窗
|
function showEditModel2(exp) {
|
admin.open({
|
type: 1,
|
offset: '150px',
|
title: (exp ? '修改' : '添加') + '项目',
|
content: $('#eCourseCouEditDialog').html(),
|
success: function (layero, dIndex) {
|
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
var url = exp ? '../../json/ok.json' : '../../json/ok.json';
|
// 回显数据
|
form.val('eCourseCouEditForm', exp);
|
// 表单提交事件
|
form.on('submit(eCourseCouEditSubmit)', function (data) {
|
if (isExpAdd) { // 前端处理添加、修改
|
if (exp) { // 前端修改
|
for (var i = 0; i < xxDataList.length; i++) {
|
if (xxDataList[i].experimentName == data.field.experimentName && xxDataList[i].experimentId != data.field.experimentId) {
|
layer.msg('实验项目名称已存在', {icon: 2});
|
return false;
|
}
|
}
|
layer.close(dIndex);
|
for (var j = 0; j < xxDataList.length; j++) {
|
if (xxDataList[j].experimentId == data.field.experimentId) {
|
xxDataList[j].experimentName = data.field.experimentName;
|
}
|
}
|
insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
|
} else { // 前端添加
|
for (var i = 0; i < xxDataList.length; i++) {
|
if (xxDataList[i].experimentName == data.field.experimentName) {
|
layer.msg('实验项目名称已存在', {icon: 2});
|
return false;
|
}
|
}
|
layer.close(dIndex);
|
data.field.experimentId = new Date().getTime();
|
xxDataList.push(data.field);
|
insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
|
}
|
} else { // 后端处理添加修改
|
layer.load(2);
|
if (!exp) {
|
data.field.experimentTypeId = expTpe.experimentTypeId;
|
}
|
$.get(url, {json: JSON.stringify(data.field)}, function (res) {
|
layer.closeAll('loading');
|
if (res.code == 200) {
|
layer.close(dIndex);
|
insTbSSXM.reload({page: {curr: 1}});
|
layer.msg(res.msg, {icon: 1});
|
} else {
|
layer.msg(res.msg, {icon: 2});
|
}
|
}, 'json');
|
}
|
return false;
|
});
|
}
|
});
|
}
|
|
}
|
});
|
}
|
|
// 删除
|
function doDel(experimentTypeId) {
|
layer.confirm('确定要删除吗?', {
|
shade: .1,
|
skin: 'layui-layer-admin'
|
}, function (i) {
|
layer.close(i);
|
layer.load(2);
|
$.post('../../json/ok.json', {
|
experimentTypeId: experimentTypeId
|
}, function (res) {
|
layer.closeAll('loading');
|
if (res.code == 200) {
|
layer.msg(res.msg, {icon: 1});
|
insTb.reload({page: {curr: 1}});
|
} else {
|
layer.msg(res.msg, {icon: 2});
|
}
|
}, 'json');
|
});
|
}
|
|
});
|
</script>
|
</body>
|
</html>
|