From fa2519cba4627ab1f2b886a45904a5a66492cc6f Mon Sep 17 00:00:00 2001 From: "DESKTOP-6C3NK6N\\WXS" <815034831@qq.com> Date: Thu, 22 Aug 2024 13:19:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E7=AA=97=E8=87=AA=E5=8A=A8=E9=80=80?= =?UTF-8?q?=E5=87=BA=E6=97=B6=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MFA/fun.js | 13 ++++++++++++- src/components/feedBack/fun.js | 14 ++++++++++++-- src/components/feedBackTable/fun.js | 13 ++++++++++++- src/main.js | 3 +++ 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/components/MFA/fun.js b/src/components/MFA/fun.js index f8192fe6..74ea3d15 100644 --- a/src/components/MFA/fun.js +++ b/src/components/MFA/fun.js @@ -2,12 +2,13 @@ import Vue from "vue"; import MFACOMP from "./index.vue"; const MFAConstructor = Vue.extend(MFACOMP); - +let MFAINSTANCELIST = []; const MFA = options => { const { UserId, username, EMail, callBack, cancelBack, status = 'login' } = options; if (!UserId) throw `UserId is requred.but ${UserId}` const id = `MFA${new Date().getTime()}`; const instance = new MFAConstructor(); + MFAINSTANCELIST.push(instance) instance.id = id; instance.vm = instance.$mount(); if (instance.vm.visible) return; @@ -20,7 +21,17 @@ const MFA = options => { if (cancelBack) cancelBack(); document.body.removeChild(instance.vm.$el); instance.vm.$destroy(); + let index = MFAINSTANCELIST.findIndex(item => item.id === id); + MFAINSTANCELIST.splice(index, 1) }); return instance.vm; } +MFA.close = () => { + if (MFAINSTANCELIST.length <= 0) return; + MFAINSTANCELIST.forEach(item => { + document.body.removeChild(item.vm.$el); + item.vm.$destroy(); + }) + MFAINSTANCELIST = []; +} export default MFA; \ No newline at end of file diff --git a/src/components/feedBack/fun.js b/src/components/feedBack/fun.js index 53ca553a..4991323d 100644 --- a/src/components/feedBack/fun.js +++ b/src/components/feedBack/fun.js @@ -1,17 +1,17 @@ import Vue from "vue"; import FEEDBACKCOMP from "./index.vue"; const FBConstructor = Vue.extend(FEEDBACKCOMP); - +let FBCINSTANCELIST = []; const FB = options => { const { type, callBack, cancelBack, trialId = null, Id = null, visitTaskId = null, SubjectVisitId = null } = options; if (!type) throw `type is requred.but ${type}` const id = `FB${new Date().getTime()}`; const instance = new FBConstructor(); + FBCINSTANCELIST.push(instance); instance.id = id; instance.vm = instance.$mount(); if (instance.vm.visible) return; document.body.appendChild(instance.vm.$el); - console.log(type); instance.vm.open({ type, trialId, Id, visitTaskId, SubjectVisitId }); instance.vm.$on("success", (Id) => { if (callBack) callBack(); @@ -20,8 +20,18 @@ const FB = options => { instance.vm.$on("closed", () => { document.body.removeChild(instance.vm.$el); instance.vm.$destroy(); + let index = FBCINSTANCELIST.findIndex(item => item.id === id); + FBCINSTANCELIST.splice(index, 1) if (cancelBack) cancelBack() }); return instance.vm; } +FB.close = () => { + if (FBCINSTANCELIST.length <= 0) return; + FBCINSTANCELIST.forEach(item => { + document.body.removeChild(item.vm.$el); + item.vm.$destroy(); + }) + FBCINSTANCELIST = []; +} export default FB; \ No newline at end of file diff --git a/src/components/feedBackTable/fun.js b/src/components/feedBackTable/fun.js index 7e970a9f..1e6f0a86 100644 --- a/src/components/feedBackTable/fun.js +++ b/src/components/feedBackTable/fun.js @@ -1,12 +1,13 @@ import Vue from "vue"; import FEEDBACKCOMP from "./index.vue"; const FBConstructor = Vue.extend(FEEDBACKCOMP); - +let FBCTABLEINSTANCELIST = []; const FBT = (options = {}) => { const { data = {}, callBack } = options; // if (!UserId) throw `UserId is requred.but ${UserId}` const id = `FB${new Date().getTime()}`; const instance = new FBConstructor(); + FBCTABLEINSTANCELIST.push(instance); instance.id = id; instance.vm = instance.$mount(); if (instance.vm.visible) return; @@ -18,7 +19,17 @@ const FBT = (options = {}) => { instance.vm.$on("closed", () => { document.body.removeChild(instance.vm.$el); instance.vm.$destroy(); + let index = FBCTABLEINSTANCELIST.findIndex(item => item.id === id); + FBCTABLEINSTANCELIST.splice(index, 1) }); return instance.vm; } +FBT.close = () => { + if (FBCTABLEINSTANCELIST.length <= 0) return; + FBCTABLEINSTANCELIST.forEach(item => { + document.body.removeChild(item.vm.$el); + item.vm.$destroy(); + }) + FBCTABLEINSTANCELIST = []; +} export default FBT; \ No newline at end of file diff --git a/src/main.js b/src/main.js index 1cc019d7..7b1423e2 100644 --- a/src/main.js +++ b/src/main.js @@ -381,6 +381,9 @@ async function VueInit() { if (_vm.$msgbox) { _vm.$msgbox.close(); } + _vm.$FB.close(); + _vm.$FBT.close(); + _vm.$MFA.close(); isOpen = false isLock = null zzSessionStorage.removeItem('isLock')