From c92a3a5f313bd8587874a6d2d1e685771d3bb5bd Mon Sep 17 00:00:00 2001 From: pycook Date: Fri, 17 May 2024 12:07:56 +0800 Subject: [PATCH] fix(ui): some bugs (#512) --- .../cmdb/components/noticeContent/index.vue | 6 ++++ .../cmdb/components/searchForm/SearchForm.vue | 3 ++ cmdb-ui/src/modules/cmdb/lang/en.js | 9 ++--- cmdb-ui/src/modules/cmdb/lang/zh.js | 11 +++--- cmdb-ui/src/modules/cmdb/router/index.js | 2 +- .../views/ci/modules/CreateInstanceForm.vue | 3 +- .../views/ci/modules/ciDetailRelation.vue | 4 +-- .../cmdb/views/ci/modules/ciDetailTab.vue | 4 +-- .../cmdb/views/resource_search/index.vue | 34 ++++++++++++++++--- 9 files changed, 56 insertions(+), 20 deletions(-) diff --git a/cmdb-ui/src/modules/cmdb/components/noticeContent/index.vue b/cmdb-ui/src/modules/cmdb/components/noticeContent/index.vue index 2c1b690..dcb2dd8 100644 --- a/cmdb-ui/src/modules/cmdb/components/noticeContent/index.vue +++ b/cmdb-ui/src/modules/cmdb/components/noticeContent/index.vue @@ -49,6 +49,8 @@ import _ from 'lodash' import '@wangeditor/editor/dist/css/style.css' import { Editor, Toolbar } from '@wangeditor/editor-for-vue' +import { i18nChangeLanguage } from '@wangeditor/editor' + export default { name: 'NoticeContent', components: { Editor, Toolbar }, @@ -76,6 +78,10 @@ export default { if (editor == null) return editor.destroy() // When the component is destroyed, destroy the editor in time }, + beforeCreate() { + const locale = this.$i18n.locale === 'zh' ? 'zh-CN' : 'en' + i18nChangeLanguage(locale) + }, methods: { onCreated(editor) { this.editor = Object.seal(editor) // Be sure to use Object.seal(), otherwise an error will be reported diff --git a/cmdb-ui/src/modules/cmdb/components/searchForm/SearchForm.vue b/cmdb-ui/src/modules/cmdb/components/searchForm/SearchForm.vue index af60824..c783920 100644 --- a/cmdb-ui/src/modules/cmdb/components/searchForm/SearchForm.vue +++ b/cmdb-ui/src/modules/cmdb/components/searchForm/SearchForm.vue @@ -198,6 +198,9 @@ export default { if (this.type === 'resourceSearch') { this.getCITypeGroups() } + if (this.typeId) { + this.currenCiType = [this.typeId] + } }, methods: { // toggleAdvanced() { diff --git a/cmdb-ui/src/modules/cmdb/lang/en.js b/cmdb-ui/src/modules/cmdb/lang/en.js index cfbcf0d..a9940c4 100644 --- a/cmdb-ui/src/modules/cmdb/lang/en.js +++ b/cmdb-ui/src/modules/cmdb/lang/en.js @@ -4,6 +4,7 @@ const cmdb_en = { configTable: 'Config Table', menu: { views: 'Views', + resources: 'Resources', config: 'Configuration', backend: 'Management', ciTable: 'Resource Views', @@ -69,9 +70,9 @@ const cmdb_en = { adAutoInLib: 'Save as CI auto', adInterval: 'Collection frequency', byInterval: 'by interval', - allNodes: 'All nodes', - specifyNodes: 'Specify Node', - specifyNodesTips: 'Please fill in the specify node!', + allNodes: 'All Instances', + specifyNodes: 'Specify Instance', + specifyNodesTips: 'Please fill in the specify instance!', username: 'Username', password: 'Password', link: 'Link', @@ -144,7 +145,7 @@ const cmdb_en = { triggerDataChange: 'Data changes', triggerDate: 'Date attribute', triggerEnable: 'Turn on', - descInput: 'Please enter remarks', + descInput: 'Please enter descriptions', triggerCondition: 'Triggering conditions', addInstance: 'Add new instance', deleteInstance: 'Delete instance', diff --git a/cmdb-ui/src/modules/cmdb/lang/zh.js b/cmdb-ui/src/modules/cmdb/lang/zh.js index de7f701..85b99c5 100644 --- a/cmdb-ui/src/modules/cmdb/lang/zh.js +++ b/cmdb-ui/src/modules/cmdb/lang/zh.js @@ -4,8 +4,9 @@ const cmdb_zh = { configTable: '配置表格', menu: { views: '视图', + resources: '资源', config: '配置', - backend: '管理端', + backend: '管理', ciTable: '资源数据', ciTree: '资源层级', ciSearch: '资源搜索', @@ -69,9 +70,9 @@ const cmdb_zh = { adAutoInLib: '自动入库', adInterval: '采集频率', byInterval: '按间隔', - allNodes: '所有节点', - specifyNodes: '指定节点', - specifyNodesTips: '请填写指定节点!', + allNodes: '所有实例', + specifyNodes: '指定实例', + specifyNodesTips: '请填写指定实例!', username: '用户名', password: '密码', link: '链接', @@ -144,7 +145,7 @@ const cmdb_zh = { triggerDataChange: '数据变更', triggerDate: '日期属性', triggerEnable: '开启', - descInput: '请输入备注', + descInput: '请输入描述', triggerCondition: '触发条件', addInstance: '新增实例', deleteInstance: '删除实例', diff --git a/cmdb-ui/src/modules/cmdb/router/index.js b/cmdb-ui/src/modules/cmdb/router/index.js index b31b03d..1a2522b 100644 --- a/cmdb-ui/src/modules/cmdb/router/index.js +++ b/cmdb-ui/src/modules/cmdb/router/index.js @@ -19,7 +19,7 @@ const genCmdbRoutes = async () => { { path: '/cmdb/disabled1', name: 'cmdb_disabled1', - meta: { title: 'cmdb.menu.views', disabled: true }, + meta: { title: 'cmdb.menu.resources', disabled: true }, }, { path: '/cmdb/resourceviews', diff --git a/cmdb-ui/src/modules/cmdb/views/ci/modules/CreateInstanceForm.vue b/cmdb-ui/src/modules/cmdb/views/ci/modules/CreateInstanceForm.vue index 1bbbc87..4fc5254 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci/modules/CreateInstanceForm.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci/modules/CreateInstanceForm.vue @@ -107,6 +107,7 @@ v-decorator="[list.name, { rules: [{ required: false }] }]" style="width: 100%" :format="getFieldType(list.name) == '4' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'" + :valueFormat="getFieldType(list.name) == '4' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'" v-if="getFieldType(list.name) === '4' || getFieldType(list.name) === '3'" :showTime="getFieldType(list.name) === '4' ? false : { format: 'HH:mm:ss' }" /> @@ -370,7 +371,7 @@ export default { return 'select%%multiple' } return 'select' - } else if (_find.value_type === '0' || _find.value_type === '1') { + } else if ((_find.value_type === '0' || _find.value_type === '1') && !_find.is_list) { return 'input_number' } else if (_find.value_type === '4' || _find.value_type === '3') { return _find.value_type diff --git a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelation.vue b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelation.vue index a45c19a..e164dd1 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelation.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelation.vue @@ -182,7 +182,7 @@ export default { const edges = [] this.parentCITypes.forEach((parent) => { const _findCiType = ci_types_list.find((item) => item.id === parent.id) - if (this.firstCIs[parent.name]) { + if (this.firstCIs[parent.name] && _findCiType) { const unique_id = _findCiType.show_id || _findCiType.unique_id const _findUnique = parent.attributes.find((attr) => attr.id === unique_id) const unique_name = _findUnique?.name @@ -225,7 +225,7 @@ export default { }) this.childCITypes.forEach((child) => { const _findCiType = ci_types_list.find((item) => item.id === child.id) - if (this.secondCIs[child.name]) { + if (this.secondCIs[child.name] && _findCiType) { const unique_id = _findCiType.show_id || _findCiType.unique_id const _findUnique = child.attributes.find((attr) => attr.id === unique_id) const unique_name = _findUnique?.name diff --git a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailTab.vue b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailTab.vue index e090a76..ffc3362 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailTab.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailTab.vue @@ -112,7 +112,7 @@ {{ $t('cmdb.ci.relITSM') }}
- +
@@ -140,8 +140,6 @@ import CiDetailRelation from './ciDetailRelation.vue' import TriggerTable from '../../operation_history/modules/triggerTable.vue' import RelatedItsmTable from './ciDetailRelatedItsmTable.vue' import CiRollbackForm from './ciRollbackForm.vue' -import { sleep } from '@/utils/util' - export default { name: 'CiDetailTab', components: { 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 d8c0405..2463119 100644 --- a/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue @@ -20,7 +20,8 @@ { + this.ciTypes = res.ci_types + }) + }, + async getAttrsByType(typeId) { + await getCITypeAttributesById(typeId).then((res) => { + this.allAttributesList = res.attributes + this.originAllAttributesList = res.attributes + }) + }, async getAllAttr() { await searchAttributes({ page_size: 9999 }).then((res) => { this.allAttributesList = res.attributes