修改表格,等样式
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)
|
||||
@@ -444,7 +444,7 @@
|
||||
<page string="切削速度Vc"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}">
|
||||
<field name="cutting_speed_ids" string="" widget="one2many"
|
||||
attrs="{'readonly': [('categ_type', '=', '刀具')]}">
|
||||
attrs="{'readonly': [('categ_type', '=', '刀具')]}" class="fixTableCss">
|
||||
<tree editable="bottom">
|
||||
<!-- <field name="order"/>-->
|
||||
<field name="execution_standard_id"/>
|
||||
@@ -463,6 +463,8 @@
|
||||
<field name="application"/>
|
||||
</tree>
|
||||
</field>
|
||||
<script src="/sf_dlm_management/static/js/changeCss.js"></script>
|
||||
|
||||
</page>
|
||||
<page string="每齿走刀量fz"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))],'readonly': [('categ_type', '=', '刀具')]}">
|
||||
|
||||
Reference in New Issue
Block a user