perf: 优化数据结构

This commit is contained in:
kuaifan 2025-04-07 06:55:35 +08:00
parent 19815fe27d
commit 83f58eae68

View File

@ -1603,6 +1603,12 @@ export default {
if (this.sendLoad > 0 || this.openLoad > 0) { if (this.sendLoad > 0 || this.openLoad > 0) {
return; return;
} }
//
if (this.taskDetail.dialog_id) {
this.openDialogBefore(this.taskDetail.dialog_id, msgText)
return;
}
//
if (onlyOpen === true) { if (onlyOpen === true) {
this.openLoad++; this.openLoad++;
} else { } else {
@ -1617,7 +1623,19 @@ export default {
}).then(async ({data}) => { }).then(async ({data}) => {
await this.$store.dispatch("saveTask", {id: data.id, dialog_id: data.dialog_id}); await this.$store.dispatch("saveTask", {id: data.id, dialog_id: data.dialog_id});
await this.$store.dispatch("saveDialog", data.dialog_data); await this.$store.dispatch("saveDialog", data.dialog_data);
// await this.openDialogBefore(data.dialog_id, msgText)
}).catch(({msg}) => {
$A.modalError(msg);
}).finally(_ => {
if (onlyOpen === true) {
this.openLoad--;
} else {
this.sendLoad--;
}
});
},
async openDialogBefore(dialogId, msgText) {
if ($A.isSubElectron) { if ($A.isSubElectron) {
await this.resizeDialog() await this.resizeDialog()
this.sendDialogMsg(msgText); this.sendDialogMsg(msgText);
@ -1631,13 +1649,13 @@ export default {
msgRecord: this.msgRecord, msgRecord: this.msgRecord,
msgFile: this.msgFile, msgFile: this.msgFile,
msgText: typeof msgText === 'string' && msgText ? msgText : this.msgText, msgText: typeof msgText === 'string' && msgText ? msgText : this.msgText,
dialogId: data.dialog_id, dialogId,
}; };
this.msgRecord = {}; this.msgRecord = {};
this.msgFile = []; this.msgFile = [];
this.msgText = ""; this.msgText = "";
this.$nextTick(_ => { this.$nextTick(_ => {
this.$store.dispatch('openDialog', data.dialog_id).then(_ => { this.$store.dispatch('openDialog', dialogId).then(_ => {
this.$store.state.dialogMsgTransfer = transferData this.$store.state.dialogMsgTransfer = transferData
}) })
}) })
@ -1645,15 +1663,6 @@ export default {
this.sendDialogMsg(msgText); this.sendDialogMsg(msgText);
} }
}); });
}).catch(({msg}) => {
$A.modalError(msg);
}).finally(_ => {
if (onlyOpen === true) {
this.openLoad--;
} else {
this.sendLoad--;
}
});
}, },
sendDialogMsg(msgText = null) { sendDialogMsg(msgText = null) {