fix:icon/filter/router...and some bugs (#451)

This commit is contained in:
dagongren 2024-03-29 10:50:14 +08:00 committed by GitHub
parent 8fc19d8b7c
commit 2a861250eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 51 additions and 35 deletions

View File

@ -17,25 +17,29 @@ export default {
getPropertyIcon(attr) { getPropertyIcon(attr) {
switch (attr.value_type) { switch (attr.value_type) {
case '0': case '0':
return 'icon-xianxing-shishu' return 'duose-shishu'
case '1': case '1':
return 'icon-xianxing-fudianshu' return 'duose-fudianshu'
case '2': case '2':
if (attr.is_password) { if (attr.is_password) {
return 'icon-xianxing-password' return 'duose-password'
} }
if (attr.is_link) { if (attr.is_link) {
return 'icon-xianxing-link' return 'duose-link'
} }
return 'icon-xianxing-wenben' return 'duose-wenben'
case '3': case '3':
return 'icon-xianxing-datetime' return 'duose-datetime'
case '4': case '4':
return 'icon-xianxing-date' return 'duose-date'
case '5': case '5':
return 'icon-xianxing-time' return 'duose-time'
case '6': case '6':
return 'icon-xianxing-json' return 'duose-json'
case '7':
return 'duose-password'
case '8':
return 'duose-link'
} }
}, },
}, },

View File

@ -11,9 +11,9 @@
:key="route.name" :key="route.name"
@click="() => handleClick(route)" @click="() => handleClick(route)"
> >
{{ $t(route.meta.title) }} {{ route.meta.title }}
</span> </span>
<a-popover v-model="visible" placement="bottom" trigger="click" overlayClassName="top-menu-dropdown"> <!-- <a-popover v-model="visible" placement="bottom" trigger="click" overlayClassName="top-menu-dropdown">
<template slot="content"> <template slot="content">
<div class="title"> <div class="title">
更多应用 更多应用
@ -36,7 +36,7 @@
</div> </div>
</template> </template>
<span class="top-menu-icon"><gridSvg /></span> <span class="top-menu-icon"><gridSvg /></span>
</a-popover> </a-popover> -->
</div> </div>
</template> </template>
@ -49,18 +49,8 @@ export default {
components: { gridSvg, top_agent, top_acl }, components: { gridSvg, top_agent, top_acl },
data() { data() {
return { return {
defaultShowRouteName: [ defaultShowRouteName: ['cmdb', 'acl'],
'dag', defaultUnShowRouteName: [],
'cmdb',
'itsm',
'ticket',
'monitor',
'calendar',
'datainsight',
'fullscreen',
'oneterm',
],
defaultUnShowRouteName: ['acl', 'agent'],
routes: store.getters.appRoutes.filter((i) => !(i.meta || {}).hiddenInTopMenu), routes: store.getters.appRoutes.filter((i) => !(i.meta || {}).hiddenInTopMenu),
current: store.getters.appRoutes[0].name, current: store.getters.appRoutes[0].name,
visible: false, visible: false,

View File

@ -271,7 +271,7 @@ const cmdb_en = {
tips1: 'Kind Reminder :', tips1: 'Kind Reminder :',
tips2: '1. Click to download the template, and users can customize the header of the template file, including model properties and model associations', tips2: '1. Click to download the template, and users can customize the header of the template file, including model properties and model associations',
// eslint-disable-next-line no-template-curly-in-string // eslint-disable-next-line no-template-curly-in-string
tips3: '2. The red color in the template file represents the model relationship, such as the $Product. Product Name (${Model Name}. {Attribute Name}) column, which establishes the relationship between the physical machine and the product.', tips3: '2. The red color in the template file represents the model relationship, such as the $Product. Product Name (${Model Name}. {Attribute Name}) column, which establishes the relationship with the product.',
tips4: '3. In the download template Excel file, the predefined values of attributes will be set as dropdown options. Please note that due to the limitations of Excel itself, a single dropdown box is limited to a maximum of 255 characters. If it exceeds 255 characters, we will not set the dropdown options for this attribute', tips4: '3. In the download template Excel file, the predefined values of attributes will be set as dropdown options. Please note that due to the limitations of Excel itself, a single dropdown box is limited to a maximum of 255 characters. If it exceeds 255 characters, we will not set the dropdown options for this attribute',
tips5: '4. When using Excel templates, please ensure that a single file does not exceed 5000 lines.', tips5: '4. When using Excel templates, please ensure that a single file does not exceed 5000 lines.',
}, },

View File

@ -270,7 +270,7 @@ const cmdb_zh = {
tips1: '温馨提示:', tips1: '温馨提示:',
tips2: '1. 点击下载模板,用户可以自定义模板文件的表头,包括模型属性、模型关联', tips2: '1. 点击下载模板,用户可以自定义模板文件的表头,包括模型属性、模型关联',
// eslint-disable-next-line no-template-curly-in-string // eslint-disable-next-line no-template-curly-in-string
tips3: '2. 模板文件中红色为模型关系,如$产品.产品名(${模型名}.{属性名})这一列就可建立物理机和产品之间的关系', tips3: '2. 模板文件中红色为模型关系,如$产品.产品名(${模型名}.{属性名})这一列就可建立和产品之间的关系',
tips4: '3. 下载模板excel文件中会将属性的预定义值置为下拉选项请注意受excel本身的限制单个下拉框限制了最多255个字符如果超过255个字符我们不会设置该属性的下拉选项', tips4: '3. 下载模板excel文件中会将属性的预定义值置为下拉选项请注意受excel本身的限制单个下拉框限制了最多255个字符如果超过255个字符我们不会设置该属性的下拉选项',
tips5: '4. 在使用excel模板时请确保单个文件不超过5000行', tips5: '4. 在使用excel模板时请确保单个文件不超过5000行',
}, },

View File

@ -156,8 +156,8 @@ const genCmdbRoutes = async () => {
const lastTypeId = window.localStorage.getItem('ops_ci_typeid') || undefined const lastTypeId = window.localStorage.getItem('ops_ci_typeid') || undefined
if (lastTypeId && preference.some(item => item.id === Number(lastTypeId))) { if (lastTypeId && preference.some(item => item.id === Number(lastTypeId))) {
routes.redirect = `/cmdb/instances/types/${lastTypeId}` routes.redirect = `/cmdb/instances/types/${lastTypeId}`
} else if (routes.children[3]?.children?.length > 0) { } else if (routes.children[2]?.children?.length > 0) {
routes.redirect = routes.children[3]?.children.find(item => !item.hidden)?.path routes.redirect = routes.children[2].children.find(item => !item.hidden)?.path
} else { } else {
routes.redirect = '/cmdb/dashboard' routes.redirect = '/cmdb/dashboard'
} }

View File

@ -108,9 +108,7 @@
handle=".handle" handle=".handle"
> >
<AttributeCard <AttributeCard
v-for="item in CITypeGroup.attributes.filter( v-for="item in filterValueType(CITypeGroup.attributes)"
(attr) => !attrTypeFilter.length || (attrTypeFilter.length && attrTypeFilter.includes(attr.value_type))
)"
:key="item.id" :key="item.id"
@edit="handleEditProperty(item)" @edit="handleEditProperty(item)"
:property="item" :property="item"
@ -152,9 +150,7 @@
handle=".handle" handle=".handle"
> >
<AttributeCard <AttributeCard
v-for="item in otherGroupAttributes.filter( v-for="item in filterValueType(otherGroupAttributes)"
(attr) => !attrTypeFilter.length || (attrTypeFilter.length && attrTypeFilter.includes(attr.value_type))
)"
:key="item.id" :key="item.id"
@edit="handleEditProperty(item)" @edit="handleEditProperty(item)"
:property="item" :property="item"
@ -564,6 +560,32 @@ export default {
this.attrTypeFilter.push(type) this.attrTypeFilter.push(type)
} }
}, },
filterValueType(array) {
const { attrTypeFilter } = this
return array.filter((attr) => {
if (!attrTypeFilter.length) {
return true
} else {
if (attrTypeFilter.includes('7') && attr.is_password) {
return true
}
if (attrTypeFilter.includes('8') && attr.is_link) {
return true
}
if (
attrTypeFilter.includes(attr.value_type) &&
attr.value_type === '2' &&
(attr.is_password || attr.is_link)
) {
return false
}
if (attrTypeFilter.includes(attr.value_type)) {
return true
}
return false
}
})
},
}, },
} }
</script> </script>

View File

@ -1143,7 +1143,7 @@ body {
border-bottom: 1px solid @border-color-base; border-bottom: 1px solid @border-color-base;
} }
.ant-tabs-tab { .ant-tabs-tab {
color: @text-color_4; color: @text-color_2;
} }
.ant-tabs-tab-active { .ant-tabs-tab-active {
color: @primary-color; color: @primary-color;