|
|
|
|
@ -109,7 +109,7 @@ let dynamicTable = resource => {
|
|
|
|
|
background: evenRowBGC
|
|
|
|
|
};
|
|
|
|
|
const th_tdCSS = {
|
|
|
|
|
color:'#59B2F6',
|
|
|
|
|
color: '#59B2F6',
|
|
|
|
|
margin: 'auto 0',
|
|
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
|
overflow: "hidden",
|
|
|
|
|
@ -144,7 +144,7 @@ let dynamicTable = resource => {
|
|
|
|
|
$(ele + '>.table>.tbody').append('<div class="tr"></div>');
|
|
|
|
|
if (colIndex) {
|
|
|
|
|
$(ele + '>.table>.tbody>.tr:eq(' + i + ')').append(
|
|
|
|
|
`<div class="td"><span class="index">${i+1}</span></div>`)
|
|
|
|
|
`<div class="td"><span class="index">${i + 1}</span></div>`)
|
|
|
|
|
}
|
|
|
|
|
rowData[i].forEach(element => {
|
|
|
|
|
if (element == "一级") {
|
|
|
|
|
@ -194,8 +194,8 @@ let dynamicTable = resource => {
|
|
|
|
|
|
|
|
|
|
//统一计量单位
|
|
|
|
|
const emptyUnit = element => element.replace(/[^0-9]/g, '');
|
|
|
|
|
const hendlen = $(`${ele}>.table>.thead>.tr>.th`).length;
|
|
|
|
|
const bodylen = $(`${ele}>.table>.tbody>.tr:nth-child(1)>.td`).length;
|
|
|
|
|
const hendlen = $(`${ele} > .table > .thead > .tr > .th`).length;
|
|
|
|
|
const bodylen = $(`${ele} > .table > .tbody > .tr:nth-child(1) > .td`).length;
|
|
|
|
|
const ceil = Math.ceil;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -204,18 +204,18 @@ let dynamicTable = resource => {
|
|
|
|
|
* nth-child() 是在匹配元素的父元素中选择第n个元素
|
|
|
|
|
*/
|
|
|
|
|
if (!colWidth) {
|
|
|
|
|
$(`${ele}>.table>.thead>.tr>.th`).css({
|
|
|
|
|
$(`${ele} > .table > .thead > .tr > .th`).css({
|
|
|
|
|
width: ceil(100 / hendlen) + '%'
|
|
|
|
|
});
|
|
|
|
|
$(`${ele}>.table>.tbody>.tr>.td`).css({
|
|
|
|
|
$(`${ele} > .table > .tbody > .tr > .td`).css({
|
|
|
|
|
width: ceil(100 / bodylen) + '%'
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
for (let i = 0; i < colWidth.length; i++) {
|
|
|
|
|
let emptyUnitColWidth = emptyUnit(colWidth[i]);
|
|
|
|
|
console.log(emptyUnitColWidth)
|
|
|
|
|
$(`${ele}>.table>.thead>.tr>.th:nth-child(${i+1})`).width(`${emptyUnitColWidth}%`);
|
|
|
|
|
$(`${ele}>.table>.tbody>.tr>.td:nth-child(${i+1})`).width(`${emptyUnitColWidth}%`);
|
|
|
|
|
$(`${ele} > .table > .thead > .tr > .th:nth-child(${i + 1})`).width(`${emptyUnitColWidth}%`);
|
|
|
|
|
$(`${ele} > .table > .tbody > .tr > .td:nth-child(${i + 1})`).width(`${emptyUnitColWidth}%`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -239,7 +239,7 @@ const tableAnimation = (el) => {
|
|
|
|
|
display: "flex",
|
|
|
|
|
background: oddRowBGC
|
|
|
|
|
};
|
|
|
|
|
let oddORevenCheck = $(`${el}>.table>.tbody>.tr`).length % 2 == 0 ? 'even' : 'odd';
|
|
|
|
|
let oddORevenCheck = $(`${el} > .table > .tbody > .tr`).length % 2 == 0 ? 'even' : 'odd';
|
|
|
|
|
setInterval(function () {
|
|
|
|
|
$(el + '>.table>.tbody>.tr:eq(0)').slideToggle(100, function () {
|
|
|
|
|
switch (oddORevenCheck) {
|
|
|
|
|
@ -256,10 +256,12 @@ const tableAnimation = (el) => {
|
|
|
|
|
});
|
|
|
|
|
}, 2000);
|
|
|
|
|
}
|
|
|
|
|
const flip = (el,time = 2000) => {
|
|
|
|
|
const flip = (el, time = 2000) => {
|
|
|
|
|
console.log($(el + '>.table>.tbody').scrollTop())
|
|
|
|
|
console.log($(el + '>.table>.tbody').outerHeight(true))
|
|
|
|
|
setInterval(function () {
|
|
|
|
|
$(el + '>.table>.tbody').animate({
|
|
|
|
|
scrollTop: $(el + '>.table>.tbody').scrollTop() + $(el + '>.table>.tbody').outerHeight(true)
|
|
|
|
|
},time)
|
|
|
|
|
}, 2000)
|
|
|
|
|
}, time)
|
|
|
|
|
}
|