修复历史贷款合同单选文本异常

This commit is contained in:
wkc
2026-04-30 10:05:27 +08:00
parent 938f9bb28e
commit e4a8cf4a13
2 changed files with 52 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
# 历史贷款合同单选异常文本修复实施记录
## 问题
- 历史贷款合同选择弹窗的选择列出现 `{ "cus...` 这类异常文本。
- 原因是 `el-radio` 使用整行对象 `scope.row` 作为 `label`Element UI 会把对象值渲染到单选文案区域。
## 修改
- `HistoryContractSelector.vue` 将单选绑定值从整行对象调整为 `selectedContractKey`
- 新增 `contractRadioValue(row, index)` 生成稳定单选值,优先使用历史贷款合同号。
- 保留 `selectedContract` 单独保存选中行对象,提交时仍向父组件返回完整合同记录。
- 隐藏单选组件内部 label 文案,选择列只展示单选圆点,不展示对象文本。
- `business-type-history-rate.test.js` 增加断言,禁止再出现 `:label="scope.row"`
## 验证
- 已执行并通过:
- `zsh -lic 'nvm use 14.21.3 >/dev/null && npm --prefix ruoyi-ui run test:business-type-history-rate'`
- 已启动后端和前端后使用 in-app browser 真实页面验证:
- 打开 `http://localhost:8080/index`
- 新增个人客户,选择业务种类 `存量转贷`
- 历史贷款合同选择弹窗正常展示客户内码、历史贷款合同号、历史贷款利率等字段。
- 选择列文本为空,不再出现 `{ "cus...` 或行对象 JSON 文本。
- 验证结果:`hasObjectText=false`
- 验证结束后已关闭测试弹窗。
- 验证结束后已停止本次启动的前端和后端进程,并确认 `8080``63310` 端口无监听。

View File

@@ -4,7 +4,14 @@
<el-table :data="contracts" v-loading="loading" @row-click="handleRowClick">
<el-table-column label="选择" align="center" width="70">
<template slot-scope="scope">
<el-radio v-model="selectedContract" :label="scope.row" type="radio">&nbsp;</el-radio>
<el-radio
class="history-contract-radio"
v-model="selectedContractKey"
:label="contractRadioValue(scope.row, scope.$index)"
@change="handleRadioChange(scope.row)"
>
<span class="history-contract-radio-text">选择</span>
</el-radio>
</template>
</el-table-column>
<el-table-column label="客户内码" prop="cust_isn" align="center" :show-overflow-tooltip="true"/>
@@ -41,7 +48,8 @@ export default {
},
data() {
return {
selectedContract: null
selectedContract: null,
selectedContractKey: null
}
},
computed: {
@@ -55,7 +63,14 @@ export default {
}
},
methods: {
handleRowClick(row) {
contractRadioValue(row, index) {
return row.loan_contract_history || `${row.cust_isn || ''}-${index}`
},
handleRowClick(row, column, event) {
this.selectedContract = row
this.selectedContractKey = this.contractRadioValue(row, this.contracts.indexOf(row))
},
handleRadioChange(row) {
this.selectedContract = row
},
confirmSelect() {
@@ -72,7 +87,14 @@ export default {
},
handleClose() {
this.selectedContract = null
this.selectedContractKey = null
}
}
}
</script>
<style scoped>
.history-contract-radio ::v-deep .el-radio__label {
display: none;
}
</style>