Commit 229bd9a0 by 李伟康

fix(dailyNewspaper): 恢复报表提交功能并添加表格行点击效果

- 恢复被注释的 submitReport 事件发射功能
- 为表格行添加点击状态样式和高亮效果
- 实现点击行后1秒自动清除选中状态
- 添加 clickedRowIndex 和 clickTimer 数据属性
- 优化行点击处理逻辑,支持单击选中和定时清除
1 parent 31d9334d
......@@ -39,7 +39,7 @@
<view
v-for="(row, rowIndex) in tableData"
:key="'row-' + rowIndex"
class="table-row"
:class="['table-row', { 'row-clicked': clickedRowIndex === rowIndex }]"
@click="handleRowClick(row, rowIndex)"
>
<!-- 左侧行表头 -->
......@@ -146,7 +146,9 @@ export default {
data () {
return {
tableData: [],
tableWidth: ''
tableWidth: '',
clickedRowIndex: -1, // 记录被点击的行索引
clickTimer: null // 定时器
}
},
watch: {
......@@ -172,7 +174,18 @@ export default {
return value !== null && value !== '' ? value : '-'
},
handleRowClick (row, rowIndex) {
// 清除之前的定时器
if (this.clickTimer) {
clearTimeout(this.clickTimer)
}
this.clickedRowIndex = rowIndex;
this.$emit('rowClick', row, rowIndex, this.tableIndex)
// 1秒后清除点击样式
this.clickTimer = setTimeout(() => {
this.clickedRowIndex = -1
}, 1000)
},
getTableWidth () {
const query = uni.createSelectorQuery()
......@@ -294,6 +307,18 @@ export default {
word-break: break-all;
}
// 点击行的样式
.row-clicked {
.data-cell {
background-color: rgba($color: #000000, $alpha: 0.05) !important;
}
.row-header-cell {
background-color: rgba($color: #000000, $alpha: 0.05) !important;
}
}
// 最后一行去掉底部边框
.table-row:last-child .data-cell,
.table-row:last-child .row-header-cell {
......
......@@ -127,7 +127,7 @@ export default {
reportParams.subformDataList = subformDataList
console.log(reportParams)
uni.hideLoading()
// this.$emit('submitReport', reportParams)
this.$emit('submitReport', reportParams)
} catch (error) {
uni.hideLoading()
uni.showToast({ title: error, icon: 'none' })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!