创建版本
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<form method="post" action="{{url()}}" id="task-form" name="task-form">
|
||||
|
||||
<input type="hidden" name="type" value="{{$type}}">
|
||||
@if($type == 'subtask')
|
||||
<input type="hidden" name="parent_id" value="{{$parent_id}}">
|
||||
@endif
|
||||
|
||||
<input type="hidden" name="project_id" value="{{$project_id}}">
|
||||
<input type="hidden" name="is_item" value="0">
|
||||
|
||||
<div class="panel m-b-none">
|
||||
|
||||
<table class="table table-form m-b-none">
|
||||
|
||||
<tr>
|
||||
<td align="right" width="10%">名称</td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" value="{{$task['name']}}" class="form-control input-sm">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@if($type == 'task')
|
||||
<tr>
|
||||
<td align="right">任务列表</td>
|
||||
<td align="left">
|
||||
<select class="form-control input-sm" name="parent_id">
|
||||
<option value="0"> - </option>
|
||||
@if($items)
|
||||
@foreach($items as $item)
|
||||
<option value="{{$item['id']}}" @if($item['id'] == $task['item_id']) selected="selected" @endif>{{$item['name']}}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
|
||||
<tr>
|
||||
<td align="right">执行者</td>
|
||||
<td align="left">
|
||||
{{App\Support\Dialog::user('user', $type.'_user_id', '', 0, 0)}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">参与者</td>
|
||||
<td align="left">
|
||||
{{App\Support\Dialog::user('user', $type.'_users', '', 1, 0)}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">时间</td>
|
||||
<td align="left">
|
||||
<input type="text" name="start_at" autocomplete="off" data-toggle="datetime" value="@datetime($task->start_at,time())" class="form-control input-sm input-inline">
|
||||
-
|
||||
<input type="text" name="end_at" autocomplete="off" data-toggle="datetime" value="" class="form-control input-sm input-inline">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">备注</td>
|
||||
<td>
|
||||
<textarea class="form-control" type="text" name="remark"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">附件</td>
|
||||
<td align="left">
|
||||
{{attachment_uploader('attachment', '', 'project_task')}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@@ -0,0 +1,234 @@
|
||||
<style>
|
||||
.modal-body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wrapper-sm {
|
||||
background-color: #f0f3f4;
|
||||
}
|
||||
</style>
|
||||
<div class="wrapper-sm">
|
||||
|
||||
<form method="post" class="project-form" action="{{url()}}" id="task-form-{{$task['id']}}" name="task-form-{{$task['id']}}">
|
||||
|
||||
<input type="hidden" name="type" value="{{$type}}">
|
||||
<input type="hidden" name="project_id" value="{{$task->project_id}}">
|
||||
<input type="hidden" name="id" value="{{$task->id}}">
|
||||
<input type="hidden" name="is_item" value="0">
|
||||
|
||||
<div class="panel b-a">
|
||||
<table class="table table-form m-b-none">
|
||||
<tr>
|
||||
<td align="right" width="10%">名称</td>
|
||||
<td align="left">
|
||||
|
||||
@if($permission['name'])
|
||||
<div class="input-group">
|
||||
<div class="input-group-check">
|
||||
<label class="i-checks i-checks-lg m-b-none hinted" title="点击完成任务">
|
||||
<input class="select-row" name="progress" type="checkbox" @if($task['progress']==1) checked="checked" @endif value="1"><i></i>
|
||||
</label>
|
||||
</div>
|
||||
<input type="text" name="name" value="{{$task['name']}}" class="form-control input-sm">
|
||||
</div>
|
||||
@else
|
||||
|
||||
@if($task['progress'] == 1)
|
||||
<span class="label label-success">完成</span>
|
||||
@else
|
||||
<span class="label label-info">执行中</span>
|
||||
@endif
|
||||
|
||||
<input type="hidden" name="progress" value="{{$task['progress']}}">
|
||||
<input type="hidden" name="name" value="{{$task['name']}}">
|
||||
|
||||
{{$task['name']}}
|
||||
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@if($type == 'task')
|
||||
<tr>
|
||||
<td align="right">任务列表</td>
|
||||
<td align="left">
|
||||
@if($items)
|
||||
@if($permission['parent_id'])
|
||||
<select class="form-control input-sm" name="parent_id">
|
||||
@foreach($items as $item)
|
||||
<option value="{{$item['id']}}" @if($item['id']==$task['parent_id']) selected="selected" @endif>{{$item['name']}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<input type="hidden" name="parent_id" value="{{$task['parent_id']}}">
|
||||
@foreach($items as $item)
|
||||
@if($item['id'] == $task['parent_id']) {{$item['name']}} @endif
|
||||
@endforeach
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
|
||||
<tr>
|
||||
<td align="right">执行者</td>
|
||||
<td align="left">
|
||||
@if($permission['user_id'])
|
||||
{{App\Support\Dialog::user('user', $type.'_user_id', $task['user_id'], 0, 0)}}
|
||||
@else
|
||||
<input type="hidden" name="{{$type}}_user_id" value="{{$task['user_id']}}">
|
||||
{{App\Support\Dialog::text('user', $task['user_id'])}}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">参与者</td>
|
||||
<td align="left">
|
||||
@if($permission['users'])
|
||||
{{App\Support\Dialog::user('user', $type.'_users', $task['users'], 1, 0)}}
|
||||
@else
|
||||
<input type="hidden" name="{{$type}}_users" value="{{$task['users']}}">
|
||||
{{App\Support\Dialog::text('user', $task['users'])}}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">时间</td>
|
||||
<td align="left">
|
||||
@if($permission['date'])
|
||||
<input type="text" name="start_at" data-toggle="datetime" value="@datetime($task->start_at,time())" class="form-control input-sm input-inline">
|
||||
-
|
||||
<input type="text" name="end_at" data-toggle="datetime" value="@datetime($task->end_at)" class="form-control input-sm input-inline">
|
||||
@else
|
||||
<input type="hidden" name="start_at" value="@datetime($task->start_at)">
|
||||
<input type="hidden" name="end_at" value="@datetime($task->end_at)">
|
||||
@datetime($task->start_at)
|
||||
-
|
||||
@datetime($task->end_at)
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">备注</td>
|
||||
<td>
|
||||
@if($permission['remark'])
|
||||
<textarea class="form-control" type="text" name="remark">{{$task->remark}}</textarea>
|
||||
@else
|
||||
{{$task->remark}}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">附件</td>
|
||||
<td align="left">
|
||||
@if($permission['attachment'])
|
||||
{{attachment_uploader('attachment', $task['attachment'], 'project_task')}}
|
||||
@else
|
||||
{{attachment_show('attachment', $task['attachment'], 'project_task')}}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="task-subtask" id="task-subtask-{{$task->id}}">
|
||||
|
||||
<div class="panel b-a">
|
||||
<div class="panel-heading b-b b-light">
|
||||
|
||||
<span class="font-bold">子任务 <span class="label bg-light">{{count($tasks)}}</span></span>
|
||||
@if($permission['add-subtask'] == 1)
|
||||
<a href="javascript:addSubTask({{$task->id}});" class="option option-add"><i class="fa fa-fw fa-plus"></i>添加子任务</a>
|
||||
@endif
|
||||
</div>
|
||||
<ul class="list-group list-group-lg no-bg auto">
|
||||
|
||||
@if($tasks)
|
||||
@foreach($tasks as $v)
|
||||
|
||||
<li class="list-group-item clearfix">
|
||||
<span class="pull-left thumb-sm avatar m-r">
|
||||
<img src="{{avatar($v['avatar'])}}">
|
||||
</span>
|
||||
<span class="clear">
|
||||
<span>
|
||||
<span class="pull-right text-muted">@datetime($v->created_at)</span>
|
||||
{{$v['created_by']}}
|
||||
</span>
|
||||
<small class="text-muted clear text-ellipsis">
|
||||
@if($v->progress == 1)
|
||||
<span class="label label-success">完成</span>
|
||||
@else
|
||||
@if(auth()->id() == $v->user_id)
|
||||
<span class="label label-danger">执行中</span>
|
||||
@else
|
||||
<span class="label label-info">执行中</span>
|
||||
@endif
|
||||
@endif
|
||||
<a href="javascript:editSubTask({{$v->id}});">{{$v->name}}</a>
|
||||
</small>
|
||||
</span>
|
||||
</li>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="task-log" id="task-log-{{$task->id}}">
|
||||
|
||||
<div class="panel b-a m-b-none">
|
||||
<div class="panel-heading b-b b-light">
|
||||
<span class="font-bold">评论列表 <span class="label bg-light">{{count($tasks)}}</span></span>
|
||||
@if($permission['add-comment'] == 1)
|
||||
<a href="javascript:addComment({{$task->id}});" class="option option-add"><i class="fa fa-fw fa-plus"></i>添加回复</a>
|
||||
@endif
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
@if($logs)
|
||||
@foreach($logs as $log)
|
||||
@if($log->type == 'comment')
|
||||
|
||||
<div class="m-l-lg">
|
||||
<a class="pull-left thumb-sm avatar m-l-n-md">
|
||||
<img src="{{avatar($log->avatar)}}" alt="{{$log->created_by}}">
|
||||
</a>
|
||||
<div class="m-l-lg panel b-a">
|
||||
<div class="panel-heading pos-rlt b-b b-light">
|
||||
<span class="arrow left"></span>
|
||||
<span>{{$log->created_by}}</span>
|
||||
<span class="text-muted m-l-sm pull-right">
|
||||
<i class="fa fa-clock-o"></i> @datetime($log->created_at)
|
||||
</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div>{{$log->content}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<p class="task-log-content"><span class="time">@datetime($log->created_at)</span>{{$log->user}} {{$log->content}}</p>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@@ -0,0 +1,355 @@
|
||||
<script src="{{$asset_url}}/vendor/dhtmlxgantt/dhtmlxgantt.js" type="text/javascript"></script>
|
||||
<script src="{{$asset_url}}/vendor/dhtmlxgantt/dhtmlxgantt_marker.js" type="text/javascript"></script>
|
||||
<script src="{{$asset_url}}/vendor/dhtmlxgantt/dhtmlxgantt_tooltip.js" type="text/javascript"></script>
|
||||
<script src="{{$asset_url}}/vendor/dhtmlxgantt/locale_cn.js" type="text/javascript"></script>
|
||||
<link rel="stylesheet" href="{{$asset_url}}/vendor/dhtmlxgantt/dhtmlxgantt.css" type="text/css">
|
||||
<!--
|
||||
<script src="https://export.dhtmlx.com/gantt/api.js"></script>
|
||||
-->
|
||||
<style type="text/css">
|
||||
/* 新样式 */
|
||||
html, body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.gantt_side_content.gantt_right {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.gantt_task_line.gantt_selected {
|
||||
box-shadow: 0 0 5px #fff;
|
||||
}
|
||||
|
||||
.gantt_container {
|
||||
border: 1px solid #eee;
|
||||
border-top: 1px solid #cecece;
|
||||
}
|
||||
|
||||
.project-item {
|
||||
position: absolute;
|
||||
height: 8px;
|
||||
color: #fff;
|
||||
background-color: #57b4f6;
|
||||
}
|
||||
.project-item div {
|
||||
position: absolute;
|
||||
}
|
||||
.project-left, .project-right {
|
||||
top: 8px;
|
||||
background-color: transparent;
|
||||
border-style: solid;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
.project-left {
|
||||
left: 0px;
|
||||
border-width: 0px 0px 8px 7px;
|
||||
border-top-color: transparent;
|
||||
border-right-color: transparent !important;
|
||||
border-bottom-color: transparent !important;
|
||||
border-left-color: #3399ff !important;
|
||||
}
|
||||
|
||||
.project-right {
|
||||
right: 0px;
|
||||
border-width: 0px 7px 8px 0px;
|
||||
border-top-color: transparent;
|
||||
border-right-color: #3399ff;
|
||||
border-bottom-color: transparent !important;
|
||||
border-left-color: transparent;
|
||||
}
|
||||
|
||||
.gantt_task_line {
|
||||
background-color: #3399ff;
|
||||
border-width: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.gantt_task_line.done {
|
||||
background-color: #66cc33;
|
||||
}
|
||||
|
||||
.gantt_task_line .gantt_task_progress {
|
||||
background-color: #197de1;
|
||||
border-width: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.gantt_grid_data .gantt_cell {
|
||||
border-right: 1px solid #ECECEC;
|
||||
}
|
||||
|
||||
.gantt_grid_data .gantt_cell.gantt_last_cell {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.gantt_task .gantt_task_scale .gantt_scale_cell, .gantt_grid_scale .gantt_grid_head_cell{
|
||||
color:#5C5C5C;
|
||||
}
|
||||
|
||||
.gantt_row, .gantt_cell {
|
||||
border-color:#cecece;
|
||||
}
|
||||
.gantt_grid_scale .gantt_grid_head_cell {
|
||||
border-right: 1px solid #cecece !important;
|
||||
}
|
||||
.gantt_grid_scale .gantt_grid_head_cell.gantt_last_cell {
|
||||
border-right: none !important;
|
||||
}
|
||||
|
||||
.gantt_tooltip {
|
||||
background-color: #383838;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 2px rgba(56, 56, 56, 0.25);
|
||||
word-break: break-all;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="panel">
|
||||
|
||||
<div class="wrapper-sm b-b">
|
||||
<span class="text-md">{{$project['name']}}</span> <span class="text-muted">{{$project['description']}}</span>
|
||||
</div>
|
||||
|
||||
<div class="wrapper-xs" id="gantt-wrapper">
|
||||
|
||||
<form id="search-task-form" class="form-inline" name="mytasksearch" method="get">
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<a href="{{url('index', ['project_id' => $project['id'], 'tpl' => 'index'])}}" class="btn btn-sm btn-default @if($query['tpl'] == 'index') active @endif">列表</a>
|
||||
<a href="{{url('index', ['project_id' => $project['id'], 'tpl' => 'gantt'])}}" class="btn btn-sm btn-default @if($query['tpl'] == 'gantt') active @endif">甘特图</a>
|
||||
<!--
|
||||
<a href="{{url('index', ['project_id' => $project['id'], 'tpl' => 'board'])}}" class="btn btn-sm btn-default @if($query['tpl'] == 'board') active @endif">看板</a>
|
||||
-->
|
||||
</div>
|
||||
<!--
|
||||
<input value="导出PDF" class="btn btn-sm btn-default" type="button" onclick='exportToPDF()'>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<a href="{{url($referer)}}" class="btn btn-sm btn-default"><i class="fa fa-reply"></i> 返回</a>
|
||||
|
||||
@if(isset($access['add']))
|
||||
|
||||
@if($permission['add_item'])
|
||||
<a href="javascript:addItem();" title="添加列表" class="hinted btn btn-sm btn-info"><i class="icon icon-plus"></i> 添加列表</a>
|
||||
@endif
|
||||
|
||||
@if($permission['add_task'])
|
||||
<a href="javascript:addTask();" title="添加任务" class="hinted btn btn-sm btn-info"><i class="icon icon-plus"></i> 添加任务</a>
|
||||
@endif
|
||||
|
||||
@endif
|
||||
|
||||
@include('searchForm')
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('#search-task-form').searchForm({
|
||||
data: {{json_encode($search['forms'])}},
|
||||
init:function(e) {
|
||||
var self = this;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="gantt-view"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var project_id = "{{(int)$project['id']}}";
|
||||
var params = {project_id:project_id};
|
||||
|
||||
gantt.config.columns = [
|
||||
{name:"name", label:"任务列表", tree:true, width:'*', resize: true}
|
||||
];
|
||||
|
||||
gantt.config.scale_unit = 'month';
|
||||
gantt.config.date_scale = '%Y - %m';
|
||||
gantt.config.scale_height = 50;
|
||||
gantt.config.link_line_width = 1;
|
||||
gantt.config.row_height = 28;
|
||||
gantt.config.task_height = 16;
|
||||
gantt.config.grid_resize = true;
|
||||
gantt.config.drag_links = false;
|
||||
gantt.config.drag_progress = false;
|
||||
gantt.config.min_column_width = 60;
|
||||
gantt.config.duration_unit = 'day';
|
||||
gantt.config.grid_width = 220;
|
||||
gantt.config.api_date = gantt.config.xml_date = '%Y-%m-%d %H:%i';
|
||||
gantt.config.show_links = false;
|
||||
gantt.config.order_branch = true;
|
||||
|
||||
// gantt.config.order_branch_free = true;
|
||||
|
||||
/*
|
||||
var date_to_str = gantt.date.date_to_str(gantt.config.api_date);
|
||||
var today = new Date();
|
||||
gantt.addMarker({
|
||||
start_date: today,
|
||||
css: "today",
|
||||
text: "今天",
|
||||
title:"今天: "+ date_to_str(today)
|
||||
});
|
||||
*/
|
||||
|
||||
gantt.config.subscales = [
|
||||
{unit:"day", step:1, date:"%d %D"}
|
||||
];
|
||||
|
||||
gantt.config.types.project = 'item';
|
||||
|
||||
gantt.config.type_renderers['item'] = function(task) {
|
||||
|
||||
var el = document.createElement('div');
|
||||
el.setAttribute(gantt.config.task_attribute, task.id);
|
||||
var size = gantt.getTaskPosition(task);
|
||||
|
||||
el.innerHTML = '<div class="project-left"></div><div class="gantt_task_content"></div><div class="project-right"></div>';
|
||||
el.className = 'project-item';
|
||||
el.style.left = size.left + 'px';
|
||||
el.style.top = size.top + 6 + 'px';
|
||||
el.style.width = size.width + 'px';
|
||||
return el;
|
||||
};
|
||||
|
||||
gantt.templates.task_class = function(start, end, task) {
|
||||
if(task.progress == 1) {
|
||||
return 'done';
|
||||
}
|
||||
};
|
||||
|
||||
gantt.templates.task_text = function() {
|
||||
return '';
|
||||
};
|
||||
|
||||
gantt.templates.rightside_text = function(start, end, task) {
|
||||
return task.user_name;
|
||||
};
|
||||
|
||||
gantt.templates.tooltip_text = function(start, end, task) {
|
||||
if(task.type == 'task' || task.type == 'subtask') {
|
||||
return '<div>任务: '+task.name+'</div><div>执行者: ' + (task.user_name || '无') + '</div><div>参与者: ' + (task.users || '无') + '</div><div>开始时间: ' + gantt.templates.tooltip_date_format(start) + '</div><div>结束时间: '+gantt.templates.tooltip_date_format(end) + '</div><div>备注: '+task.remark+'</div>';
|
||||
}
|
||||
};
|
||||
|
||||
gantt.attachEvent('onTaskDblClick', function (task_id) {
|
||||
var task = gantt.getTask(task_id);
|
||||
if(task.type == 'item') {
|
||||
editItem(task_id);
|
||||
}
|
||||
if(task.type == 'task') {
|
||||
editTask(task_id);
|
||||
}
|
||||
if(task.type == 'subtask') {
|
||||
editSubTask(task_id);
|
||||
}
|
||||
});
|
||||
|
||||
gantt.attachEvent('onBeforeRowDragEnd', function(task_id, parent, index) {
|
||||
|
||||
var task = gantt.getTask(task_id);
|
||||
if(task.option_delete == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = gantt.getSiblings(task_id);
|
||||
$.post('{{url("sort")}}', {id:task_id,parent_id:task.parent,sort:data}, function(res) {
|
||||
toastrSuccess('恭喜您,任务排序成功。');
|
||||
}, 'json');
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
|
||||
gantt.attachEvent('onBeforeTaskDrag', function(task_id, mode, e) {
|
||||
var task = gantt.getTask(task_id);
|
||||
if(task.option_delete == 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
gantt.attachEvent('onAfterTaskDrag', function(task_id, mode, e) {
|
||||
|
||||
var task = gantt.getTask(task_id);
|
||||
|
||||
var data = {id: task.id,progress: task.progress};
|
||||
|
||||
var date_to_str = gantt.date.date_to_str(gantt.config.api_date);
|
||||
data.start_date = date_to_str(task.start_date);
|
||||
data.end_date = date_to_str(task.end_date);
|
||||
|
||||
$.post('{{url("drag")}}', data, function(res) {
|
||||
gantt.render();
|
||||
}, 'json');
|
||||
});
|
||||
|
||||
gantt._do_autosize = function() {
|
||||
|
||||
// 设置高度
|
||||
var height = $('#gantt-wrapper').outerHeight();
|
||||
var iframeHeight = $(window).height();
|
||||
$('#gantt-view').height(iframeHeight - height - 68 + 'px');
|
||||
|
||||
var resize = this._get_resize_options();
|
||||
var boxSizes = this._get_box_styles();
|
||||
|
||||
if(resize.y) {
|
||||
var reqHeight = this._calculate_content_height();
|
||||
if(boxSizes.borderBox) {
|
||||
reqHeight += boxSizes.vertPaddings;
|
||||
}
|
||||
this._obj.style.height = reqHeight + 'px';
|
||||
}
|
||||
if(resize.x) {
|
||||
var reqWidth = this._calculate_content_width();
|
||||
if(boxSizes.borderBox) {
|
||||
reqWidth += boxSizes.horPaddings;
|
||||
}
|
||||
this._obj.style.width = reqWidth + 'px';
|
||||
}
|
||||
};
|
||||
|
||||
gantt.init("gantt-view");
|
||||
gantt.load(app.url('project/task/index', params));
|
||||
|
||||
$('#search-submit').on('click', function() {
|
||||
var query = $('#search-task-form').serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
dataReload();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
function exportToPDF()
|
||||
{
|
||||
gantt.exportToPDF({
|
||||
locale:"cn",
|
||||
skin:'terrace',
|
||||
});
|
||||
}
|
||||
|
||||
function dataReload() {
|
||||
gantt.clearAll();
|
||||
gantt.load(app.url('project/task/index', params));
|
||||
}
|
||||
|
||||
function getTask(id) {
|
||||
return gantt.getTask(id);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@include('task/index/js')
|
||||
@@ -0,0 +1,150 @@
|
||||
<div class="panel">
|
||||
|
||||
<div class="wrapper-sm b-b">
|
||||
<span class="text-md">{{$project['name']}}</span> <span class="text-muted">{{$project['description']}}</span>
|
||||
</div>
|
||||
|
||||
<div class="wrapper-xs" id="index-wrapper">
|
||||
<form id="search-task-form" class="form-inline" name="mytasksearch" method="get">
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<a href="{{url('index', ['project_id' => $project['id'], 'tpl' => 'index'])}}" class="btn btn-sm btn-default @if($query['tpl'] == 'index') active @endif">列表</a>
|
||||
<a href="{{url('index', ['project_id' => $project['id'], 'tpl' => 'gantt'])}}" class="btn btn-sm btn-default @if($query['tpl'] == 'gantt') active @endif">甘特图</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="{{url($referer)}}" class="btn btn-sm btn-default"><i class="fa fa-reply"></i> 返回</a>
|
||||
|
||||
@if(isset($access['add']))
|
||||
|
||||
@if($permission['add_item'])
|
||||
<a href="javascript:addItem();" title="添加列表" class="hinted btn btn-sm btn-info"><i class="icon icon-plus"></i> 添加列表</a>
|
||||
@endif
|
||||
|
||||
@if($permission['add_task'])
|
||||
<a href="javascript:addTask();" title="添加任务" class="hinted btn btn-sm btn-info"><i class="icon icon-plus"></i> 添加任务</a>
|
||||
@endif
|
||||
|
||||
@endif
|
||||
|
||||
@include('searchForm')
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="list-jqgrid">
|
||||
<div id="jqgrid-table" class="ag-theme-balham" style="width:100%;"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var grid = null;
|
||||
var project_id = "{{(int)$project['id']}}";
|
||||
var params = {project_id:project_id};
|
||||
var auth_id = '{{auth()->id()}}';
|
||||
|
||||
function progressRenderer(params) {
|
||||
var data = params.data;
|
||||
if (data.type == 'task' || data.type == 'subtask') {
|
||||
if (params.value == 1) {
|
||||
return '<span class="label label-success">已完成</span>';
|
||||
} else {
|
||||
return '<span class="label label-' + (auth_id == data.user_id ? 'danger' : 'info') + '">进行中</span>';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function durationRenderer(params) {
|
||||
if (params.value) {
|
||||
return '<span class="hinted" title="任务持续' + params.value + '">' + params.value + '</span>';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
(function($) {
|
||||
grid = new agGridOptions();
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = params;
|
||||
grid.rowSelection = 'multiple';
|
||||
|
||||
grid.columnDefs = [
|
||||
{field: "id", hide: true},
|
||||
{field: "type", hide: true},
|
||||
{field: "option_edit", hide: true},
|
||||
{field: "option_delete", hide: true}
|
||||
];
|
||||
|
||||
grid.autoGroupColumnDef = {
|
||||
headerName: '任务',
|
||||
width: 250,
|
||||
cellRendererParams: {
|
||||
checkbox: false,
|
||||
suppressCount: false,
|
||||
}
|
||||
};
|
||||
grid.treeData = true;
|
||||
grid.groupDefaultExpanded = -1;
|
||||
|
||||
grid.getDataPath = function(data) {
|
||||
return data.tree_path;
|
||||
};
|
||||
|
||||
grid.columnDefs.push(
|
||||
{cellClass:'text-center', sortable: false, field: 'user_name', headerName: '执行者', width: 140},
|
||||
{cellClass:'text-center', sortable: false, field: 'users', headerName: '参与者', minWidth: 200},
|
||||
{cellClass:'text-center', cellRenderer: progressRenderer, sortable: false, field: 'progress', headerName: '状态', width: 100},
|
||||
{cellClass:'text-center', sortable: false, field: 'start_at', headerName: '开始时间', width: 120},
|
||||
{cellClass:'text-center', sortable: false, field: 'end_at', headerName: '结束时间', width: 120},
|
||||
{cellClass:'text-center', cellRenderer: durationRenderer, sortable: false, field: 'duration_date', headerName: '持续时间', width: 100},
|
||||
{cellClass:'text-center', sortable: false, field: 'created_at', headerName: '创建时间', width: 140},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 80}
|
||||
);
|
||||
|
||||
grid.onRowDoubleClicked = function (row) {
|
||||
var data = row.data;
|
||||
if(data.type == 'item') {
|
||||
editItem(data.id);
|
||||
}
|
||||
if(data.type == 'task') {
|
||||
editTask(data.id);
|
||||
}
|
||||
if(data.type == 'subtask') {
|
||||
editSubTask(data.id);
|
||||
}
|
||||
};
|
||||
|
||||
var gridDiv = document.querySelector("#jqgrid-table");
|
||||
gridDiv.style.height = getPanelHeight(12);
|
||||
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
// 读取数据
|
||||
grid.remoteData();
|
||||
|
||||
var search = $('#search-task-form').searchForm({
|
||||
data: JSON.parse('{{json_encode($search["forms"])}}'),
|
||||
init:function(e) {
|
||||
var self = this;
|
||||
}
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
params.page = 1;
|
||||
grid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
function dataReload() {
|
||||
params.page = 1;
|
||||
grid.remoteData(params);
|
||||
}
|
||||
|
||||
function getTask(id) {
|
||||
return grid.api.getRowNode(id);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@include('task/index/js')
|
||||
@@ -0,0 +1,198 @@
|
||||
<script>
|
||||
|
||||
function formsBox(title, url, id, success, remove, error)
|
||||
{
|
||||
var options = {
|
||||
dialogClass: 'modal-lg',
|
||||
backdrop: 'static',
|
||||
title: title,
|
||||
url: url,
|
||||
buttons: []
|
||||
};
|
||||
|
||||
if (typeof success === 'function') {
|
||||
options.buttons.push({
|
||||
text: '<i class="fa fa-check"></i> 提交',
|
||||
class: 'btn-info',
|
||||
click: function() {
|
||||
var me = this;
|
||||
var action = $('#'+id).attr('action');
|
||||
var formData = $('#'+id).serialize();
|
||||
$.post(action, formData, function(res) {
|
||||
success.call(me, res);
|
||||
},'json');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof remove === 'function') {
|
||||
options.buttons.push({
|
||||
text: '<i class="fa fa-remove"></i> 删除',
|
||||
class: 'btn-danger',
|
||||
click: function() {
|
||||
var me = this;
|
||||
remove.call(me);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
options.buttons.push({
|
||||
text: '取消',
|
||||
class: 'btn-default',
|
||||
click: function() {
|
||||
var me = this;
|
||||
if (typeof error === 'function') {
|
||||
error.call(me);
|
||||
} else {
|
||||
$(me).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
$.dialog(options);
|
||||
}
|
||||
|
||||
function saveResult(res) {
|
||||
if(res.status) {
|
||||
dataReload();
|
||||
toastrSuccess(res.data);
|
||||
$(this).dialog("close");
|
||||
} else {
|
||||
toastrError(res.data);
|
||||
}
|
||||
}
|
||||
|
||||
function addItem() {
|
||||
formsBox('添加任务列表', app.url('project/task/add', {type:'item',project_id:project_id}), 'item-form', function(res) {
|
||||
saveResult.call(this, res);
|
||||
});
|
||||
}
|
||||
|
||||
function editItem(id) {
|
||||
|
||||
var fun_edit = null, fun_delete = null;
|
||||
|
||||
var task = getTask(id);
|
||||
|
||||
if(task.option_edit == 1) {
|
||||
fun_edit = function(res) {
|
||||
saveResult.call(this, res);
|
||||
}
|
||||
}
|
||||
|
||||
if(task.option_delete == 1) {
|
||||
fun_delete = function() {
|
||||
var me = this;
|
||||
$.messager.confirm('操作警告', '确定要删除任务列表吗?', function(btn) {
|
||||
if (btn == true) {
|
||||
$.post(app.url('project/task/delete'), {id: id}, function(res) {
|
||||
saveResult.call(me, res);
|
||||
},'json');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
formsBox('编辑任务列表', app.url('project/task/edit', {type:'item',id:id}), 'item-form-'+ id, fun_edit, fun_delete);
|
||||
}
|
||||
|
||||
function addTask() {
|
||||
formsBox('添加任务', app.url('project/task/add', {type:'task',project_id:project_id}), 'task-form', function(res) {
|
||||
saveResult.call(this, res);
|
||||
});
|
||||
}
|
||||
|
||||
function editTask(id) {
|
||||
|
||||
var fun_edit = null, fun_delete = null;
|
||||
|
||||
var task = getTask(id);
|
||||
|
||||
if(task.option_edit == 1) {
|
||||
fun_edit = function(res) {
|
||||
saveResult.call(this, res);
|
||||
}
|
||||
}
|
||||
|
||||
if(task.option_delete == 1) {
|
||||
fun_delete = function() {
|
||||
var me = this;
|
||||
$.messager.confirm('操作警告', '确定要删除任务吗?', function(btn) {
|
||||
if (btn == true) {
|
||||
$.post(app.url('project/task/delete'), {id: id}, function(res) {
|
||||
saveResult.call(me, res);
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
formsBox('编辑任务', app.url('project/task/edit', {type:'task',id:id}), 'task-form-'+ id, fun_edit, fun_delete);
|
||||
}
|
||||
|
||||
function addSubTask(id) {
|
||||
formsBox('添加子任务', app.url('project/task/add', {type:'subtask',project_id:project_id,parent_id:id}), 'task-form', function(res) {
|
||||
if(res.status) {
|
||||
dataReload();
|
||||
$('#task-subtask-' + id).prepend('<p><span class="time">'+ res.data.created_at + '(' + res.data.user_name + ')</span><label class="i-checks i-checks-sm m-b-none"><input class="select-row" type="checkbox" name="progress" value="'+ res.data.progress + '"><i></i></label><a href="javascript:editSubTask(' + res.data.id + ');">'+ res.data.name + '</a></p>');
|
||||
toastrSuccess('恭喜您,添加子任务成功。');
|
||||
$(this).dialog("close");
|
||||
} else {
|
||||
toastrError(res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function editSubTask(id) {
|
||||
|
||||
var fun_edit = null, fun_delete = null;
|
||||
|
||||
var task = getTask(id);
|
||||
|
||||
if(task.option_edit == 1) {
|
||||
fun_edit = function(res) {
|
||||
saveResult.call(this, res);
|
||||
}
|
||||
}
|
||||
|
||||
if(task.option_delete == 1) {
|
||||
fun_delete = function() {
|
||||
var me = this;
|
||||
$.messager.confirm('操作警告', '确定要删除任务吗?', function(btn) {
|
||||
if (btn == true) {
|
||||
$.post(app.url('project/task/delete'), {id: id}, function(res) {
|
||||
saveResult.call(me, res);
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
formsBox('编辑子任务', app.url('project/task/edit', {type:'subtask',id:id}), 'task-form-'+ id, fun_edit, fun_delete);
|
||||
}
|
||||
|
||||
function addComment(task_id) {
|
||||
formsBox('添加评论', app.url('project/comment/add', {task_id:task_id}), 'comment-form', function(res) {
|
||||
if(res.status) {
|
||||
$('#task-log-' + task_id).prepend('<p class="task-log-comment"><span class="time">' + res.data.created_at + '</span><div class="task-log-user">' + res.data.user + '</div>' + res.data.content + '</p>');
|
||||
toastrSuccess('恭喜您,添加评论成功。');
|
||||
$(this).dialog("close");
|
||||
} else {
|
||||
toastrError(res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function editComment(id) {
|
||||
formsBox('编辑评论', app.url('project/comment/edit', {id:id}), 'comment-form', function(res) {
|
||||
saveResult.call(this, res);
|
||||
}, function() {
|
||||
var me = this;
|
||||
$.messager.confirm('操作警告', '确定要删除评论吗?', function(btn) {
|
||||
if (btn == true) {
|
||||
$.post(app.url('project/comment/delete'), {id:id}, function(res) {
|
||||
saveResult.call(me, res);
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,34 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<form method="post" action="{{url()}}" id="item-form" name="item-form">
|
||||
<div class="panel m-b-none">
|
||||
|
||||
<table class="table table-form m-b-none">
|
||||
|
||||
<tr>
|
||||
<td align="right" width="10%">名称</td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" value="{{$task['name']}}" class="form-control input-sm">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">备注</td>
|
||||
<td>
|
||||
<textarea class="form-control" type="text" name="remark"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="type" value="{{$type}}">
|
||||
<input type="hidden" name="parent_id" value="{{$parent_id}}">
|
||||
<input type="hidden" name="project_id" value="{{$project_id}}">
|
||||
<input type="hidden" name="is_item" value="1">
|
||||
|
||||
</form>
|
||||
@@ -0,0 +1,42 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<form method="post" class="project-form" action="{{url()}}" id="item-form-{{$task->id}}" name="item-form-{{$task->id}}">
|
||||
<div class="panel m-b-none">
|
||||
|
||||
<table class="table table-form m-b-none">
|
||||
|
||||
<tr>
|
||||
<td align="right" width="10%">名称</td>
|
||||
<td align="left">
|
||||
@if($permission['name'])
|
||||
<input type="text" name="name" value="{{$task['name']}}" class="form-control input-sm">
|
||||
@else
|
||||
{{$task['name']}}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">备注</td>
|
||||
<td>
|
||||
@if($permission['remark'])
|
||||
<textarea class="form-control" type="text" name="remark">{{$task->remark}}</textarea>
|
||||
@else
|
||||
{{$task->remark}}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="type" value="{{$type}}">
|
||||
<input type="hidden" name="project_id" value="{{$task->project_id}}">
|
||||
<input type="hidden" name="id" value="{{$task->id}}">
|
||||
<input type="hidden" name="is_item" value="1">
|
||||
|
||||
</form>
|
||||
@@ -0,0 +1,106 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<form method="post" enctype="multipart/form-data" id="mytaskform" name="mytaskform">
|
||||
<div class="panel m-b-none">
|
||||
|
||||
<table class="table table-form m-b-none">
|
||||
|
||||
<tr>
|
||||
<td align="right" width="15%">名称</td>
|
||||
<td align="left">
|
||||
<input type="text" name="name" id="name" value="{{$task['name']}}" class="form-control input-sm">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">列表</td>
|
||||
<td align="left">
|
||||
<select class="form-control input-inline input-sm" id="item_id" name="item_id">
|
||||
<option value="1">测试日程1_</option>
|
||||
<option value="2">abc123</option>
|
||||
<option value="408">一般事件</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">执行者</td>
|
||||
<td align="left">
|
||||
{{App\Support\Dialog::user('user','user_id', $task['user_id'], 0, 0)}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">参与者</td>
|
||||
<td align="left">
|
||||
{{App\Support\Dialog::user('user', 'users', $task['users'], 1, 0)}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">时间</td>
|
||||
<td align="left">
|
||||
<input type="text" name="start_at" autocomplete="off" data-toggle="datetime" value="@datetime($task->start_at,time())" id="start_at" class="form-control input-sm input-inline">
|
||||
-
|
||||
<input type="text" name="end_at" autocomplete="off" data-toggle="datetime" value="@datetime($task->end_at)" id="end_at" class="form-control input-sm input-inline">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">备注</td>
|
||||
<td>
|
||||
<textarea class="form-control" type="text" name="purchase_plan[remark]" id="remark" placeholder="暂无备注"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">附件</td>
|
||||
<td align="left">
|
||||
{{attachment_uploader('attachment', $task['attachment'])}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">子任务</td>
|
||||
<td>
|
||||
<a href="#" class="option"><i class="fa fa-fw fa-plus"></i>添加子任务</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">评论</td>
|
||||
<td>
|
||||
<a href="#" class="option"><i class="fa fa-fw fa-plus"></i>添加评论</a>
|
||||
<!--
|
||||
<textarea class="form-control" rows="2" type="text" name="comment" id="comment" placeholder="内容"></textarea>
|
||||
{{attachment_uploader('comment_attachment', '', false)}}
|
||||
<a href="#" class="btn btn-sm btn-success"> 提交</a>
|
||||
-->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">活动</td>
|
||||
<td>
|
||||
<div class="project-task-log">
|
||||
@if($logs)
|
||||
@foreach($logs as $log)
|
||||
<p><span class="time">@datetime($log->created_at)</span>{{$log->description}}</p>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="{{$task->id}}">
|
||||
<input type="hidden" name="project_id" value="{{$project_id}}">
|
||||
|
||||
</form>
|
||||
Reference in New Issue
Block a user