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
7 changed files with 51 additions and 35 deletions

View File

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

View File

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

View File

@@ -108,9 +108,7 @@
handle=".handle"
>
<AttributeCard
v-for="item in CITypeGroup.attributes.filter(
(attr) => !attrTypeFilter.length || (attrTypeFilter.length && attrTypeFilter.includes(attr.value_type))
)"
v-for="item in filterValueType(CITypeGroup.attributes)"
:key="item.id"
@edit="handleEditProperty(item)"
:property="item"
@@ -152,9 +150,7 @@
handle=".handle"
>
<AttributeCard
v-for="item in otherGroupAttributes.filter(
(attr) => !attrTypeFilter.length || (attrTypeFilter.length && attrTypeFilter.includes(attr.value_type))
)"
v-for="item in filterValueType(otherGroupAttributes)"
:key="item.id"
@edit="handleEditProperty(item)"
:property="item"
@@ -564,6 +560,32 @@ export default {
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>