diff --git a/src/assets/css/common.scss b/src/assets/css/common.scss index 63f52f1b..b71258f1 100644 --- a/src/assets/css/common.scss +++ b/src/assets/css/common.scss @@ -61,7 +61,11 @@ body { } } -// 单词换行不被拆开 -.el-table .cell { +// 表头单词换行不被拆开 +.el-table th > .cell { word-break: keep-all !important; } +// 表格内容换行,不对中文生效,避免中文出现省略号 +.el-table .cell { + word-break: break-word !important; +} diff --git a/src/components/table/setting/KnowledgeBaseTable.vue b/src/components/table/setting/KnowledgeBaseTable.vue index adc86b75..0b43addf 100644 --- a/src/components/table/setting/KnowledgeBaseTable.vue +++ b/src/components/table/setting/KnowledgeBaseTable.vue @@ -92,6 +92,7 @@ export default { }, { label: this.$t('overall.type'), prop: 'tagType', + minWidth: 80, show: true }, { label: this.$t('overall.remark'), diff --git a/src/mixins/table.js b/src/mixins/table.js index 65c13894..515345f5 100644 --- a/src/mixins/table.js +++ b/src/mixins/table.js @@ -55,7 +55,7 @@ export default { } list.forEach((item, index) => { - if (item.label) { + if (item.label && item.label !== 'IP') { let tempLength = 0 if (item.label.indexOf(' ') > -1) { @@ -72,20 +72,22 @@ export default { // 为了避免没有minWidth这种情况 if (!item.minWidth) { item.minWidth = newWidth - } else if (item.minWidth < newWidth) { - item.minWidth = newWidth } // 排序最后一位一般是'操作',或者是较长的字符,故不让其换行,宽度直接为字符宽度 if (index === list.length - 1) { item.minWidth = (num * item.label.length) + 22 - item.width = (num * item.label.length) + 22 } // 有排序的,额外添加24px的排序图标宽度 if (item.sortable) { item.minWidth = item.minWidth + 30 - item.width = item.width + 30 + } + + if (item.minWidth < newWidth) { + item.minWidth = newWidth + } else if (item.width < item.minWidth) { + item.width = item.minWidth } } })