From 66ea277a595b5c96562b936d4b847548265425a0 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 8 May 2025 10:28:37 +0800 Subject: [PATCH] no message --- .../assets/js/components/MicroApps/index.vue | 27 ++++++++++++++++++- resources/assets/js/components/UserSelect.vue | 9 ++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/components/MicroApps/index.vue b/resources/assets/js/components/MicroApps/index.vue index 254c7e07d..2cca48a44 100644 --- a/resources/assets/js/components/MicroApps/index.vue +++ b/resources/assets/js/components/MicroApps/index.vue @@ -47,6 +47,13 @@ @error="error"/> + + + @@ -104,11 +111,13 @@ import store from "../../store"; export default { name: "MicroApps", directives: {TransferDom}, - components: {MicroContent, DrawerOverlay}, + components: {UserSelect, MicroContent, DrawerOverlay}, data() { return { apps: [], + + userSelectOptions: {value: [], config: {}}, } }, @@ -244,6 +253,22 @@ export default { } return 1000; }, + selectUsers: async (params) => { + if (!$A.isJson(params)) { + params = {value: params} + } + if ($A.isArray(params.value)) { + params.value = params.value ? [params.value] : [] + } + this.userSelectOptions.value = params.value + delete params.value + this.userSelectOptions.config = params + return await new Promise(resolve => { + this.$refs.userSelect.onSelection((res) => { + return resolve(res) + }) + }) + }, popoutWindow: async (config) => { let appConfig = {} if (config.url) { diff --git a/resources/assets/js/components/UserSelect.vue b/resources/assets/js/components/UserSelect.vue index 8c60ac2ff..eb170c9b8 100755 --- a/resources/assets/js/components/UserSelect.vue +++ b/resources/assets/js/components/UserSelect.vue @@ -297,6 +297,7 @@ export default { values: [], selects: [], + callback: null, recents: [], contacts: [], @@ -683,12 +684,13 @@ export default { }, this.searchCache.length > 0 ? 300 : 0) }, - onSelection() { + onSelection(callback = null) { if (this.disabled) { return } this.$nextTick(_ => { this.selects = $A.cloneJSON(this.values) + this.callback = typeof callback === 'function' ? callback : null this.showModal = true }) }, @@ -794,11 +796,12 @@ export default { this.$emit('input', this.values) this.$emit('on-submit', this.values) - if (!this.beforeSubmit) { + const beforeSubmit = this.callback || this.beforeSubmit; + if (!beforeSubmit) { this.hide() return } - const before = this.beforeSubmit(); + const before = beforeSubmit(this.values); if (before && before.then) { this.submittIng++ before.then(() => {