优化确认弹窗

This commit is contained in:
kuaifan 2022-06-29 13:30:40 +08:00
parent 575e569048
commit 644f415d46
11 changed files with 178 additions and 183 deletions

View File

@ -367,14 +367,14 @@ export default {
content: '你确定要删除任务【' + data.name + '】吗?', content: '你确定要删除任务【' + data.name + '】吗?',
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("removeTask", {task_id: data.id}).then(({msg}) => { return new Promise((resolve, reject) => {
$A.messageSuccess(msg); this.$store.dispatch("removeTask", {task_id: data.id}).then(({msg}) => {
}).catch(({msg}) => { resolve(msg);
$A.modalError(msg, 301); }).catch(({msg}) => {
this.setRenderRange(); reject(msg);
}).finally(_ => { this.setRenderRange();
this.$Modal.remove(); });
}); })
} }
}); });
break; break;

View File

@ -213,25 +213,25 @@ export default {
content, content,
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("call", { return new Promise((resolve, reject) => {
url: 'dialog/group/deluser', this.$store.dispatch("call", {
data: { url: 'dialog/group/deluser',
dialog_id: this.dialogId, data: {
userids, dialog_id: this.dialogId,
} userids,
}).then(({msg}) => { }
$A.messageSuccess(msg); }).then(({msg}) => {
if (userids.length > 0) { resolve(msg);
this.getDialogUser(); if (userids.length > 0) {
} else { this.getDialogUser();
this.$store.dispatch("forgetDialog", this.dialogId); } else {
this.goForward({name: 'manage-messenger'}); this.$store.dispatch("forgetDialog", this.dialogId);
} this.goForward({name: 'manage-messenger'});
}).catch(({msg}) => { }
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
}, },
}); });
}, },
@ -242,20 +242,20 @@ export default {
loading: true, loading: true,
okText: '解散', okText: '解散',
onOk: () => { onOk: () => {
this.$store.dispatch("call", { return new Promise((resolve, reject) => {
url: 'dialog/group/disband', this.$store.dispatch("call", {
data: { url: 'dialog/group/disband',
dialog_id: this.dialogId, data: {
} dialog_id: this.dialogId,
}).then(({msg}) => { }
$A.messageSuccess(msg); }).then(({msg}) => {
this.$store.dispatch("forgetDialog", this.dialogId); resolve(msg);
this.goForward({name: 'manage-messenger'}); this.$store.dispatch("forgetDialog", this.dialogId);
}).catch(({msg}) => { this.goForward({name: 'manage-messenger'});
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
}, },
}); });
}, },

View File

@ -1225,19 +1225,19 @@ export default {
okText: '撤回', okText: '撤回',
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("call", { return new Promise((resolve, reject) => {
url: 'dialog/msg/withdraw', this.$store.dispatch("call", {
data: { url: 'dialog/msg/withdraw',
msg_id: this.operateItem.id data: {
}, msg_id: this.operateItem.id
}).then(() => { },
$A.messageSuccess("消息已撤回"); }).then(() => {
this.$store.dispatch("forgetDialogMsg", this.operateItem.id); resolve("消息已撤回");
}).catch(({msg}) => { this.$store.dispatch("forgetDialogMsg", this.operateItem.id);
$A.messageError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
} }
}); });
}, },

View File

@ -423,21 +423,21 @@ export default {
okText: '确定', okText: '确定',
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("call", { return new Promise((resolve, reject) => {
url: 'file/content/restore', this.$store.dispatch("call", {
data: { url: 'file/content/restore',
id: this.fileId, data: {
history_id: item.id, id: this.fileId,
} history_id: item.id,
}).then(({msg}) => { }
$A.messageSuccess(msg); }).then(({msg}) => {
this.contentDetail = null; resolve(msg);
this.getContent(); this.contentDetail = null;
}).catch(({msg}) => { this.getContent();
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
} }
}); });
}, },

View File

@ -244,20 +244,20 @@ export default {
content: item.content, content: item.content,
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("call", { return new Promise((resolve, reject) => {
url: 'project/task/resetfromlog', this.$store.dispatch("call", {
data: { url: 'project/task/resetfromlog',
id: item.id data: {
} id: item.id
}).then(({data, msg}) => { }
$A.messageSuccess(msg); }).then(({data, msg}) => {
this.$store.dispatch("saveTask", data); resolve(msg);
this.getLists(true); this.$store.dispatch("saveTask", data);
}).catch(({msg}) => { this.getLists(true);
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
} }
}); });
}, },

View File

@ -1047,15 +1047,15 @@ export default {
} }
this.$set(this.columnLoad, column.id, true); this.$set(this.columnLoad, column.id, true);
// //
this.$store.dispatch("removeColumn", column.id).then(({data, msg}) => { return new Promise((resolve, reject) => {
$A.messageSuccess(msg); this.$store.dispatch("removeColumn", column.id).then(({msg}) => {
this.$set(this.columnLoad, column.id, false); resolve(msg);
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg, 301); reject(msg);
this.$set(this.columnLoad, column.id, false); }).finally(_ => {
}).finally(_ => { this.$set(this.columnLoad, column.id, false);
this.$Modal.remove(); });
}); })
} }
}); });
}, },
@ -1129,13 +1129,13 @@ export default {
content: '你确定要归档项目【' + this.projectData.name + '】吗?', content: '你确定要归档项目【' + this.projectData.name + '】吗?',
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("archivedProject", this.projectId).then(({msg}) => { return new Promise((resolve, reject) => {
$A.messageSuccess(msg); this.$store.dispatch("archivedProject", this.projectId).then(({msg}) => {
}).catch(({msg}) => { resolve(msg);
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
} }
}); });
}, },
@ -1146,13 +1146,13 @@ export default {
content: '你确定要删除项目【' + this.projectData.name + '】吗?', content: '你确定要删除项目【' + this.projectData.name + '】吗?',
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("removeProject", this.projectId).then(({msg}) => { return new Promise((resolve, reject) => {
$A.messageSuccess(msg); this.$store.dispatch("removeProject", this.projectId).then(({msg}) => {
}).catch(({msg}) => { resolve(msg);
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
} }
}); });
}, },
@ -1163,13 +1163,13 @@ export default {
content: '你确定要退出项目【' + this.projectData.name + '】吗?', content: '你确定要退出项目【' + this.projectData.name + '】吗?',
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("exitProject", this.projectId).then(({msg}) => { return new Promise((resolve, reject) => {
$A.messageSuccess(msg); this.$store.dispatch("exitProject", this.projectId).then(({msg}) => {
}).catch(({msg}) => { resolve(msg);
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
} }
}); });
}, },

View File

@ -336,31 +336,30 @@ export default {
loading: true, loading: true,
onOk: () => { onOk: () => {
if (data.id > 0) { if (data.id > 0) {
this.loadIng++; return new Promise((resolve, reject) => {
this.$store.dispatch("call", { this.loadIng++;
url: 'project/flow/delete', this.$store.dispatch("call", {
data: { url: 'project/flow/delete',
project_id: this.projectId, data: {
}, project_id: this.projectId,
}).then(({msg}) => { },
$.messageSuccess(msg); }).then(({msg}) => {
// resolve(msg);
let index = this.list.findIndex(({id}) => id == data.id) //
if (index > -1) { let index = this.list.findIndex(({id}) => id == data.id)
this.list.splice(index, 1) if (index > -1) {
} this.list.splice(index, 1)
}).catch(({msg}) => { }
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); }).finally(_ => {
this.loadIng--; this.loadIng--;
}); });
} else { })
let index = this.list.findIndex(({id}) => id == data.id) }
if (index > -1) { const index = this.list.findIndex(({id}) => id == data.id)
this.list.splice(index, 1) if (index > -1) {
} this.list.splice(index, 1)
this.$Modal.remove();
} }
} }
}); });

View File

@ -106,9 +106,8 @@ export default {
$A.modalConfirm({ $A.modalConfirm({
title: '覆盖提交', title: '覆盖提交',
content: '你已提交过此日期的报告,是否覆盖提交?', content: '你已提交过此日期的报告,是否覆盖提交?',
loading: true,
onOk: () => { onOk: () => {
this.doSubmit(true); this.doSubmit();
} }
}); });
} else { } else {
@ -116,13 +115,12 @@ export default {
} }
}, },
doSubmit(isModal = false) { doSubmit() {
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'report/store', url: 'report/store',
data: this.reportData, data: this.reportData,
method: 'post', method: 'post',
}).then(({data, msg}) => { }).then(({data, msg}) => {
isModal && this.$Modal.remove();
// data // data
this.reportData.offset = 0; this.reportData.offset = 0;
this.reportData.type = "weekly"; this.reportData.type = "weekly";
@ -132,7 +130,6 @@ export default {
!this.$isSubElectron && $A.messageSuccess(msg); !this.$isSubElectron && $A.messageSuccess(msg);
this.$emit("saveSuccess", {data, msg}); this.$emit("saveSuccess", {data, msg});
}).catch(({msg}) => { }).catch(({msg}) => {
isModal && this.$Modal.remove();
// msg // msg
$A.messageError(msg); $A.messageError(msg);
}); });

View File

@ -303,17 +303,16 @@ export default {
loading: true, loading: true,
onOk: () => { onOk: () => {
if (this.loadIng) { if (this.loadIng) {
this.$Modal.remove();
return; return;
} }
this.$store.dispatch(typeDispatch, typeData).then(({msg}) => { return new Promise((resolve, reject) => {
$A.messageSuccess(msg); this.$store.dispatch(typeDispatch, typeData).then(({msg}) => {
this.$store.dispatch("saveTaskBrowse", typeData.task_id); resolve(msg);
}).catch(({msg}) => { this.$store.dispatch("saveTaskBrowse", typeData.task_id);
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
} }
}); });
}, },

View File

@ -1160,19 +1160,19 @@ export default {
content: '你确定要退出【' + item.name + '】共享成员吗?', content: '你确定要退出【' + item.name + '】共享成员吗?',
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("call", { return new Promise((resolve, reject) => {
url: 'file/share/out', this.$store.dispatch("call", {
data: { url: 'file/share/out',
id: item.id, data: {
}, id: item.id,
}).then(({msg}) => { },
$A.messageSuccess(msg); }).then(({msg}) => {
this.$store.dispatch("forgetFile", item.id); resolve(msg);
}).catch(({msg}) => { this.$store.dispatch("forgetFile", item.id);
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
} }
}); });
break; break;
@ -1288,20 +1288,20 @@ export default {
content: '你确定要删除' + fileName + '吗?', content: '你确定要删除' + fileName + '吗?',
loading: true, loading: true,
onOk: () => { onOk: () => {
this.$store.dispatch("call", { return new Promise((resolve, reject) => {
url: 'file/remove', this.$store.dispatch("call", {
data: { url: 'file/remove',
ids, data: {
}, ids,
}).then(({msg}) => { },
$A.messageSuccess(msg); }).then(({msg}) => {
this.$store.dispatch("forgetFile", ids); resolve(msg);
this.selectIds = this.selectIds.filter(id => !ids.includes(id)) this.$store.dispatch("forgetFile", ids);
}).catch(({msg}) => { this.selectIds = this.selectIds.filter(id => !ids.includes(id))
$A.modalError(msg, 301); }).catch(({msg}) => {
}).finally(_ => { reject(msg);
this.$Modal.remove(); });
}); })
} }
}); });
}, },
@ -1466,7 +1466,7 @@ export default {
} }
}) })
} else { } else {
$A.modalError(msg, force === true ? 301 : 0) $A.modalError(msg)
} }
}).finally(_ => { }).finally(_ => {
this.shareLoad--; this.shareLoad--;
@ -1512,7 +1512,7 @@ export default {
}) })
} else { } else {
item.permission = item._permission; item.permission = item._permission;
$A.modalError(msg, force === true ? 301 : 0) $A.modalError(msg)
} }
}) })
}, },

View File

@ -452,7 +452,7 @@ export default {
}); });
}) })
}, },
onCancel: _ => setTimeout(nameReject, 301) onCancel: _ => nameReject
}); });
}, 100) }, 100)
}); });
@ -1629,7 +1629,7 @@ export default {
}).catch(e => { }).catch(e => {
console.warn(e); console.warn(e);
dispatch("getTaskOne", post.task_id).catch(() => {}) dispatch("getTaskOne", post.task_id).catch(() => {})
setTimeout(() => { reject(e) }, confirm === true ? 301 : 0) reject(e)
}).finally(_ => { }).finally(_ => {
dispatch("cancelLoad", `task-${post.task_id}`) dispatch("cancelLoad", `task-${post.task_id}`)
}); });