diff --git a/cmdb-ui/public/iconfont/demo_index.html b/cmdb-ui/public/iconfont/demo_index.html
index 0f9fea8..fc4808c 100644
--- a/cmdb-ui/public/iconfont/demo_index.html
+++ b/cmdb-ui/public/iconfont/demo_index.html
@@ -54,6 +54,12 @@
+ -
+
+
veops-department
+ 
+
+
-
duose-changwenben (1)
@@ -5514,9 +5520,9 @@
@font-face {
font-family: 'iconfont';
- src: url('iconfont.woff2?t=1724135954264') format('woff2'),
- url('iconfont.woff?t=1724135954264') format('woff'),
- url('iconfont.ttf?t=1724135954264') format('truetype');
+ src: url('iconfont.woff2?t=1724653006782') format('woff2'),
+ url('iconfont.woff?t=1724653006782') format('woff'),
+ url('iconfont.ttf?t=1724653006782') format('truetype');
}
第二步:定义使用 iconfont 的样式
@@ -5542,6 +5548,15 @@
+ -
+
+
+ veops-department
+
+ .veops-department
+
+
+
-
@@ -13732,6 +13747,14 @@
+ -
+
+
veops-department
+ #veops-department
+
+
-
-
- {{ $t('cmdb.ciType.viewAllAttr') }}
-
+
+
+ {{ $t('cmdb.ciType.viewAllAttr') }}
+
+
v[0] === newValue)
- if (idx > -1) {
- this.$message.warning(this.$t('cmdb.ciType.valueExisted'))
- } else {
- this.valueList.push([newValue, { style: newStyle, icon: { ...newIcon } }])
- }
- }
- },
- deleteValue(item) {
- const _valueList = _.cloneDeep(this.valueList)
- const idx = _valueList.findIndex((v) => v[0] === item[0])
- if (idx > -1) {
- _valueList.splice(idx, 1)
- this.valueList = _valueList
- }
- },
- editValue(item, newValue, newStyle, newIcon) {
- const _valueList = _.cloneDeep(this.valueList)
- const idx = _valueList.findIndex((v) => v[0] === item[0])
- if (idx > -1) {
- _valueList[idx] = [newValue, { style: newStyle, icon: { ...newIcon } }]
- this.valueList = _valueList
- }
- },
getData() {
- if (this.activeKey === 'define') {
+ if (this.activeKey === 'builtin') {
return {
choice_value: this.valueList,
choice_web_hook: null,
choice_other: null,
+ choice_builtin: null,
+ }
+ } else if (this.activeKey === 'define') {
+ if (this.validateDefine()) {
+ return {
+ isError: true
+ }
+ }
+
+ return {
+ choice_value: this.valueList.filter((item) => item?.[0]),
+ choice_web_hook: null,
+ choice_other: null,
+ choice_builtin: null
}
} else if (this.activeKey === 'webhook') {
const choice_web_hook = this.$refs.webhook.getParams()
choice_web_hook.ret_key = this.form.ret_key
- return { choice_value: [], choice_web_hook, choice_other: null }
+ return { choice_value: [], choice_web_hook, choice_other: null, choice_builtin: null }
} else if (this.activeKey === 'script') {
return {
choice_value: [],
choice_web_hook: null,
+ choice_builtin: null,
choice_other: {
script: this.script,
cascade_attributes: this.cascade_attributes,
@@ -395,9 +396,22 @@ export default {
choice_value: [],
choice_web_hook: null,
choice_other,
+ choice_builtin: null,
}
}
},
+
+ validateDefine() {
+ const valueList = this.valueList.filter((item) => item?.[0])
+ const isRepeat = _.uniq(valueList.map(item => item?.[0] || '')).length !== valueList.length
+ if (isRepeat) {
+ this.$message.warning(this.$t('cmdb.ciType.enumValueTip2'))
+ return true
+ }
+
+ return false
+ },
+
setData({ choice_value, choice_web_hook, choice_other }) {
if (choice_web_hook) {
this.activeKey = 'webhook'
@@ -425,7 +439,26 @@ export default {
}
}
} else {
- this.valueList = choice_value
+ let valueList = [[
+ '',
+ {
+ style: {},
+ icon: {},
+ label: ''
+ }
+ ]]
+ if (choice_value?.length) {
+ valueList = choice_value.map((item) => {
+ return [
+ item[0],
+ {
+ ...item[1],
+ label: item?.[1]?.['label'] || item[0]
+ }
+ ]
+ })
+ }
+ this.valueList = valueList
this.activeKey = 'define'
}
const dom = document.querySelector('#preValueArea .ant-tabs-ink-bar')
@@ -436,6 +469,56 @@ export default {
dom.style.backgroundColor = '#2f54eb'
}
},
+
+ resetData() {
+ this.activeKey = 'define'
+ this.$set(this, 'valueList', [
+ [
+ '',
+ {
+ style: {},
+ icon: {},
+ label: ''
+ }
+ ]
+ ])
+
+ this.$nextTick(() => {
+ if (this.$refs.builtInRef) {
+ this.$refs.builtInRef.setData({})
+ }
+
+ if (this.$refs.webhook) {
+ this.$refs.webhook.setParams({})
+ }
+ this.form.ret_key = ''
+
+ this.script = ''
+ this.cascade_attributes = []
+ if (this.$refs.codemirror) {
+ this.$refs.codemirror.initCodeMirror('')
+ }
+
+ this.choice_other = {
+ type_ids: undefined,
+ attr_id: undefined
+ }
+ if (this.$refs.attrFilter) {
+ this.$refs.attrFilter.init(true, false)
+ }
+ })
+ },
+
+ initEnumValue() {
+ if (this.valueList) {
+ const valueList = _.cloneDeep(this.valueList)
+ valueList.forEach((item) => {
+ item[0] = ''
+ })
+ this.$set(this, 'valueList', valueList)
+ }
+ },
+
setExpFromFilter(filterExp) {
if (filterExp) {
this.filterExp = `${filterExp}`
@@ -462,6 +545,24 @@ export default {
diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/builtin/userFilterComp/constants.js b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/builtin/userFilterComp/constants.js
new file mode 100644
index 0000000..0574a20
--- /dev/null
+++ b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/builtin/userFilterComp/constants.js
@@ -0,0 +1,16 @@
+export const ruleTypeList = [
+ { value: '&', label: 'cs.components.and' },
+ { value: '|', label: 'cs.components.or' },
+]
+
+export const expList = [
+ { value: 1, label: 'cs.components.equal' },
+ { value: 2, label: 'cs.components.notEqual' },
+ { value: 7, label: 'cs.components.isEmpty' },
+ { value: 8, label: 'cs.components.isNotEmpty' },
+]
+
+export const compareTypeList = [
+ { value: 5, label: 'cs.components.moreThan' },
+ { value: 6, label: 'cs.components.lessThan' },
+]
diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/builtin/userFilterComp/employeeTreeSelect.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/builtin/userFilterComp/employeeTreeSelect.vue
new file mode 100644
index 0000000..a472e3c
--- /dev/null
+++ b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/builtin/userFilterComp/employeeTreeSelect.vue
@@ -0,0 +1,143 @@
+
+
+
+ {{ node.label }}
+
+
+
+
+
+
+
diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/builtin/userFilterComp/index.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/builtin/userFilterComp/index.vue
new file mode 100644
index 0000000..2cab506
--- /dev/null
+++ b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/builtin/userFilterComp/index.vue
@@ -0,0 +1,347 @@
+
+
+
+
+ {{ $t('add') }}
+
+
+
+
+
+
+
+
+
+
+ {{ $t(node.label) }}
+
+
+
+
+ {{ $t(node.label) }}
+
+
+
+ handleChangeExp(value, item, index)"
+ >
+
+
+ {{ $t(node.label) }}
+
+
+
+
+ {{ $t(node.label) }}
+
+
+
+
+
+ {{ $t(node.label) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/constants.js b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/constants.js
index 3dd2ef5..5f4818a 100644
--- a/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/constants.js
+++ b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/constants.js
@@ -39,3 +39,10 @@ export const compareTypeList = [
{ value: '3', label: '<' },
{ value: '4', label: '<=' },
]
+
+export const ENUM_VALUE_TYPE = {
+ INPUT: 'input',
+ DATE: 'date',
+ DATE_TIME: 'dateTIme',
+ NUMBER: 'number'
+}
diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/define/defineLabel.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/define/defineLabel.vue
new file mode 100644
index 0000000..8c0a402
--- /dev/null
+++ b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/define/defineLabel.vue
@@ -0,0 +1,310 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ labelData.label }}
+
+
+
+
+
+
+
{{ $t('icon') }}
+
+
{{ $t('cmdb.ciType.font') }}
+
+
+
{{ $t('cmdb.ciType.color') }}
+
+
+
+
changeFontStyle('color', v)"
+ :predefine="defaultBGColors"
+ >
+
+
+
+
+
changeFontStyle('backgroundColor', v)"
+ :predefine="defaultBGColors"
+ >
+
+
+
+
{{ $t('operation') }}
+
+
+
+
+
+
+
+
+
+
diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/define/index.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/define/index.vue
new file mode 100644
index 0000000..3af1e9b
--- /dev/null
+++ b/cmdb-ui/src/modules/cmdb/views/ci_types/preValueAttr/define/index.vue
@@ -0,0 +1,245 @@
+
+
+
+
+ {{ $t('add') }}
+
+
+
+
+
+
+ {{ column.title }}
+
+
+ changeValue(rowIndex, e.target.value)"
+ >
+ changeValue(rowIndex, v)"
+ >
+
+ changeDate(rowIndex, e)"
+ />
+
+
+
+
+ changeStyle(rowIndex, key, value)"
+ @deleteData="handleClear(rowIndex)"
+ />
+
+
+
+
+
+
+
+
+
+
diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/relationTable.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/relationTable.vue
index 2a19985..e2a7160 100644
--- a/cmdb-ui/src/modules/cmdb/views/ci_types/relationTable.vue
+++ b/cmdb-ui/src/modules/cmdb/views/ci_types/relationTable.vue
@@ -179,6 +179,7 @@
>
{{ CIType.alias || CIType.name }}
+ ({{ CIType.name }})
@@ -674,6 +675,11 @@ export default {
.modal-attribute-action {
margin-left: 5px;
}
+
+.model-select-name {
+ font-size: 12px;
+ color: #A5A9BC;
+}
diff --git a/cmdb-ui/src/modules/cmdb/views/relation_views/modules/AddTableModal.vue b/cmdb-ui/src/modules/cmdb/views/relation_views/modules/AddTableModal.vue
index 5f2236f..6bc79d2 100644
--- a/cmdb-ui/src/modules/cmdb/views/relation_views/modules/AddTableModal.vue
+++ b/cmdb-ui/src/modules/cmdb/views/relation_views/modules/AddTableModal.vue
@@ -63,6 +63,14 @@
{{ id }}
+
+
+ {{ getChoiceValueLabel(col, value) || value }}
+
+
{{ JSON.stringify(row[col.field]) }}
@@ -253,6 +261,14 @@ export default {
this.currentPage = page
this.fetchData()
},
+
+ getChoiceValueLabel(col, colValue) {
+ const _find = col.filters.find((item) => String(item[0]) === String(colValue))
+ if (_find) {
+ return _find[1]?.label || ''
+ }
+ return ''
+ },
},
}
diff --git a/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue b/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue
index 2835288..fe2f2b9 100644
--- a/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue
+++ b/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue
@@ -124,7 +124,7 @@
"
target="_blank"
>
- {{ item }}
+ {{ getChoiceValueLabel(col, item) || item }}
{{ value }}
+
+ {{ getChoiceValueLabel(col, value) || value }}
+
- {{ row[col.field] }}
+ {{ getChoiceValueLabel(col, row[col.field]) || row[col.field] }}
+
@@ -582,6 +584,13 @@ export default {
}
return {}
},
+ getChoiceValueLabel(col, colValue) {
+ const _find = col?.filters?.find((item) => String(item[0]) === String(colValue))
+ if (_find) {
+ return _find[1]?.label || ''
+ }
+ return ''
+ },
handleExport() {
this.$refs.batchDownload.open({
preferenceAttrList: [
@@ -611,6 +620,7 @@ export default {
return { ...item }
}),
],
+ original: true,
download: false,
})
this.selectedRowKeys = []
diff --git a/cmdb-ui/src/modules/cmdb/views/topology_view/index.vue b/cmdb-ui/src/modules/cmdb/views/topology_view/index.vue
index c1044b9..d02ea37 100644
--- a/cmdb-ui/src/modules/cmdb/views/topology_view/index.vue
+++ b/cmdb-ui/src/modules/cmdb/views/topology_view/index.vue
@@ -1185,7 +1185,23 @@ export default {
if (!res.result.length) {
this.handleNullNodeTips(this.$t('cmdb.topo.noInstancePerm'))
} else {
- this.currentNodeValues = res.result[0]
+ const currentNodeValues = res.result[0]
+ Object.keys(currentNodeValues).forEach((key) => {
+ const attr = this.currentNodeAttributes.find((attr) => attr.name === key)
+ if (attr?.choice_value?.length) {
+ if (Array.isArray(currentNodeValues[key])) {
+ currentNodeValues[key] = currentNodeValues[key].map((value) => {
+ const choice = attr.choice_value.find((choice) => value === choice?.[0])
+ return choice?.[1]?.label || value
+ })
+ } else {
+ const choice = attr.choice_value.find((choice) => currentNodeValues[key] === choice?.[0])
+ currentNodeValues[key] = choice?.[1]?.label || currentNodeValues[key]
+ }
+ }
+ })
+
+ this.currentNodeValues = currentNodeValues
}
}).catch(error => {
this.handleNullNodeTips(((error.response || {}).data || {}).message)
diff --git a/cmdb-ui/src/modules/cmdb/views/tree_views/index.vue b/cmdb-ui/src/modules/cmdb/views/tree_views/index.vue
index 47268d3..8188eca 100644
--- a/cmdb-ui/src/modules/cmdb/views/tree_views/index.vue
+++ b/cmdb-ui/src/modules/cmdb/views/tree_views/index.vue
@@ -375,10 +375,9 @@ export default {
},
methods: {
async getAttributeList() {
- await getCITypeAttributesById(Number(this.typeId)).then((res) => {
- this.attrList = res.attributes
- this.attributes = res
- })
+ const res = await getCITypeAttributesById(Number(this.typeId))
+ this.attrList = res.attributes
+ this.attributes = res
},
async getTreeViews() {
this.subscribeTreeViewCiTypesLoading = true
@@ -519,10 +518,18 @@ export default {
wrapTreeData(facet) {
// 切面
- console.log('facet', facet)
const _treeData = Object.values(facet)[0].map((item) => {
+ let title = item[0]
+ const attr = this.attrList.find((attr) => attr.name === item[2])
+ if (attr?.choice_value?.length) {
+ const choice = attr.choice_value.find((choice) => item[0] === choice?.[0])
+ if (choice?.[1]?.label) {
+ title = choice[1].label
+ }
+ }
+
return {
- title: item[0],
+ title: title,
childLength: item[1],
key: this.treeKeys.join(this.keySplit) + this.keySplit + item[0],
isLeaf: this.levels.length - 1 === this.treeKeys.length,