|
@@ -238,6 +238,7 @@
|
|
|
placeholder="请输入"
|
|
|
size="small"
|
|
|
style="width: calc(100% - 90px)"
|
|
|
+ @input="(value) => handleInput(value, index, sIndex, 'rule')"
|
|
|
/>
|
|
|
<el-select
|
|
|
v-model="sItem.categoryType"
|
|
@@ -483,6 +484,54 @@
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 添加知识库弹窗 -->
|
|
|
+ <el-dialog
|
|
|
+ title="知识库"
|
|
|
+ :visible.sync="knowledgeDialogVisible"
|
|
|
+ width="600px"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <div class="knowledge-content">
|
|
|
+ <!-- 搜索框 -->
|
|
|
+ <el-input
|
|
|
+ v-model="searchKeyword"
|
|
|
+ placeholder="请输入内容"
|
|
|
+ prefix-icon="el-icon-search"
|
|
|
+ style="margin-bottom: 15px;"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 知识库列表 -->
|
|
|
+ <el-table
|
|
|
+ :data="knowledgeList.filter(data => !searchKeyword || data.name.toLowerCase().includes(searchKeyword.toLowerCase()))"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ prop="id"
|
|
|
+ label="序号"
|
|
|
+ width="80"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="name"
|
|
|
+ label="知识库名称"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ width="120"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="handleKnowledgeSelect(scope.row)"
|
|
|
+ >
|
|
|
+ 选择
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -602,7 +651,12 @@ export default {
|
|
|
activeCategory: '',
|
|
|
currentSubCategories: [],
|
|
|
selectedCategory: null,
|
|
|
- currentSource: ''
|
|
|
+ currentSource: '',
|
|
|
+ currentInputSource: '', // 添加输入来源标识
|
|
|
+ knowledgeDialogVisible: false,
|
|
|
+ knowledgeList: [],
|
|
|
+ currentInputIndex: null,
|
|
|
+ currentRuleIndexForKnowledge: null
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -963,6 +1017,46 @@ export default {
|
|
|
if (!parentObj) return ''
|
|
|
const childObj = parentObj.child.find(child => child.field === childField)
|
|
|
return childObj ? childObj.field_name : ''
|
|
|
+ },
|
|
|
+ handleInput(value, ruleIndex, index, source = 'custom_basis') {
|
|
|
+ if (value && value.endsWith('@')) {
|
|
|
+ this.currentInputIndex = index
|
|
|
+ this.currentRuleIndexForKnowledge = ruleIndex
|
|
|
+ this.currentInputSource = source
|
|
|
+ this.knowledgeDialogVisible = true
|
|
|
+ this.getKnowledgeList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleKnowledgeSelect(item) {
|
|
|
+ if (this.currentInputIndex !== null && this.currentRuleIndexForKnowledge !== null) {
|
|
|
+ if (this.currentInputSource === 'rule') {
|
|
|
+ // 质控逻辑
|
|
|
+ const condition = this.ruleForm.rule[this.currentRuleIndexForKnowledge].condition_content[this.currentInputIndex]
|
|
|
+ if (condition) {
|
|
|
+ // 直接替换整个值,不保留@
|
|
|
+ condition.param2 = condition.param2.replace(/@.*$/, item.name)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 质控依据
|
|
|
+ const basis = this.ruleForm.rule[this.currentRuleIndexForKnowledge].custom_basis[this.currentInputIndex]
|
|
|
+ if (basis) {
|
|
|
+ // 直接替换整个值,不保留@
|
|
|
+ basis.input2 = basis.input2.replace(/@.*$/, item.name)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.knowledgeDialogVisible = false
|
|
|
+ },
|
|
|
+ async getKnowledgeList() {
|
|
|
+ try {
|
|
|
+ const res = await get_all_word_map({ status: 1 })
|
|
|
+ if (res && res.p) {
|
|
|
+ this.knowledgeList = Array.isArray(res.p) ? res.p : []
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取知识库列表失败:', error)
|
|
|
+ this.$message.error('获取知识库列表失败')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1062,4 +1156,8 @@ export default {
|
|
|
margin-left: -1px;
|
|
|
}
|
|
|
}
|
|
|
+.knowledge-content {
|
|
|
+ max-height: 500px;
|
|
|
+ overflow-y: auto;
|
|
|
+}
|
|
|
</style>
|