Files
test/sf_dlm_management/static/js/changeCss.js
2024-01-05 14:10:43 +08:00

36 lines
978 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 因为表格可以拖动设置宽度所以需要用js设置初始宽度
function setBasicParamTableWidth() {
const basicParamDom = $('.fixTableCss')
let dom = []
try {
dom = basicParamDom.find('table').find('thead').children().children()
} catch {
dom = []
}
if (!dom) return
dom.each(function () {
if ($(this).hasClass('row_no') >= 0) { // 序号列
// 不设置 通过css设置
}
const text = $(this).text()
$(this).find('span').removeClass('text-truncate')
if (text.length > 5) {
$(this).width('150px')
} else if (text.length == 5) {
$(this).width('100px')
} else if (text.length == 4) {
$(this).width('80px')
} else if (text.length == 3) {
$(this).width('65px')
} else if (text.length == 2) {
$(this).width('50px')
}
})
}
setTimeout(setBasicParamTableWidth, 500)