1、新增必填字段前添加 * 的样式;2、给刀具管理模块的必填字段添加红星样式;

This commit is contained in:
yuxianghui
2024-02-27 17:15:22 +08:00
parent 7f50a3f1d3
commit 0f8bee120b
3 changed files with 78 additions and 25 deletions

View File

@@ -59,4 +59,46 @@ $(function (){
}
}
})
function customRequired() {
let timer = null
let timer_count = 0
clearInterval(timer)
timer = setInterval(() => {
timer_count ++
const dom = $('.custom_required')
let tableDom = $('.table_custom_required')
if(tableDom.length) {
tableDom = tableDom.eq(0).parents('tr').children('.table_custom_required')
tableDom.each(function (){
const i = $(this).index()
const requiredDom = $(this).parents('table').find('thead').find('th').eq(i).find('span').eq(0)
const t = requiredDom.text().replace('*', '')
requiredDom.html('<i style="color: red;margin-left: -4px">*</i>' + t)
})
clearInterval(timer)
}
if(dom.length) {
dom.each(function (){
const requiredDom = $(this).parent().prev().find('label')
let t = requiredDom.html()
t.replace('<i style="color: red;margin-left: -4px">*</i>', '');
t = '<i style="color: red;margin-left: -4px">*</i>' + t
requiredDom.html(t)
})
clearInterval(timer)
}
if(timer_count == 20) {
clearInterval(timer)
}
},500)
}
var currentUrl = location.href
const listenerUrl = setInterval(() => {
const isChange = currentUrl != location.href
if(isChange) {
currentUrl = location.href
customRequired()
}
}, 500)
customRequired()
})