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;
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->save();
//
return Base::retSuccess('修改成功');
return Base::retSuccess('修改成功', $project);
}
/**

View File

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

View File

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

View File

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

View File

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