同步通知 项目正删改
This commit is contained in:
parent
41825ea4d4
commit
867a46a791
@ -163,7 +163,7 @@ class ProjectController extends AbstractController
|
|||||||
* @apiParam {String} name 项目名称
|
* @apiParam {String} name 项目名称
|
||||||
* @apiParam {String} [desc] 项目介绍
|
* @apiParam {String} [desc] 项目介绍
|
||||||
*/
|
*/
|
||||||
public function edit()
|
public function update()
|
||||||
{
|
{
|
||||||
user::auth();
|
user::auth();
|
||||||
//
|
//
|
||||||
@ -193,10 +193,86 @@ class ProjectController extends AbstractController
|
|||||||
$project->addLog("修改项目介绍");
|
$project->addLog("修改项目介绍");
|
||||||
}
|
}
|
||||||
$project->save();
|
$project->save();
|
||||||
|
$project->pushMsg('update', $project->toArray());
|
||||||
//
|
//
|
||||||
return Base::retSuccess('修改成功', $project);
|
return Base::retSuccess('修改成功', $project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改项目成员
|
||||||
|
*
|
||||||
|
* @apiParam {Number} project_id 项目ID
|
||||||
|
* @apiParam {Number} userid 成员ID 或 成员ID组
|
||||||
|
*/
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
user::auth();
|
||||||
|
//
|
||||||
|
$project_id = intval(Request::input('project_id'));
|
||||||
|
$userid = Request::input('userid');
|
||||||
|
$userid = is_array($userid) ? $userid : [$userid];
|
||||||
|
//
|
||||||
|
$project = Project::userProject($project_id);
|
||||||
|
if (!$project->owner) {
|
||||||
|
return Base::retError('你不是项目负责人');
|
||||||
|
}
|
||||||
|
//
|
||||||
|
return AbstractModel::transaction(function() use ($project, $userid) {
|
||||||
|
$array = [];
|
||||||
|
foreach ($userid as $uid) {
|
||||||
|
if ($project->joinProject($uid)) {
|
||||||
|
$array[] = $uid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$delete = ProjectUser::whereProjectId($project->id)->whereNotIn('userid', $array);
|
||||||
|
$deleteUser = $delete->pluck('userid');
|
||||||
|
$delete->delete();
|
||||||
|
$project->syncDialogUser();
|
||||||
|
$project->addLog("修改项目成员");
|
||||||
|
$project->pushMsg('delete', null, $deleteUser->toArray());
|
||||||
|
$project->pushMsg('detail');
|
||||||
|
return Base::retSuccess('修改成功', ['id' => $project->id]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移交项目
|
||||||
|
*
|
||||||
|
* @apiParam {Number} project_id 项目ID
|
||||||
|
* @apiParam {Number} owner_userid 新的项目负责人ID
|
||||||
|
*/
|
||||||
|
public function transfer()
|
||||||
|
{
|
||||||
|
user::auth();
|
||||||
|
//
|
||||||
|
$project_id = intval(Request::input('project_id'));
|
||||||
|
$owner_userid = intval(Request::input('owner_userid'));
|
||||||
|
//
|
||||||
|
$project = Project::userProject($project_id);
|
||||||
|
if (!$project->owner) {
|
||||||
|
return Base::retError('你不是项目负责人');
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!User::whereUserid($owner_userid)->exists()) {
|
||||||
|
return Base::retError('会员不存在');
|
||||||
|
}
|
||||||
|
//
|
||||||
|
return AbstractModel::transaction(function() use ($owner_userid, $project) {
|
||||||
|
ProjectUser::whereProjectId($project->id)->update(['owner' => 0]);
|
||||||
|
ProjectUser::updateInsert([
|
||||||
|
'project_id' => $project->id,
|
||||||
|
'userid' => $owner_userid,
|
||||||
|
], [
|
||||||
|
'owner' => 1,
|
||||||
|
]);
|
||||||
|
$project->syncDialogUser();
|
||||||
|
$project->addLog("移交项目给会员ID:" . $owner_userid);
|
||||||
|
$project->pushMsg('detail');
|
||||||
|
//
|
||||||
|
return Base::retSuccess('移交成功', ['id' => $project->id]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排序任务
|
* 排序任务
|
||||||
*
|
*
|
||||||
@ -246,79 +322,10 @@ class ProjectController extends AbstractController
|
|||||||
}
|
}
|
||||||
$project->addLog("调整任务排序");
|
$project->addLog("调整任务排序");
|
||||||
}
|
}
|
||||||
|
$project->pushMsg('detail');
|
||||||
return Base::retSuccess('调整成功');
|
return Base::retSuccess('调整成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改项目成员
|
|
||||||
*
|
|
||||||
* @apiParam {Number} project_id 项目ID
|
|
||||||
* @apiParam {Number} userid 成员ID 或 成员ID组
|
|
||||||
*/
|
|
||||||
public function user()
|
|
||||||
{
|
|
||||||
user::auth();
|
|
||||||
//
|
|
||||||
$project_id = intval(Request::input('project_id'));
|
|
||||||
$userid = Request::input('userid');
|
|
||||||
$userid = is_array($userid) ? $userid : [$userid];
|
|
||||||
//
|
|
||||||
$project = Project::userProject($project_id);
|
|
||||||
if (!$project->owner) {
|
|
||||||
return Base::retError('你不是项目负责人');
|
|
||||||
}
|
|
||||||
//
|
|
||||||
return AbstractModel::transaction(function() use ($project, $userid) {
|
|
||||||
$array = [];
|
|
||||||
foreach ($userid as $uid) {
|
|
||||||
if ($project->joinProject($uid)) {
|
|
||||||
$array[] = $uid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ProjectUser::whereProjectId($project->id)->whereNotIn('userid', $array)->delete();
|
|
||||||
$project->syncDialogUser();
|
|
||||||
$project->addLog("修改项目成员");
|
|
||||||
return Base::retSuccess('修改成功');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移交项目
|
|
||||||
*
|
|
||||||
* @apiParam {Number} project_id 项目ID
|
|
||||||
* @apiParam {Number} owner_userid 新的项目负责人ID
|
|
||||||
*/
|
|
||||||
public function transfer()
|
|
||||||
{
|
|
||||||
user::auth();
|
|
||||||
//
|
|
||||||
$project_id = intval(Request::input('project_id'));
|
|
||||||
$owner_userid = intval(Request::input('owner_userid'));
|
|
||||||
//
|
|
||||||
$project = Project::userProject($project_id);
|
|
||||||
if (!$project->owner) {
|
|
||||||
return Base::retError('你不是项目负责人');
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (!User::whereUserid($owner_userid)->exists()) {
|
|
||||||
return Base::retError('会员不存在');
|
|
||||||
}
|
|
||||||
//
|
|
||||||
return AbstractModel::transaction(function() use ($owner_userid, $project) {
|
|
||||||
ProjectUser::whereProjectId($project->id)->update(['owner' => 0]);
|
|
||||||
ProjectUser::updateInsert([
|
|
||||||
'project_id' => $project->id,
|
|
||||||
'userid' => $owner_userid,
|
|
||||||
], [
|
|
||||||
'owner' => 1,
|
|
||||||
]);
|
|
||||||
$project->syncDialogUser();
|
|
||||||
$project->addLog("移交项目给会员ID:" . $owner_userid);
|
|
||||||
//
|
|
||||||
return Base::retSuccess('移交成功');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出项目
|
* 退出项目
|
||||||
*
|
*
|
||||||
@ -340,6 +347,7 @@ class ProjectController extends AbstractController
|
|||||||
ProjectUser::whereProjectId($project->id)->whereUserid($user->userid)->delete();
|
ProjectUser::whereProjectId($project->id)->whereUserid($user->userid)->delete();
|
||||||
$project->syncDialogUser();
|
$project->syncDialogUser();
|
||||||
$project->addLog("会员ID:" . $user->userid . " 退出项目");
|
$project->addLog("会员ID:" . $user->userid . " 退出项目");
|
||||||
|
$project->pushMsg('delete', null, $user->userid);
|
||||||
return Base::retSuccess('退出成功', ['id' => $project->id]);
|
return Base::retSuccess('退出成功', ['id' => $project->id]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -266,9 +266,9 @@ class Project extends AbstractModel
|
|||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
$column->deleteColumn(false);
|
$column->deleteColumn(false);
|
||||||
}
|
}
|
||||||
$this->pushMsg('delete', $this->toArray());
|
|
||||||
$this->delete();
|
$this->delete();
|
||||||
$this->addLog("删除项目");
|
$this->addLog("删除项目");
|
||||||
|
$this->pushMsg('delete');
|
||||||
return Base::retSuccess('删除成功', $this->toArray());
|
return Base::retSuccess('删除成功', $this->toArray());
|
||||||
});
|
});
|
||||||
return Base::isSuccess($result);
|
return Base::isSuccess($result);
|
||||||
@ -296,12 +296,19 @@ class Project extends AbstractModel
|
|||||||
/**
|
/**
|
||||||
* 推送消息
|
* 推送消息
|
||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $data
|
* @param array $data 发送内容,默认为[id=>项目ID]
|
||||||
|
* @param array $userid 指定会员,默认为项目所有成员
|
||||||
*/
|
*/
|
||||||
public function pushMsg($action, $data)
|
public function pushMsg($action, $data = null, $userid = null)
|
||||||
{
|
{
|
||||||
|
if ($data === null) {
|
||||||
|
$data = ['id' => $this->id];
|
||||||
|
}
|
||||||
|
if ($userid === null) {
|
||||||
|
$userid = $this->relationUserids();
|
||||||
|
}
|
||||||
$lists = [
|
$lists = [
|
||||||
'userid' => $this->relationUserids(),
|
'userid' => $userid,
|
||||||
'msg' => [
|
'msg' => [
|
||||||
'type' => 'project',
|
'type' => 'project',
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
|
@ -70,11 +70,11 @@ class ProjectColumn extends AbstractModel
|
|||||||
foreach ($tasks as $task) {
|
foreach ($tasks as $task) {
|
||||||
$task->deleteTask($pushMsg);
|
$task->deleteTask($pushMsg);
|
||||||
}
|
}
|
||||||
|
$this->delete();
|
||||||
|
$this->addLog("删除列表:" . $this->name);
|
||||||
if ($pushMsg) {
|
if ($pushMsg) {
|
||||||
$this->pushMsg("delete", $this->toArray());
|
$this->pushMsg("delete", $this->toArray());
|
||||||
}
|
}
|
||||||
$this->delete();
|
|
||||||
$this->addLog("删除列表:" . $this->name);
|
|
||||||
return Base::retSuccess('删除成功', $this->toArray());
|
return Base::retSuccess('删除成功', $this->toArray());
|
||||||
});
|
});
|
||||||
return Base::isSuccess($result);
|
return Base::isSuccess($result);
|
||||||
@ -102,15 +102,22 @@ class ProjectColumn extends AbstractModel
|
|||||||
/**
|
/**
|
||||||
* 推送消息
|
* 推送消息
|
||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $data
|
* @param array $data 发送内容,默认为[id=>列表ID]
|
||||||
|
* @param array $userid 指定会员,默认为项目所有成员
|
||||||
*/
|
*/
|
||||||
public function pushMsg($action, $data)
|
public function pushMsg($action, $data = null, $userid = null)
|
||||||
{
|
{
|
||||||
if (!$this->project) {
|
if (!$this->project) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ($data === null) {
|
||||||
|
$data = ['id' => $this->id];
|
||||||
|
}
|
||||||
|
if ($userid === null) {
|
||||||
|
$userid = $this->project->relationUserids();
|
||||||
|
}
|
||||||
$lists = [
|
$lists = [
|
||||||
'userid' => $this->project->relationUserids(),
|
'userid' => $userid,
|
||||||
'msg' => [
|
'msg' => [
|
||||||
'type' => 'projectColumn',
|
'type' => 'projectColumn',
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
|
@ -591,11 +591,11 @@ class ProjectTask extends AbstractModel
|
|||||||
if ($this->dialog_id) {
|
if ($this->dialog_id) {
|
||||||
WebSocketDialog::whereId($this->dialog_id)->delete();
|
WebSocketDialog::whereId($this->dialog_id)->delete();
|
||||||
}
|
}
|
||||||
|
$this->delete();
|
||||||
|
$this->addLog("删除{任务}:" . $this->name);
|
||||||
if ($pushMsg) {
|
if ($pushMsg) {
|
||||||
$this->pushMsg('delete', $this->toArray());
|
$this->pushMsg('delete', $this->toArray());
|
||||||
}
|
}
|
||||||
$this->delete();
|
|
||||||
$this->addLog("删除{任务}:" . $this->name);
|
|
||||||
return Base::retSuccess('删除成功', $this->toArray());
|
return Base::retSuccess('删除成功', $this->toArray());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -623,15 +623,22 @@ class ProjectTask extends AbstractModel
|
|||||||
/**
|
/**
|
||||||
* 推送消息
|
* 推送消息
|
||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $data
|
* @param array $data 发送内容,默认为[id=>任务ID]
|
||||||
|
* @param array $userid 指定会员,默认为项目所有成员
|
||||||
*/
|
*/
|
||||||
public function pushMsg($action, $data)
|
public function pushMsg($action, $data = null, $userid = null)
|
||||||
{
|
{
|
||||||
if (!$this->project) {
|
if (!$this->project) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ($data === null) {
|
||||||
|
$data = ['id' => $this->id];
|
||||||
|
}
|
||||||
|
if ($userid === null) {
|
||||||
|
$userid = $this->project->relationUserids();
|
||||||
|
}
|
||||||
$lists = [
|
$lists = [
|
||||||
'userid' => $this->project->relationUserids(),
|
'userid' => $userid,
|
||||||
'msg' => [
|
'msg' => [
|
||||||
'type' => 'projectTask',
|
'type' => 'projectTask',
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
|
@ -626,7 +626,7 @@ export default {
|
|||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
this.sortDisabled = false;
|
this.sortDisabled = false;
|
||||||
this.$store.dispatch("getProjectDetail", this.projectDetail.id);
|
this.$store.dispatch("getProjectDetail", this.projectDetail);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -782,7 +782,7 @@ export default {
|
|||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
this.$set(column, 'loading', false);
|
this.$set(column, 'loading', false);
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
this.$store.commit("columnRemoveSuccess", data);
|
this.$store.commit("columnDeleteSuccess", data);
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg, 301);
|
$A.modalError(msg, 301);
|
||||||
this.$set(column, 'loading', false);
|
this.$set(column, 'loading', false);
|
||||||
@ -869,7 +869,7 @@ export default {
|
|||||||
onSetting() {
|
onSetting() {
|
||||||
this.settingLoad++;
|
this.settingLoad++;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'project/edit',
|
url: 'project/update',
|
||||||
data: this.settingData,
|
data: this.settingData,
|
||||||
}).then(({data, msg}) => {
|
}).then(({data, msg}) => {
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
@ -890,11 +890,11 @@ export default {
|
|||||||
project_id: this.userData.project_id,
|
project_id: this.userData.project_id,
|
||||||
userid: this.userData.userids,
|
userid: this.userData.userids,
|
||||||
},
|
},
|
||||||
}).then(({msg}) => {
|
}).then(({data, msg}) => {
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
this.userLoad--;
|
this.userLoad--;
|
||||||
this.userShow = false;
|
this.userShow = false;
|
||||||
this.$store.dispatch("getProjectDetail", this.userData.project_id);
|
this.$store.dispatch("getProjectDetail", data);
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
this.userLoad--;
|
this.userLoad--;
|
||||||
@ -909,11 +909,11 @@ export default {
|
|||||||
project_id: this.transferData.project_id,
|
project_id: this.transferData.project_id,
|
||||||
owner_userid: this.transferData.owner_userid[0],
|
owner_userid: this.transferData.owner_userid[0],
|
||||||
},
|
},
|
||||||
}).then(({msg}) => {
|
}).then(({data, msg}) => {
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
this.transferLoad--;
|
this.transferLoad--;
|
||||||
this.transferShow = false;
|
this.transferShow = false;
|
||||||
this.$store.dispatch("getProjectDetail", this.transferData.project_id);
|
this.$store.dispatch("getProjectDetail", data);
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
this.transferLoad--;
|
this.transferLoad--;
|
||||||
|
@ -24,7 +24,7 @@ export default {
|
|||||||
this.project_id = route.params.id;
|
this.project_id = route.params.id;
|
||||||
},
|
},
|
||||||
project_id(id) {
|
project_id(id) {
|
||||||
this.$store.dispatch("getProjectDetail", id);
|
this.$store.dispatch("getProjectDetail", {id});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
34
resources/assets/js/store/actions.js
vendored
34
resources/assets/js/store/actions.js
vendored
@ -314,16 +314,16 @@ export default {
|
|||||||
* 获取项目信息
|
* 获取项目信息
|
||||||
* @param state
|
* @param state
|
||||||
* @param dispatch
|
* @param dispatch
|
||||||
* @param project_id
|
* @param data {id}
|
||||||
*/
|
*/
|
||||||
getProjectBasic({state, dispatch}, project_id) {
|
getProjectBasic({state, dispatch}, data) {
|
||||||
if (state.method.runNum(project_id) === 0) {
|
if (state.method.runNum(data.id) === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'project/basic',
|
url: 'project/basic',
|
||||||
data: {
|
data: {
|
||||||
project_id: project_id,
|
project_id: data.id,
|
||||||
},
|
},
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
dispatch("saveProject", result.data);
|
dispatch("saveProject", result.data);
|
||||||
@ -334,24 +334,24 @@ export default {
|
|||||||
* 获取项目详情
|
* 获取项目详情
|
||||||
* @param state
|
* @param state
|
||||||
* @param dispatch
|
* @param dispatch
|
||||||
* @param project_id
|
* @param data {id}
|
||||||
*/
|
*/
|
||||||
getProjectDetail({state, dispatch}, project_id) {
|
getProjectDetail({state, dispatch}, data) {
|
||||||
if (state.method.runNum(project_id) === 0) {
|
if (state.method.runNum(data.id) === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const project = state.cacheProjectList.find(({id}) => id == project_id);
|
const project = state.cacheProjectList.find(({id}) => id == data.id);
|
||||||
if (project) {
|
if (project) {
|
||||||
state.projectDetail = Object.assign({project_column: [], project_user: []}, project);
|
state.projectDetail = Object.assign({project_column: [], project_user: []}, project);
|
||||||
} else {
|
} else {
|
||||||
state.projectDetail.id = project_id;
|
state.projectDetail.id = data.id;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
state.projectLoad++;
|
state.projectLoad++;
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'project/detail',
|
url: 'project/detail',
|
||||||
data: {
|
data: {
|
||||||
project_id: project_id,
|
project_id: data.id,
|
||||||
},
|
},
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
state.projectLoad--;
|
state.projectLoad--;
|
||||||
@ -365,7 +365,7 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* 删除项目信息
|
* 删除项目信息
|
||||||
* @param state
|
* @param state
|
||||||
* @param data
|
* @param data {id}
|
||||||
*/
|
*/
|
||||||
removeProject({state}, data) {
|
removeProject({state}, data) {
|
||||||
let index = state.projectList.findIndex(({id}) => id == data.id);
|
let index = state.projectList.findIndex(({id}) => id == data.id);
|
||||||
@ -689,7 +689,7 @@ export default {
|
|||||||
dispatch("getTaskBasic", result.data.parent_id);
|
dispatch("getTaskBasic", result.data.parent_id);
|
||||||
}
|
}
|
||||||
if (typeof post.complete_at !== "undefined") {
|
if (typeof post.complete_at !== "undefined") {
|
||||||
dispatch("getProjectBasic", result.data.project_id);
|
dispatch("getProjectBasic", {id: result.data.project_id});
|
||||||
}
|
}
|
||||||
dispatch("saveTask", result.data);
|
dispatch("saveTask", result.data);
|
||||||
resolve(result)
|
resolve(result)
|
||||||
@ -716,7 +716,7 @@ export default {
|
|||||||
task_id,
|
task_id,
|
||||||
},
|
},
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
commit("taskRemoveSuccess", result.data);
|
commit("taskDeleteSuccess", result.data);
|
||||||
resolve(result);
|
resolve(result);
|
||||||
}).catch(result => {
|
}).catch(result => {
|
||||||
reject(result)
|
reject(result)
|
||||||
@ -1126,8 +1126,12 @@ export default {
|
|||||||
const {action, data} = msg;
|
const {action, data} = msg;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'add':
|
case 'add':
|
||||||
|
case 'update':
|
||||||
dispatch("saveProject", data)
|
dispatch("saveProject", data)
|
||||||
break;
|
break;
|
||||||
|
case 'detail':
|
||||||
|
dispatch("getProjectDetail", data);
|
||||||
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
dispatch("removeProject", data);
|
dispatch("removeProject", data);
|
||||||
break;
|
break;
|
||||||
@ -1146,7 +1150,7 @@ export default {
|
|||||||
commit("columnAddSuccess", data)
|
commit("columnAddSuccess", data)
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
commit("columnRemoveSuccess", data)
|
commit("columnDeleteSuccess", data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})(msgDetail);
|
})(msgDetail);
|
||||||
@ -1164,7 +1168,7 @@ export default {
|
|||||||
break;
|
break;
|
||||||
case 'archived':
|
case 'archived':
|
||||||
case 'delete':
|
case 'delete':
|
||||||
commit("taskRemoveSuccess", data)
|
commit("taskDeleteSuccess", data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})(msgDetail);
|
})(msgDetail);
|
||||||
|
18
resources/assets/js/store/mutations.js
vendored
18
resources/assets/js/store/mutations.js
vendored
@ -1,6 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
* 添加列表成功
|
* 添加列表
|
||||||
* @param state
|
* @param state
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
@ -14,20 +14,20 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除列表成功
|
* 删除列表
|
||||||
* @param state
|
* @param state
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
columnRemoveSuccess(state, data) {
|
columnDeleteSuccess(state, data) {
|
||||||
let index = state.projectDetail.project_column.findIndex(({id}) => id === data.id);
|
let index = state.projectDetail.project_column.findIndex(({id}) => id === data.id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.projectDetail.project_column.splice(index, 1);
|
state.projectDetail.project_column.splice(index, 1);
|
||||||
}
|
}
|
||||||
this.dispatch("getProjectBasic", data.project_id);
|
this.dispatch("getProjectBasic", {id: data.project_id});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加任务成功
|
* 添加任务
|
||||||
* @param state
|
* @param state
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
@ -51,7 +51,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.dispatch("getProjectBasic", task.project_id);
|
this.dispatch("getProjectBasic", {id: task.project_id});
|
||||||
} else {
|
} else {
|
||||||
// 添加子任务
|
// 添加子任务
|
||||||
if (state.projectDetail.id == task.project_id) {
|
if (state.projectDetail.id == task.project_id) {
|
||||||
@ -78,11 +78,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除任务成功
|
* 删除任务
|
||||||
* @param state
|
* @param state
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
taskRemoveSuccess(state, data) {
|
taskDeleteSuccess(state, data) {
|
||||||
const column = state.projectDetail.project_column.find(({id}) => id === data.column_id);
|
const column = state.projectDetail.project_column.find(({id}) => id === data.column_id);
|
||||||
if (column) {
|
if (column) {
|
||||||
let index = column.project_task.findIndex(({id}) => id === data.id);
|
let index = column.project_task.findIndex(({id}) => id === data.id);
|
||||||
@ -102,6 +102,6 @@ export default {
|
|||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.calendarTask.splice(index, 1)
|
state.calendarTask.splice(index, 1)
|
||||||
}
|
}
|
||||||
this.dispatch("getProjectBasic", data.project_id);
|
this.dispatch("getProjectBasic", {id: data.project_id});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user