diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 34e6ce78d..8903072eb 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -1156,7 +1156,7 @@ const cn = { }, module: { module: '模块', - moduleName: '模块名称', + moduleName: '名称', editModule: '编辑模块', description: '描述', createModule: '新增模块', diff --git a/nezha-fronted/src/components/common/table/asset/assetTable.vue b/nezha-fronted/src/components/common/table/asset/assetTable.vue index 5c1f0c398..1c50f0987 100644 --- a/nezha-fronted/src/components/common/table/asset/assetTable.vue +++ b/nezha-fronted/src/components/common/table/asset/assetTable.vue @@ -94,18 +94,18 @@ export default { prop: 'id', show: true, width: 110, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('overall.name'), prop: 'name', show: true, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('asset.manageIp'), prop: 'manageIp', show: true, width: 120, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('overall.parent'), prop: 'parent', @@ -116,49 +116,49 @@ export default { prop: 'type', show: true, width: 140, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('asset.state'), prop: 'state', show: true, width: 80, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('overall.dc'), prop: 'dc', show: true, width: 110, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('asset.cabinet'), prop: 'cabinet', show: true, width: 110, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('asset.alertNum'), prop: 'alertNum', show: true, width: 140, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('asset.endpointNum2'), prop: 'endpointNum', show: true, - width: 140, - sortable:'custom' + width: 160, + sortable: 'custom' }, { label: this.$t('asset.brand'), prop: 'brand', show: true, width: 120, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('asset.model'), prop: 'model', show: true, width: 110, - sortable:'custom' + sortable: 'custom' }, { label: 'SN', prop: 'sn', diff --git a/nezha-fronted/src/components/common/table/settings/endpointTable.vue b/nezha-fronted/src/components/common/table/settings/endpointTable.vue index 497af9eec..16f06f803 100644 --- a/nezha-fronted/src/components/common/table/settings/endpointTable.vue +++ b/nezha-fronted/src/components/common/table/settings/endpointTable.vue @@ -133,10 +133,10 @@ export default { prop: 'type', show: true }, { - label: this.$t('project.project.project'), + label: this.$t('project.project.projectName'), prop: 'project', show: true, - sortable:'custom' + sortable: 'custom' }, { label: this.$t('project.endpoint.asset'), diff --git a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue index 74346c460..84cf044a0 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue @@ -25,7 +25,7 @@
+ @input="metricKeyDown" @keyup.enter.native="expressionChange" ref="elInput">
{{errorMsg}}
{{appendMsg}}
@@ -69,7 +69,7 @@
+ :autosize="{ minRows: 1, maxRows: 6}" class="not-fixed-height no-resize" ref="elInput">
{{errorMsg}}
{{appendMsg}}
@@ -286,7 +286,8 @@ export default { }, metricChange: function (value) { if (!value) return - this.expressionList[this.index] = value + // this.expressionList[this.index] = value + this.insertText(value) // this.$refs.editor.setContent(value) this.dropDownVisible = false this.$emit('change', value) @@ -392,7 +393,8 @@ export default { if (this.tempBox.vars.length == 0) { this.tempBoxShow = false // eslint-disable-next-line vue/no-mutating-props - this.expressionList[this.index] = params.expression + // this.expressionList[this.index] = params.expression + this.insertText(params.expression) this.$emit('change', params.expression) return } @@ -400,7 +402,8 @@ export default { this.$post('/expression/tmpl/render', params).then(res => { if (res.code === 200) { this.tempBoxShow = false - this.expressionList[this.index] = res.data.expression + // this.expressionList[this.index] = res.data.expression + this.insertText(res.data.expression) this.$emit('change', res.data.expression) } }) @@ -491,8 +494,25 @@ export default { }, tempBoxClose () { this.cascaderValue = '' - } + }, + insertText (insertTxt) { + // 获取el-input中的input元素 + const elInput = this.$refs.elInput.$el.firstElementChild + // 获取el-input的值 + const txt = elInput.value + // 获取选区开始位置 + const startPos = elInput.selectionStart + // 获取选区结束位置 + const endPos = elInput.selectionEnd + if (startPos === undefined || endPos === undefined) return + // 将文本插入光标位置 + this.expressionList[this.index] = txt.substring(0, startPos) + insertTxt + txt.substring(endPos) + // 将光标移至文本末尾 + elInput.focus() + elInput.selectionStart = startPos + insertTxt.length + elInput.selectionEnd = startPos + insertTxt.length + } /* setMsg:function(){ this.appendMsg } */