|
|
@ -722,6 +722,8 @@ |
|
|
pageSize: 100, |
|
|
pageSize: 100, |
|
|
totalPage: 0, |
|
|
totalPage: 0, |
|
|
height: 200, |
|
|
height: 200, |
|
|
|
|
|
// 选中行持久化相关 |
|
|
|
|
|
selectedRowKey: null, // 当前选中行的唯一标识 |
|
|
componentPartModelFlag: false, |
|
|
componentPartModelFlag: false, |
|
|
componentPartData: { |
|
|
componentPartData: { |
|
|
site: '', |
|
|
site: '', |
|
|
@ -1786,11 +1788,36 @@ |
|
|
this.pageSize = data.page.pageSize |
|
|
this.pageSize = data.page.pageSize |
|
|
this.totalPage = data.page.totalCount |
|
|
this.totalPage = data.page.totalCount |
|
|
if(this.dataList.length>0){ |
|
|
if(this.dataList.length>0){ |
|
|
this.$refs.mainTable.setCurrentRow(this.dataList[0]); |
|
|
|
|
|
this.changeData(this.dataList[0]) |
|
|
|
|
|
this.dataList.forEach(o => { |
|
|
this.dataList.forEach(o => { |
|
|
o.modifyLabel = !!o.modifyFlag?'是':''; |
|
|
o.modifyLabel = !!o.modifyFlag?'是':''; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 使用 $nextTick 确保 DOM 渲染完成后再设置选中行 |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
try { |
|
|
|
|
|
// 检查表格引用是否存在 |
|
|
|
|
|
if (!this.$refs.mainTable) { |
|
|
|
|
|
console.warn('[行选择持久化] 表格引用不存在,跳过设置选中行'); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 尝试恢复之前选中的行 |
|
|
|
|
|
const restoredRow = this.restoreSelectedRow(); |
|
|
|
|
|
if (restoredRow) { |
|
|
|
|
|
this.$refs.mainTable.setCurrentRow(restoredRow); |
|
|
|
|
|
this.changeData(restoredRow); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果没有之前选中的行,默认选中第一行 |
|
|
|
|
|
this.$refs.mainTable.setCurrentRow(this.dataList[0]); |
|
|
|
|
|
this.changeData(this.dataList[0]); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('[行选择持久化] 设置选中行失败:', error); |
|
|
|
|
|
// 降级处理:只调用 changeData,不设置表格选中状态 |
|
|
|
|
|
const restoredRow = this.restoreSelectedRow(); |
|
|
|
|
|
this.changeData(restoredRow || this.dataList[0]); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}else { |
|
|
}else { |
|
|
this.changeData(null) |
|
|
this.changeData(null) |
|
|
} |
|
|
} |
|
|
@ -1861,6 +1888,13 @@ |
|
|
changeData(row){ |
|
|
changeData(row){ |
|
|
this.currentRow = JSON.parse(JSON.stringify(row)); |
|
|
this.currentRow = JSON.parse(JSON.stringify(row)); |
|
|
this.headerData=row; |
|
|
this.headerData=row; |
|
|
|
|
|
|
|
|
|
|
|
// 保存选中行的唯一标识到本地存储 |
|
|
|
|
|
if (row && row.delNo) { |
|
|
|
|
|
this.selectedRowKey = row.delNo; |
|
|
|
|
|
this.saveSelectedRowToStorage(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.refreshCurrentTabTable (); |
|
|
this.refreshCurrentTabTable (); |
|
|
}, |
|
|
}, |
|
|
importModel(){ |
|
|
importModel(){ |
|
|
@ -1912,6 +1946,12 @@ |
|
|
} |
|
|
} |
|
|
updateEcssDelHeader(this.updateHeaderModel).then(({data}) => { |
|
|
updateEcssDelHeader(this.updateHeaderModel).then(({data}) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
|
|
|
// 保存当前选中行的标识,以便刷新后恢复 |
|
|
|
|
|
const currentSelectedKey = this.currentRow ? this.currentRow.delNo : null; |
|
|
|
|
|
if (currentSelectedKey) { |
|
|
|
|
|
this.selectedRowKey = currentSelectedKey; |
|
|
|
|
|
this.saveSelectedRowToStorage(); |
|
|
|
|
|
} |
|
|
this.searchTable() |
|
|
this.searchTable() |
|
|
this.updateHeaderModelFlag = false |
|
|
this.updateHeaderModelFlag = false |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
@ -1931,6 +1971,10 @@ |
|
|
this.$confirm('确认删除吗?', '提示').then(() => { |
|
|
this.$confirm('确认删除吗?', '提示').then(() => { |
|
|
deleteEcssDelHeader(row).then(({data}) => { |
|
|
deleteEcssDelHeader(row).then(({data}) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
|
|
|
// 如果删除的是当前选中行,清除选中状态 |
|
|
|
|
|
if (this.currentRow && this.currentRow.delNo === row.delNo) { |
|
|
|
|
|
this.clearSelectedRowStorage(); |
|
|
|
|
|
} |
|
|
this.searchTable() |
|
|
this.searchTable() |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
message: '操作成功', |
|
|
message: '操作成功', |
|
|
@ -1967,6 +2011,12 @@ |
|
|
this.$confirm('确认废弃吗?', '提示').then(() => { |
|
|
this.$confirm('确认废弃吗?', '提示').then(() => { |
|
|
cancelEcssDelHeader(row).then(({data}) => { |
|
|
cancelEcssDelHeader(row).then(({data}) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
|
|
|
// 保存当前选中行的标识,以便刷新后恢复 |
|
|
|
|
|
const currentSelectedKey = row ? row.delNo : null; |
|
|
|
|
|
if (currentSelectedKey) { |
|
|
|
|
|
this.selectedRowKey = currentSelectedKey; |
|
|
|
|
|
this.saveSelectedRowToStorage(); |
|
|
|
|
|
} |
|
|
this.searchTable() |
|
|
this.searchTable() |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
message: '操作成功', |
|
|
message: '操作成功', |
|
|
@ -1986,6 +2036,12 @@ |
|
|
this.$confirm('确认取消废弃吗?', '提示').then(() => { |
|
|
this.$confirm('确认取消废弃吗?', '提示').then(() => { |
|
|
recoverEcssDelHeader(row).then(({data}) => { |
|
|
recoverEcssDelHeader(row).then(({data}) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
|
|
|
// 保存当前选中行的标识,以便刷新后恢复 |
|
|
|
|
|
const currentSelectedKey = row ? row.delNo : null; |
|
|
|
|
|
if (currentSelectedKey) { |
|
|
|
|
|
this.selectedRowKey = currentSelectedKey; |
|
|
|
|
|
this.saveSelectedRowToStorage(); |
|
|
|
|
|
} |
|
|
this.searchTable() |
|
|
this.searchTable() |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
message: '操作成功', |
|
|
message: '操作成功', |
|
|
@ -2042,6 +2098,12 @@ |
|
|
|
|
|
|
|
|
changeEcssDelStatus(inData).then(({data}) => { |
|
|
changeEcssDelStatus(inData).then(({data}) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
|
|
|
// 保存当前选中行的标识,以便刷新后恢复 |
|
|
|
|
|
const currentSelectedKey = this.currentRow ? this.currentRow.delNo : null; |
|
|
|
|
|
if (currentSelectedKey) { |
|
|
|
|
|
this.selectedRowKey = currentSelectedKey; |
|
|
|
|
|
this.saveSelectedRowToStorage(); |
|
|
|
|
|
} |
|
|
this.searchTable() |
|
|
this.searchTable() |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
message: '操作成功', |
|
|
message: '操作成功', |
|
|
@ -2078,6 +2140,12 @@ |
|
|
this.$confirm('确认取消下达吗?', '提示').then(() => { |
|
|
this.$confirm('确认取消下达吗?', '提示').then(() => { |
|
|
changeEcssDelStatus(inData).then(({data}) => { |
|
|
changeEcssDelStatus(inData).then(({data}) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
|
|
|
// 保存当前选中行的标识,以便刷新后恢复 |
|
|
|
|
|
const currentSelectedKey = row ? row.delNo : null; |
|
|
|
|
|
if (currentSelectedKey) { |
|
|
|
|
|
this.selectedRowKey = currentSelectedKey; |
|
|
|
|
|
this.saveSelectedRowToStorage(); |
|
|
|
|
|
} |
|
|
this.searchTable() |
|
|
this.searchTable() |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
message: '操作成功', |
|
|
message: '操作成功', |
|
|
@ -2103,6 +2171,12 @@ |
|
|
this.$confirm('确认一键结单吗?', '提示').then(() => { |
|
|
this.$confirm('确认一键结单吗?', '提示').then(() => { |
|
|
changeEcssDelStatus(inData).then(({data}) => { |
|
|
changeEcssDelStatus(inData).then(({data}) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
|
|
|
// 保存当前选中行的标识,以便刷新后恢复 |
|
|
|
|
|
const currentSelectedKey = row ? row.delNo : null; |
|
|
|
|
|
if (currentSelectedKey) { |
|
|
|
|
|
this.selectedRowKey = currentSelectedKey; |
|
|
|
|
|
this.saveSelectedRowToStorage(); |
|
|
|
|
|
} |
|
|
this.searchTable() |
|
|
this.searchTable() |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
message: '操作成功', |
|
|
message: '操作成功', |
|
|
@ -2552,6 +2626,70 @@ |
|
|
} |
|
|
} |
|
|
this.templateFlag = false |
|
|
this.templateFlag = false |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 保存选中行到本地存储 |
|
|
|
|
|
* 使用页面路径和用户名作为存储键的一部分,确保不同页面和用户的选择互不影响 |
|
|
|
|
|
*/ |
|
|
|
|
|
saveSelectedRowToStorage() { |
|
|
|
|
|
try { |
|
|
|
|
|
const storageKey = `codelnotify_selected_row_${this.$store.state.user.name}`; |
|
|
|
|
|
localStorage.setItem(storageKey, this.selectedRowKey); |
|
|
|
|
|
console.log(`[行选择持久化] 已保存选中行: ${this.selectedRowKey}`); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.warn('保存选中行状态失败:', error); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 从本地存储恢复选中行 |
|
|
|
|
|
* @returns {Object|null} 返回匹配的行数据,如果没有找到则返回null |
|
|
|
|
|
*/ |
|
|
|
|
|
restoreSelectedRow() { |
|
|
|
|
|
try { |
|
|
|
|
|
const storageKey = `codelnotify_selected_row_${this.$store.state.user.name}`; |
|
|
|
|
|
const savedRowKey = localStorage.getItem(storageKey); |
|
|
|
|
|
|
|
|
|
|
|
// 检查必要的条件 |
|
|
|
|
|
if (!savedRowKey) { |
|
|
|
|
|
console.log('[行选择持久化] 没有保存的选中行'); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!this.dataList || this.dataList.length === 0) { |
|
|
|
|
|
console.log('[行选择持久化] 数据列表为空,无法恢复选中行'); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 在当前数据列表中查找匹配的行 |
|
|
|
|
|
const matchedRow = this.dataList.find(row => row && row.delNo === savedRowKey); |
|
|
|
|
|
if (matchedRow) { |
|
|
|
|
|
this.selectedRowKey = savedRowKey; |
|
|
|
|
|
console.log(`[行选择持久化] 已恢复选中行: ${savedRowKey}`); |
|
|
|
|
|
return matchedRow; |
|
|
|
|
|
} else { |
|
|
|
|
|
console.log(`[行选择持久化] 未找到匹配的行: ${savedRowKey},当前数据列表长度: ${this.dataList.length}`); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.warn('恢复选中行状态失败:', error); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 清除本地存储的选中行状态 |
|
|
|
|
|
*/ |
|
|
|
|
|
clearSelectedRowStorage() { |
|
|
|
|
|
try { |
|
|
|
|
|
const storageKey = `codelnotify_selected_row_${this.$store.state.user.name}`; |
|
|
|
|
|
localStorage.removeItem(storageKey); |
|
|
|
|
|
this.selectedRowKey = null; |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.warn('清除选中行状态失败:', error); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
activated() { |
|
|
activated() { |
|
|
this.searchTable() |
|
|
this.searchTable() |
|
|
@ -2560,6 +2698,17 @@ |
|
|
this.getBu () |
|
|
this.getBu () |
|
|
// 动态列 |
|
|
// 动态列 |
|
|
this.getTableUserColumn(this.$route.meta.menuId+'table1',1) |
|
|
this.getTableUserColumn(this.$route.meta.menuId+'table1',1) |
|
|
|
|
|
|
|
|
|
|
|
// 初始化时从本地存储加载选中行状态 |
|
|
|
|
|
try { |
|
|
|
|
|
const storageKey = `codelnotify_selected_row_${this.$store.state.user.name}`; |
|
|
|
|
|
const savedRowKey = localStorage.getItem(storageKey); |
|
|
|
|
|
if (savedRowKey) { |
|
|
|
|
|
this.selectedRowKey = savedRowKey; |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.warn('初始化选中行状态失败:', error); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|