feat(applicationManagement): 优化规则管理功能

- 新增规则类型、字段类型和风险类型字典列表接口
- 完善规则类型和字段类型的中文显示逻辑
- 优化规则列表查询功能,支持中文名称查询
- 修复规则状态切换逻辑
This commit is contained in:
陈昱达
2025-07-24 15:09:55 +08:00
parent e2c2d034fb
commit 351bda18c5
4 changed files with 198 additions and 38 deletions

View File

@@ -120,4 +120,43 @@ export function batchAddRiskType(data) {
method: 'post',
data
})
}
}
/**
* 获取规则类型字典列表
* @param data 查询参数
* @returns {Promise}
*/
export function getRuleTypeList(data) {
return request({
url: getUrl('/risk/check/rule/type/list'),
method: 'post',
data
})
}
/**
* 获取字段类型字典列表
* @param data 查询参数
* @returns {Promise}
*/
export function getFieldTypeList(data) {
return request({
url: getUrl('/risk/check/field/list'),
method: 'post',
data
})
}
/**
* 获取风险类型字典列表
* @param data 查询参数
* @returns {Promise}
*/
export function getRiskTypeList(data) {
return request({
url: getUrl('/risk/types/list'),
method: 'post',
data
})
}

View File

@@ -25,7 +25,7 @@
placeholder="请输入审批单号"
></el-input>
</el-form-item>
<!-- 被保人名称输入框 -->
<el-form-item label="被保人名称" prop="insuredName">
<el-input
@@ -34,10 +34,15 @@
placeholder="请输入被保人名称"
></el-input>
</el-form-item>
<!-- 归属机构下拉选择 -->
<el-form-item label="归属机构" prop="institution">
<el-select v-model="queryParams.institution" size="medium" clearable placeholder="请选择归属机构">
<el-select
v-model="queryParams.institution"
size="medium"
clearable
placeholder="请选择归属机构"
>
<el-option
v-for="item in institutionList"
:label="item.label"
@@ -46,7 +51,7 @@
></el-option>
</el-select>
</el-form-item>
<!-- 提交时间范围选择 -->
<el-form-item label="提交时间" prop="submitTime">
<el-date-picker
@@ -56,11 +61,12 @@
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd">
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
</el-form>
<!-- 查询操作按钮 -->
<div class="mt15 flex align-items-c justify-content-b">
<el-button size="medium" type="primary" @click="handleQuery"
@@ -70,7 +76,7 @@
</div>
</div>
</div>
<!-- 记录列表表格 -->
<r-table
:columns="tableConfig.columns"
@@ -158,23 +164,27 @@ export default {
getList() {
this.loading = true
const params = Object.assign({}, this.queryParams)
// 处理时间范围参数
if (params.submitTime && params.submitTime.length === 2) {
params.submitTimeStart = params.submitTime[0]
params.submitTimeEnd = params.submitTime[1]
}
delete params.submitTime
getRecordPage(params)
.then(response => {
// 根据实际API返回结构调整兼容Vue2语法
var content = response.content || {}
this.tableData = content.list || []
this.tableConfig.total = content.total || 0
if (response) {
// 根据实际API返回结构调整兼容Vue2语法
const content = response.content.content || {}
this.tableData = content.list || []
this.tableConfig.total = content.total || 0
}
})
.catch(error => {
this.$message.error('获取记录列表失败: ' + (error.message || '未知错误'))
this.$message.error(
'获取记录列表失败: ' + (error.message || '未知错误')
)
})
.finally(() => {
this.loading = false
@@ -225,4 +235,4 @@ export default {
}
}
}
</style>
</style>

View File

@@ -278,7 +278,25 @@ export default {
this.submitLoading = true
// 根据是否为编辑模式调用不同接口
const request = this.isEdit ? updateRule : createRule
// 创建提交参数的副本
const params = Object.assign({}, this.ruleForm)
// 将ruleType的值转换为对应的中文typeName
const selectedRuleType = this.ruleTypeList.find(
item => item.typeCode === params.ruleType
)
if (selectedRuleType) {
params.ruleType = selectedRuleType.typeName
}
// 将ruleField的值转换为对应的中文fieldComment
const selectedFieldType = this.fieldTypeList.find(
item => item.fieldName === params.ruleField
)
if (selectedFieldType) {
params.ruleField = selectedFieldType.fieldComment
}
request(params)
.then(response => {

View File

@@ -134,7 +134,10 @@ import {
getRuleList,
batchAddRuleType,
batchAddField,
batchAddRiskType
batchAddRiskType,
getRuleTypeList,
getFieldTypeList,
getRiskTypeList
} from '@/api/riskCheck/rule'
import RuleEditDialog from './components/RuleEditDialog.vue'
import RuleViewDialog from './components/RuleViewDialog.vue'
@@ -166,26 +169,11 @@ export default {
ruleStatus: ''
},
// 规则类型选项列表
ruleTypeList: [
{ typeName: '基本信息', typeCode: 'basic_rule' },
{ typeName: '投保信息', typeCode: 'insurance_rule' }
],
ruleTypeList: [],
// 字段类型选项列表
fieldTypeList: [
{ fieldComment: '保险期限(天)', fieldName: 'insurance_period' },
{ fieldComment: '投保金额', fieldName: 'insurance_amount' }
],
fieldTypeList: [],
// 风险类型选项列表
riskTypeList: [
{
riskType: '费率与投保方案不合理风险',
riskTypeCode: 'rate_plan_risk'
},
{
riskType: '保险责任不明确风险',
riskTypeCode: 'insurance_liability_risk'
}
],
riskTypeList: [],
// 规则状态选项列表
statusList: [{ label: '启用', value: 0 }, { label: '未启用', value: 1 }],
// 表格配置项
@@ -195,8 +183,40 @@ export default {
pageSize: 10,
columns: [
{ type: 'index', key: '序号', width: 60 },
{ prop: 'ruleType', key: '规则类型' },
{ prop: 'ruleField', key: '字段类型' },
{
prop: 'ruleType',
key: '规则类型',
render: (h, params) => {
// 将ruleType编码转换为中文显示
const ruleTypeItem = this.ruleTypeList.find(
item =>
item.typeCode === params.row.ruleType ||
item.typeName === params.row.ruleType
)
return h(
'span',
ruleTypeItem ? ruleTypeItem.typeName : params.row.ruleType
)
}
},
{
prop: 'ruleField',
key: '字段类型',
render: (h, params) => {
// 将ruleField编码转换为中文显示
const fieldTypeItem = this.fieldTypeList.find(
item =>
item.fieldName === params.row.ruleField ||
item.fieldComment === params.row.ruleField
)
return h(
'span',
fieldTypeItem
? fieldTypeItem.fieldComment
: params.row.ruleField
)
}
},
{ prop: 'ruleDesc', key: '规则描述' },
{ prop: 'riskScript', key: '风险展示话术' },
{
@@ -293,6 +313,9 @@ export default {
},
created() {
this.getList()
this.getRuleTypeList()
this.getFieldTypeList()
this.getRiskTypeList()
},
methods: {
// 获取规则列表数据
@@ -316,9 +339,79 @@ export default {
this.loading = false
})
},
// 获取规则类型选项列表
getRuleTypeList() {
getRuleTypeList({})
.then(response => {
// 根据实际API返回结构调整兼容Vue2语法
const content = response.content || {}
this.ruleTypeList = content.content || []
})
.catch(error => {
this.$message.error(
'获取规则类型列表失败: ' + (error.message || '未知错误')
)
})
},
// 获取字段类型选项列表
getFieldTypeList() {
getFieldTypeList({})
.then(response => {
// 根据实际API返回结构调整兼容Vue2语法
const content = response.content || {}
this.fieldTypeList = content.content || []
})
.catch(error => {
this.$message.error(
'获取字段类型列表失败: ' + (error.message || '未知错误')
)
})
},
// 获取风险类型选项列表
getRiskTypeList() {
getRiskTypeList({})
.then(response => {
// 根据实际API返回结构调整兼容Vue2语法
const content = response.content || {}
this.riskTypeList = content.content || []
})
.catch(error => {
this.$message.error(
'获取风险类型列表失败: ' + (error.message || '未知错误')
)
})
},
// 查询按钮点击事件
handleQuery() {
this.queryParams.page = 1
// 创建查询参数的副本
const queryParams = Object.assign({}, this.queryParams)
console.log(queryParams, this.ruleTypeList)
// 如果ruleType是中文转换为编码值
if (queryParams.ruleType) {
const ruleTypeItem = this.ruleTypeList.find(
item => item.typeCode === queryParams.ruleType
)
console.log(ruleTypeItem)
if (ruleTypeItem) {
console.log(ruleTypeItem)
queryParams.ruleType = ruleTypeItem.typeName
}
}
// 如果ruleField是中文转换为编码值
if (queryParams.ruleField) {
const fieldTypeItem = this.fieldTypeList.find(
item => item.fieldName === queryParams.ruleField
)
if (fieldTypeItem) {
queryParams.ruleField = fieldTypeItem.fieldComment
}
}
// 使用转换后的参数进行查询
this.queryParams = queryParams
this.getList()
},
// 重置按钮点击事件
@@ -380,7 +473,7 @@ export default {
handleToggleStatus(row) {
// 1 停用 0 启用
// 启用的数据能停用,停用的数据反之
const newStatus = row.ruleStatus === 0 ? 'enable' : 'disabled'
const newStatus = row.ruleStatus === 1 ? 'enable' : 'disabled'
const statusText = row.ruleStatus === 0 ? '停用' : '启用'
this.$messageBox(