no message
This commit is contained in:
parent
01fd0907e9
commit
13ecc6b3f3
@ -70,19 +70,13 @@ class ProjectController extends AbstractController
|
||||
//
|
||||
$project_id = intval(Request::input('project_id'));
|
||||
//
|
||||
$project = Project::with(['projectColumn' => function($query) {
|
||||
$query->with(['projectTask' => function($taskQuery) {
|
||||
$taskQuery->with(['taskUser', 'taskTag'])->where('parent_id', 0);
|
||||
}]);
|
||||
}, 'projectUser'])
|
||||
->select($this->projectSelect)
|
||||
$project = Project::select($this->projectSelect)
|
||||
->join('project_users', 'projects.id', '=', 'project_users.project_id')
|
||||
->where('projects.id', $project_id)
|
||||
->where('project_users.userid', $user->userid)
|
||||
->first();
|
||||
if ($project) {
|
||||
$owner_user = $project->projectUser->where('owner', 1)->first();
|
||||
$project->owner_userid = $owner_user ? $owner_user->userid : 0;
|
||||
if (empty($project)) {
|
||||
return Base::retError('项目不存在或不在成员列表内');
|
||||
}
|
||||
//
|
||||
return Base::retSuccess('success', $project);
|
||||
@ -114,10 +108,11 @@ class ProjectController extends AbstractController
|
||||
->where('projects.id', $project_id)
|
||||
->where('project_users.userid', $user->userid)
|
||||
->first();
|
||||
if ($project) {
|
||||
$owner_user = $project->projectUser->where('owner', 1)->first();
|
||||
$project->owner_userid = $owner_user ? $owner_user->userid : 0;
|
||||
if (empty($project)) {
|
||||
return Base::retError('项目不存在或不在成员列表内');
|
||||
}
|
||||
$owner_user = $project->projectUser->where('owner', 1)->first();
|
||||
$project->owner_userid = $owner_user ? $owner_user->userid : 0;
|
||||
//
|
||||
return Base::retSuccess('success', $project);
|
||||
}
|
||||
|
49
resources/assets/js/store/mutations.js
vendored
49
resources/assets/js/store/mutations.js
vendored
@ -89,6 +89,9 @@ export default {
|
||||
typeof afterCallback === "function" && afterCallback();
|
||||
return;
|
||||
}
|
||||
if (state.method.isArray(state.cacheProjectList)) {
|
||||
state.projectList = state.cacheProjectList;
|
||||
}
|
||||
$A.apiAjax({
|
||||
url: 'project/lists',
|
||||
after: () => {
|
||||
@ -97,6 +100,7 @@ export default {
|
||||
success: ({ret, data, msg}) => {
|
||||
if (ret === 1) {
|
||||
state.projectList = data.data;
|
||||
state.method.setStorage("cacheProjectList", state.projectList);
|
||||
} else {
|
||||
$A.modalError(msg);
|
||||
}
|
||||
@ -120,15 +124,29 @@ export default {
|
||||
},
|
||||
success: ({ret, data, msg}) => {
|
||||
if (ret === 1) {
|
||||
let index = state.projectList.findIndex(({id}) => id === data.id);
|
||||
if (index > -1) {
|
||||
state.projectList.splice(index, 1, data);
|
||||
}
|
||||
this.commit('storageProjectOne', data);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 保存项目信息
|
||||
* @param state
|
||||
* @param project
|
||||
*/
|
||||
storageProjectOne(state, project) {
|
||||
if (typeof project.project_column !== "undefined") delete project.project_column;
|
||||
if (typeof project.project_user !== "undefined") delete project.project_user;
|
||||
let index = state.projectList.findIndex(({id}) => id === project.id);
|
||||
if (index > -1) {
|
||||
state.projectList.splice(index, 1, project);
|
||||
state.method.setStorage("cacheProjectList", state.projectList);
|
||||
} else {
|
||||
state.projectList.push(project);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取项目详情
|
||||
* @param state
|
||||
@ -138,15 +156,15 @@ export default {
|
||||
if (state.method.runNum(project_id) === 0) {
|
||||
return;
|
||||
}
|
||||
if (state.method.isJson(state.cacheProject[project_id])) {
|
||||
state.projectDetail = state.cacheProject[project_id];
|
||||
if (state.method.isJson(state.cacheProjectDetail[project_id])) {
|
||||
state.projectDetail = state.cacheProjectDetail[project_id];
|
||||
}
|
||||
state.projectDetail.id = project_id;
|
||||
//
|
||||
if (state.cacheProject[project_id + "::load"]) {
|
||||
if (state.cacheProjectDetail[project_id + "::load"]) {
|
||||
return;
|
||||
}
|
||||
state.cacheProject[project_id + "::load"] = true;
|
||||
state.cacheProjectDetail[project_id + "::load"] = true;
|
||||
//
|
||||
state.projectLoad++;
|
||||
$A.apiAjax({
|
||||
@ -156,23 +174,16 @@ export default {
|
||||
},
|
||||
complete: () => {
|
||||
state.projectLoad--;
|
||||
state.cacheProject[project_id + "::load"] = false;
|
||||
state.cacheProjectDetail[project_id + "::load"] = false;
|
||||
},
|
||||
success: ({ret, data, msg}) => {
|
||||
if (ret === 1) {
|
||||
state.cacheProject[data.id] = data;
|
||||
state.cacheProjectDetail[data.id] = data;
|
||||
if (state.projectDetail.id === data.id) {
|
||||
state.projectDetail = data;
|
||||
}
|
||||
state.method.setStorage("cacheProject", state.cacheProject);
|
||||
//
|
||||
let index = state.projectList.findIndex(({id}) => id === data.id);
|
||||
if (index > -1) {
|
||||
const project = $A.cloneJSON(data);
|
||||
delete project.project_column;
|
||||
delete project.project_user;
|
||||
state.projectList.splice(index, 1, project);
|
||||
}
|
||||
state.method.setStorage("cacheProjectDetail", state.cacheProjectDetail);
|
||||
this.commit('storageProjectOne', $A.cloneJSON(data));
|
||||
} else {
|
||||
$A.modalError(msg);
|
||||
}
|
||||
|
22
resources/assets/js/store/state.js
vendored
22
resources/assets/js/store/state.js
vendored
@ -148,7 +148,7 @@ const method = {
|
||||
// 方法类
|
||||
const state = { method };
|
||||
|
||||
// Boolean变量
|
||||
// 变量缓存
|
||||
[
|
||||
'projectChatShow', // 项目聊天显示
|
||||
'projectListPanel', // 项目面板显示类型
|
||||
@ -159,6 +159,12 @@ const state = { method };
|
||||
state[key] = state.method.getStorageBoolean('boolean:' + key, true)
|
||||
})
|
||||
|
||||
// 数据缓存
|
||||
state.cacheUserBasic = state.method.getStorageJson("cacheUserBasic");
|
||||
state.cacheDialogMsg = state.method.getStorageJson("cacheDialogMsg");
|
||||
state.cacheProjectList = state.method.getStorageArray("cacheProjectList");
|
||||
state.cacheProjectDetail = state.method.getStorageJson("cacheProjectDetail");
|
||||
|
||||
// 会员信息
|
||||
state.userInfo = state.method.getStorageJson('userInfo');
|
||||
state.userId = state.userInfo.userid = state.method.runNum(state.userInfo.userid);
|
||||
@ -177,13 +183,8 @@ state.wsReadWaitList = [];
|
||||
|
||||
// 项目信息
|
||||
state.projectLoad = 0;
|
||||
state.projectList = [];
|
||||
state.projectDetail = {
|
||||
id: 0,
|
||||
dialog_id: 0,
|
||||
project_column: [],
|
||||
project_user: []
|
||||
};
|
||||
state.projectList = state.cacheProjectList;
|
||||
state.projectDetail = {id: 0, dialog_id: 0, project_column: [], project_user: []};
|
||||
|
||||
// 会话消息
|
||||
state.dialogId = 0;
|
||||
@ -196,9 +197,4 @@ state.dialogMsgUnread = 0;
|
||||
// 任务优先级
|
||||
state.taskPriority = [];
|
||||
|
||||
// 其他
|
||||
state.cacheProject = state.method.getStorageJson("cacheProject");
|
||||
state.cacheUserBasic = state.method.getStorageJson("cacheUserBasic");
|
||||
state.cacheDialogMsg = state.method.getStorageJson("cacheDialogMsg");
|
||||
|
||||
export default state
|
||||
|
10
resources/assets/sass/pages/common.scss
vendored
10
resources/assets/sass/pages/common.scss
vendored
@ -226,6 +226,16 @@ body {
|
||||
}
|
||||
}
|
||||
}
|
||||
.ivu-progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&.ivu-progress-show-info {
|
||||
.ivu-progress-outer {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal-info-show {
|
||||
|
1
resources/assets/sass/pages/page-manage.scss
vendored
1
resources/assets/sass/pages/page-manage.scss
vendored
@ -158,6 +158,7 @@
|
||||
display: none;
|
||||
margin: 16px 4px;
|
||||
padding: 0 8px 0 26px;
|
||||
cursor: default;
|
||||
> p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
Loading…
x
Reference in New Issue
Block a user