Commit f9b3c523 by yangbenyong

添加设备预约

parent 85819035
#默认数据库配置
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/syzy_se?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#默认数据库配置
......
layui.define([ 'form', 'laydate', 'table','laboratoryEquipmentMakeApi'], function(exports) {
layui.define([ 'form', 'laydate', 'laytpl','table','laboratoryEquipmentMakeApi'], function(exports) {
var form = layui.form;
var laboratoryEquipmentMakeApi = layui.laboratoryEquipmentMakeApi;
var index = layui.index;
var table = layui.table;
var laytpl = layui.laytpl;
var dateHref = '';
var view = {
init:function(){
Lib.initGenrealForm($("#updateForm"),form);
// Lib.initGenrealForm($("#updateForm"),form);
this.initSubmit();
},
initSubmit:function(){
dateHref = location.href.split("=")[1];
var res = {"code":0,"msg":"成功","count":2,"data":[{"id":1,"processinstId":"1","equipment":"123","topicName":"323","experimenter":"232","createTime":"2023-03-31 11:08:05","updateTime":"2023-03-31 11:08:02","startTime":"2023-03-02","endTime":"2023-03-04","remarks":null,"laboratoryId":null},{"id":2,"processinstId":"2","equipment":"4545","topicName":"454","experimenter":"545","createTime":"2023-03-31 11:08:10","updateTime":"2023-03-31 11:08:12","startTime":"2023-03-05","endTime":"2023-03-07","remarks":null,"laboratoryId":null}]}
var dataList = res.data.filter(function(v){
if(v.startTime == dateHref){
return v;
}
})
console.log(dataList)
table.render({
elem: "#taskList",
id: "taskList",
height: 400,
data : dataList,
cols:[[
{ field: "startTime", title: "任务时间" },
{ field: "topicName" , title: "任务名称"},
{ field: "remarks" , title: "备注"},
{ title: "操作", templet: function(){
return '<input type="button" lay-event="detail" value="编辑" class="layui-btn layui-btn-xs" /><input type="button" lay-event="del" value="删除" class="layui-btn layui-btn-xs layui-btn-danger" />'
}}
]]
});
//添加
$("#addTask").click(function(){
laytpl($("#taskFormTemplate").html() ).render({ topicName: '', remarks:''}, function(string){
layer.open({
title:"添加",
area: ["800px","90%"],
content: string,
success: function(layout){
form.render();
// console.log(JSON.stringify(res))
},
yes: function(index, layout){
res.data.push({ startTime:dateHref, topicName: $(layout).find("[name='name']").val(), remarks: $(layout).find("[name='remarks']").val() })
table.reload("taskList",{
data: res.data
})
layer.close(index);
// parent.window.dataReload();
}
})
});
})
//点击删除-编辑
table.on("tool(taskList)",function(obj){
console.log(obj)
if(obj.event === 'detail'){
laytpl($("#taskFormTemplate").html() ).render(obj.data, function(string){
layer.open({
title:"编辑",
area: ["800px","90%"],
content: string ,
success: function(layout){
form.render();
// console.log(JSON.stringify(res))
},
yes: function(index, layout){
res.data.map(function(v){
if(v.topicName == $(layout).find("[name='name']").val().trim()){
v["topicName"] = $(layout).find("[name='name']").val().trim();
v["remarks"] = $(layout).find("[name='remarks']").val().trim();
}
})
// ({ startTime:dateHref, topicName: $(layout).find("[name='name']").val(), remarks: $(layout).find("[name='remarks']").val() })
table.reload("taskList",{
data: res.data
})
layer.close(index);
// parent.window.dataReload();
}
})
})
}else if(obj.event === 'del'){
layer.confirm('确定删除吗?', function(index){
obj.del(); // 删除对应行(tr)的 DOM 结构,并更新缓存
layer.close(index);
// parent.window.dataReload();
})
}
})
$("#updateButton").click(function(){
form.on('submit(form)', function(){
laboratoryEquipmentMakeApi.updateLaboratoryEquipmentMake($('#updateForm'),function(){
......
layui.define([ 'form', 'laydate', 'table' ], function(exports) {
layui.define([ 'form', 'laydate', 'table','layer' ], function(exports) {
var form = layui.form;
var laydate = layui.laydate;
var table = layui.table;
var layer = layui.layer;
var laboratoryEquipmentMakeTable = null;
var view ={
init:function(){
var _this = this;
this.initTable();
this.initSearchForm();
this.initToolBar();
//this.initSearchForm();
//this.initToolBar();
window.dataReload = function(){
Lib.doSearchForm($("#searchForm"),laboratoryEquipmentMakeTable)
_this.initTable();
//Lib.doSearchForm($("#searchForm"),laboratoryEquipmentMakeTable)
}
},
initTable:function(){
laboratoryEquipmentMakeTable = table.render({
elem : '#laboratoryEquipmentMakeTable',
height : Lib.getTableHeight(1),
cellMinWidth: 100,
method : 'post',
url : Common.ctxPath + '/laboratory/laboratoryEquipmentMake/list.json' // 数据接口
,page : Lib.tablePage // 开启分页
,limit : 10,
cols : [ [ // 表头
{
type : 'checkbox',
fixed:'left',
},
{
field : 'id',
title : '主键',
fixed:'left',
width : 60,
},
{
field : 'processinstId',
title : '流程主键',
},
{
field : 'equipment',
title : '设备',
},
{
field : 'topicName',
title : '课题名称',
},
{
field : 'experimenter',
title : '实验人',
},
{
field : 'createTime',
title : '创建时间',
},
{
field : 'updateTime',
title : '修改时间',
},
{
field : 'startTime',
title : '开始时间',
},
{
field : 'endTime',
title : '结束时间',
},
{
// url : Common.ctxPath + '/laboratory/laboratoryEquipmentMake/list.json' // 数据接口
var data = [
// { startDate: "2018-6-10", name: "事件1" },
{ startTime: "2018-7-10", topicName: "事件2" },
{ startTime: "2018-8-10", topicName: "事件3" },
{ startTime: "2018-9-10", topicName: "事件4" },
{ startTime: "2018-10-10", topicName: "事件5" },
{ startTime: "2018-11-1", topicName: "事件6" },
{ startTime: "2018-11-1", topicName: "事件7" },
{ startTime: "2018-12-1", topicName: "事件8" },
{ startTime: "2018-12-1", topicName: "事件9" },
{ startTime: "2018-12-1", topicName: "事10" },
{ startTime: "2019-1-10", topicName: "事件11" },
{ startTime: "2019-1-10", topicName: "任务22" },
{ startTime: "2019-2-10", topicName: "事件12" },
{ startTime: "2019-3-10", topicName: "事件13" },
{ startTime: "2019-4-10", topicName: "事件14" },
{ startTime: "2019-5-10", topicName: "事件15" },
{ startTime: "2019-6-10", topicName: "事件16" },
{ startTime: "2019-7-10", topicName: "事件17" },
{ startTime: "2019-8-10", topicName: "事件18" },
{ startTime: "2019-9-10", topicName: "事件19" },
{ startTime: "2019-10-10", topicName: "事件20" },
{ startTime: "2019-11-10", topicName: "事件21" },
{ startTime: "2023-03-05", topicName: "事件22" },
{ startTime: "2023-03-05", topicName: "事件23" },
// { startTime: "2020-2-10", topicName: "事件24" },
];
/* field : 'topicName',
title : '课题名称',
field : 'experimenter',
title : '实验人',
field : 'remarks',
title : '备注',
},
{
field : 'laboratoryId',
title : '实验室id',
}
] ]
});
table.on('checkbox(laboratoryEquipmentMakeTable)', function(obj){
var laboratoryEquipmentMake = obj.data;
if(obj.checked){
//按钮逻辑Lib.buttonEnable()
}else{
}
})
*/
$.post(Common.ctxPath + '/laboratory/laboratoryEquipmentMake/list.json',{},function(res){
console.log(JSON.stringify(res))
$("#calendarbox").calendar({
data: res.data,
mode: "month",
maxEvent: 1,
whereForm:{
key: "startTime", //日期
name:"topicName" //任务名称
},
showModeBtn: false,
newDate: "2023-03-05",
cellClick: function (res) {
var dateUrl = res.date.split("-");
var url = "/laboratory/laboratoryEquipmentMake/edit.do?date="+ dateUrl[0]+"-" + ( dateUrl[1] <=9 ? '0'+ dateUrl[1] : dateUrl[1]) +"-"+( dateUrl[2]<=9?'0'+ dateUrl[2] : dateUrl[2] );
console.log(res.events[0]['startTime'])
Common.openDlg(url,"管理>"+res.events[0]['startTime']+">编辑",{
//area: ["80%","80%"]
});
// layer.open({
// type: 2,
// title:"操作",
// area: ["800px","90%"],
// content: url ,
// success: function(layout){
//
// console.log(JSON.stringify(res))
// //viewCell的事件列表
// }
// })
}
})
})
//刷新数据
function refresh(data){
$("#calendarbox").data("calendar").loadData( data || [])
}
},
initSearchForm:function(){
......@@ -104,8 +101,8 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
initToolBar:function(){
toolbar = {
add : function() { // 获取选中数据
var url = "/laboratory/laboratoryEquipmentMake/add.do";
Common.openDlg(url,"LaboratoryEquipmentMake管理>新增");
/*var url = "/laboratory/laboratoryEquipmentMake/add.do";
Common.openDlg(url,"LaboratoryEquipmentMake管理>新增");*/
},
edit : function() { // 获取选中数目
var data = Common.getOneFromTable(table,"laboratoryEquipmentMakeTable");
......@@ -122,10 +119,10 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
});
}
};
$('.ext-toolbar').on('click', function() {
/* $('.ext-toolbar').on('click', function() {
var type = $(this).data('type');
toolbar[type] ? toolbar[type].call(this) : '';
});
});*/
}
}
exports('index',view);
......
<!--# layout("/common/layout.html",{"jsBase":"/js/laboratory/laboratoryEquipmentMake/"}){ -->
<form class="layui-form layui-form-pane" id="updateForm">
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">流程主键</label>
<div class="layui-input-inline">
<input type="text" id="processinstId" name="processinstId" value="${laboratoryEquipmentMake.processinstId}" class="layui-input" >
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">设备</label>
<div class="layui-input-inline">
<input type="text" id="equipment" name="equipment" value="${laboratoryEquipmentMake.equipment}" class="layui-input" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">课题名称</label>
<div class="layui-input-inline">
<input type="text" id="topicName" name="topicName" value="${laboratoryEquipmentMake.topicName}" class="layui-input" >
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">实验人</label>
<div class="layui-input-inline">
<input type="text" id="experimenter" name="experimenter" value="${laboratoryEquipmentMake.experimenter}" class="layui-input" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">创建时间</label>
<div class="layui-input-inline">
<input type="text" id="createTime" name="createTime" value="${laboratoryEquipmentMake.createTime,"yyyy-MM-dd"}" class="layui-input input-date" >
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">修改时间</label>
<div class="layui-input-inline">
<input type="text" id="updateTime" name="updateTime" value="${laboratoryEquipmentMake.updateTime,"yyyy-MM-dd"}" class="layui-input input-date" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">开始时间</label>
<div class="layui-input-inline">
<input type="text" id="startTime" name="startTime" value="${laboratoryEquipmentMake.startTime}" class="layui-input" >
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">结束时间</label>
<div class="layui-input-inline">
<input type="text" id="endTime" name="endTime" value="${laboratoryEquipmentMake.endTime}" class="layui-input" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">备注</label>
<div class="layui-input-inline">
<input type="text" id="remarks" name="remarks" value="${laboratoryEquipmentMake.remarks}" class="layui-input" >
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">实验室id</label>
<div class="layui-input-inline">
<input type="text" id="laboratoryId" name="laboratoryId" value="${laboratoryEquipmentMake.laboratoryId}" class="layui-input" >
</div>
</div>
</div>
</div>
<!-- 业务对象须有hidden字段,保存delFlag和version字段-->
<input type="hidden" name="id" value=${laboratoryEquipmentMake.id} />
<layui:submitButtons id="updateButton" />
</form>
<style>
.taskFormTemplate{
padding:20px;
}
</style>
<!-- <form class="layui-form layui-form-pane" id="updateForm"> -->
<div class="layui-btn-group">
<button type="button" id="addTask" class="layui-btn layui-btn-sm">添加</button>
</div>
<div class="layui-form-item">
<table class="layui-hide" id="taskList" lay-filter="taskList"></table>
</div>
<!--#} -->
<script>
layui.use(['edit'], function(){
......@@ -92,3 +19,31 @@ layui.use(['edit'], function(){
laboratoryEquipmentMakeEdit.init();
});
</script>
<script type="text/template" id="taskTemplate">
<div class="layui-btn-group">
<button type="button" id="addTask" class="layui-btn layui-btn-sm">添加</button>
</div>
<div class="layui-form-item">
<table class="layui-hide" id="taskList" lay-filter="taskList"></table>
</div>
</script>
<script type="text/template" id="taskFormTemplate">
<form class="layui-form taskFormTemplate">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="min-width:80px;">设备名称</label>
<div class="layui-input-inline"><input type="text" name="name" value="{{ d.topicName }}" class="layui-input"/></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="min-width:80px;">设备描述</label>
<div class="layui-input-block">
<textarea name="remarks" placeholder="请输入内容" value="{{ d.remarks }}" class="layui-textarea"></textarea>
</div>
</div>
</form>
</script>
\ No newline at end of file
<!--#layout("/common/layout.html",{"jsBase":"/js/laboratory/laboratoryEquipmentMake/"}){ -->
<layui:searchForm formId="searchForm" condition="${search}">
<!-- <layui:searchForm formId="searchForm" condition="${search}">
</layui:searchForm>
<div class="layui-btn-group">
......@@ -8,13 +8,34 @@
<layui:accessButton function="laboratoryEquipmentMake.del" action="del">删除</layui:accessButton>
</div>
<table id="laboratoryEquipmentMakeTable" lay-filter="laboratoryEquipmentMakeTable"></table>
<table id="laboratoryEquipmentMakeTable" lay-filter="laboratoryEquipmentMakeTable"></table> -->
<style>
html, body {width: 100%;height: 100%;padding: 0;margin: 0;}ul, li {padding: 0;margin: 0;list-style: none;}#calendarbox {width: 60%;margin-left: auto;margin-right: auto;}.calendar {position: relative;font-family: "Chinese Quote", "Microsoft YaHei";font-size: 14px;}.calendar-header {padding: 11px 16px 11px 0;text-align: right;}.calendar-select {line-height: 1.5;color: rgba(0, 0, 0, 0.65);-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;list-style: none;display: inline-block;position: relative;outline: 0;}.calendar-table {width: 100%;height: 100%;}.calendar-column-header, .calendar-cell {width: 14% }.calendar-column-header {font-weight: 400;text-align: center;padding-right: 12px;}.calendar-table {table-layout: fixed;}.calendar-cell {color: rgba(0, 0, 0, 0.65);}.calendar-cell.calendar-last-month-cell, .calendar-cell.calendar-next-month-cell {color: rgba(0, 0, 0, 0.25);}.calendar-date {padding: 4px 8px;margin: 0 4px;border-top: 2px solid #e8e8e8;}.calendar-cell.calendar-thisMonth .calendar-date, .calendar-cell.calendar-today .calendar-date {border-top-color: #1890ff;background-color: #e6f7ff;color: #1890ff;}.calendar-date:hover {background: #e6f7ff;}.calendar-value {text-align: center;}.calendar-content {height: 60px;overflow-x: hidden;overflow-y: auto;position: static;width: auto;left: auto;bottom: auto;}.calendar-select {font-size: 13px;vertical-align: middle;}.btn.calendar-select-active {border-color: #40a9ff;z-index: 2;}.calendar-select:first-child {margin-right: 10px;}.calendar-year-select, .calendar-month-select {border-radius: 4px;border: 1px solid #d9d9d9;}.calendar-year-select:hover, .calendar-month-select:hover {border-color: #40a9ff;}.calendar-year-text, .calendar-month-text {margin: 0 10px;line-height: 28px;}.calendar-icon {margin: 0 10px 0 0;}.calendar-icon * {color: rgba(0, 0, 0, 0.25);}.btn {float: left;padding: 5px 10px;border: 1px solid #d9d9d9;border-radius: 4px;}.btn-group {float:left;display: inline;padding: 0 8px;}.btn-group > .btn {position: relative;float: left;}.btn-group > .btn:hover {z-index: 2;border-color: #40a9ff;}.btn-group .btn + .btn {margin-left: -1px;}.btn-group > .btn:first-child {border-top-right-radius: 0;border-bottom-right-radius: 0;}.btn-group > .btn:last-child:not(:first-child) {border-top-left-radius: 0;border-bottom-left-radius: 0;}ul.dropdown-month, .dropdown-month li, ul.dropdown-year, .dropdown-year li {list-style: none;text-align: center;padding: 0;margin: 0;}.dropdown-month.open, .dropdown-year.open {display: inline-block;margin-top: 1px;width: 100%;}.dropdown-month, .dropdown-year {height: 250px;overflow-y: auto;overflow-x: hidden;display: none;position: absolute;left: 0;top: 100%;background: #fff;width: 50px;border: 1px solid #eee;box-shadow: 0px 6px 12px rgba(0,0,0,0.175);-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175) }.dropdown-month .month-item, .dropdown-year .year-item {font-size: 12px;position: relative;display: block;padding: 5px 2px;line-height: 20px;font-weight: normal;color: rgba(0, 0, 0, 0.65);white-space: nowrap;cursor: pointer;overflow: hidden;text-overflow: ellipsis;-webkit-transition: background 0.3s ease;transition: background 0.3s ease;}.month-item:hover, .year-item:hover {background: #e6f7ff;}.year-item.active {background-color: #fafafa;font-weight: 600;color: rgba(0, 0, 0, 0.65);}ul.events li {white-space: nowrap;font-size: 13px;padding: 2px 2px;}ul.events .total {font-size: 14px;font-weight: 600;}ul.events li span {margin-left: 5px;}ul.events li:before {content: "*" }*::-webkit-scrollbar {width: 8px;background-color: #fff;}*::-webkit-scrollbar-thumb {background-color: #ddd;border-radius: 8px;-webkit-box-shadow: inset 0 0 6px rgba(255, 255, 255, .3);}
.taskFormTemplate{
position: absolute;
left:0;right:0;top:0;bottom:0;
width: 90%;
height: 90%;
margin: auto;
background-color: #fff;
border: 1px solid #999;
border-radius: 10px;
padding:20px;
box-shadow: 0 0 18px 1px #999;
display:none;
}
</style>
<div id="calendarbox" class="calendar"></div>
<!--#} -->
<script type="text/javascript" src="${ctxPath}/js/laboratory/laboratoryEquipmentMake/calendar.js?v=${jsVer}"></script>
<script>
layui.use(['index'], function(){
var index = layui.index
index.init();
layui.use(['index','layer'], function(){
var index = layui.index
index.init();
});
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment