no message
This commit is contained in:
parent
52722eda17
commit
22862edc13
@ -26,11 +26,8 @@ use function Swoole\Coroutine\Http\get;
|
||||
class ProjectController extends AbstractController
|
||||
{
|
||||
private $projectSelect = [
|
||||
'*',
|
||||
'projects.id AS id',
|
||||
'projects.userid AS userid',
|
||||
'projects.created_at AS created_at',
|
||||
'projects.updated_at AS updated_at',
|
||||
'projects.*',
|
||||
'project_users.owner',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -121,20 +118,20 @@ class ProjectController extends AbstractController
|
||||
$columns = Request::input('columns');
|
||||
if (!is_array($columns)) $columns = [];
|
||||
$insertColumns = [];
|
||||
$inorder = 0;
|
||||
$sort = 0;
|
||||
foreach ($columns AS $column) {
|
||||
$column = trim($column);
|
||||
if ($column) {
|
||||
$insertColumns[] = [
|
||||
'name' => $column,
|
||||
'inorder' => $inorder++,
|
||||
'sort' => $sort++,
|
||||
];
|
||||
}
|
||||
}
|
||||
if (empty($insertColumns)) {
|
||||
$insertColumns[] = [
|
||||
'name' => 'Default',
|
||||
'inorder' => 0,
|
||||
'sort' => 0,
|
||||
];
|
||||
}
|
||||
if (count($insertColumns) > 30) {
|
||||
|
@ -13,10 +13,16 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property string|null $name 名称
|
||||
* @property string|null $desc 描述、备注
|
||||
* @property int|null $userid 创建人
|
||||
* @property int|null $dialog_id 聊天会话ID
|
||||
* @property int|mixed $dialog_id 聊天会话ID
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property-read int $task_complete
|
||||
* @property-read int $task_my_complete
|
||||
* @property-read int $task_my_num
|
||||
* @property-read int $task_my_percent
|
||||
* @property-read int $task_num
|
||||
* @property-read int $task_percent
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProjectColumn[] $projectColumn
|
||||
* @property-read int|null $project_column_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProjectLog[] $projectLog
|
||||
@ -43,6 +49,93 @@ class Project extends AbstractModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $appends = [
|
||||
'task_num',
|
||||
'task_complete',
|
||||
'task_percent',
|
||||
'task_my_num',
|
||||
'task_my_complete',
|
||||
'task_my_percent',
|
||||
];
|
||||
|
||||
/**
|
||||
* 生成子任务数据
|
||||
*/
|
||||
private function generateTaskData()
|
||||
{
|
||||
if (!isset($this->attributes['task_num'])) {
|
||||
$builder = ProjectTask::whereProjectId($this->id)->whereParentId(0)->whereNull('archived_at');
|
||||
$this->attributes['task_num'] = $builder->count();
|
||||
$this->attributes['task_complete'] = $builder->whereNotNull('complete_at')->count();
|
||||
$this->attributes['task_percent'] = $this->attributes['task_num'] ? intval($this->attributes['task_complete'] / $this->attributes['task_num'] * 100) : 0;
|
||||
//
|
||||
$builder = ProjectTask::whereProjectId($this->id)->whereParentId(0)->whereNull('archived_at');
|
||||
$this->attributes['task_my_num'] = $builder->whereUserid(User::token2userid())->count();
|
||||
$this->attributes['task_my_complete'] = $builder->whereUserid(User::token2userid())->whereNotNull('complete_at')->count();
|
||||
$this->attributes['task_my_percent'] = $this->attributes['task_my_num'] ? intval($this->attributes['task_my_complete'] / $this->attributes['task_my_num'] * 100) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务数量
|
||||
* @return int
|
||||
*/
|
||||
public function getTaskNumAttribute()
|
||||
{
|
||||
$this->generateTaskData();
|
||||
return $this->attributes['task_num'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务完成数量
|
||||
* @return int
|
||||
*/
|
||||
public function getTaskCompleteAttribute()
|
||||
{
|
||||
$this->generateTaskData();
|
||||
return $this->attributes['task_complete'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务完成率
|
||||
* @return int
|
||||
*/
|
||||
public function getTaskPercentAttribute()
|
||||
{
|
||||
$this->generateTaskData();
|
||||
return $this->attributes['task_percent'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务数量(我的)
|
||||
* @return int
|
||||
*/
|
||||
public function getTaskMyNumAttribute()
|
||||
{
|
||||
$this->generateTaskData();
|
||||
return $this->attributes['task_my_num'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务完成数量(我的)
|
||||
* @return int
|
||||
*/
|
||||
public function getTaskMyCompleteAttribute()
|
||||
{
|
||||
$this->generateTaskData();
|
||||
return $this->attributes['task_my_complete'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务完成率(我的)
|
||||
* @return int
|
||||
*/
|
||||
public function getTaskMyPercentAttribute()
|
||||
{
|
||||
$this->generateTaskData();
|
||||
return $this->attributes['task_my_percent'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return int|mixed
|
||||
|
@ -20,8 +20,8 @@
|
||||
"lodash": "^4.17.19",
|
||||
"postcss": "^8.1.14",
|
||||
"resolve-url-loader": "^3.1.3",
|
||||
"sass": "^1.34.0",
|
||||
"sass-loader": "^11.1.1",
|
||||
"sass": "^1.34.1",
|
||||
"sass-loader": "^12.0.0",
|
||||
"stylus": "^0.54.8",
|
||||
"stylus-loader": "^3.0.2",
|
||||
"vue": "^2.6.12",
|
||||
|
@ -33,7 +33,10 @@
|
||||
</li>
|
||||
<li class="menu-project">
|
||||
<ul>
|
||||
<li v-for="(item, key) in projectList" :key="key" @click="toggleRoute('project/' + item.id)" :class="classNameRoute('project/' + item.id)">{{item.name}}</li>
|
||||
<li v-for="(item, key) in projectList" :key="key" @click="toggleRoute('project/' + item.id)" :class="classNameRoute('project/' + item.id)">
|
||||
<div class="title">{{item.name}}</div>
|
||||
<div v-if="item.task_my_num > 0" class="num">{{item.task_my_num}}</div>
|
||||
</li>
|
||||
</ul>
|
||||
<Loading v-if="loadIng > 0"/>
|
||||
</li>
|
||||
@ -62,7 +65,7 @@
|
||||
<Option v-for="(item, index) in columns" :value="index" :key="index">{{ item.label }}</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem v-if="addData.columns.length > 0" :label="$L('任务分类')">
|
||||
<FormItem v-if="addData.columns.length > 0" :label="$L('任务列表')">
|
||||
<div style="line-height:38px">
|
||||
<span v-for="(item, index) in addData.columns">
|
||||
<Tag @on-close="() => { addData.columns.splice(index, 1)}" closable size="large" color="primary">{{item}}</Tag>
|
||||
@ -70,7 +73,7 @@
|
||||
</div>
|
||||
<div style="margin-top:4px;"></div>
|
||||
<div style="margin-bottom:-16px">
|
||||
<Button icon="ios-add" type="dashed" @click="addColumns">{{$L('添加分类')}}</Button>
|
||||
<Button icon="ios-add" type="dashed" @click="addColumns">{{$L('添加列表')}}</Button>
|
||||
</div>
|
||||
</FormItem>
|
||||
</Form>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div v-for="(item, key) in list" :key="key">
|
||||
<Row class="task-row" :style="item.color ? {backgroundColor: item.color, borderBottomColor: item.color} : {}">
|
||||
<em v-if="item.p_name && item.parent_id === 0" class="priority-color" :style="{backgroundColor:item.p_color}"></em>
|
||||
<Col span="12" :class="['row-item', item.complete_at ? 'complete' : '']">
|
||||
<Col span="12" :class="['row-name', item.complete_at ? 'complete' : '']">
|
||||
<Icon
|
||||
v-if="item.sub_num > 0"
|
||||
:class="['sub-icon', item.sub_open ? 'active' : '']"
|
||||
@ -60,20 +60,20 @@
|
||||
<div v-if="item.msg_num > 0" class="item-icon">{{item.msg_num}}<Icon type="ios-chatbubbles-outline" /></div>
|
||||
</div>
|
||||
</Col>
|
||||
<Col span="3">
|
||||
<div v-if="item.parent_id === 0">{{item.column_name}}</div>
|
||||
<Col span="3" class="row-column">
|
||||
<div v-if="item.parent_id === 0" class="task-column">{{item.column_name}}</div>
|
||||
</Col>
|
||||
<Col span="3">
|
||||
<Col span="3" class="row-priority">
|
||||
<TaskPriority v-if="item.p_name && item.parent_id === 0" :backgroundColor="item.p_color">{{item.p_name}}</TaskPriority>
|
||||
</Col>
|
||||
<Col span="3" class="row-member">
|
||||
<Col span="3" class="row-user">
|
||||
<ul>
|
||||
<li v-for="(user, keyu) in item.task_user" :key="keyu" v-if="keyu < 3">
|
||||
<UserAvatar :userid="user.userid" size="32" :borderWitdh="2" :borderColor="item.color"/>
|
||||
</li>
|
||||
</ul>
|
||||
</Col>
|
||||
<Col span="3">
|
||||
<Col span="3" class="row-time">
|
||||
<ETooltip
|
||||
v-if="!item.complete_at && item.end_at"
|
||||
:class="['task-time', item.today ? 'today' : '', item.overdue ? 'overdue' : '']"
|
||||
|
22
resources/assets/sass/manage-wrapper.scss
vendored
22
resources/assets/sass/manage-wrapper.scss
vendored
@ -112,14 +112,11 @@
|
||||
position: relative;
|
||||
list-style: none;
|
||||
padding: 0 8px 0 30px;
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
margin: 4px auto;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
border-radius: 4px;
|
||||
color: #333333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
@ -131,6 +128,19 @@
|
||||
background: url("data:image/svg+xml;base64,PHN2ZyB0PSIxNjIyMzkwODExNTQxIiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjI0OTk3IiB3aWR0aD0iNDgiIGhlaWdodD0iNDgiPjxwYXRoIGQ9Ik0zNjYuMTgyNCAxMDguMjM2OEw4MTIuMDMyIDQyOC4wMzJhMTAyLjQgMTAyLjQgMCAwIDEgMCAxNjYuNTAyNEwzNjYuMTgyNCA5MTQuMzI5NmExMDIuNCAxMDIuNCAwIDAgMS0xNjIuMDk5Mi04My4yNTEyVjE5MS40ODhhMTAyLjQgMTAyLjQgMCAwIDEgMTYyLjA5OTItODMuMjUxMnoiIHAtaWQ9IjI0OTk4IiBmaWxsPSIjOTk5OTk5Ij48L3BhdGg+PC9zdmc+") no-repeat center center;
|
||||
background-size: contain;
|
||||
}
|
||||
.title {
|
||||
flex: 1;
|
||||
color: #333333;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
}
|
||||
.num {
|
||||
font-size: 12px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
&.active {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
103
resources/assets/sass/project-list.scss
vendored
103
resources/assets/sass/project-list.scss
vendored
@ -515,52 +515,9 @@
|
||||
&:hover {
|
||||
box-shadow: 0 0 10px #e6ecfa;
|
||||
}
|
||||
.task-rows {
|
||||
.task-rows {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
box-shadow: rgb(0 0 0 / 8%) 0 0 8px 1px;
|
||||
z-index: 1;
|
||||
}
|
||||
.task-row {
|
||||
background-color: #fcfcfd;
|
||||
> div {
|
||||
&.row-item {
|
||||
padding-left: 56px;
|
||||
.item-title {
|
||||
color: #6C7D8C;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.task-row {
|
||||
> div {
|
||||
padding: 10px 12px;
|
||||
.task-time {
|
||||
&.overdue,
|
||||
&.today {
|
||||
color: #ffffff;
|
||||
padding: 1px 5px;
|
||||
font-size: 13px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
&.overdue {
|
||||
font-weight: 600;
|
||||
background-color: #ed4014;
|
||||
}
|
||||
&.today {
|
||||
font-weight: 500;
|
||||
background-color: #ff9900;
|
||||
}
|
||||
}
|
||||
&.row-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
@ -579,7 +536,7 @@
|
||||
padding-left: 6px;
|
||||
}
|
||||
}
|
||||
&.row-item {
|
||||
&.row-name {
|
||||
padding-left: 34px;
|
||||
.loading {
|
||||
width: 24px;
|
||||
@ -659,7 +616,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
&.row-member {
|
||||
&.row-column {
|
||||
.task-column {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
&.row-user {
|
||||
padding: 8px;
|
||||
> ul {
|
||||
height: 32px;
|
||||
@ -676,6 +640,28 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
&.row-time {
|
||||
.task-time {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
&.overdue,
|
||||
&.today {
|
||||
color: #ffffff;
|
||||
padding: 1px 5px;
|
||||
font-size: 13px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
&.overdue {
|
||||
font-weight: 600;
|
||||
background-color: #ed4014;
|
||||
}
|
||||
&.today {
|
||||
font-weight: 500;
|
||||
background-color: #ff9900;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.row-add {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -689,7 +675,32 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.task-rows {
|
||||
.task-rows {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
box-shadow: rgba(0, 0, 0, 0.08) 0 0 8px 1px;
|
||||
z-index: 1;
|
||||
}
|
||||
.task-row {
|
||||
background-color: #fcfcfd;
|
||||
> div {
|
||||
&.row-name {
|
||||
padding-left: 56px;
|
||||
.item-title {
|
||||
color: #6C7D8C;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user