mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-10 11:26:50 +08:00
feat(applicationManagement): 优化规则管理功能
- 新增规则类型、字段类型和风险类型字典列表接口 - 完善规则类型和字段类型的中文显示逻辑 - 优化规则列表查询功能,支持中文名称查询 - 修复规则状态切换逻辑
This commit is contained in:
@@ -121,3 +121,42 @@ export function batchAddRiskType(data) {
|
|||||||
data
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -37,7 +37,12 @@
|
|||||||
|
|
||||||
<!-- 归属机构下拉选择 -->
|
<!-- 归属机构下拉选择 -->
|
||||||
<el-form-item label="归属机构" prop="institution">
|
<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
|
<el-option
|
||||||
v-for="item in institutionList"
|
v-for="item in institutionList"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
@@ -56,7 +61,8 @@
|
|||||||
range-separator="至"
|
range-separator="至"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
value-format="yyyy-MM-dd">
|
value-format="yyyy-MM-dd"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -168,13 +174,17 @@ export default {
|
|||||||
|
|
||||||
getRecordPage(params)
|
getRecordPage(params)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
if (response) {
|
||||||
// 根据实际API返回结构调整,兼容Vue2语法
|
// 根据实际API返回结构调整,兼容Vue2语法
|
||||||
var content = response.content || {}
|
const content = response.content.content || {}
|
||||||
this.tableData = content.list || []
|
this.tableData = content.list || []
|
||||||
this.tableConfig.total = content.total || 0
|
this.tableConfig.total = content.total || 0
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.$message.error('获取记录列表失败: ' + (error.message || '未知错误'))
|
this.$message.error(
|
||||||
|
'获取记录列表失败: ' + (error.message || '未知错误')
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
|||||||
@@ -278,8 +278,26 @@ export default {
|
|||||||
this.submitLoading = true
|
this.submitLoading = true
|
||||||
// 根据是否为编辑模式调用不同接口
|
// 根据是否为编辑模式调用不同接口
|
||||||
const request = this.isEdit ? updateRule : createRule
|
const request = this.isEdit ? updateRule : createRule
|
||||||
|
|
||||||
|
// 创建提交参数的副本
|
||||||
const params = Object.assign({}, this.ruleForm)
|
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)
|
request(params)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$message.success(`${this.dialogTitle}成功`)
|
this.$message.success(`${this.dialogTitle}成功`)
|
||||||
|
|||||||
@@ -134,7 +134,10 @@ import {
|
|||||||
getRuleList,
|
getRuleList,
|
||||||
batchAddRuleType,
|
batchAddRuleType,
|
||||||
batchAddField,
|
batchAddField,
|
||||||
batchAddRiskType
|
batchAddRiskType,
|
||||||
|
getRuleTypeList,
|
||||||
|
getFieldTypeList,
|
||||||
|
getRiskTypeList
|
||||||
} from '@/api/riskCheck/rule'
|
} from '@/api/riskCheck/rule'
|
||||||
import RuleEditDialog from './components/RuleEditDialog.vue'
|
import RuleEditDialog from './components/RuleEditDialog.vue'
|
||||||
import RuleViewDialog from './components/RuleViewDialog.vue'
|
import RuleViewDialog from './components/RuleViewDialog.vue'
|
||||||
@@ -166,26 +169,11 @@ export default {
|
|||||||
ruleStatus: ''
|
ruleStatus: ''
|
||||||
},
|
},
|
||||||
// 规则类型选项列表
|
// 规则类型选项列表
|
||||||
ruleTypeList: [
|
ruleTypeList: [],
|
||||||
{ typeName: '基本信息', typeCode: 'basic_rule' },
|
|
||||||
{ typeName: '投保信息', typeCode: 'insurance_rule' }
|
|
||||||
],
|
|
||||||
// 字段类型选项列表
|
// 字段类型选项列表
|
||||||
fieldTypeList: [
|
fieldTypeList: [],
|
||||||
{ fieldComment: '保险期限(天)', fieldName: 'insurance_period' },
|
|
||||||
{ fieldComment: '投保金额', fieldName: 'insurance_amount' }
|
|
||||||
],
|
|
||||||
// 风险类型选项列表
|
// 风险类型选项列表
|
||||||
riskTypeList: [
|
riskTypeList: [],
|
||||||
{
|
|
||||||
riskType: '费率与投保方案不合理风险',
|
|
||||||
riskTypeCode: 'rate_plan_risk'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
riskType: '保险责任不明确风险',
|
|
||||||
riskTypeCode: 'insurance_liability_risk'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// 规则状态选项列表
|
// 规则状态选项列表
|
||||||
statusList: [{ label: '启用', value: 0 }, { label: '未启用', value: 1 }],
|
statusList: [{ label: '启用', value: 0 }, { label: '未启用', value: 1 }],
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
@@ -195,8 +183,40 @@ export default {
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
columns: [
|
columns: [
|
||||||
{ type: 'index', key: '序号', width: 60 },
|
{ 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: 'ruleDesc', key: '规则描述' },
|
||||||
{ prop: 'riskScript', key: '风险展示话术' },
|
{ prop: 'riskScript', key: '风险展示话术' },
|
||||||
{
|
{
|
||||||
@@ -293,6 +313,9 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList()
|
this.getList()
|
||||||
|
this.getRuleTypeList()
|
||||||
|
this.getFieldTypeList()
|
||||||
|
this.getRiskTypeList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取规则列表数据
|
// 获取规则列表数据
|
||||||
@@ -316,9 +339,79 @@ export default {
|
|||||||
this.loading = false
|
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() {
|
handleQuery() {
|
||||||
this.queryParams.page = 1
|
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()
|
this.getList()
|
||||||
},
|
},
|
||||||
// 重置按钮点击事件
|
// 重置按钮点击事件
|
||||||
@@ -380,7 +473,7 @@ export default {
|
|||||||
handleToggleStatus(row) {
|
handleToggleStatus(row) {
|
||||||
// 1 停用 0 启用
|
// 1 停用 0 启用
|
||||||
// 启用的数据能停用,停用的数据反之
|
// 启用的数据能停用,停用的数据反之
|
||||||
const newStatus = row.ruleStatus === 0 ? 'enable' : 'disabled'
|
const newStatus = row.ruleStatus === 1 ? 'enable' : 'disabled'
|
||||||
const statusText = row.ruleStatus === 0 ? '停用' : '启用'
|
const statusText = row.ruleStatus === 0 ? '停用' : '启用'
|
||||||
|
|
||||||
this.$messageBox(
|
this.$messageBox(
|
||||||
|
|||||||
Reference in New Issue
Block a user