no message

This commit is contained in:
kuaifan 2021-06-10 22:52:16 +08:00
parent 13ecc6b3f3
commit 1f832ece2c
5 changed files with 63 additions and 43 deletions

View File

@ -188,7 +188,7 @@ class ProjectController extends AbstractController
$column['project_id'] = $project->id; $column['project_id'] = $project->id;
ProjectColumn::createInstance($column)->save(); ProjectColumn::createInstance($column)->save();
} }
return Base::retSuccess('添加成功'); return Base::retSuccess('添加成功', $project->find($project->id));
}); });
} }
@ -236,7 +236,7 @@ class ProjectController extends AbstractController
$project->desc = $desc; $project->desc = $desc;
$project->save(); $project->save();
// //
return Base::retSuccess('修改成功'); return Base::retSuccess('修改成功', $project);
} }
/** /**

View File

@ -269,11 +269,8 @@ export default {
this.addShow = false; this.addShow = false;
this.$refs.addProject.resetFields(); this.$refs.addProject.resetFields();
this.$set(this.addData, 'template', 0); this.$set(this.addData, 'template', 0);
// this.$store.commit('storageProjectData', data);
this.loadIng++; this.toggleRoute('project/' + data.id)
this.$store.commit('getProjectList', () => {
this.loadIng--;
});
} else { } else {
$A.modalError(msg); $A.modalError(msg);
} }

View File

@ -46,14 +46,14 @@
</li> </li>
</ul> </ul>
<div class="project-switch"> <div class="project-switch">
<div :class="['project-switch-button', !projectListPanel ? 'menu' : '']" @click="toggleBoolean('projectListPanel')"> <div :class="['project-switch-button', !projectTablePanel ? 'menu' : '']" @click="toggleBoolean('projectTablePanel')">
<div><i class="iconfont">&#xe60c;</i></div> <div><i class="iconfont">&#xe60c;</i></div>
<div><i class="iconfont">&#xe66a;</i></div> <div><i class="iconfont">&#xe66a;</i></div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="projectListPanel" class="project-column overlay-x"> <div v-if="projectTablePanel" class="project-column overlay-x">
<Draggable <Draggable
:list="projectDetail.project_column" :list="projectDetail.project_column"
:animation="150" :animation="150"
@ -444,11 +444,12 @@ export default {
'userId', 'userId',
'dialogList', 'dialogList',
'projectList',
'projectDetail', 'projectDetail',
'projectLoad', 'projectLoad',
'projectChatShow', 'projectChatShow',
'projectListPanel', 'projectTablePanel',
'taskMyShow', 'taskMyShow',
'taskUndoneShow', 'taskUndoneShow',
'taskCompletedShow' 'taskCompletedShow'
@ -961,9 +962,8 @@ export default {
success: ({ret, data, msg}) => { success: ({ret, data, msg}) => {
if (ret === 1) { if (ret === 1) {
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.$set(this.projectDetail, 'name', this.settingData.name);
this.$set(this.projectDetail, 'desc', this.settingData.desc);
this.settingShow = false; this.settingShow = false;
this.$store.commit("storageProjectData", data)
} else { } else {
$A.modalError(msg); $A.modalError(msg);
} }
@ -1036,8 +1036,13 @@ export default {
this.$Modal.remove(); this.$Modal.remove();
if (ret === 1) { if (ret === 1) {
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.$store.commit('getProjectList'); this.$store.commit('forgetProjectData', this.projectDetail.id);
const project = this.projectList.find(({id}) => id);
if (project) {
this.goForward({path: '/manage/project/' + project.id}, true);
} else {
this.goForward({path: '/manage/dashboard'}, true); this.goForward({path: '/manage/dashboard'}, true);
}
}else{ }else{
$A.modalError(msg, 301); $A.modalError(msg, 301);
} }
@ -1066,8 +1071,13 @@ export default {
this.$Modal.remove(); this.$Modal.remove();
if (ret === 1) { if (ret === 1) {
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.$store.commit('getProjectList'); this.$store.commit('forgetProjectData', this.projectDetail.id);
const project = this.projectList.find(({id}) => id);
if (project) {
this.goForward({path: '/manage/project/' + project.id}, true);
} else {
this.goForward({path: '/manage/dashboard'}, true); this.goForward({path: '/manage/dashboard'}, true);
}
}else{ }else{
$A.modalError(msg, 301); $A.modalError(msg, 301);
} }

View File

@ -81,12 +81,10 @@ export default {
/** /**
* 获取项目列表 * 获取项目列表
* @param state * @param state
* @param afterCallback
*/ */
getProjectList(state, afterCallback) { getProjectList(state) {
if (state.userId === 0) { if (state.userId === 0) {
state.projectList = []; state.projectList = [];
typeof afterCallback === "function" && afterCallback();
return; return;
} }
if (state.method.isArray(state.cacheProjectList)) { if (state.method.isArray(state.cacheProjectList)) {
@ -94,9 +92,6 @@ export default {
} }
$A.apiAjax({ $A.apiAjax({
url: 'project/lists', url: 'project/lists',
after: () => {
typeof afterCallback === "function" && afterCallback();
},
success: ({ret, data, msg}) => { success: ({ret, data, msg}) => {
if (ret === 1) { if (ret === 1) {
state.projectList = data.data; state.projectList = data.data;
@ -124,7 +119,7 @@ export default {
}, },
success: ({ret, data, msg}) => { success: ({ret, data, msg}) => {
if (ret === 1) { if (ret === 1) {
this.commit('storageProjectOne', data); this.commit('storageProjectData', data);
} }
} }
}); });
@ -133,17 +128,38 @@ export default {
/** /**
* 保存项目信息 * 保存项目信息
* @param state * @param state
* @param project * @param data
*/ */
storageProjectOne(state, project) { storageProjectData(state, data) {
if (typeof project.project_column !== "undefined") delete project.project_column; if (data.id == state.projectDetail.id) {
if (typeof project.project_user !== "undefined") delete project.project_user; state.projectDetail = Object.assign({}, state.projectDetail, data)
let index = state.projectList.findIndex(({id}) => id === project.id); }
//
if (typeof data.project_column !== "undefined") delete data.project_column;
if (typeof data.project_user !== "undefined") delete data.project_user;
let index = state.projectList.findIndex(({id}) => id == data.id);
if (index > -1) { if (index > -1) {
state.projectList.splice(index, 1, project); state.projectList.splice(index, 1, Object.assign({}, state.projectList[index], data));
state.method.setStorage("cacheProjectList", state.projectList);
} else { } else {
state.projectList.push(project); state.projectList.unshift(data);
}
state.method.setStorage("cacheProjectList", state.projectList);
},
/**
* 删除项目信息
* @param state
* @param project_id
*/
forgetProjectData(state, project_id) {
let index = state.projectList.findIndex(({id}) => id == project_id);
if (index > -1) {
state.projectList.splice(index, 1);
state.method.setStorage("cacheProjectList", state.projectList);
}
if (typeof state.cacheProjectDetail[project_id] !== "undefined") {
delete state.cacheProjectDetail[project_id];
state.method.setStorage("cacheProjectDetail", state.cacheProjectDetail);
} }
}, },
@ -179,11 +195,8 @@ export default {
success: ({ret, data, msg}) => { success: ({ret, data, msg}) => {
if (ret === 1) { if (ret === 1) {
state.cacheProjectDetail[data.id] = data; state.cacheProjectDetail[data.id] = data;
if (state.projectDetail.id === data.id) {
state.projectDetail = data;
}
state.method.setStorage("cacheProjectDetail", state.cacheProjectDetail); state.method.setStorage("cacheProjectDetail", state.cacheProjectDetail);
this.commit('storageProjectOne', $A.cloneJSON(data)); this.commit('storageProjectData', $A.cloneJSON(data));
} else { } else {
$A.modalError(msg); $A.modalError(msg);
} }
@ -282,7 +295,7 @@ export default {
getDialogUpdate(state, data) { getDialogUpdate(state, data) {
let splice = false; let splice = false;
state.dialogList.some(({id, unread}, index) => { state.dialogList.some(({id, unread}, index) => {
if (id === data.id) { if (id == data.id) {
unread !== data.unread && this.commit('getDialogMsgUnread'); unread !== data.unread && this.commit('getDialogMsgUnread');
state.dialogList.splice(index, 1, data); state.dialogList.splice(index, 1, data);
return splice = true; return splice = true;
@ -345,7 +358,7 @@ export default {
if (state.method.runNum(dialog_id) === 0) { if (state.method.runNum(dialog_id) === 0) {
return; return;
} }
if (state.dialogId === dialog_id) { if (state.dialogId == dialog_id) {
return; return;
} }
// //
@ -386,10 +399,10 @@ export default {
}; };
state.method.setStorage("cacheDialogMsg", state.cacheDialogMsg); state.method.setStorage("cacheDialogMsg", state.cacheDialogMsg);
// 更新当前会话消息 // 更新当前会话消息
if (state.dialogId === dialog_id) { if (state.dialogId == dialog_id) {
state.dialogDetail = dialog; state.dialogDetail = dialog;
reverse.forEach((item) => { reverse.forEach((item) => {
let index = state.dialogMsgList.findIndex(({id}) => id === item.id); let index = state.dialogMsgList.findIndex(({id}) => id == item.id);
if (index === -1) { if (index === -1) {
state.dialogMsgList.push(item); state.dialogMsgList.push(item);
} else { } else {
@ -414,7 +427,7 @@ export default {
url: 'dialog/msg/unread', url: 'dialog/msg/unread',
success: ({ret, data, msg}) => { success: ({ret, data, msg}) => {
if (ret === 1) { if (ret === 1) {
if (unread === state.dialogMsgUnread) { if (unread == state.dialogMsgUnread) {
state.dialogMsgUnread = data.unread; state.dialogMsgUnread = data.unread;
} else { } else {
setTimeout(() => { setTimeout(() => {
@ -535,8 +548,8 @@ export default {
(function (msg) { (function (msg) {
const {data} = msg; const {data} = msg;
const {dialog_id} = data; const {dialog_id} = data;
if (dialog_id === state.dialogId) { if (dialog_id == state.dialogId) {
let index = state.dialogMsgList.findIndex(({id}) => id === data.id); let index = state.dialogMsgList.findIndex(({id}) => id == data.id);
if (index === -1) { if (index === -1) {
state.dialogMsgList.push(data); state.dialogMsgList.push(data);
} else { } else {

View File

@ -151,7 +151,7 @@ const state = { method };
// 变量缓存 // 变量缓存
[ [
'projectChatShow', // 项目聊天显示 'projectChatShow', // 项目聊天显示
'projectListPanel', // 项目面板显示类型 'projectTablePanel', // 项目面板显示类型
'taskMyShow', // 项目面板显示我的任务 'taskMyShow', // 项目面板显示我的任务
'taskUndoneShow', // 项目面板显示未完成任务 'taskUndoneShow', // 项目面板显示未完成任务
'taskCompletedShow' // 项目面板显示已完成任务 'taskCompletedShow' // 项目面板显示已完成任务