UPDATE: VERSION-20260317
This commit is contained in:
@@ -1291,6 +1291,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-select:not(.ant-select-customize-input) .ant-select-selector{
|
||||||
|
border: 1px solid #475f71
|
||||||
|
}
|
||||||
|
|
||||||
.ant-input-affix-wrapper.ant-input-password input:-webkit-autofill,
|
.ant-input-affix-wrapper.ant-input-password input:-webkit-autofill,
|
||||||
.ant-input-affix-wrapper.ant-input-password input:-webkit-autofill:hover,
|
.ant-input-affix-wrapper.ant-input-password input:-webkit-autofill:hover,
|
||||||
.ant-input-affix-wrapper.ant-input-password input:-webkit-autofill:focus,
|
.ant-input-affix-wrapper.ant-input-password input:-webkit-autofill:focus,
|
||||||
@@ -1504,9 +1508,7 @@
|
|||||||
border-inline-end-width: 1px;
|
border-inline-end-width: 1px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.ant-select:not(.ant-select-customize-input) .ant-select-selector{
|
|
||||||
border: 1px solid #2c2a2a;
|
|
||||||
}
|
|
||||||
.ant-select .ant-select-selection-placeholder,
|
.ant-select .ant-select-selection-placeholder,
|
||||||
.ant-select .ant-select-selection-search-input{
|
.ant-select .ant-select-selection-search-input{
|
||||||
background: transparent
|
background: transparent
|
||||||
|
|||||||
@@ -35,9 +35,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, onMounted, type PropType, ref, watch } from 'vue';
|
import { computed, defineComponent, type PropType, ref, watch } from 'vue';
|
||||||
import type { Platform, PlatformComponent, PlatformComponentPayload, PlatformWithComponents, PlatformWithComponentsResponse } from '../types';
|
import type { PlatformComponentPayload } from '../types';
|
||||||
import { findAllPlatformWithComponents } from './api';
|
import { usePlatformComponents } from './store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'PlatformSelect',
|
name: 'PlatformSelect',
|
||||||
@@ -57,45 +57,16 @@ export default defineComponent({
|
|||||||
change: (payload: PlatformComponentPayload) => true,
|
change: (payload: PlatformComponentPayload) => true,
|
||||||
},
|
},
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const loading = ref<boolean>(true);
|
const { loading, platforms, platformMap, componentMap } = usePlatformComponents();
|
||||||
const platforms = ref<PlatformWithComponents[]>([]);
|
|
||||||
const platformMap = ref<Map<number, Platform>>(new Map());
|
|
||||||
const componentMap = ref<Map<number, PlatformComponent>>(new Map());
|
|
||||||
|
|
||||||
const innerPlatformId = ref<number | null>(null);
|
const innerPlatformId = ref<number | null>(props.platformId);
|
||||||
const innerComponentId = ref<number | null>(null);
|
const innerComponentId = ref<number | null>(props.componentId);
|
||||||
|
|
||||||
const selectedPlatformComponents = computed(() => {
|
const selectedPlatformComponents = computed(() => {
|
||||||
const platform = platforms.value.find(p => p.id === innerPlatformId.value);
|
const platform = platforms.value.find(p => p.id === innerPlatformId.value);
|
||||||
return platform?.components || [];
|
return platform?.components || [];
|
||||||
});
|
});
|
||||||
|
|
||||||
const loadData = async () => {
|
|
||||||
try {
|
|
||||||
loading.value = true;
|
|
||||||
const res: PlatformWithComponentsResponse = await findAllPlatformWithComponents();
|
|
||||||
const data = res.data || [];
|
|
||||||
|
|
||||||
platforms.value = data;
|
|
||||||
platformMap.value.clear();
|
|
||||||
componentMap.value.clear();
|
|
||||||
|
|
||||||
data.forEach(platform => {
|
|
||||||
platformMap.value.set(platform.id, platform);
|
|
||||||
platform.components?.forEach(component => {
|
|
||||||
componentMap.value.set(component.id, component);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
innerPlatformId.value = props.platformId;
|
|
||||||
innerComponentId.value = props.componentId;
|
|
||||||
} catch (err) {
|
|
||||||
console.error('加载平台组件失败:', err);
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const emitChange = () => {
|
const emitChange = () => {
|
||||||
// 根据ID获取完整对象
|
// 根据ID获取完整对象
|
||||||
const platform = platformMap.value.get(innerPlatformId.value || -1) || null;
|
const platform = platformMap.value.get(innerPlatformId.value || -1) || null;
|
||||||
@@ -135,10 +106,6 @@ export default defineComponent({
|
|||||||
|
|
||||||
watch(innerComponentId, emitChange);
|
watch(innerComponentId, emitChange);
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
loadData();
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading,
|
loading,
|
||||||
platforms,
|
platforms,
|
||||||
|
|||||||
64
modeler/src/views/decision/rule/store.ts
Normal file
64
modeler/src/views/decision/rule/store.ts
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the kernelstudio package.
|
||||||
|
*
|
||||||
|
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE file
|
||||||
|
* that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { onMounted, ref, type Ref } from 'vue';
|
||||||
|
import type { Platform, PlatformComponent, PlatformWithComponents, PlatformWithComponentsResponse } from '../types';
|
||||||
|
import { findAllPlatformWithComponents } from './api';
|
||||||
|
|
||||||
|
const loading: Ref<boolean> = ref<boolean>(true);
|
||||||
|
const platforms: Ref<PlatformWithComponents[]> = ref<PlatformWithComponents[]>([]);
|
||||||
|
const platformMap: Ref<Map<number, Platform>> = ref<Map<number, Platform>>(new Map());
|
||||||
|
const componentMap: Ref<Map<number, PlatformComponent>> = ref<Map<number, PlatformComponent>>(new Map());
|
||||||
|
const loaded: Ref<boolean> = ref<boolean>(false);
|
||||||
|
|
||||||
|
export interface UsePlatformComponentsReturn {
|
||||||
|
loading: Ref<boolean>;
|
||||||
|
platforms: Ref<PlatformWithComponents[]>;
|
||||||
|
platformMap: Ref<Map<number, Platform>>;
|
||||||
|
componentMap: Ref<Map<number, PlatformComponent>>;
|
||||||
|
loaded: Ref<boolean>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const usePlatformComponents = (): UsePlatformComponentsReturn => {
|
||||||
|
const load = () => {
|
||||||
|
if (!loaded.value) {
|
||||||
|
loading.value = true;
|
||||||
|
platformMap.value.clear();
|
||||||
|
componentMap.value.clear();
|
||||||
|
|
||||||
|
findAllPlatformWithComponents()
|
||||||
|
.then((res: PlatformWithComponentsResponse) => { // 显式标注响应类型
|
||||||
|
platforms.value = res.data || [];
|
||||||
|
platforms.value.forEach(platform => {
|
||||||
|
platformMap.value.set(platform.id, platform);
|
||||||
|
platform.components?.forEach(component => {
|
||||||
|
componentMap.value.set(component.id, component);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
loaded.value = true;
|
||||||
|
})
|
||||||
|
.catch((err: unknown) => {
|
||||||
|
console.error('加载平台组件失败:', err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => load());
|
||||||
|
|
||||||
|
return {
|
||||||
|
loading,
|
||||||
|
platforms,
|
||||||
|
platformMap,
|
||||||
|
componentMap,
|
||||||
|
loaded,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user