增加任务消息页面展示,修改头部任务消息显示,增加了任务表
This commit is contained in:
parent
2419c5c193
commit
5fd28f71e3
|
@ -207,6 +207,7 @@
|
||||||
<Content Include="Scripts\Profiles.js" />
|
<Content Include="Scripts\Profiles.js" />
|
||||||
<Content Include="Scripts\register.js" />
|
<Content Include="Scripts\register.js" />
|
||||||
<Content Include="Scripts\Roles.js" />
|
<Content Include="Scripts\Roles.js" />
|
||||||
|
<Content Include="Scripts\tasks.js" />
|
||||||
<Content Include="Scripts\Users.js" />
|
<Content Include="Scripts\Users.js" />
|
||||||
<Content Include="Content\js\jquery-1.10.2.js" />
|
<Content Include="Content\js\jquery-1.10.2.js" />
|
||||||
<Content Include="Content\js\jquery-1.10.2.min.js" />
|
<Content Include="Content\js\jquery-1.10.2.min.js" />
|
||||||
|
@ -250,6 +251,7 @@
|
||||||
<Compile Include="Controllers\NotificationsController.cs" />
|
<Compile Include="Controllers\NotificationsController.cs" />
|
||||||
<Compile Include="Controllers\ProfilesController.cs" />
|
<Compile Include="Controllers\ProfilesController.cs" />
|
||||||
<Compile Include="Controllers\RolesController.cs" />
|
<Compile Include="Controllers\RolesController.cs" />
|
||||||
|
<Compile Include="Controllers\TasksController.cs" />
|
||||||
<Compile Include="Controllers\UsersController.cs" />
|
<Compile Include="Controllers\UsersController.cs" />
|
||||||
<Compile Include="Global.asax.cs">
|
<Compile Include="Global.asax.cs">
|
||||||
<DependentUpon>Global.asax</DependentUpon>
|
<DependentUpon>Global.asax</DependentUpon>
|
||||||
|
@ -311,6 +313,7 @@
|
||||||
<Content Include="Views\Admin\Infos.cshtml" />
|
<Content Include="Views\Admin\Infos.cshtml" />
|
||||||
<Content Include="Views\Admin\Exceptions.cshtml" />
|
<Content Include="Views\Admin\Exceptions.cshtml" />
|
||||||
<Content Include="Views\Admin\Messages.cshtml" />
|
<Content Include="Views\Admin\Messages.cshtml" />
|
||||||
|
<Content Include="Views\Admin\Tasks.cshtml" />
|
||||||
<None Include="Web.Debug.config">
|
<None Include="Web.Debug.config">
|
||||||
<DependentUpon>Web.config</DependentUpon>
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
</None>
|
</None>
|
||||||
|
|
|
@ -127,5 +127,10 @@ namespace Bootstrap.Admin.Controllers
|
||||||
var v = new NavigatorBarModel("~/Admin/Messages");
|
var v = new NavigatorBarModel("~/Admin/Messages");
|
||||||
return View(v);
|
return View(v);
|
||||||
}
|
}
|
||||||
|
public ActionResult Tasks()
|
||||||
|
{
|
||||||
|
var v = new NavigatorBarModel("~/Admin/Tasks");
|
||||||
|
return View(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
using Bootstrap.DataAccess;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Web.Http;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Bootstrap.Admin.Controllers
|
||||||
|
{
|
||||||
|
public class TasksController : ApiController
|
||||||
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public Tasks Get()
|
||||||
|
{
|
||||||
|
var tasks = new Tasks();
|
||||||
|
TaskHelper.RetrieveTasks().AsParallel().ForAll(n => tasks.Users.Add(n));
|
||||||
|
return tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Tasks
|
||||||
|
{
|
||||||
|
public Tasks()
|
||||||
|
{
|
||||||
|
Users = new List<Task>();
|
||||||
|
}
|
||||||
|
public List<Task> Users { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,7 +26,9 @@ namespace Bootstrap.Admin.Models
|
||||||
MessageCount = msgs.Count();
|
MessageCount = msgs.Count();
|
||||||
Messages = msgs.Take(6);
|
Messages = msgs.Take(6);
|
||||||
MessageList = MessageHelper.RetrieveMessages(UserName);
|
MessageList = MessageHelper.RetrieveMessages(UserName);
|
||||||
|
var tasks = TaskHelper.RetrieveTasks();
|
||||||
|
TaskCount = tasks.Count();
|
||||||
|
Tasks = tasks.Take(6);
|
||||||
}
|
}
|
||||||
public string UserName { get; protected set; }
|
public string UserName { get; protected set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -73,6 +75,14 @@ namespace Bootstrap.Admin.Models
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Icon { get; set; }
|
public string Icon { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 获取/设置 任务数量
|
||||||
|
/// </summary>
|
||||||
|
public int TaskCount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 获取/设置 任务内容集合
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<Task> Tasks { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
$(function () {
|
||||||
|
var url = '../api/Tasks/';
|
||||||
|
|
||||||
|
var htmlTask = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title notifi"><span class="task-title-sp">{0}</span><span class="task-value">{1}</span><span class="task-time">{2}</span>';
|
||||||
|
htmlTask += '<div class="pull-right hidden-phone"><button class="btn btn-success btn-xs fa fa-check" data-id="{3}" data-result="1"></button><button class="btn btn-danger btn-xs fa fa-remove" data-id="{3}" data-result="0" data-placement="left" data-original-title="拒绝授权"></button></div></div></li>';
|
||||||
|
|
||||||
|
function listData(options) {
|
||||||
|
options = $.extend({ url: url, animation: true, ctl: $('a.fa-refresh') }, options);
|
||||||
|
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||||
|
$.ajax({
|
||||||
|
url: options.url,
|
||||||
|
type: 'GET',
|
||||||
|
success: function (result) {
|
||||||
|
if (result) {
|
||||||
|
var content = result.Users.map(function (task) {
|
||||||
|
var t = new Date(task.AssignTime).format('yyyy-MM-dd HH:mm:ss');
|
||||||
|
return $.format(htmlTask, task.TaskName, task.UserName, t, task.ID);
|
||||||
|
}).join('');
|
||||||
|
$('#list-task').html(content);
|
||||||
|
}
|
||||||
|
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||||
|
},
|
||||||
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
listData();
|
||||||
|
|
||||||
|
$('a.fa-refresh').on('click', function () {
|
||||||
|
listData({ ctl: $(this) });
|
||||||
|
});
|
||||||
|
})
|
|
@ -0,0 +1,40 @@
|
||||||
|
@model NavigatorBarModel
|
||||||
|
@{
|
||||||
|
ViewBag.Title = "任务消息";
|
||||||
|
Layout = "~/Views/Shared/_Admin.cshtml";
|
||||||
|
}
|
||||||
|
@section Javascript {
|
||||||
|
<script src="~/Content/js/sweetalert.js"></script>
|
||||||
|
<script src="~/Scripts/tasks.js"></script>
|
||||||
|
}
|
||||||
|
@section css {
|
||||||
|
<link href="~/Content/css/sweetalert.css" rel="stylesheet" />
|
||||||
|
<link href="~/Content/css/tasks.css" rel="stylesheet" />
|
||||||
|
}
|
||||||
|
@section header {
|
||||||
|
@Html.Partial("Header", Model)
|
||||||
|
}
|
||||||
|
@section navigator {
|
||||||
|
@Html.Partial("Navigator", Model)
|
||||||
|
}
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">任务消息<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-category="0" data-placement="left" data-original-title="点击刷新"></a></span></div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="tasks-widget">
|
||||||
|
<ul id="list-task" class="task-list ui-sortable">
|
||||||
|
<li class="list-primary">
|
||||||
|
<i class="fa fa-ellipsis-v"></i>
|
||||||
|
<div class="task-title notifi">
|
||||||
|
@*<span class="task-title-sp">Title</span>
|
||||||
|
<span class="task-value">Content</span>
|
||||||
|
<span class="task-time">@System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")</span>
|
||||||
|
<div class="pull-right hidden-phone">
|
||||||
|
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
|
||||||
|
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
|
||||||
|
</div>*@
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -26,86 +26,41 @@
|
||||||
<!-- notification start -->
|
<!-- notification start -->
|
||||||
<ul class="notify-row">
|
<ul class="notify-row">
|
||||||
<!-- settings start -->
|
<!-- settings start -->
|
||||||
<li class="dropdown">
|
@if (Model.TaskCount > 0)
|
||||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
{
|
||||||
<i class="fa fa-tasks"></i>
|
<li class="dropdown">
|
||||||
<span class="badge bg-success">5</span>
|
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||||
</a>
|
<i class="fa fa-tasks"></i>
|
||||||
<ul class="dropdown-menu tasks-bar">
|
<span class="badge bg-success">@Model.TaskCount</span>
|
||||||
<div class="notify-arrow notify-arrow-green"></div>
|
</a>
|
||||||
<li>
|
<ul class="dropdown-menu tasks-bar">
|
||||||
<p>您有 5 个待处理的任务</p>
|
<div class="notify-arrow notify-arrow-green"></div>
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<p>您有 @Model.TaskCount 个未读的消息</p>
|
||||||
<a href="#">
|
</li>
|
||||||
<div>
|
@foreach (var task in Model.Tasks)
|
||||||
<div class="desc">任务1</div>
|
{
|
||||||
<div class="percent">40%</div>
|
var TaskProgress = task.TaskProgress * 100;
|
||||||
</div>
|
<li>
|
||||||
<div class="progress progress-striped">
|
<a href="~/Admin/Tasks?id=@task.ID">
|
||||||
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%">
|
<div>
|
||||||
<span class="sr-only">40% Complete (success)</span>
|
<div class="desc">@task.TaskName</div>
|
||||||
</div>
|
<div class="percent">@TaskProgress%</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
<div class="progress progress-striped">
|
||||||
</li>
|
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="@TaskProgress" aria-valuemin="0" aria-valuemax="100" style="width: @TaskProgress%">
|
||||||
<li>
|
<span class="sr-only">@TaskProgress% Complete</span>
|
||||||
<a href="#">
|
</div>
|
||||||
<div>
|
</div>
|
||||||
<div class="desc">任务2</div>
|
</a>
|
||||||
<div class="percent">60%</div>
|
</li>
|
||||||
</div>
|
}
|
||||||
<div class="progress progress-striped">
|
<li>
|
||||||
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">
|
<a href="~/Admin/Tasks">查看所有消息</a>
|
||||||
<span class="sr-only">60% Complete (warning)</span>
|
</li>
|
||||||
</div>
|
</ul>
|
||||||
</div>
|
</li>
|
||||||
</a>
|
}
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#">
|
|
||||||
<div>
|
|
||||||
<div class="desc">任务3</div>
|
|
||||||
<div class="percent">87%</div>
|
|
||||||
</div>
|
|
||||||
<div class="progress progress-striped">
|
|
||||||
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 87%">
|
|
||||||
<span class="sr-only">87% Complete</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#">
|
|
||||||
<div>
|
|
||||||
<div class="desc">任务4</div>
|
|
||||||
<div class="percent">33%</div>
|
|
||||||
</div>
|
|
||||||
<div class="progress progress-striped">
|
|
||||||
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 33%">
|
|
||||||
<span class="sr-only">33% Complete (danger)</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#">
|
|
||||||
<div>
|
|
||||||
<div class="desc">任务5</div>
|
|
||||||
<div class="percent">45%</div>
|
|
||||||
</div>
|
|
||||||
<div class="progress progress-striped active">
|
|
||||||
<div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 45%">
|
|
||||||
<span class="sr-only">45% Complete</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#">查看所有任务</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<!-- settings end -->
|
<!-- settings end -->
|
||||||
<!-- message dropdown start-->
|
<!-- message dropdown start-->
|
||||||
@if (Model.MessageCount > 0)
|
@if (Model.MessageCount > 0)
|
||||||
|
|
|
@ -75,6 +75,8 @@
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Role.cs" />
|
<Compile Include="Role.cs" />
|
||||||
<Compile Include="RoleHelper.cs" />
|
<Compile Include="RoleHelper.cs" />
|
||||||
|
<Compile Include="Task.cs" />
|
||||||
|
<Compile Include="TaskHelper.cs" />
|
||||||
<Compile Include="User.cs" />
|
<Compile Include="User.cs" />
|
||||||
<Compile Include="UserHelper.cs" />
|
<Compile Include="UserHelper.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Bootstrap.DataAccess
|
||||||
|
{
|
||||||
|
public class Task
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取/设置 任务ID
|
||||||
|
/// </summary>
|
||||||
|
public int ID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 获取/设置 任务名称
|
||||||
|
/// </summary>
|
||||||
|
public string TaskName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 获取/设置 分配人
|
||||||
|
/// </summary>
|
||||||
|
public string AssignName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 获取/设置 完成任务人
|
||||||
|
/// </summary>
|
||||||
|
public string UserName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 获取/设置 任务所需时间(天)
|
||||||
|
/// </summary>
|
||||||
|
public int TaskTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 获取/设置 任务进度
|
||||||
|
/// </summary>
|
||||||
|
public double TaskProgress { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 获取/设置 分配时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AssignTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
using Longbow;
|
||||||
|
using Longbow.Caching;
|
||||||
|
using Longbow.Caching.Configuration;
|
||||||
|
using Longbow.ExceptionManagement;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.Common;
|
||||||
|
|
||||||
|
namespace Bootstrap.DataAccess
|
||||||
|
{
|
||||||
|
public static class TaskHelper
|
||||||
|
{
|
||||||
|
internal const string RetrieveTasksDataKey = "TaskHelper-RetrieveTasks";
|
||||||
|
/// <summary>
|
||||||
|
/// 查询所有任务
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IEnumerable<Task> RetrieveTasks()
|
||||||
|
{
|
||||||
|
var ret = CacheManager.GetOrAdd(RetrieveTasksDataKey, CacheSection.RetrieveIntervalByKey(RetrieveTasksDataKey), key =>
|
||||||
|
{
|
||||||
|
string sql = "select * from Tasks";
|
||||||
|
List<Task> tasks = new List<Task>();
|
||||||
|
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (DbDataReader reader = DBAccessManager.SqlDBAccess.ExecuteReader(cmd))
|
||||||
|
{
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
tasks.Add(new Task()
|
||||||
|
{
|
||||||
|
ID = (int)reader[0],
|
||||||
|
TaskName = (string)reader[1],
|
||||||
|
AssignName = (string)reader[2],
|
||||||
|
UserName = (string)reader[3],
|
||||||
|
TaskTime = (int)reader[4],
|
||||||
|
TaskProgress = (double)reader[5],
|
||||||
|
AssignTime = LgbConvert.ReadValue(reader[6], DateTime.MinValue)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) { ExceptionManager.Publish(ex); }
|
||||||
|
return tasks;
|
||||||
|
}, CacheSection.RetrieveDescByKey(RetrieveTasksDataKey));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -357,3 +357,39 @@ GO
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Users] ADD CONSTRAINT [DF_Users_Icon] DEFAULT ('default.jpg') FOR [Icon]
|
ALTER TABLE [dbo].[Users] ADD CONSTRAINT [DF_Users_Icon] DEFAULT ('default.jpg') FOR [Icon]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
/****** Object: Table [dbo].[Tasks] Script Date: 11/16/2016 15:40:02 ******/
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
SET ANSI_PADDING ON
|
||||||
|
GO
|
||||||
|
CREATE TABLE [dbo].[Tasks](
|
||||||
|
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||||
|
[TaskName] [varchar](500) NOT NULL,
|
||||||
|
[AssignName] [varchar](50) NOT NULL,
|
||||||
|
[UserName] [varchar](50) NOT NULL,
|
||||||
|
[TaskTime] [int] NOT NULL,
|
||||||
|
[TaskProgress] [float] NOT NULL,
|
||||||
|
[AssignTime] [datetime] NOT NULL,
|
||||||
|
CONSTRAINT [PK_Tasks] PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
|
[ID] ASC
|
||||||
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||||
|
) ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
SET ANSI_PADDING OFF
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Tasks', @level2type=N'COLUMN',@level2name=N'TaskName'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'分配人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Tasks', @level2type=N'COLUMN',@level2name=N'AssignName'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'完成任务人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Tasks', @level2type=N'COLUMN',@level2name=N'UserName'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'任务所需时间(天)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Tasks', @level2type=N'COLUMN',@level2name=N'TaskTime'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'完成进度' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Tasks', @level2type=N'COLUMN',@level2name=N'TaskProgress'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'分配时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Tasks', @level2type=N'COLUMN',@level2name=N'AssignTime'
|
||||||
|
GO
|
||||||
|
|
Loading…
Reference in New Issue