fix: 规则管理界面异常

1. 界面 “规则类型”枚举错误,“知识拆分规则”和“提示词规则”反了
This commit is contained in:
Huangzhe
2025-04-16 10:00:54 +08:00
parent 45e1b1d821
commit fca82aa481

View File

@@ -11,6 +11,10 @@ export default {
return {
// 表格配置项
tableConfig: {
ruleType: {
1: '提词规则',
2: '知识拆分规则'
},
total: 0,
currentPage: 1,
pageSize: 10,
@@ -90,8 +94,8 @@ export default {
if (this.form.query) {
// 过滤 ruleType
const map = {
1: '提示词规则',
2: '知识拆分规则'
1: '知识拆分规则',
2: '提词规则'
}
filteredData = this.tableData.filter(item => {
if (!this.form.ruleType) return true
@@ -114,23 +118,20 @@ export default {
}
return filteredData
},
// 获取表格数据
getCurrentTableData() {
// 需要处理 规则类型, 因为规则类型都是数字,需要转换成中文
return this.currentTableDate.map(item => ({
...item,
ruleType: item.ruleType === 1 ? '提示词规则' : '知识拆分规则'
ruleType: item.ruleType === 1 ? '知识拆分规则' : '提词规则'
}))
},
// 查询表单的 ruleTypeOptions
ruleTypeOptions() {
const map = {
1: '提示词规则',
2: '知识拆分规则'
}
// 去重所有 ruleType 然后映射成 option
return [...new Set(this.tableData.map(item => item.ruleType))].map(type => map[type])
return [...new Set(this.tableData.map(item => item.ruleType))].map(type => this.tableConfig.ruleType[type])
},
// 查询表单的 ruleNameOptions
ruleNameOptions() {
@@ -140,7 +141,8 @@ export default {
},
watch: {
form: {
handler() {},
handler() {
},
deep: true
}
},
@@ -182,7 +184,7 @@ export default {
// 处理修改规则
handleEdit(row, index) {
this.dialogOptions.title = '修改规则'
this.dialogOptions.currentComponent = row.ruleType === '知识拆分规则' ? 'EditPromptRule' : 'EditSplitRule'
this.dialogOptions.currentComponent = row.ruleType === '知识拆分规则' ? 'EditSplitRule' : 'EditPromptRule'
this.dialogOptions.visible = true
this.dialogOptions.currentRow = row
},
@@ -256,15 +258,9 @@ export default {
<!-- 创建时间 -->
<el-col :span="8">
<el-form-item label="创建时间">
<el-date-picker
v-model="form.createdDate"
type="daterange"
unlink-panels
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="form.pickerOptions"
>
<el-date-picker v-model="form.createdDate" type="daterange" unlink-panels range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期"
:picker-options="form.pickerOptions">
</el-date-picker>
</el-form-item>
</el-col>
@@ -272,7 +268,7 @@ export default {
<!-- 功能按钮组 查询重置新增规则 -->
<el-row class="p25">
<el-col :span="16">
<!-- <el-button size="mini" type="primary" @click="handleQuery">查询</el-button>-->
<!-- <el-button size="mini" type="primary" @click="handleQuery">查询</el-button>-->
<el-button size="mini" type="info" @click="handleReset">重置</el-button>
<el-button size="mini" type="primary" @click="handleAdd">新增规则</el-button>
</el-col>
@@ -282,27 +278,15 @@ export default {
<!-- 下方规则列表 -->
<div class="p20">
<r-table
:columns="tableConfig.columns"
:data="getCurrentTableData"
:deletion="false"
:total="tableConfig.total"
@currentChange="handleCurrentChange"
@sizeChange="handleSizeChange"
/>
<r-table :columns="tableConfig.columns" :data="getCurrentTableData" :deletion="false" :total="tableConfig.total"
@currentChange="handleCurrentChange" @sizeChange="handleSizeChange" />
</div>
</el-card>
<!-- 规则详情弹窗 -->
<el-drawer :visible.sync="dialogOptions.visible" size="50%" :title="dialogOptions.title">
<!-- diglog 弹窗内容组件 -->
<component
class="container"
v-if="dialogOptions.visible"
:is="dialogOptions.currentComponent"
:data="tableData"
:columns="columns"
:currentRow="dialogOptions.currentRow"
/>
<component class="container" v-if="dialogOptions.visible" :is="dialogOptions.currentComponent" :data="tableData"
:columns="columns" :currentRow="dialogOptions.currentRow" />
</el-drawer>
</div>
</template>