From 4b70753aae3a9f14d4b794265c66b9dd2a1eef21 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 5 Jun 2024 21:06:20 +0800 Subject: [PATCH] fix: fixed api reference path error. --- .../FlowDesign/src/components/OrgPicker.vue | 6 +- .../src/components/Form/src/componentMap.ts | 3 + .../src/components/Form/src/types/index.ts | 3 +- apps/vue/src/hooks/abp/useDefineSettings.ts | 7 +- apps/vue/src/hooks/web/useSignalR.ts | 25 ++- apps/vue/src/store/modules/settings.ts | 9 +- .../components/EntityChangesDrawer.vue | 168 ++++++++++++++++++ 7 files changed, 206 insertions(+), 15 deletions(-) create mode 100644 apps/vue/src/views/auditing/components/EntityChangesDrawer.vue diff --git a/apps/vue/src/components/FlowDesign/src/components/OrgPicker.vue b/apps/vue/src/components/FlowDesign/src/components/OrgPicker.vue index 4d11242c0..7ec739f94 100644 --- a/apps/vue/src/components/FlowDesign/src/components/OrgPicker.vue +++ b/apps/vue/src/components/FlowDesign/src/components/OrgPicker.vue @@ -129,9 +129,9 @@ } from '@ant-design/icons-vue'; import { useMessage } from '/@/hooks/web/useMessage'; import { isNullOrWhiteSpace } from '/@/utils/strings'; - import { findByUserName } from '/@/api/identity/userLookup'; - import { getList as getUsers } from '/@/api/identity/user'; - import { getList as getRoles } from '/@/api/identity/role'; + import { findByUserName } from '/@/api/identity/users-lookup'; + import { getList as getUsers } from '/@/api/identity/users'; + import { getList as getRoles } from '/@/api/identity/roles'; import { getList as getOrganizationUnits } from '/@/api/identity/organization-units'; import Ellipsis from './Ellipsis.vue'; diff --git a/apps/vue/src/components/Form/src/componentMap.ts b/apps/vue/src/components/Form/src/componentMap.ts index dc399bcce..aaa70fada 100644 --- a/apps/vue/src/components/Form/src/componentMap.ts +++ b/apps/vue/src/components/Form/src/componentMap.ts @@ -20,6 +20,7 @@ import { Rate, Divider, } from 'ant-design-vue'; +import { ColorPicker } from 'vue3-colorpicker'; import ApiRadioGroup from './components/ApiRadioGroup.vue'; import RadioButtonGroup from './components/RadioButtonGroup.vue'; @@ -80,6 +81,8 @@ componentMap.set('WeekPicker', DatePicker.WeekPicker); componentMap.set('TimePicker', TimePicker); componentMap.set('Divider', Divider); +componentMap.set('ColorPicker', ColorPicker); + componentMap.set('ExtraPropertyDictionary', ExtraPropertyDictionary); componentMap.set('LocalizableInput', LocalizableInput); diff --git a/apps/vue/src/components/Form/src/types/index.ts b/apps/vue/src/components/Form/src/types/index.ts index 8182d7c9a..9e80c025b 100644 --- a/apps/vue/src/components/Form/src/types/index.ts +++ b/apps/vue/src/components/Form/src/types/index.ts @@ -117,4 +117,5 @@ export type ComponentType = | 'ApiTransfer' | 'CodeEditorX' | 'ExtraPropertyDictionary' - | 'LocalizableInput'; + | 'LocalizableInput' + | 'ColorPicker'; diff --git a/apps/vue/src/hooks/abp/useDefineSettings.ts b/apps/vue/src/hooks/abp/useDefineSettings.ts index ff971ded7..8fabe81eb 100644 --- a/apps/vue/src/hooks/abp/useDefineSettings.ts +++ b/apps/vue/src/hooks/abp/useDefineSettings.ts @@ -5,7 +5,10 @@ import { useSettings as useAbpSettings, ISettingProvider } from '/@/hooks/abp/us type SettingValue = NameValue; -export function useDefineSettings(settingKey: string, api: (...args) => Promise>) { +export function useDefineSettings( + settingKey: string, + api: (...args) => Promise>, + onReady?: () => void) { const settingStore = useSettingManagementStoreWithOut(); const { settingProvider: abpSettingProvider } = useAbpSettings(); const getSettings = computed(() => { @@ -14,7 +17,7 @@ export function useDefineSettings(settingKey: string, api: (...args) => Promise< }); onMounted(() => { - settingStore.initlize(settingKey, api); + settingStore.initlize(settingKey, api, onReady); }); function get(name: string): SettingValue | undefined { diff --git a/apps/vue/src/hooks/web/useSignalR.ts b/apps/vue/src/hooks/web/useSignalR.ts index ed771b786..4eed635ce 100644 --- a/apps/vue/src/hooks/web/useSignalR.ts +++ b/apps/vue/src/hooks/web/useSignalR.ts @@ -69,8 +69,12 @@ export function useSignalR(options: UseSignalR & SignalROptions) { return Promise.reject('unable to start, connection not initialized!'); } emitter.emit('signalR:beforeStart'); - await connection.start(); - emitter.emit('signalR:onStart'); + try { + await connection.start(); + emitter.emit('signalR:onStart'); + } catch(error) { + emitter.emit('signalR:onError', error); + } } async function stop(): Promise { @@ -78,8 +82,12 @@ export function useSignalR(options: UseSignalR & SignalROptions) { return Promise.reject('unable to stop, connection not initialized!'); } emitter.emit('signalR:beforeStop'); - await connection.stop(); - emitter.emit('signalR:onStop'); + try { + await connection.stop(); + emitter.emit('signalR:onStop'); + } catch(error) { + emitter.emit('signalR:onError', error); + } } function beforeStart(callback: (event?: T) => void) { @@ -98,6 +106,10 @@ export function useSignalR(options: UseSignalR & SignalROptions) { emitter.on('signalR:onStop', callback); } + function onError(callback: (error?: Error) => void) { + emitter.on('signalR:onError', callback); + } + function on(methodName: string, newMethod: (...args: any[]) => void): void { connection?.on(methodName, newMethod); } @@ -106,7 +118,7 @@ export function useSignalR(options: UseSignalR & SignalROptions) { connection?.off(methodName, method); } - function onclose(callback: (error?: Error) => void): void { + function onClose(callback: (error?: Error) => void): void { connection?.onclose(callback); } @@ -128,7 +140,8 @@ export function useSignalR(options: UseSignalR & SignalROptions) { on, off, init, - onclose, + onError, + onClose, beforeStart, onStart, beforeStop, diff --git a/apps/vue/src/store/modules/settings.ts b/apps/vue/src/store/modules/settings.ts index 965ff089d..bbab0747e 100644 --- a/apps/vue/src/store/modules/settings.ts +++ b/apps/vue/src/store/modules/settings.ts @@ -24,14 +24,16 @@ export const useSettingManagementStore = defineStore({ }, }, actions: { - initlize(settingKey: string, api: (...args) => Promise>) { + initlize(settingKey: string, api: (...args) => Promise>, onReady?: () => void) { this.settingKey = settingKey; this.settings = ls.get(this.settingKey); if (!this.settings || this.settings.length === 0) { - this.refreshSettings(api); + this.refreshSettings(api, onReady); + } else { + onReady?.call(null); } }, - refreshSettings(api: (...args) => Promise>) { + refreshSettings(api: (...args) => Promise>, onReady?: () => void) { api().then((res) => { const settings: SettingValue[] = []; res.items.forEach((group) => { @@ -46,6 +48,7 @@ export const useSettingManagementStore = defineStore({ }); this.settings = settings; ls.set(this.settingKey, settings); + onReady?.call(null); }); }, }, diff --git a/apps/vue/src/views/auditing/components/EntityChangesDrawer.vue b/apps/vue/src/views/auditing/components/EntityChangesDrawer.vue new file mode 100644 index 000000000..d384982fe --- /dev/null +++ b/apps/vue/src/views/auditing/components/EntityChangesDrawer.vue @@ -0,0 +1,168 @@ + + + + + \ No newline at end of file