refactor: 规范化代码.
This commit is contained in:
@@ -256,18 +256,27 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
|||||||
if (Strings.isBlank(type) || Lists.isEmpty(relIdList)) {
|
if (Strings.isBlank(type) || Lists.isEmpty(relIdList)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// 查询 group
|
// 查询需要删除的数据
|
||||||
List<Long> groupIdList = dataGroupRelDAO.of()
|
List<DataGroupRelDO> rows = dataGroupRelDAO.of()
|
||||||
.createWrapper()
|
.createWrapper()
|
||||||
.eq(DataGroupRelDO::getType, type)
|
.eq(DataGroupRelDO::getType, type)
|
||||||
.in(DataGroupRelDO::getRelId, relIdList)
|
.in(DataGroupRelDO::getRelId, relIdList)
|
||||||
.then()
|
.then()
|
||||||
.stream()
|
.list();
|
||||||
|
if (rows.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// 需要删除的 id
|
||||||
|
List<Long> idList = rows.stream()
|
||||||
|
.map(DataGroupRelDO::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
// 需要删除的 groupId
|
||||||
|
List<Long> groupIdList = rows.stream()
|
||||||
.map(DataGroupRelDO::getGroupId)
|
.map(DataGroupRelDO::getGroupId)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
// 删除数据库
|
// 删除数据库
|
||||||
int effect = dataGroupRelDAO.deleteBatchIds(relIdList);
|
int effect = dataGroupRelDAO.deleteBatchIds(idList);
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.deleteCache(type, groupIdList);
|
this.deleteCache(type, groupIdList);
|
||||||
return effect;
|
return effect;
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<template>
|
||||||
|
<a-tree-select v-model="value"
|
||||||
|
:multiple="true"
|
||||||
|
:data="treeData"
|
||||||
|
placeholder="请选择主机分组"
|
||||||
|
:allow-clear="true"
|
||||||
|
:allow-search="true">
|
||||||
|
</a-tree-select>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'host-group-tree-selector'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type { TreeNodeData } from '@arco-design/web-vue';
|
||||||
|
import type { PropType } from 'vue';
|
||||||
|
import { computed, onBeforeMount, ref } from 'vue';
|
||||||
|
import { useCacheStore } from '@/store';
|
||||||
|
import { getHostGroupTree } from '@/api/asset/host-group';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Array as PropType<Array<Number>>,
|
||||||
|
});
|
||||||
|
|
||||||
|
const emits = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
const cacheStore = useCacheStore();
|
||||||
|
|
||||||
|
const value = computed<Array<number>>({
|
||||||
|
get() {
|
||||||
|
return props.modelValue as Array<number>;
|
||||||
|
},
|
||||||
|
set(e) {
|
||||||
|
if (e) {
|
||||||
|
emits('update:modelValue', e);
|
||||||
|
} else {
|
||||||
|
emits('update:modelValue', null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const treeData = ref<Array<TreeNodeData>>([]);
|
||||||
|
|
||||||
|
// 初始化选项
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
if (cacheStore.hostGroups.length) {
|
||||||
|
treeData.value = cacheStore.hostGroups;
|
||||||
|
} else {
|
||||||
|
// 加载数据
|
||||||
|
const { data } = await getHostGroupTree();
|
||||||
|
treeData.value = data;
|
||||||
|
cacheStore.set('hostGroups', data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-select v-model:model-value="value"
|
<a-select v-model:model-value="value"
|
||||||
:options="optionData()"
|
:options="optionData"
|
||||||
placeholder="请选择主机身份"
|
placeholder="请选择主机身份"
|
||||||
allow-clear />
|
allow-clear />
|
||||||
</template>
|
</template>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||||
import { computed } from 'vue';
|
import { computed, onBeforeMount, ref } from 'vue';
|
||||||
import { useCacheStore } from '@/store';
|
import { useCacheStore } from '@/store';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
const emits = defineEmits(['update:modelValue']);
|
const emits = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
const cacheStore = useCacheStore();
|
||||||
|
|
||||||
const value = computed<number>({
|
const value = computed<number>({
|
||||||
get() {
|
get() {
|
||||||
return props.modelValue as number;
|
return props.modelValue as number;
|
||||||
@@ -34,17 +36,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const optionData = ref<Array<SelectOptionData>>([]);
|
||||||
|
|
||||||
// 选项数据
|
// 初始化选项
|
||||||
const cacheStore = useCacheStore();
|
onBeforeMount(() => {
|
||||||
const optionData = (): SelectOptionData[] => {
|
optionData.value = cacheStore.hostIdentities.map(s => {
|
||||||
return cacheStore.hostIdentities.map(s => {
|
|
||||||
return {
|
return {
|
||||||
label: `${s.name} (${s.username})`,
|
label: `${s.name} (${s.username})`,
|
||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-select v-model:model-value="value"
|
<a-select v-model:model-value="value"
|
||||||
:options="optionData()"
|
:options="optionData"
|
||||||
placeholder="请选择主机秘钥"
|
placeholder="请选择主机秘钥"
|
||||||
allow-clear />
|
allow-clear />
|
||||||
</template>
|
</template>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||||
import { computed } from 'vue';
|
import { computed, onBeforeMount, ref } from 'vue';
|
||||||
import { useCacheStore } from '@/store';
|
import { useCacheStore } from '@/store';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
const emits = defineEmits(['update:modelValue']);
|
const emits = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
const cacheStore = useCacheStore();
|
||||||
|
|
||||||
const value = computed<number>({
|
const value = computed<number>({
|
||||||
get() {
|
get() {
|
||||||
return props.modelValue as number;
|
return props.modelValue as number;
|
||||||
@@ -34,17 +36,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const optionData = ref<Array<SelectOptionData>>([]);
|
||||||
|
|
||||||
// 选项数据
|
// 初始化选项
|
||||||
const cacheStore = useCacheStore();
|
onBeforeMount(() => {
|
||||||
const optionData = (): SelectOptionData[] => {
|
optionData.value = cacheStore.hostKeys.map(s => {
|
||||||
return cacheStore.hostKeys.map(s => {
|
|
||||||
return {
|
return {
|
||||||
label: s.name,
|
label: s.name,
|
||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
import type { PropType } from 'vue';
|
import type { PropType } from 'vue';
|
||||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||||
import type { TagCreateRequest } from '@/api/meta/tag';
|
import type { TagCreateRequest } from '@/api/meta/tag';
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onBeforeMount } from 'vue';
|
||||||
import { useCacheStore } from '@/store';
|
import { useCacheStore } from '@/store';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import { createTag } from '@/api/meta/tag';
|
import { createTag } from '@/api/meta/tag';
|
||||||
@@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
const emits = defineEmits(['update:modelValue', 'onLimited']);
|
const emits = defineEmits(['update:modelValue', 'onLimited']);
|
||||||
|
|
||||||
|
const cacheStore = useCacheStore();
|
||||||
|
|
||||||
const value = computed<Array<number>>({
|
const value = computed<Array<number>>({
|
||||||
get() {
|
get() {
|
||||||
return props.modelValue as Array<number>;
|
return props.modelValue as Array<number>;
|
||||||
@@ -45,25 +47,17 @@
|
|||||||
emits('update:modelValue', e);
|
emits('update:modelValue', e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 选项数据
|
|
||||||
const cacheStore = useCacheStore();
|
|
||||||
const optionData = ref<SelectOptionData[]>([]);
|
const optionData = ref<SelectOptionData[]>([]);
|
||||||
const initOptionData = () => {
|
|
||||||
|
// 初始化选项
|
||||||
|
onBeforeMount(() => {
|
||||||
const tagCache = cacheStore[props.tagType as string] as Array<any>;
|
const tagCache = cacheStore[props.tagType as string] as Array<any>;
|
||||||
optionData.value = tagCache.map(s => {
|
optionData.value = tagCache.map(s => {
|
||||||
return {
|
return {
|
||||||
label: s.name,
|
label: s.name,
|
||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
}) as SelectOptionData[];
|
});
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
defineExpose({ initOptionData });
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
initOptionData();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 检查是否可以创建tag
|
// 检查是否可以创建tag
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-select v-model:model-value="value as any"
|
<a-select v-model:model-value="value as any"
|
||||||
:options="optionData()"
|
:options="optionData"
|
||||||
:allow-search="true"
|
:allow-search="true"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||||
import { computed } from 'vue';
|
import { computed, onBeforeMount, ref } from 'vue';
|
||||||
import { useCacheStore } from '@/store';
|
import { useCacheStore } from '@/store';
|
||||||
import { labelFilter } from '@/types/form';
|
import { labelFilter } from '@/types/form';
|
||||||
|
|
||||||
@@ -32,6 +32,9 @@
|
|||||||
|
|
||||||
const emits = defineEmits(['update:modelValue', 'change']);
|
const emits = defineEmits(['update:modelValue', 'change']);
|
||||||
|
|
||||||
|
// 选项数据
|
||||||
|
const cacheStore = useCacheStore();
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
return props.modelValue;
|
return props.modelValue;
|
||||||
@@ -54,17 +57,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const optionData = ref<Array<SelectOptionData>>([]);
|
||||||
|
|
||||||
// 选项数据
|
// 初始化选项
|
||||||
const cacheStore = useCacheStore();
|
onBeforeMount(() => {
|
||||||
const optionData = (): SelectOptionData[] => {
|
optionData.value = cacheStore.dictKeys.map(s => {
|
||||||
return cacheStore.dictKeys.map(s => {
|
|
||||||
return {
|
return {
|
||||||
label: `${s.keyName} - ${s.description || ''}`,
|
label: `${s.keyName} - ${s.description || ''}`,
|
||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-select v-model:model-value="value as any"
|
<a-select v-model:model-value="value as any"
|
||||||
:options="optionData()"
|
:options="optionData"
|
||||||
:allow-search="true"
|
:allow-search="true"
|
||||||
:multiple="multiple"
|
:multiple="multiple"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { PropType } from 'vue';
|
import type { PropType } from 'vue';
|
||||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||||
import { computed } from 'vue';
|
import { computed, onBeforeMount, ref } from 'vue';
|
||||||
import { useCacheStore } from '@/store';
|
import { useCacheStore } from '@/store';
|
||||||
import { RoleStatus } from '@/views/user/role/types/const';
|
import { RoleStatus } from '@/views/user/role/types/const';
|
||||||
import { labelFilter } from '@/types/form';
|
import { labelFilter } from '@/types/form';
|
||||||
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
const emits = defineEmits(['update:modelValue']);
|
const emits = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
const cacheStore = useCacheStore();
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
return props.modelValue;
|
return props.modelValue;
|
||||||
@@ -39,18 +41,18 @@
|
|||||||
emits('update:modelValue', e);
|
emits('update:modelValue', e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const optionData = ref<Array<SelectOptionData>>([]);
|
||||||
|
|
||||||
// 选项数据
|
// 初始化选项
|
||||||
const cacheStore = useCacheStore();
|
onBeforeMount(() => {
|
||||||
const optionData = (): SelectOptionData[] => {
|
optionData.value = cacheStore.roles.map(s => {
|
||||||
return cacheStore.roles.map(s => {
|
|
||||||
return {
|
return {
|
||||||
label: `${s.name} (${s.code})`,
|
label: `${s.name} (${s.code})`,
|
||||||
disabled: s.status === RoleStatus.DISABLED,
|
disabled: s.status === RoleStatus.DISABLED,
|
||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-select v-model:model-value="value as any"
|
<a-select v-model:model-value="value as any"
|
||||||
:options="optionData()"
|
:options="optionData"
|
||||||
:allow-search="true"
|
:allow-search="true"
|
||||||
:multiple="multiple"
|
:multiple="multiple"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { PropType } from 'vue';
|
import type { PropType } from 'vue';
|
||||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||||
import { computed } from 'vue';
|
import { computed, ref, onBeforeMount } from 'vue';
|
||||||
import { useCacheStore } from '@/store';
|
import { useCacheStore } from '@/store';
|
||||||
import { labelFilter } from '@/types/form';
|
import { labelFilter } from '@/types/form';
|
||||||
|
|
||||||
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
const emits = defineEmits(['update:modelValue']);
|
const emits = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
const cacheStore = useCacheStore();
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
return props.modelValue;
|
return props.modelValue;
|
||||||
@@ -38,16 +40,18 @@
|
|||||||
emits('update:modelValue', e);
|
emits('update:modelValue', e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 选项数据
|
const optionData = ref<Array<SelectOptionData>>([]);
|
||||||
const cacheStore = useCacheStore();
|
|
||||||
const optionData = (): SelectOptionData[] => {
|
// 初始化选项
|
||||||
return cacheStore.users.map(s => {
|
onBeforeMount(() => {
|
||||||
|
optionData.value = cacheStore.users.map(s => {
|
||||||
return {
|
return {
|
||||||
label: `${s.nickname} (${s.username})`,
|
label: `${s.nickname} (${s.username})`,
|
||||||
value: s.id,
|
value: s.id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { CacheState } from './types';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
export type CacheType = 'users' | 'menus' | 'roles'
|
export type CacheType = 'users' | 'menus' | 'roles'
|
||||||
| 'host' | 'hostTags' | 'hostKeys' | 'hostIdentities'
|
| 'host' | 'hostGroups' | 'hostTags' | 'hostKeys' | 'hostIdentities'
|
||||||
| 'dictKeys' | string
|
| 'dictKeys' | string
|
||||||
|
|
||||||
export default defineStore('cache', {
|
export default defineStore('cache', {
|
||||||
@@ -11,6 +11,7 @@ export default defineStore('cache', {
|
|||||||
menus: [],
|
menus: [],
|
||||||
roles: [],
|
roles: [],
|
||||||
hosts: [],
|
hosts: [],
|
||||||
|
hostGroups: [],
|
||||||
hostTags: [],
|
hostTags: [],
|
||||||
hostKeys: [],
|
hostKeys: [],
|
||||||
hostIdentities: [],
|
hostIdentities: [],
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import type { UserQueryResponse } from '@/api/user/user';
|
|||||||
import type { MenuQueryResponse } from '@/api/system/menu';
|
import type { MenuQueryResponse } from '@/api/system/menu';
|
||||||
import type { RoleQueryResponse } from '@/api/user/role';
|
import type { RoleQueryResponse } from '@/api/user/role';
|
||||||
import type { TagQueryResponse } from '@/api/meta/tag';
|
import type { TagQueryResponse } from '@/api/meta/tag';
|
||||||
|
import type { HostQueryResponse } from '@/api/asset/host';
|
||||||
|
import type { HostGroupQueryResponse } from '@/api/asset/host-group';
|
||||||
import type { HostKeyQueryResponse } from '@/api/asset/host-key';
|
import type { HostKeyQueryResponse } from '@/api/asset/host-key';
|
||||||
import type { HostIdentityQueryResponse } from '@/api/asset/host-identity';
|
import type { HostIdentityQueryResponse } from '@/api/asset/host-identity';
|
||||||
import type { DictKeyQueryResponse } from '@/api/system/dict-key';
|
import type { DictKeyQueryResponse } from '@/api/system/dict-key';
|
||||||
import type { HostQueryResponse } from '@/api/asset/host';
|
|
||||||
|
|
||||||
export interface CacheState {
|
export interface CacheState {
|
||||||
users: UserQueryResponse[];
|
users: UserQueryResponse[];
|
||||||
@@ -13,6 +14,7 @@ export interface CacheState {
|
|||||||
roles: RoleQueryResponse[];
|
roles: RoleQueryResponse[];
|
||||||
hostTags: TagQueryResponse[];
|
hostTags: TagQueryResponse[];
|
||||||
hosts: HostQueryResponse[];
|
hosts: HostQueryResponse[];
|
||||||
|
hostGroups: HostGroupQueryResponse[];
|
||||||
hostKeys: HostKeyQueryResponse[];
|
hostKeys: HostKeyQueryResponse[];
|
||||||
hostIdentities: HostIdentityQueryResponse[];
|
hostIdentities: HostIdentityQueryResponse[];
|
||||||
dictKeys: DictKeyQueryResponse[];
|
dictKeys: DictKeyQueryResponse[];
|
||||||
|
|||||||
@@ -172,7 +172,7 @@
|
|||||||
address: undefined,
|
address: undefined,
|
||||||
favorite: undefined,
|
favorite: undefined,
|
||||||
tags: undefined,
|
tags: undefined,
|
||||||
extra: true
|
queryTag: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// 条件数量
|
// 条件数量
|
||||||
|
|||||||
@@ -32,6 +32,11 @@
|
|||||||
<a-form-item field="address" label="主机地址">
|
<a-form-item field="address" label="主机地址">
|
||||||
<a-input v-model="formModel.address" placeholder="请输入主机地址" />
|
<a-input v-model="formModel.address" placeholder="请输入主机地址" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<!-- 主机分组 -->
|
||||||
|
<a-form-item field="groupIdList" label="主机分组">
|
||||||
|
<host-group-tree-selector v-model="formModel.groupIdList"
|
||||||
|
placeholder="请选择主机分组" />
|
||||||
|
</a-form-item>
|
||||||
<!-- 主机标签 -->
|
<!-- 主机标签 -->
|
||||||
<a-form-item field="tags" label="主机标签">
|
<a-form-item field="tags" label="主机标签">
|
||||||
<tag-multi-selector v-model="formModel.tags"
|
<tag-multi-selector v-model="formModel.tags"
|
||||||
@@ -61,8 +66,9 @@
|
|||||||
import formRules from '../types/host.form.rules';
|
import formRules from '../types/host.form.rules';
|
||||||
import { createHost, getHost, updateHost } from '@/api/asset/host';
|
import { createHost, getHost, updateHost } from '@/api/asset/host';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import TagMultiSelector from '@/components/meta/tag/tag-multi-selector.vue';
|
|
||||||
import { pick } from 'lodash';
|
import { pick } from 'lodash';
|
||||||
|
import TagMultiSelector from '@/components/meta/tag/tag-multi-selector.vue';
|
||||||
|
import HostGroupTreeSelector from '@/components/asset/host-group/host-group-tree-selector.vue';
|
||||||
|
|
||||||
const { visible, setVisible } = useVisible();
|
const { visible, setVisible } = useVisible();
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
|
|||||||
@@ -192,7 +192,7 @@
|
|||||||
address: undefined,
|
address: undefined,
|
||||||
favorite: undefined,
|
favorite: undefined,
|
||||||
tags: undefined,
|
tags: undefined,
|
||||||
extra: true
|
queryTag: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// 删除当前行
|
// 删除当前行
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
<host-table v-if="renderTable"
|
<host-table v-if="renderTable"
|
||||||
ref="table"
|
ref="table"
|
||||||
@openAdd="() => modal.openAdd()"
|
@openAdd="() => modal.openAdd()"
|
||||||
@openUpdate="(e) => modal.openUpdate(e)"
|
@openUpdate="(e) => modal.openUpdate(e.id)"
|
||||||
@openUpdateConfig="(e) => config.open(e)" />
|
@openUpdateConfig="(e) => config.open(e)" />
|
||||||
<!-- 列表-卡片 -->
|
<!-- 列表-卡片 -->
|
||||||
<host-card-list v-else
|
<host-card-list v-else
|
||||||
ref="card"
|
ref="card"
|
||||||
@openAdd="() => modal.openAdd()"
|
@openAdd="() => modal.openAdd()"
|
||||||
@openUpdate="(e) => modal.openUpdate(e)"
|
@openUpdate="(e) => modal.openUpdate(e.id)"
|
||||||
@openUpdateConfig="(e) => config.open(e)" />
|
@openUpdateConfig="(e) => config.open(e)" />
|
||||||
<!-- 添加修改模态框 -->
|
<!-- 添加修改模态框 -->
|
||||||
<host-form-modal ref="modal"
|
<host-form-modal ref="modal"
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
// 卸载时清除 cache
|
// 卸载时清除 cache
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
cacheStore.reset('hostTags', 'hostKeys', 'hostIdentities');
|
cacheStore.reset('hostTags', 'hostKeys', 'hostIdentities', 'hostGroups');
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user