完善工作日程安排
This commit is contained in:
parent
66fdadc418
commit
2db7668b62
@ -44,9 +44,10 @@ class Plan extends BaseController
|
|||||||
->order('a.id desc')
|
->order('a.id desc')
|
||||||
->paginate($rows, false)
|
->paginate($rows, false)
|
||||||
->each(function ($item, $key) {
|
->each(function ($item, $key) {
|
||||||
|
$item->remind_time = empty($item->remind_time) ? '-' : date('Y-m-d H:i', $item->remind_time);
|
||||||
$item->start_time = empty($item->start_time) ? '' : date('Y-m-d H:i', $item->start_time);
|
$item->start_time = empty($item->start_time) ? '' : date('Y-m-d H:i', $item->start_time);
|
||||||
//$item->end_time = empty($item->end_time) ? '': date('Y-m-d H:i', $item->end_time);
|
$item->end_time = empty($item->end_time) ? '': date('Y-m-d H:i', $item->end_time);
|
||||||
$item->end_time = empty($item->end_time) ? '' : date('H:i', $item->end_time);
|
//$item->end_time = empty($item->end_time) ? '' : date('H:i', $item->end_time);
|
||||||
});
|
});
|
||||||
return table_assign(0, '', $plan);
|
return table_assign(0, '', $plan);
|
||||||
} else {
|
} else {
|
||||||
@ -68,11 +69,12 @@ class Plan extends BaseController
|
|||||||
$where[] = ['end_time', '<=', strtotime($param['end'])];
|
$where[] = ['end_time', '<=', strtotime($param['end'])];
|
||||||
$where[] = ['admin_id', '=', $uid];
|
$where[] = ['admin_id', '=', $uid];
|
||||||
$where[] = ['status', '=', 1];
|
$where[] = ['status', '=', 1];
|
||||||
$schedule = Db::name('Plan')->where($where)->field('id,title,color,start_time,end_time')->select()->toArray();
|
$schedule = Db::name('Plan')->where($where)->field('id,title,type,start_time,end_time')->select()->toArray();
|
||||||
$events = [];
|
$events = [];
|
||||||
|
$color_array=['#393D49','#FF5722','#FFB800','#1E9FFF','#009688'];
|
||||||
foreach ($schedule as $k => $v) {
|
foreach ($schedule as $k => $v) {
|
||||||
$v['backgroundColor'] = $v['color'];
|
$v['backgroundColor'] = $color_array[$v['type']];
|
||||||
$v['borderColor'] = $v['color'];
|
$v['borderColor'] = $color_array[$v['type']];
|
||||||
$v['title'] = $v['title'];
|
$v['title'] = $v['title'];
|
||||||
$v['start'] = date('Y-m-d H:i', $v['start_time']);
|
$v['start'] = date('Y-m-d H:i', $v['start_time']);
|
||||||
$v['end'] = date('Y-m-d H:i', $v['end_time']);
|
$v['end'] = date('Y-m-d H:i', $v['end_time']);
|
||||||
@ -109,43 +111,35 @@ class Plan extends BaseController
|
|||||||
{
|
{
|
||||||
$param = get_params();
|
$param = get_params();
|
||||||
$admin_id = $this->uid;
|
$admin_id = $this->uid;
|
||||||
|
if (isset($param['start_time_a'])) {
|
||||||
|
$param['start_time'] = strtotime($param['start_time_a'] . '' . $param['start_time_b']);
|
||||||
|
}
|
||||||
|
if (isset($param['end_time_a'])) {
|
||||||
|
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
|
||||||
|
}
|
||||||
|
if ($param['end_time'] <= $param['start_time']) {
|
||||||
|
return to_assign(1, "结束时间需要大于开始时间");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($param['remind_type']==1){
|
||||||
|
$param['remind_time'] = $param['start_time']-5*60;
|
||||||
|
}
|
||||||
|
if($param['remind_type']==2){
|
||||||
|
$param['remind_time'] = $param['start_time']-15*60;
|
||||||
|
}
|
||||||
|
if($param['remind_type']==3){
|
||||||
|
$param['remind_time'] = $param['start_time']-30*60;
|
||||||
|
}
|
||||||
|
if($param['remind_type']==4){
|
||||||
|
$param['remind_time'] = $param['start_time']-60*60;
|
||||||
|
}
|
||||||
|
if($param['remind_type']==5){
|
||||||
|
$param['remind_time'] = $param['start_time']-120*60;
|
||||||
|
}
|
||||||
|
if($param['remind_type']==6){
|
||||||
|
$param['remind_time'] = $param['start_time']-1440*60;
|
||||||
|
}
|
||||||
if ($param['id'] == 0) {
|
if ($param['id'] == 0) {
|
||||||
if (isset($param['start_time'])) {
|
|
||||||
$param['start_time'] = strtotime($param['start_time'] . '' . $param['start_time_1']);
|
|
||||||
}
|
|
||||||
if (isset($param['end_time'])) {
|
|
||||||
$param['end_time'] = strtotime($param['end_time'] . '' . $param['end_time_1']);
|
|
||||||
}
|
|
||||||
if ($param['end_time'] <= $param['start_time']) {
|
|
||||||
return to_assign(1, "结束时间需要大于开始时间");
|
|
||||||
}
|
|
||||||
$where1[] = ['status', '=', 1];
|
|
||||||
$where1[] = ['admin_id', '=', $admin_id];
|
|
||||||
$where1[] = ['start_time', 'between', [$param['start_time'], $param['end_time'] - 1]];
|
|
||||||
|
|
||||||
$where2[] = ['status', '=', 1];
|
|
||||||
$where2[] = ['admin_id', '=', $admin_id];
|
|
||||||
$where2[] = ['start_time', '<=', $param['start_time']];
|
|
||||||
$where2[] = ['start_time', '>=', $param['end_time']];
|
|
||||||
|
|
||||||
$where3[] = ['status', '=', 1];
|
|
||||||
$where3[] = ['admin_id', '=', $admin_id];
|
|
||||||
$where3[] = ['end_time', 'between', [$param['start_time'] + 1, $param['end_time']]];
|
|
||||||
|
|
||||||
$record = Db::name('Plan')
|
|
||||||
->where(function ($query) use ($where1) {
|
|
||||||
$query->where($where1);
|
|
||||||
})
|
|
||||||
->whereOr(function ($query) use ($where2) {
|
|
||||||
$query->where($where2);
|
|
||||||
})
|
|
||||||
->whereOr(function ($query) use ($where3) {
|
|
||||||
$query->where($where3);
|
|
||||||
})
|
|
||||||
->count();
|
|
||||||
if ($record > 0) {
|
|
||||||
return to_assign(1, "您所选的时间区间已有日程安排,请重新选时间");
|
|
||||||
}
|
|
||||||
$param['admin_id'] = $admin_id;
|
$param['admin_id'] = $admin_id;
|
||||||
$param['did'] = get_admin($admin_id)['did'];
|
$param['did'] = get_admin($admin_id)['did'];
|
||||||
$param['create_time'] = time();
|
$param['create_time'] = time();
|
||||||
@ -160,7 +154,7 @@ class Plan extends BaseController
|
|||||||
$param['update_time'] = time();
|
$param['update_time'] = time();
|
||||||
$res = Db::name('Plan')->strict(false)->field(true)->update($param);
|
$res = Db::name('Plan')->strict(false)->field(true)->update($param);
|
||||||
if ($res !== false) {
|
if ($res !== false) {
|
||||||
add_log('edit', $addid, $param);
|
add_log('edit', $param['id'], $param);
|
||||||
return to_assign(0, '操作成功');
|
return to_assign(0, '操作成功');
|
||||||
} else {
|
} else {
|
||||||
return to_assign(0, '操作失败');
|
return to_assign(0, '操作失败');
|
||||||
@ -188,6 +182,11 @@ class Plan extends BaseController
|
|||||||
$id = get_params('id');
|
$id = get_params('id');
|
||||||
$schedule = Db::name('Plan')->where(['id' => $id])->find();
|
$schedule = Db::name('Plan')->where(['id' => $id])->find();
|
||||||
if (!empty($schedule)) {
|
if (!empty($schedule)) {
|
||||||
|
$schedule['remind_time'] = date('Y-m-d H:i', $schedule['remind_time']);
|
||||||
|
$schedule['start_time_a'] = date('Y-m-d', $schedule['start_time']);
|
||||||
|
$schedule['end_time_a'] = date('Y-m-d', $schedule['end_time']);
|
||||||
|
$schedule['start_time_b'] = date('H:i', $schedule['start_time']);
|
||||||
|
$schedule['end_time_b'] = date('H:i', $schedule['end_time']);
|
||||||
$schedule['start_time'] = date('Y-m-d H:i', $schedule['start_time']);
|
$schedule['start_time'] = date('Y-m-d H:i', $schedule['start_time']);
|
||||||
$schedule['end_time'] = date('Y-m-d H:i', $schedule['end_time']);
|
$schedule['end_time'] = date('Y-m-d H:i', $schedule['end_time']);
|
||||||
$schedule['create_time'] = date('Y-m-d H:i:s', $schedule['create_time']);
|
$schedule['create_time'] = date('Y-m-d H:i:s', $schedule['create_time']);
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
.layui-layer-content .layui-table-view .layui-table td,.layui-layer-content .layui-table-view .layui-table th{padding:1px 0;}
|
.layui-layer-content .layui-table-view .layui-table td,.layui-layer-content .layui-table-view .layui-table th{padding:1px 0;}
|
||||||
.calendar-add{width:200px; height:38px; position:absolute; top:25px; left:180px; z-index:100;}
|
.calendar-add{width:200px; height:38px; position:absolute; top:25px; left:180px; z-index:100;}
|
||||||
.calendar-select{width:200px; height:38px; position:absolute; top:25px; right:153px; z-index:100;}
|
.calendar-select{width:200px; height:38px; position:absolute; top:25px; right:153px; z-index:100;}
|
||||||
|
.layui-unselect dl {max-height:188px;}
|
||||||
</style>
|
</style>
|
||||||
{/block}
|
{/block}
|
||||||
<!-- 主体 -->
|
<!-- 主体 -->
|
||||||
@ -27,7 +28,7 @@
|
|||||||
<div class="body-content">
|
<div class="body-content">
|
||||||
<div id="calendar"></div>
|
<div id="calendar"></div>
|
||||||
<div class="calendar-add">
|
<div class="calendar-add">
|
||||||
<button class="layui-btn layui-btn-normal addLoan" style="padding:0 12px;">+新增工作记录</button>
|
<button class="layui-btn layui-btn-normal addLoan" style="padding:0 12px;">+新增日程安排</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="calendar-select">
|
<div class="calendar-select">
|
||||||
<div class="layui-input-inline" style="width: 110px;"><input type="text" placeholder="请选择员工" class="layui-input" data-event="select" autocomplete="off"/></div>
|
<div class="layui-input-inline" style="width: 110px;"><input type="text" placeholder="请选择员工" class="layui-input" data-event="select" autocomplete="off"/></div>
|
||||||
@ -39,11 +40,12 @@
|
|||||||
<!-- 脚本 -->
|
<!-- 脚本 -->
|
||||||
{block name="script"}
|
{block name="script"}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var detail={},uid=0;
|
var uid=0;
|
||||||
|
|
||||||
function init(layui){
|
function init(layui){
|
||||||
var layer = layui.layer
|
var layer = layui.layer
|
||||||
,employeepicker = layui.employeepicker
|
,employeepicker = layui.employeepicker
|
||||||
|
,dropdown = layui.dropdown
|
||||||
,form = layui.form
|
,form = layui.form
|
||||||
,laydate = layui.laydate;
|
,laydate = layui.laydate;
|
||||||
|
|
||||||
@ -61,7 +63,7 @@
|
|||||||
uid = ids;
|
uid = ids;
|
||||||
that.val(names);
|
that.val(names);
|
||||||
calendar.refetchEvents({
|
calendar.refetchEvents({
|
||||||
url: '/home/schedule/index?uid='+uid
|
url: '/home/plan/index?uid='+uid
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -77,61 +79,99 @@
|
|||||||
|
|
||||||
|
|
||||||
$('.body-content').on('click','.addLoan',function(){
|
$('.body-content').on('click','.addLoan',function(){
|
||||||
addEvent();
|
|
||||||
});
|
|
||||||
|
|
||||||
function addEvent(){
|
|
||||||
var detail={};
|
var detail={};
|
||||||
detail['id']=0;
|
detail['id']=0;
|
||||||
detail['name']='';
|
detail['title']='';
|
||||||
detail['start_time']='';
|
detail['start_time_a']='';
|
||||||
detail['end_time']='';
|
detail['end_time_a']='';
|
||||||
detail['start_time_1']='08:30';
|
detail['start_time_b']='08:30';
|
||||||
detail['end_time_1']='09:00';
|
detail['end_time_b']='09:00';
|
||||||
detail['remark']='';
|
detail['remark']='';
|
||||||
detail['labor_type']=0;
|
detail['type']=0;
|
||||||
var content='<form class="layui-form" style="width:868px">\
|
detail['remind_type']=0;
|
||||||
|
addEvent(detail);
|
||||||
|
});
|
||||||
|
|
||||||
|
function addEvent(detail){
|
||||||
|
var type='<span style="color:#aaa">请选择</span>';
|
||||||
|
if(detail.type==1){
|
||||||
|
type = '<span class="layui-badge-dot"></span> 紧急';
|
||||||
|
}
|
||||||
|
else if(detail.type==2){
|
||||||
|
type = '<span class="layui-badge-dot layui-bg-orange"></span> 重要';
|
||||||
|
}
|
||||||
|
else if(detail.type==3){
|
||||||
|
type = '<span class="layui-badge-dot layui-bg-blue"></span> 次要';
|
||||||
|
}
|
||||||
|
else if(detail.type==4){
|
||||||
|
type = '<span class="layui-badge-dot layui-bg-green"></span> 不重要';
|
||||||
|
}
|
||||||
|
else if(detail.type==5){
|
||||||
|
type = '<span class="layui-badge-dot layui-bg-black"></span> 无优先级';
|
||||||
|
}
|
||||||
|
|
||||||
|
var remind_type='不提醒';
|
||||||
|
if(detail.remind_type==1){
|
||||||
|
remind_type = '提前5分钟';
|
||||||
|
}
|
||||||
|
else if(detail.remind_type==2){
|
||||||
|
remind_type = '提前15分钟';
|
||||||
|
}
|
||||||
|
else if(detail.remind_type==3){
|
||||||
|
remind_type = '提前30分钟';
|
||||||
|
}
|
||||||
|
else if(detail.remind_type==4){
|
||||||
|
remind_type = '提前1小时';
|
||||||
|
}
|
||||||
|
else if(detail.remind_type==5){
|
||||||
|
remind_type = '提前2小时';
|
||||||
|
}else if(detail.remind_type==6){
|
||||||
|
remind_type = '提前1天';
|
||||||
|
}
|
||||||
|
|
||||||
|
var content='<form class="layui-form" style="width:828px">\
|
||||||
<table class="layui-table" style="margin:15px 15px 0;">\
|
<table class="layui-table" style="margin:15px 15px 0;">\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作时间范围 <span style="color: red">*</span></td>\
|
<td class="layui-td-gray2">日程时间范围 <span style="color: red">*</span></td>\
|
||||||
<td>\
|
<td>\
|
||||||
<input id="start_time_a" name="start_time_a" style="width:100px; display:inline-block;" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" lay-reqText="请选择"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="start_time_1" id="start_time_1"></select></div> 至 <input id="end_time_a" name="end_time_a" style="width:100px; display:inline-block;" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" lay-reqText="请选择"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="end_time_1" id="end_time_1"></select></div>\
|
<input id="start_time_a" name="start_time_a" style="width:120px; display:inline-block;" autocomplete="off" class="layui-input" value="'+detail.start_time_a+'" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间"><div style="display: inline-block; margin-left:3px; width: 86px;"><select lay-filter="start_time_b" id="start_time_b"></select></div> 至 <input id="end_time_a" name="end_time_a" style="width:120px; display:inline-block;" autocomplete="off" class="layui-input" value="'+detail.end_time_a+'" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间"><div style="display: inline-block; margin-left:3px; width: 86px;"><select lay-filter="end_time_b" id="end_time_b"></select></div>\
|
||||||
</td>\
|
</td>\
|
||||||
<td class="layui-td-gray">工作类型 <span style="color: red">*</span></td>\
|
<td class="layui-td-gray">日程优先级 <span style="color: red">*</span></td>\
|
||||||
<td>\
|
<td>\
|
||||||
<input type="radio" name="labor_type" lay-filter="labor_type" value="1" title="案头工作"><input type="radio" name="labor_type" value="2" lay-filter="labor_type" title="外勤工作">\
|
<div class="layui-input" id="type" style="width:120px; line-height:35px;">'+type+'</div>\
|
||||||
</td>\
|
</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作内容 <span style="color: red">*</span></td>\
|
<td class="layui-td-gray2">日程内容 <span style="color: red">*</span></td>\
|
||||||
<td colspan="3"><input name="name" class="layui-input" value="" lay-verify="required" lay-reqText="请完成工作内容"></td>\
|
<td><input name="title" class="layui-input" value="'+detail.title+'" lay-verify="required" placeholder="请完成日程内容" lay-reqText="请完成日程内容"></td>\
|
||||||
|
<td class="layui-td-gray">提醒 <span style="color: red">*</span></td>\
|
||||||
|
<td>\
|
||||||
|
<div class="layui-input" id="remind_type" style="width:120px; line-height:35px;">'+remind_type+'</div>\
|
||||||
|
</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作详细描述</td>\
|
<td class="layui-td-gray2">日程详细描述</td>\
|
||||||
<td colspan="3">\
|
<td colspan="3">\
|
||||||
<textarea name="remark" form-input="remark" class="layui-textarea" style="min-height:120px;"></textarea>\
|
<textarea name="remark" form-input="remark" class="layui-textarea" style="min-height:120px;">'+detail.remark+'</textarea>\
|
||||||
</td>\
|
</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
</table>\
|
</table>\
|
||||||
</form>';
|
</form>';
|
||||||
layer.open({
|
layer.open({
|
||||||
type:1,
|
type:1,
|
||||||
title:'添加工作记录',
|
title:'日程安排',
|
||||||
area:['900px','390px'],
|
area:['860px','390px'],
|
||||||
content:content,
|
content:content,
|
||||||
success:function(){
|
success:function(){
|
||||||
//日期时间范围
|
//日期时间范围
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#start_time_a',
|
elem: '#start_time_a',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
min: -7,
|
min: 0,
|
||||||
max:0,
|
|
||||||
format: 'yyyy-MM-dd',
|
format: 'yyyy-MM-dd',
|
||||||
showBottom: false,
|
showBottom: false,
|
||||||
done:function(a,b,c){
|
done:function(a,b,c){
|
||||||
$('#end_time_a').val(a);
|
detail.start_time_a=a;
|
||||||
detail.start_time=a;
|
|
||||||
detail.end_time=a;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -139,26 +179,22 @@
|
|||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#end_time_a',
|
elem: '#end_time_a',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
min: -7,
|
min: 0,
|
||||||
max:0,
|
|
||||||
format: 'yyyy-MM-dd',
|
format: 'yyyy-MM-dd',
|
||||||
showBottom: false,
|
showBottom: false,
|
||||||
done:function(a,b,c){
|
done:function(a,b,c){
|
||||||
$('#start_time_a').val(a);
|
detail.end_time_a=a;
|
||||||
detail.start_time=a;
|
|
||||||
detail.end_time=a;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#start_time_1,#end_time_1').empty();
|
$('#start_time_a,#end_time_a').empty();
|
||||||
|
|
||||||
var hourArray=[];
|
var hourArray=[];
|
||||||
for(var h=0;h<24;h++){
|
for(var h=0;h<24;h++){
|
||||||
var t=h<10?'0'+h:h
|
var t=h<10?'0'+h:h
|
||||||
var t_1=t+':00',t_2=t+':15',t_3=t+':30',t_4=t+':45';
|
var t_1=t+':00',t_2=t+':15',t_3=t+':30',t_4=t+':45';
|
||||||
hourArray.push(t_1,t_2,t_3,t_4);
|
hourArray.push(t_1,t_2,t_3,t_4);
|
||||||
}
|
}
|
||||||
|
var html_1='', html_2='',def_h1=detail.start_time_b,def_h2=detail.end_time_b;
|
||||||
var html_1='', html_2='',def_h1='08:30',def_h2='09:00';
|
|
||||||
for(var s=0;s<hourArray.length;s++){
|
for(var s=0;s<hourArray.length;s++){
|
||||||
var check_1='',check_2='';
|
var check_1='',check_2='';
|
||||||
if(hourArray[s]==def_h1){
|
if(hourArray[s]==def_h1){
|
||||||
@ -171,47 +207,100 @@
|
|||||||
html_2 += '<option value="'+hourArray[s]+'" '+check_2+'>'+hourArray[s]+'</option>';
|
html_2 += '<option value="'+hourArray[s]+'" '+check_2+'>'+hourArray[s]+'</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#start_time_1').append(html_1);
|
$('#start_time_b').append(html_1);
|
||||||
$('#end_time_1').append(html_2);
|
$('#end_time_b').append(html_2);
|
||||||
form.render();
|
form.render();
|
||||||
|
|
||||||
$('[name="name"]').on('input',function(){
|
$('[name="title"]').on('input',function(){
|
||||||
var _val=$(this).val();
|
var _val=$(this).val();
|
||||||
detail.name=_val;
|
detail.title=_val;
|
||||||
});
|
});
|
||||||
form.on('select(start_time_1)', function(data){
|
form.on('select(start_time_b)', function(data){
|
||||||
detail.start_time_1=data.value;
|
detail.start_time_b=data.value;
|
||||||
console.log(data);
|
|
||||||
});
|
});
|
||||||
form.on('select(end_time_1)', function(data){
|
form.on('select(end_time_b)', function(data){
|
||||||
detail.end_time_1=data.value;
|
detail.end_time_b=data.value;
|
||||||
});
|
});
|
||||||
$('[form-input="remark"]').on('input',function(){
|
$('[form-input="remark"]').on('input',function(){
|
||||||
var _val=$(this).val();
|
var _val=$(this).val();
|
||||||
detail.remark=_val;
|
detail.remark=_val;
|
||||||
});
|
});
|
||||||
form.on('radio(labor_type)', function(data){
|
|
||||||
detail.labor_type=data.value;
|
dropdown.render({
|
||||||
});
|
elem: '#type'
|
||||||
|
,data: [{
|
||||||
|
title: '<span class="layui-badge-dot"></span> 紧急',
|
||||||
|
id: 1
|
||||||
|
},{
|
||||||
|
title: '<span class="layui-badge-dot layui-bg-orange"></span> 重要',
|
||||||
|
|
||||||
|
id: 2
|
||||||
|
},{
|
||||||
|
title: '<span class="layui-badge-dot layui-bg-blue"></span> 次要',
|
||||||
|
id: 3
|
||||||
|
},{
|
||||||
|
title: '<span class="layui-badge-dot layui-bg-green"></span> 不重要',
|
||||||
|
id: 4
|
||||||
|
},{
|
||||||
|
title: '<span class="layui-badge-dot layui-bg-black"></span> 无优先级',
|
||||||
|
id: 5
|
||||||
|
}]
|
||||||
|
,click: function(obj){
|
||||||
|
this.elem.html(obj.title);
|
||||||
|
detail.type = obj.id;
|
||||||
|
}
|
||||||
|
,style: 'width: 120px;'
|
||||||
|
});
|
||||||
|
|
||||||
|
dropdown.render({
|
||||||
|
elem: '#remind_type'
|
||||||
|
,data: [{
|
||||||
|
title: '不提醒',
|
||||||
|
id: 0
|
||||||
|
},{
|
||||||
|
title: '提前5分钟',
|
||||||
|
id: 1
|
||||||
|
},{
|
||||||
|
title: '提前15分钟',
|
||||||
|
id: 2
|
||||||
|
},{
|
||||||
|
title: '提前30分钟',
|
||||||
|
id: 3
|
||||||
|
},{
|
||||||
|
title: '提前1小时',
|
||||||
|
id: 4
|
||||||
|
},{
|
||||||
|
title: '提前2小时',
|
||||||
|
id: 5
|
||||||
|
},{
|
||||||
|
title: '提前1天',
|
||||||
|
id:6
|
||||||
|
}]
|
||||||
|
,click: function(obj){
|
||||||
|
this.elem.html(obj.title);
|
||||||
|
detail.remind_type = obj.id;
|
||||||
|
}
|
||||||
|
,style: 'width: 120px;'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
btn: ['确定提交'],
|
btn: ['确定提交'],
|
||||||
btnAlign:'c',
|
btnAlign:'c',
|
||||||
yes: function(idx){
|
yes: function(idx){
|
||||||
if(detail.start_time=='' || detail.end_time==''){
|
if(detail.start_time_a=='' || detail.end_time_a==''){
|
||||||
layer.msg('请选择工作时间范围');
|
layer.msg('请完善日程时间范围');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(detail.labor_type==0){
|
if(detail.type==0){
|
||||||
layer.msg('请选择工作类型');
|
layer.msg('请选择日程优先级');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(detail.name==''){
|
if(detail.title==''){
|
||||||
layer.msg('请填写工作内容');
|
layer.msg('请填写日程内容');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(detail);
|
console.log(detail);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"{:url('home/plan/save')}",
|
url:"{:url('home/plan/add')}",
|
||||||
type:'post',
|
type:'post',
|
||||||
data:detail,
|
data:detail,
|
||||||
success:function(e){
|
success:function(e){
|
||||||
@ -229,38 +318,44 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//查看工作记录
|
//查看日程记录
|
||||||
function viewEvent(){
|
function viewEvent(detail){
|
||||||
var work_type='-';
|
var work_type='<span style="color:#393D49">无优先级</span>';
|
||||||
if(detail.labor_type==2){
|
if(detail.type==1){
|
||||||
work_type='外勤工作';
|
work_type = '<span style="color:#FF5722">紧急</span>';
|
||||||
}
|
}
|
||||||
else if(detail.labor_type==1){
|
else if(detail.type==2){
|
||||||
work_type='案头工作';
|
work_type = '<span style="color:#FFB800">重要</span>';
|
||||||
}
|
}
|
||||||
var content='<form class="layui-form" style="width:770px">\
|
else if(detail.type==3){
|
||||||
|
work_type = '<span style="color:#1E9FFF">次要</span>';
|
||||||
|
}
|
||||||
|
else if(detail.type==4){
|
||||||
|
work_type = '<span style="color:#009688">不重要</span>';
|
||||||
|
}
|
||||||
|
var content='<div style="width:770px">\
|
||||||
<table class="layui-table" style="margin:12px 15px 0;">\
|
<table class="layui-table" style="margin:12px 15px 0;">\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作内容</td>\
|
<td class="layui-td-gray2">日程时间范围</td>\
|
||||||
<td>'+detail.name+'</td>\
|
<td>'+detail.start_time+' 至 '+detail.end_time+'</td>\
|
||||||
<td class="layui-td-gray">工作类别</td>\
|
<td class="layui-td-gray">提醒时间</td>\
|
||||||
<td>'+work_type+'</td>\
|
<td>'+detail.remind_time+'</td>\
|
||||||
</tr>\
|
|
||||||
<tr id="tr_date_range">\
|
|
||||||
<td class="layui-td-gray2">工作时间范围</td>\
|
|
||||||
<td>'+detail.start_time+' '+detail.start_time_1+' 至 '+detail.end_time_1+',共'+detail.labor_time+'工时</td>\
|
|
||||||
<td class="layui-td-gray">执行人</td>\
|
|
||||||
<td>'+detail.user+'</td>\
|
|
||||||
</tr>\
|
</tr>\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作描述</td>\
|
<td class="layui-td-gray2">日程安排内容</td>\
|
||||||
|
<td>'+detail.title+'</td>\
|
||||||
|
<td class="layui-td-gray">优先级</td>\
|
||||||
|
<td>'+work_type+'</td>\
|
||||||
|
</tr>\
|
||||||
|
<tr>\
|
||||||
|
<td class="layui-td-gray2">日程内容描述</td>\
|
||||||
<td colspan="3">'+detail.remark+'</td>\
|
<td colspan="3">'+detail.remark+'</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
</table>\
|
</table>\
|
||||||
</form>';
|
</div>';
|
||||||
layer.open({
|
layer.open({
|
||||||
type:1,
|
type:1,
|
||||||
title:'工作记录',
|
title:'日程安排',
|
||||||
area:['800px','336px'],
|
area:['800px','336px'],
|
||||||
content:content,
|
content:content,
|
||||||
success:function(){
|
success:function(){
|
||||||
@ -280,12 +375,12 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"{:url('home/schedule/detail')}",
|
url:"{:url('home/plan/detail')}",
|
||||||
type:'post',
|
type:'post',
|
||||||
data:{id:id},
|
data:{id:id},
|
||||||
success:function(res){
|
success:function(res){
|
||||||
detail=res.data;
|
var detail=res.data;
|
||||||
viewEvent();
|
viewEvent(detail);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/html" id="toolbarDemo">
|
<script type="text/html" id="toolbarDemo">
|
||||||
<div class="layui-btn-container">
|
<div class="layui-btn-container">
|
||||||
<button class="layui-btn layui-btn-normal layui-btn-sm addLoan" type="button">+ 新增工作记录</button>
|
<button class="layui-btn layui-btn-normal layui-btn-sm addLoan" type="button">+ 新增日程安排</button>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
{/block}
|
{/block}
|
||||||
@ -46,6 +46,7 @@
|
|||||||
function init(layui){
|
function init(layui){
|
||||||
var table = layui.table
|
var table = layui.table
|
||||||
,form = layui.form
|
,form = layui.form
|
||||||
|
,dropdown = layui.dropdown
|
||||||
,dtree = layui.dtree
|
,dtree = layui.dtree
|
||||||
,employeepicker = layui.employeepicker
|
,employeepicker = layui.employeepicker
|
||||||
,laydate = layui.laydate;
|
,laydate = layui.laydate;
|
||||||
@ -98,17 +99,32 @@
|
|||||||
,cellMinWidth: 80
|
,cellMinWidth: 80
|
||||||
,cols: [[ //表头
|
,cols: [[ //表头
|
||||||
{field: 'id', title: '序号',fixed: 'left', width:80, align:'center'}
|
{field: 'id', title: '序号',fixed: 'left', width:80, align:'center'}
|
||||||
,{field: 'color', title: '优先级', align:'center',width:90,templet:function(d){
|
,{field: 'type', title: '优先级', align:'center',width:80,templet:function(d){
|
||||||
var html='<span class="span-color-'+d.color+'">-</span>';
|
var html='';
|
||||||
|
if(d.type==1){
|
||||||
|
html = '<span style="color:#FF5722">紧急</span>';
|
||||||
|
}
|
||||||
|
else if(d.type==2){
|
||||||
|
html = '<span style="color:#FFB800">重要</span>';
|
||||||
|
}
|
||||||
|
else if(d.type==3){
|
||||||
|
html = '<span style="color:#1E9FFF">次要</span>';
|
||||||
|
}
|
||||||
|
else if(d.type==4){
|
||||||
|
html = '<span style="color:#009688">不重要</span>';
|
||||||
|
}
|
||||||
|
else if(d.type==5){
|
||||||
|
html = '<span style="color:#393D49">无优先级</span>';
|
||||||
|
}
|
||||||
return html;
|
return html;
|
||||||
}}
|
}}
|
||||||
,{field: 'start_time', title: '工作时间范围', align:'center',width:186,templet:function(d){
|
,{field: 'start_time', title: '日程时间范围', align:'center',width:260,templet:function(d){
|
||||||
var html=d.start_time+'至'+d.end_time;
|
var html=d.start_time+'至'+d.end_time;
|
||||||
return html;
|
return html;
|
||||||
}}
|
}}
|
||||||
,{field: 'title', title: '工作内容'}
|
,{field: 'title', title: '日程安排内容'}
|
||||||
,{field: 'create_time', title: '登记时间', align:'center',width:150}
|
,{field: 'remind_time', title: '提醒时间', align:'center',width:136}
|
||||||
,{field: 'right', title: '操作',fixed:'right', width:120, align:'center',templet:function(d){
|
,{field: 'right', title: '操作',fixed:'right', width:100, align:'center',templet:function(d){
|
||||||
var html='<div class="layui-btn-group">';
|
var html='<div class="layui-btn-group">';
|
||||||
html+='<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">查看</button>';
|
html+='<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">查看</button>';
|
||||||
if(d.admin_id==login_user){
|
if(d.admin_id==login_user){
|
||||||
@ -120,7 +136,7 @@
|
|||||||
]]
|
]]
|
||||||
});
|
});
|
||||||
|
|
||||||
//更改工时
|
//操作
|
||||||
table.on('tool(test)', function(obj){
|
table.on('tool(test)', function(obj){
|
||||||
var data = obj.data;
|
var data = obj.data;
|
||||||
if(obj.event === 'edit'){
|
if(obj.event === 'edit'){
|
||||||
@ -130,8 +146,18 @@
|
|||||||
id:data.id
|
id:data.id
|
||||||
},
|
},
|
||||||
success:function(e){
|
success:function(e){
|
||||||
if(e.code==0){
|
if(e.code==0){
|
||||||
editEvent(e.data);
|
var detail={};
|
||||||
|
detail['id']=e.data.id;
|
||||||
|
detail['title']=e.data.title;
|
||||||
|
detail['start_time_a']=e.data.start_time_a;
|
||||||
|
detail['end_time_a']=e.data.end_time_a;
|
||||||
|
detail['start_time_b']=e.data.start_time_b;
|
||||||
|
detail['end_time_b']=e.data.end_time_b;
|
||||||
|
detail['remark']=e.data.remark;
|
||||||
|
detail['type']=e.data.type;
|
||||||
|
detail['remind_type']=e.data.remind_type;
|
||||||
|
addEvent(detail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -150,115 +176,42 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//编辑
|
|
||||||
function editEvent(data){
|
|
||||||
var detail={};
|
|
||||||
detail['id']=data.id;
|
|
||||||
detail['title']=data.title;
|
|
||||||
detail['remark']=data.remark;
|
|
||||||
detail['labor_type']=data.labor_type;
|
|
||||||
var content='<form class="layui-form" style="width:868px">\
|
|
||||||
<table class="layui-table" style="margin:15px 15px 0;">\
|
|
||||||
<tr>\
|
|
||||||
<td class="layui-td-gray2">工作时间范围 <span style="color: red">*</span></td>\
|
|
||||||
<td>'+data.start_time+' '+data.start_time_1+' 至 '+data.end_time_1+'</td>\
|
|
||||||
<td class="layui-td-gray">工作类型 <span style="color: red">*</span></td>\
|
|
||||||
<td>\
|
|
||||||
<input type="radio" name="labor_type" lay-filter="labor_type" value="1" title="案头工作"><input type="radio" name="labor_type" value="2" lay-filter="labor_type" title="外勤工作">\
|
|
||||||
</td>\
|
|
||||||
</tr>\
|
|
||||||
<tr>\
|
|
||||||
<td class="layui-td-gray2">工作内容 <span style="color: red">*</span></td>\
|
|
||||||
<td colspan="3"><input name="title" class="layui-input" value="'+data.name+'" lay-verify="required" lay-reqText="请完成工作内容"></td>\
|
|
||||||
</tr>\
|
|
||||||
<tr>\
|
|
||||||
<td class="layui-td-gray2">工作详细描述</td>\
|
|
||||||
<td colspan="3">\
|
|
||||||
<textarea name="remark" form-input="remark" class="layui-textarea" style="min-height:120px;">'+data.remark+'</textarea>\
|
|
||||||
</td>\
|
|
||||||
</tr>\
|
|
||||||
</table>\
|
|
||||||
</form>';
|
|
||||||
layer.open({
|
|
||||||
type:1,
|
|
||||||
title:'编辑日程安排',
|
|
||||||
area:['900px','390px'],
|
|
||||||
content:content,
|
|
||||||
success:function(){
|
|
||||||
$("input[name=labor_type][value="+data.labor_type+"]").prop("checked","true");
|
|
||||||
form.render();
|
|
||||||
$('[name="title"]').on('input',function(){
|
|
||||||
var _val=$(this).val();
|
|
||||||
detail.title=_val;
|
|
||||||
});
|
|
||||||
$('[form-input="remark"]').on('input',function(){
|
|
||||||
var _val=$(this).val();
|
|
||||||
detail.remark=_val;
|
|
||||||
});
|
|
||||||
form.on('radio(labor_type)', function(data){
|
|
||||||
detail.labor_type=data.value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
btn: ['确定提交'],
|
|
||||||
btnAlign:'c',
|
|
||||||
yes: function(idx){
|
|
||||||
if(detail.labor_type==0){
|
|
||||||
layer.msg('请选择工作类型');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(detail.title==''){
|
|
||||||
layer.msg('请填写工作内容');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log(detail);
|
|
||||||
$.ajax({
|
|
||||||
url:"{:url('home/plan/add')}",
|
|
||||||
type:'post',
|
|
||||||
data:detail,
|
|
||||||
success:function(e){
|
|
||||||
layer.msg(e.msg);
|
|
||||||
if(e.code==0){
|
|
||||||
layer.close(idx);
|
|
||||||
setTimeout(function(){
|
|
||||||
window.location.reload();
|
|
||||||
},1000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//查看工作记录
|
//查看日程记录
|
||||||
function viewEvent(detail){
|
function viewEvent(detail){
|
||||||
var work_type='-';
|
var work_type='<span style="color:#393D49">无优先级</span>';
|
||||||
if(detail.labor_type==2){
|
if(detail.type==1){
|
||||||
work_type='外勤工作';
|
work_type = '<span style="color:#FF5722">紧急</span>';
|
||||||
}
|
}
|
||||||
else if(detail.labor_type==1){
|
else if(detail.type==2){
|
||||||
work_type='案头工作';
|
work_type = '<span style="color:#FFB800">重要</span>';
|
||||||
}
|
}
|
||||||
var content='<form class="layui-form" style="width:770px">\
|
else if(detail.type==3){
|
||||||
|
work_type = '<span style="color:#1E9FFF">次要</span>';
|
||||||
|
}
|
||||||
|
else if(detail.type==4){
|
||||||
|
work_type = '<span style="color:#009688">不重要</span>';
|
||||||
|
}
|
||||||
|
var content='<div style="width:770px">\
|
||||||
<table class="layui-table" style="margin:12px 15px 0;">\
|
<table class="layui-table" style="margin:12px 15px 0;">\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作内容</td>\
|
<td class="layui-td-gray2">日程时间范围</td>\
|
||||||
<td>'+detail.name+'</td>\
|
<td>'+detail.start_time+' 至 '+detail.end_time+'</td>\
|
||||||
<td class="layui-td-gray">工作类别</td>\
|
<td class="layui-td-gray">提醒时间</td>\
|
||||||
<td>'+work_type+'</td>\
|
<td>'+detail.remind_time+'</td>\
|
||||||
</tr>\
|
|
||||||
<tr id="tr_date_range">\
|
|
||||||
<td class="layui-td-gray2">工作时间范围</td>\
|
|
||||||
<td>'+detail.start_time+' '+detail.start_time_1+' 至 '+detail.end_time_1+',共'+detail.labor_time+'工时</td>\
|
|
||||||
<td class="layui-td-gray">执行人</td>\
|
|
||||||
<td>'+detail.user+'</td>\
|
|
||||||
</tr>\
|
</tr>\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作描述</td>\
|
<td class="layui-td-gray2">日程安排内容</td>\
|
||||||
|
<td>'+detail.title+'</td>\
|
||||||
|
<td class="layui-td-gray">优先级</td>\
|
||||||
|
<td>'+work_type+'</td>\
|
||||||
|
</tr>\
|
||||||
|
<tr>\
|
||||||
|
<td class="layui-td-gray2">日程内容描述</td>\
|
||||||
<td colspan="3">'+detail.remark+'</td>\
|
<td colspan="3">'+detail.remark+'</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
</table>\
|
</table>\
|
||||||
</form>';
|
</div>';
|
||||||
layer.open({
|
layer.open({
|
||||||
type:1,
|
type:1,
|
||||||
title:'日程安排',
|
title:'日程安排',
|
||||||
@ -276,61 +229,100 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('.body-content').on('click','.addLoan',function(){
|
$('.body-content').on('click','.addLoan',function(){
|
||||||
addEvent();
|
|
||||||
});
|
|
||||||
|
|
||||||
function addEvent(){
|
|
||||||
var detail={};
|
var detail={};
|
||||||
detail['id']=0;
|
detail['id']=0;
|
||||||
detail['title']='';
|
detail['title']='';
|
||||||
detail['start_time']='';
|
detail['start_time_a']='';
|
||||||
detail['end_time']='';
|
detail['end_time_a']='';
|
||||||
detail['start_time_1']='08:30';
|
detail['start_time_b']='08:30';
|
||||||
detail['end_time_1']='09:00';
|
detail['end_time_b']='09:00';
|
||||||
detail['remark']='';
|
detail['remark']='';
|
||||||
detail['labor_type']=0;
|
detail['type']=0;
|
||||||
var content='<form class="layui-form" style="width:868px">\
|
detail['remind_type']=0;
|
||||||
|
addEvent(detail);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function addEvent(detail){
|
||||||
|
var type='<span style="color:#aaa">请选择</span>';
|
||||||
|
if(detail.type==1){
|
||||||
|
type = '<span class="layui-badge-dot"></span> 紧急';
|
||||||
|
}
|
||||||
|
else if(detail.type==2){
|
||||||
|
type = '<span class="layui-badge-dot layui-bg-orange"></span> 重要';
|
||||||
|
}
|
||||||
|
else if(detail.type==3){
|
||||||
|
type = '<span class="layui-badge-dot layui-bg-blue"></span> 次要';
|
||||||
|
}
|
||||||
|
else if(detail.type==4){
|
||||||
|
type = '<span class="layui-badge-dot layui-bg-green"></span> 不重要';
|
||||||
|
}
|
||||||
|
else if(detail.type==5){
|
||||||
|
type = '<span class="layui-badge-dot layui-bg-black"></span> 无优先级';
|
||||||
|
}
|
||||||
|
|
||||||
|
var remind_type='不提醒';
|
||||||
|
if(detail.remind_type==1){
|
||||||
|
remind_type = '提前5分钟';
|
||||||
|
}
|
||||||
|
else if(detail.remind_type==2){
|
||||||
|
remind_type = '提前15分钟';
|
||||||
|
}
|
||||||
|
else if(detail.remind_type==3){
|
||||||
|
remind_type = '提前30分钟';
|
||||||
|
}
|
||||||
|
else if(detail.remind_type==4){
|
||||||
|
remind_type = '提前1小时';
|
||||||
|
}
|
||||||
|
else if(detail.remind_type==5){
|
||||||
|
remind_type = '提前2小时';
|
||||||
|
}else if(detail.remind_type==6){
|
||||||
|
remind_type = '提前1天';
|
||||||
|
}
|
||||||
|
|
||||||
|
var content='<form class="layui-form" style="width:828px">\
|
||||||
<table class="layui-table" style="margin:15px 15px 0;">\
|
<table class="layui-table" style="margin:15px 15px 0;">\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作时间范围 <span style="color: red">*</span></td>\
|
<td class="layui-td-gray2">日程时间范围 <span style="color: red">*</span></td>\
|
||||||
<td>\
|
<td>\
|
||||||
<input id="start_time_a" name="start_time_a" style="width:100px; display:inline-block;" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" lay-reqText="请选择"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="start_time_1" id="start_time_1"></select></div> 至 <input id="end_time_a" name="end_time_a" style="width:100px; display:inline-block;" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" lay-reqText="请选择"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="end_time_1" id="end_time_1"></select></div>\
|
<input id="start_time_a" name="start_time_a" style="width:120px; display:inline-block;" autocomplete="off" class="layui-input" value="'+detail.start_time_a+'" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间"><div style="display: inline-block; margin-left:3px; width: 86px;"><select lay-filter="start_time_b" id="start_time_b"></select></div> 至 <input id="end_time_a" name="end_time_a" style="width:120px; display:inline-block;" autocomplete="off" class="layui-input" value="'+detail.end_time_a+'" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间"><div style="display: inline-block; margin-left:3px; width: 86px;"><select lay-filter="end_time_b" id="end_time_b"></select></div>\
|
||||||
</td>\
|
</td>\
|
||||||
<td class="layui-td-gray">工作类型 <span style="color: red">*</span></td>\
|
<td class="layui-td-gray">日程优先级 <span style="color: red">*</span></td>\
|
||||||
<td>\
|
<td>\
|
||||||
<input type="radio" name="labor_type" lay-filter="labor_type" value="1" title="案头工作"><input type="radio" name="labor_type" value="2" lay-filter="labor_type" title="外勤工作">\
|
<div class="layui-input" id="type" style="width:120px; line-height:35px;">'+type+'</div>\
|
||||||
</td>\
|
</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作内容 <span style="color: red">*</span></td>\
|
<td class="layui-td-gray2">日程内容 <span style="color: red">*</span></td>\
|
||||||
<td colspan="3"><input name="title" class="layui-input" value="" lay-verify="required" lay-reqText="请完成工作内容"></td>\
|
<td><input name="title" class="layui-input" value="'+detail.title+'" lay-verify="required" placeholder="请完成日程内容" lay-reqText="请完成日程内容"></td>\
|
||||||
|
<td class="layui-td-gray">提醒 <span style="color: red">*</span></td>\
|
||||||
|
<td>\
|
||||||
|
<div class="layui-input" id="remind_type" style="width:120px; line-height:35px;">'+remind_type+'</div>\
|
||||||
|
</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
<tr>\
|
<tr>\
|
||||||
<td class="layui-td-gray2">工作详细描述</td>\
|
<td class="layui-td-gray2">日程详细描述</td>\
|
||||||
<td colspan="3">\
|
<td colspan="3">\
|
||||||
<textarea name="remark" form-input="remark" class="layui-textarea" style="min-height:120px;"></textarea>\
|
<textarea name="remark" form-input="remark" class="layui-textarea" style="min-height:120px;">'+detail.remark+'</textarea>\
|
||||||
</td>\
|
</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
</table>\
|
</table>\
|
||||||
</form>';
|
</form>';
|
||||||
layer.open({
|
layer.open({
|
||||||
type:1,
|
type:1,
|
||||||
title:'添加工作记录',
|
title:'日程安排',
|
||||||
area:['900px','390px'],
|
area:['860px','390px'],
|
||||||
content:content,
|
content:content,
|
||||||
success:function(){
|
success:function(){
|
||||||
//日期时间范围
|
//日期时间范围
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#start_time_a',
|
elem: '#start_time_a',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
min: -7,
|
min: 0,
|
||||||
max:0,
|
|
||||||
format: 'yyyy-MM-dd',
|
format: 'yyyy-MM-dd',
|
||||||
showBottom: false,
|
showBottom: false,
|
||||||
done:function(a,b,c){
|
done:function(a,b,c){
|
||||||
$('#end_time_a').val(a);
|
detail.start_time_a=a;
|
||||||
detail.start_time=a;
|
|
||||||
detail.end_time=a;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -338,26 +330,22 @@
|
|||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#end_time_a',
|
elem: '#end_time_a',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
min: -7,
|
min: 0,
|
||||||
max:0,
|
|
||||||
format: 'yyyy-MM-dd',
|
format: 'yyyy-MM-dd',
|
||||||
showBottom: false,
|
showBottom: false,
|
||||||
done:function(a,b,c){
|
done:function(a,b,c){
|
||||||
$('#start_time_a').val(a);
|
detail.end_time_a=a;
|
||||||
detail.start_time=a;
|
|
||||||
detail.end_time=a;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#start_time_1,#end_time_1').empty();
|
$('#start_time_a,#end_time_a').empty();
|
||||||
|
|
||||||
var hourArray=[];
|
var hourArray=[];
|
||||||
for(var h=0;h<24;h++){
|
for(var h=0;h<24;h++){
|
||||||
var t=h<10?'0'+h:h
|
var t=h<10?'0'+h:h
|
||||||
var t_1=t+':00',t_2=t+':15',t_3=t+':30',t_4=t+':45';
|
var t_1=t+':00',t_2=t+':15',t_3=t+':30',t_4=t+':45';
|
||||||
hourArray.push(t_1,t_2,t_3,t_4);
|
hourArray.push(t_1,t_2,t_3,t_4);
|
||||||
}
|
}
|
||||||
|
var html_1='', html_2='',def_h1=detail.start_time_b,def_h2=detail.end_time_b;
|
||||||
var html_1='', html_2='',def_h1='08:30',def_h2='09:00';
|
|
||||||
for(var s=0;s<hourArray.length;s++){
|
for(var s=0;s<hourArray.length;s++){
|
||||||
var check_1='',check_2='';
|
var check_1='',check_2='';
|
||||||
if(hourArray[s]==def_h1){
|
if(hourArray[s]==def_h1){
|
||||||
@ -370,42 +358,95 @@
|
|||||||
html_2 += '<option value="'+hourArray[s]+'" '+check_2+'>'+hourArray[s]+'</option>';
|
html_2 += '<option value="'+hourArray[s]+'" '+check_2+'>'+hourArray[s]+'</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#start_time_1').append(html_1);
|
$('#start_time_b').append(html_1);
|
||||||
$('#end_time_1').append(html_2);
|
$('#end_time_b').append(html_2);
|
||||||
form.render();
|
form.render();
|
||||||
|
|
||||||
$('[name="title"]').on('input',function(){
|
$('[name="title"]').on('input',function(){
|
||||||
var _val=$(this).val();
|
var _val=$(this).val();
|
||||||
detail.title=_val;
|
detail.title=_val;
|
||||||
});
|
});
|
||||||
form.on('select(start_time_1)', function(data){
|
form.on('select(start_time_b)', function(data){
|
||||||
detail.start_time_1=data.value;
|
detail.start_time_b=data.value;
|
||||||
console.log(data);
|
|
||||||
});
|
});
|
||||||
form.on('select(end_time_1)', function(data){
|
form.on('select(end_time_b)', function(data){
|
||||||
detail.end_time_1=data.value;
|
detail.end_time_b=data.value;
|
||||||
});
|
});
|
||||||
$('[form-input="remark"]').on('input',function(){
|
$('[form-input="remark"]').on('input',function(){
|
||||||
var _val=$(this).val();
|
var _val=$(this).val();
|
||||||
detail.remark=_val;
|
detail.remark=_val;
|
||||||
});
|
});
|
||||||
form.on('radio(labor_type)', function(data){
|
|
||||||
detail.labor_type=data.value;
|
dropdown.render({
|
||||||
});
|
elem: '#type'
|
||||||
|
,data: [{
|
||||||
|
title: '<span class="layui-badge-dot"></span> 紧急',
|
||||||
|
id: 1
|
||||||
|
},{
|
||||||
|
title: '<span class="layui-badge-dot layui-bg-orange"></span> 重要',
|
||||||
|
|
||||||
|
id: 2
|
||||||
|
},{
|
||||||
|
title: '<span class="layui-badge-dot layui-bg-blue"></span> 次要',
|
||||||
|
id: 3
|
||||||
|
},{
|
||||||
|
title: '<span class="layui-badge-dot layui-bg-green"></span> 不重要',
|
||||||
|
id: 4
|
||||||
|
},{
|
||||||
|
title: '<span class="layui-badge-dot layui-bg-black"></span> 无优先级',
|
||||||
|
id: 5
|
||||||
|
}]
|
||||||
|
,click: function(obj){
|
||||||
|
this.elem.html(obj.title);
|
||||||
|
detail.type = obj.id;
|
||||||
|
}
|
||||||
|
,style: 'width: 120px;'
|
||||||
|
});
|
||||||
|
|
||||||
|
dropdown.render({
|
||||||
|
elem: '#remind_type'
|
||||||
|
,data: [{
|
||||||
|
title: '不提醒',
|
||||||
|
id: 0
|
||||||
|
},{
|
||||||
|
title: '提前5分钟',
|
||||||
|
id: 1
|
||||||
|
},{
|
||||||
|
title: '提前15分钟',
|
||||||
|
id: 2
|
||||||
|
},{
|
||||||
|
title: '提前30分钟',
|
||||||
|
id: 3
|
||||||
|
},{
|
||||||
|
title: '提前1小时',
|
||||||
|
id: 4
|
||||||
|
},{
|
||||||
|
title: '提前2小时',
|
||||||
|
id: 5
|
||||||
|
},{
|
||||||
|
title: '提前1天',
|
||||||
|
id:6
|
||||||
|
}]
|
||||||
|
,click: function(obj){
|
||||||
|
this.elem.html(obj.title);
|
||||||
|
detail.remind_type = obj.id;
|
||||||
|
}
|
||||||
|
,style: 'width: 120px;'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
btn: ['确定提交'],
|
btn: ['确定提交'],
|
||||||
btnAlign:'c',
|
btnAlign:'c',
|
||||||
yes: function(idx){
|
yes: function(idx){
|
||||||
if(detail.start_time=='' || detail.end_time==''){
|
if(detail.start_time_a=='' || detail.end_time_a==''){
|
||||||
layer.msg('请选择工作时间范围');
|
layer.msg('请完善日程时间范围');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(detail.labor_type==0){
|
if(detail.type==0){
|
||||||
layer.msg('请选择工作类型');
|
layer.msg('请选择日程优先级');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(detail.title==''){
|
if(detail.title==''){
|
||||||
layer.msg('请填写工作内容');
|
layer.msg('请填写日程内容');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(detail);
|
console.log(detail);
|
||||||
|
@ -810,7 +810,7 @@ DROP TABLE IF EXISTS `oa_plan`;
|
|||||||
CREATE TABLE `oa_plan` (
|
CREATE TABLE `oa_plan` (
|
||||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '工作安排主题',
|
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '工作安排主题',
|
||||||
`color` varchar(100) NOT NULL DEFAULT '' COMMENT '颜色',
|
`type` varchar(100) NOT NULL DEFAULT '' COMMENT '日程优先级',
|
||||||
`cid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '预设字段:关联工作内容类型ID',
|
`cid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '预设字段:关联工作内容类型ID',
|
||||||
`cmid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '预设字段:关联客户ID',
|
`cmid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '预设字段:关联客户ID',
|
||||||
`ptid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '预设字段:关联项目ID',
|
`ptid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '预设字段:关联项目ID',
|
||||||
@ -818,6 +818,7 @@ CREATE TABLE `oa_plan` (
|
|||||||
`did` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '所属部门',
|
`did` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '所属部门',
|
||||||
`start_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '开始时间',
|
`start_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '开始时间',
|
||||||
`end_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '结束时间',
|
`end_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '结束时间',
|
||||||
|
`remind_type` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '提醒类型',
|
||||||
`remind_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '提醒时间',
|
`remind_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '提醒时间',
|
||||||
`remark` text NOT NULL COMMENT '描述',
|
`remark` text NOT NULL COMMENT '描述',
|
||||||
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用',
|
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user