diff --git a/resources/assets/js/pages/manage/components/ChatInput/index.vue b/resources/assets/js/pages/manage/components/ChatInput/index.vue index 3dda58abf..dca281c0d 100755 --- a/resources/assets/js/pages/manage/components/ChatInput/index.vue +++ b/resources/assets/js/pages/manage/components/ChatInput/index.vue @@ -496,7 +496,7 @@ export default { }; }, created() { - inputLoadAdd(this.dialogId, this._uid) + inputLoadAdd(this._uid) }, mounted() { this.init(); @@ -530,7 +530,7 @@ export default { $A.loadScript('js/emoticon.all.js') }, beforeDestroy() { - inputLoadRemove(this.dialogId, this._uid) + inputLoadRemove(this._uid) if (this.quill) { this.quill.getModule("mention")?.hideMentionList(); this.quill = null @@ -749,15 +749,13 @@ export default { }, // Reset lists - dialogId(id1, id2) { + dialogId() { this.userList = null; this.userCache = null; this.taskList = null; this.fileList = {}; this.reportList = {}; this.loadInputDraft() - inputLoadAdd(id1, this._uid) - inputLoadRemove(id2, this._uid) }, taskId() { this.userList = null; @@ -990,6 +988,9 @@ export default { // Mark model as touched if editor lost focus this.quill.on('selection-change', range => { + if (!inputLoadIsLast(this._uid)) { + return; + } if (range) { this.selectRange = range } else if (this.selectRange && document.activeElement && /(ql-editor|ql-clipboard)/.test(document.activeElement.className)) { @@ -1878,7 +1879,7 @@ export default { if (!this.quill) { return; } - if (!inputLoadIsLast(this.dialogId, this._uid)) { + if (!inputLoadIsLast(this._uid)) { return; } const {index} = this.quill.getSelection(true); diff --git a/resources/assets/js/pages/manage/components/ChatInput/one.js b/resources/assets/js/pages/manage/components/ChatInput/one.js index f422598f8..bc1cf2188 100644 --- a/resources/assets/js/pages/manage/components/ChatInput/one.js +++ b/resources/assets/js/pages/manage/components/ChatInput/one.js @@ -2,29 +2,30 @@ import Vue from 'vue'; import Emoji from "./emoji.vue"; import {Modal} from "view-design-hi"; -const inputLoadUid = {} +// 加载中的输入框的uid,主要用于判断是否最后一个输入框 +const inputLoadUid = [] -function inputLoadAdd(dialogId, uid) { - if (!dialogId || typeof inputLoadUid[dialogId] === "undefined") { - inputLoadUid[dialogId] = []; - } else { - inputLoadUid[dialogId] = inputLoadUid[dialogId].filter(v => v !== uid) +function inputLoadIsLast(uid) { + if (inputLoadUid.length === 0) { + return true } - inputLoadUid[dialogId].push(uid) + const index = inputLoadUid.indexOf(uid) + if (index === -1) { + return false + } + return index === inputLoadUid.length - 1 } -function inputLoadRemove(dialogId, uid) { - if (!dialogId || typeof inputLoadUid[dialogId] === "undefined") { - return; +const inputLoadRemove = (uid) => { + const index = inputLoadUid.indexOf(uid) + if (index !== -1) { + inputLoadUid.splice(index, 1) } - inputLoadUid[dialogId] = inputLoadUid[dialogId].filter(v => v !== uid) } -function inputLoadIsLast(dialogId, uid) { - if (typeof inputLoadUid[dialogId] === "undefined") { - return false; - } - return inputLoadUid[dialogId][inputLoadUid[dialogId].length - 1] === uid +const inputLoadAdd = (uid) => { + inputLoadRemove(uid) + inputLoadUid.push(uid) } function choiceEmojiOne() { diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index 26a5bf304..0f1e2cffa 100755 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -745,8 +745,6 @@ export default { 'taskFiles', 'taskPriority', - 'dialogId', - 'formOptions' ]),