|
|
|
@ -338,20 +338,20 @@ const isHaveSelection = ref(false);
|
|
|
|
|
let selectarr = ref([]); |
|
|
|
|
/** 设置每行颜色 */ |
|
|
|
|
const tableRowClassName = ({ row, rowIndex }: { row: TableDataType; rowIndex: number }) => { |
|
|
|
|
let sfcheck = false; |
|
|
|
|
selectarr.value.forEach((val, index) => { |
|
|
|
|
if (val == row) { |
|
|
|
|
sfcheck = true; |
|
|
|
|
// let sfcheck = false; |
|
|
|
|
let item = ''; |
|
|
|
|
|
|
|
|
|
for (let value of selectarr.value) { |
|
|
|
|
if (value == row) { |
|
|
|
|
item = value; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
selectCount.value.forEach(item => { |
|
|
|
|
if (index === 0) item.value = 0; |
|
|
|
|
item.value = computeNumber(item.value, '+', Number(val[item.prop] || 0)).result; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
if (sfcheck) { |
|
|
|
|
if (item) { |
|
|
|
|
return 'table-SelectedRow-bgcolor'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (props.tableRowClassName) return props.tableRowClassName(row, rowIndex); |
|
|
|
|
|
|
|
|
|
return ''; |
|
|
|
@ -483,19 +483,26 @@ function timechange(value, column: TableColumnType) {
|
|
|
|
|
emit('timeCheck', value, column); |
|
|
|
|
} |
|
|
|
|
const handleSelectionChange = (param: TableDataType[]) => { |
|
|
|
|
// 重置数据 |
|
|
|
|
// selectCount.value.forEach(item => { |
|
|
|
|
// item.value = 0; |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
selectarr.value = param; |
|
|
|
|
// selectarr.value.forEach((val, index) => { |
|
|
|
|
// selectCount.value.forEach(item => { |
|
|
|
|
// if (index === 0) item.value = 0; |
|
|
|
|
// item.value = computeNumber(item.value, '+', Number(val[item.prop] || 0)).result; |
|
|
|
|
// }); |
|
|
|
|
// }); |
|
|
|
|
emit('selection', param); |
|
|
|
|
try { |
|
|
|
|
// 重置数据 |
|
|
|
|
for (const iterator of selectCount.value) { |
|
|
|
|
iterator.value = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (let index = 0; index < selectarr.value.length; index++) { |
|
|
|
|
const val = selectarr.value[index]; |
|
|
|
|
|
|
|
|
|
for (let item of selectCount.value) { |
|
|
|
|
if (index === 0) item.value = 0; |
|
|
|
|
item.value = computeNumber(item.value, '+', Number(val[item.prop] || 0)).result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log('error :>> ', error); |
|
|
|
|
} finally { |
|
|
|
|
emit('selection', param); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
function inputclear(value, column: TableColumnType) { |
|
|
|
|
emit('inputTxt', '', column); |
|
|
|
|