修改表格,等样式
This commit is contained in:
35
sf_dlm_management/static/js/changeCss.js
Normal file
35
sf_dlm_management/static/js/changeCss.js
Normal file
@@ -0,0 +1,35 @@
|
||||
// 因为表格可以拖动设置宽度,所以需要用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)
|
||||
Reference in New Issue
Block a user