Skip to content

Commit

Permalink
feat(frontend): 资源池增加统计视图、专用业务专用db改单选 TencentBlueKing#6519
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 17319
  • Loading branch information
JustaCattt committed Sep 4, 2024
1 parent 3655588 commit 9530aca
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@
bizNameMap[dataItem.for_biz.bk_biz_id] = currentBizNameMap[dataItem.for_biz.bk_biz_id];
}
resourceTypesSet.add(dataItem.resource_type);
if(dataItem.resource_type) {
resourceTypesSet.add(dataItem.resource_type);
}
if (dataItem.device_class) {
deviceClassSet.add(dataItem.device_class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
v-model="formData.for_biz"
:disabled="formData.set_empty_biz"
filterable
:loading="isBizListLoading"
multiple
multiple-mode="tag">
:loading="isBizListLoading">
<BkOption
v-for="bizItem in bizList"
:key="bizItem.bk_biz_id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,9 @@
<div class="com-input">
<BkSelect
v-model="formData.for_biz"
collapse-tags
:disabled="isSetEmptyBiz"
filterable
:loading="isBizListLoading"
multiple
multiple-mode="tag">
:loading="isBizListLoading">
<BkOption
v-for="bizItem in bizList"
:key="bizItem.bk_biz_id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
{} as Record<string, string>,
);

console.log(result, 'result');

emits('change', result);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,22 @@

<template>
<BkSelect
:class="{
'is-selected-all': !(defaultValue && defaultValue.length > 0),
}"
collapse-tags
filterable
:input-search="false"
:loading="isBizListLoading"
:model-value="defaultValue && defaultValue.length > 0 ? defaultValue : [allText]"
:model-value="defaultValue"
:placeholder="t('请选择专用业务')"
show-selected-icon
@change="handleChange">
<BkOption
key="empty"
:label="t('无限制')"
value="0" />
:value="0" />
<BkOption
v-for="bizItem in bizList"
:key="bizItem.bk_biz_id"
:label="bizItem.display_name"
:value="`${bizItem.bk_biz_id}`" />
:value="bizItem.bk_biz_id" />
<template
v-if="simple"
#extension>
Expand All @@ -52,14 +48,13 @@
</BkSelect>
</template>
<script setup lang="ts">
import _ from 'lodash';
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';

import { getBizs } from '@services/source/cmdb';

interface Props {
defaultValue?: string[];
defaultValue?: number;
simple?: boolean;
}
interface Emits {
Expand All @@ -69,7 +64,8 @@
}

withDefaults(defineProps<Props>(), {
defaultValue: () => [],
defaultValue: 0,
simple: false,
});
const emits = defineEmits<Emits>();
defineOptions({
Expand All @@ -78,8 +74,6 @@

const { t } = useI18n();

const allText = t('全部');

const { data: bizList, loading: isBizListLoading } = useRequest(getBizs);

const handleSubmit = () => {
Expand All @@ -89,9 +83,7 @@
emits('cancel');
};

const handleChange = (value: Array<string>) => {
const result = [...value];
_.remove(result, (item) => item === allText);
emits('change', result);
const handleChange = (value: number) => {
emits('change', value);
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@

<template>
<BkSelect
:class="{
'is-selected-all': !(defaultValue && defaultValue.length > 0),
}"
filterable
:input-search="false"
:loading="isDbTypeListLoading"
:model-value="defaultValue && defaultValue.length > 0 ? defaultValue : [allText]"
:model-value="defaultValue"
:placeholder="t('请选择专用 DB')"
show-selected-icon
@change="handleChange">
Expand Down Expand Up @@ -51,14 +48,13 @@
</BkSelect>
</template>
<script setup lang="ts">
import _ from 'lodash';
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';

import { fetchDbTypeList } from '@services/source/infras';

interface Props {
defaultValue?: string[];
defaultValue?: string;
simple?: boolean;
}
interface Emits {
Expand All @@ -67,14 +63,16 @@
(e: 'cancel'): void;
}

defineProps<Props>();
withDefaults(defineProps<Props>(), {
defaultValue: '',
simple: false,
});
const emits = defineEmits<Emits>();
defineOptions({
inheritAttrs: false,
});

const { t } = useI18n();
const allText = t('全部');

const { data: dbTypeList, loading: isDbTypeListLoading } = useRequest(fetchDbTypeList);

Expand All @@ -85,9 +83,7 @@
emits('cancel');
};

const handleChange = (value: string[]) => {
const result = [...value];
_.remove(result, (item) => item === allText);
emits('change', result);
const handleChange = (value: string) => {
emits('change', value);
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
const result = { ...localValueMemo.value };
result[name] = value;

console.log(result[name], 'result[name]');

localValueMemo.value = result;
// 搜索项改变立即搜索
handleSubmit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
changeBySelect = false;
return;
}
collectSelectRef.value.handleClear({
collectSelectRef.value?.handleClear({
stopPropagation: () => undefined,
});
},
Expand Down

0 comments on commit 9530aca

Please sign in to comment.