删除模块,移到efms里面,修改样式

This commit is contained in:
hyyy
2025-02-14 17:31:19 +08:00
parent 5463bff63b
commit b117fde8c3
15 changed files with 36 additions and 346 deletions

View File

@@ -9,6 +9,7 @@ function getDomData() {
table.hide()
const thead = customTable.children('thead')
const tbody = customTable.children('tbody')
const tfooter = customTable.children('tfoot')
const tableData = []
const tbody_child = tbody.children()
@@ -16,30 +17,29 @@ function getDomData() {
for (let v = 0; v < tbody_child_len; v++) { // 将数据取出来到tableData里面
const data = tbody_child[v].innerText.split('\t')
// console.log('dom data',data)
const [index, deep, name, Φ, value] = data
tableData.push({index, deep, name, Φ, value})
tableData.push({ index, deep, name, Φ, value })
}
const ΦList = [...new Set(tableData.map(_ => _.name))] // ΦList去重
const ΦList = [...new Set(tableData.map(_ => _.Φ))] // ΦList去重
const newTableData = {}
tableData.forEach(_ => {
const key = _.deep + '|' + _.Φ
!newTableData[key] ? newTableData[key] = {i: _.index} : '';
const key = _.deep + '|' + _.name
!newTableData[key] ? newTableData[key] = { i: _.index } : '';
if (_.Φ) { // 去除没有Φ的脏数据
newTableData[key]['Φ' + _.Φ] = _.value
newTableData[key]['Φ' + _.Φ + 'i'] = _.index
}
})
// console.log('qwdh',tableData, ΦList, newTableData);
// console.log(tableData, ΦList, newTableData);
if (ΦList.filter(_ => _).length == 0) return;
handleThead(thead, ΦList)
handleThead(thead, ΦList, tfooter)
handleTbody(tbody, newTableData, ΦList, table)
handleTbody(tbody, newTableData, ΦList, table )
}
// 重新设置表头、
function handleThead(thead, ΦList) {
function handleThead(thead, ΦList, tfooter) {
const dom = thead.children().eq(0).children()
const len = dom.length
dom.eq(0).attr('rowspan', 2)
@@ -47,7 +47,11 @@ function handleThead(thead, ΦList) {
len == 5 ? dom.eq(2).attr('rowspan', 2) : ''
dom.eq(-2).attr('colspan', ΦList.length)
dom.eq(-1).remove()
if(tfooter && tfooter.length) {
tfooter.children().each(function () {
$(this).children().eq(-1).remove()
})
}
const tr = document.createElement('tr')
for (let v = 0; v < ΦList.length; v++) {
const th = document.createElement('th')
@@ -68,7 +72,6 @@ function handleTbody(tbody, newTableData, ΦList, table) {
// b = b.split('=')[1].split('%')[0]
// return a - b
// })
// console.log('wqoqw ',ΦList)
data.forEach(_ => {
i++
const tr = $('<tr class="o_data_row"></tr>')
@@ -98,61 +101,6 @@ function handleTbody(tbody, newTableData, ΦList, table) {
// // }
tbody.append(tr)
})
// $(document).click(function (e) {
// if ($(e.target).attr('coustomTd')) {
// const orginV = $('[coustomInput=1]').children('input').val()
// $('[coustomInput=1]').parent().html(orginV)
// const v = $(e.target).attr('val')
// console.log($(e.target));
// $(e.target).html('')
// const input = $('<div coustomInput="1" name="feed_per_tooth" class="o_field_widget o_field_char"><input class="o_input" type="text" autocomplete="off" maxlength="20"></div>')
// input.children('input').val(v)
// $(e.target).append(input)
// input.children('input').focus()
// input.children('input').select()
// } else if ($(e.target).attr('coustomInput')) {
//
// } else {
// const orginV = $('[coustomInput=1]').children('input').val()
// $('[coustomInput=1]').parent().html(orginV)
// const v = $(e.target).attr('val')
// }
// })
// $(document).off('change') // 防止重复绑定
// $(document).on('change', '[coustomInput] input', function () {
// $(this).parents('td').attr('val', $(this).val());
// var eve1 = new Event('change');
// var eve2 = new Event('input');
// var eve3 = new Event('click');
// const i = $(this).parents('td').attr('col');
// let patchDom = table.find('tbody').children('tr').eq(i - 1);
//
// if (patchDom.length === 0) {
// console.error('No such row found');
// return;
// }
//
// patchDom = patchDom.children().eq(-1);
//
// setTimeout(() => {
// if (patchDom.length === 0) {
// console.error('No such cell found');
// return;
// }
// patchDom[0].dispatchEvent(eve3); // Simulate click event
//
// setTimeout(() => {
// patchDom = patchDom.find('input');
// if (patchDom.length === 0) {
// console.error('No input found in the target cell');
// return;
// }
// patchDom.val($(this).val());
// patchDom[0].dispatchEvent(eve2);
// patchDom[0].dispatchEvent(eve1);
// }, 200);
// }, 500);
// });
}