任务列表增删通知
This commit is contained in:
parent
a97b7f158a
commit
c3fe7c1f7e
@ -392,6 +392,7 @@ class ProjectController extends AbstractController
|
|||||||
//
|
//
|
||||||
$data = $column->find($column->id);
|
$data = $column->find($column->id);
|
||||||
$data->project_task = [];
|
$data->project_task = [];
|
||||||
|
$data->pushMsg("add", $data->toArray());
|
||||||
return Base::retSuccess('添加成功', $data);
|
return Base::retSuccess('添加成功', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +462,9 @@ class ProjectController extends AbstractController
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
if ($column->deleteColumn()) {
|
if ($column->deleteColumn()) {
|
||||||
return Base::retSuccess('删除成功');
|
$data = ['id' => $column->id];
|
||||||
|
$column->pushMsg("delete", $data);
|
||||||
|
return Base::retSuccess('删除成功', $data);
|
||||||
}
|
}
|
||||||
return Base::retError('删除失败');
|
return Base::retError('删除失败');
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Module\Base;
|
use App\Module\Base;
|
||||||
|
use App\Tasks\PushTask;
|
||||||
|
use Hhxsv5\LaravelS\Swoole\Task\Task;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,6 +19,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||||
|
* @property-read \App\Models\Project|null $project
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProjectTask[] $projectTask
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProjectTask[] $projectTask
|
||||||
* @property-read int|null $project_task_count
|
* @property-read int|null $project_task_count
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectColumn newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectColumn newModelQuery()
|
||||||
@ -39,6 +42,14 @@ class ProjectColumn extends AbstractModel
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||||
|
*/
|
||||||
|
public function project(): \Illuminate\Database\Eloquent\Relations\HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(Project::class, 'id', 'project_id');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
*/
|
*/
|
||||||
@ -86,4 +97,26 @@ class ProjectColumn extends AbstractModel
|
|||||||
$log->save();
|
$log->save();
|
||||||
return $log;
|
return $log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送消息
|
||||||
|
* @param string $action
|
||||||
|
* @param array $data
|
||||||
|
*/
|
||||||
|
public function pushMsg($action, $data)
|
||||||
|
{
|
||||||
|
if (!$this->project) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$lists = [
|
||||||
|
'userid' => $this->project->relationUserids(),
|
||||||
|
'msg' => [
|
||||||
|
'type' => 'projectColumn',
|
||||||
|
'action' => $action,
|
||||||
|
'data' => $data,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$task = new PushTask($lists, false);
|
||||||
|
Task::deliver($task);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,9 +76,10 @@
|
|||||||
<EDropdown
|
<EDropdown
|
||||||
v-else
|
v-else
|
||||||
trigger="click"
|
trigger="click"
|
||||||
|
size="small"
|
||||||
@command="dropColumn(column, $event)">
|
@command="dropColumn(column, $event)">
|
||||||
<Icon type="ios-more" />
|
<Icon type="ios-more" />
|
||||||
<EDropdownMenu slot="dropdown" class="project-list-more-dropdown-menu column-more">
|
<EDropdownMenu slot="dropdown" class="project-list-more-dropdown-menu">
|
||||||
<EDropdownItem command="title">
|
<EDropdownItem command="title">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<Icon type="md-create" />{{$L('修改')}}
|
<Icon type="md-create" />{{$L('修改')}}
|
||||||
@ -701,7 +702,7 @@ export default {
|
|||||||
}).then(({data, msg}) => {
|
}).then(({data, msg}) => {
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
this.addColumnName = '';
|
this.addColumnName = '';
|
||||||
this.projectDetail.project_column.push(data)
|
this.$store.commit("columnAddSuccess", data);
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
});
|
});
|
||||||
@ -777,15 +778,11 @@ export default {
|
|||||||
data: {
|
data: {
|
||||||
column_id: column.id,
|
column_id: column.id,
|
||||||
},
|
},
|
||||||
}).then(({msg}) => {
|
}).then(({data, msg}) => {
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
this.$set(column, 'loading', false);
|
this.$set(column, 'loading', false);
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
let index = this.projectDetail.project_column.findIndex(({id}) => id === column.id);
|
this.$store.commit("columnRemoveSuccess", data);
|
||||||
if (index > -1) {
|
|
||||||
this.projectDetail.project_column.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.$store.dispatch("getProjectBasic", column.project_id);
|
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg, 301);
|
$A.modalError(msg, 301);
|
||||||
this.$set(column, 'loading', false);
|
this.$set(column, 'loading', false);
|
||||||
|
19
resources/assets/js/store/actions.js
vendored
19
resources/assets/js/store/actions.js
vendored
@ -1064,7 +1064,7 @@ export default {
|
|||||||
});
|
});
|
||||||
switch (type) {
|
switch (type) {
|
||||||
/**
|
/**
|
||||||
* 会话消息
|
* 聊天会话消息
|
||||||
*/
|
*/
|
||||||
case "dialog": // 更新会话
|
case "dialog": // 更新会话
|
||||||
(function (msg) {
|
(function (msg) {
|
||||||
@ -1110,6 +1110,23 @@ export default {
|
|||||||
})(msgDetail);
|
})(msgDetail);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务列表消息
|
||||||
|
*/
|
||||||
|
case "projectColumn":
|
||||||
|
(function (msg) {
|
||||||
|
const {action, data} = msg;
|
||||||
|
switch (action) {
|
||||||
|
case 'add':
|
||||||
|
commit("columnAddSuccess", data)
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
commit("columnRemoveSuccess", data)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})(msgDetail);
|
||||||
|
break;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务消息
|
* 任务消息
|
||||||
*/
|
*/
|
||||||
|
27
resources/assets/js/store/mutations.js
vendored
27
resources/assets/js/store/mutations.js
vendored
@ -1,4 +1,31 @@
|
|||||||
export default {
|
export default {
|
||||||
|
/**
|
||||||
|
* 添加列表成功
|
||||||
|
* @param state
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
columnAddSuccess(state, data) {
|
||||||
|
if (state.projectDetail.id == data.project_id) {
|
||||||
|
let index = state.projectDetail.project_column.findIndex(({id}) => id === data.id);
|
||||||
|
if (index === -1) {
|
||||||
|
state.projectDetail.project_column.push(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除列表成功
|
||||||
|
* @param state
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
columnRemoveSuccess(state, data) {
|
||||||
|
let index = state.projectDetail.project_column.findIndex(({id}) => id === data.id);
|
||||||
|
if (index > -1) {
|
||||||
|
state.projectDetail.project_column.splice(index, 1);
|
||||||
|
}
|
||||||
|
this.dispatch("getProjectBasic", data.project_id);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加任务成功
|
* 添加任务成功
|
||||||
* @param state
|
* @param state
|
||||||
|
@ -757,9 +757,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.column-more {
|
|
||||||
> li {
|
|
||||||
min-width: 130px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user