feat: 问题管理

This commit is contained in:
wangdan-fit2cloud 2024-04-09 18:32:49 +08:00
parent 4114d86a8c
commit 254af265ba
3 changed files with 16 additions and 7 deletions

View File

@ -11,6 +11,7 @@
autofocus
:maxlength="quickCreateMaxlength"
:show-word-limit="quickCreateMaxlength ? true : false"
@keydown.enter="submitHandle"
/>
<el-button type="primary" @click="submitHandle" :disabled="loading">创建</el-button>

View File

@ -18,18 +18,13 @@
<el-form-item label="关联分段">
<template v-for="(item, index) in paragraphList" :key="index">
<CardBox
shadow="never"
:title="item.title || '-'"
class="paragraph-source-card cursor mb-8"
:showIcon="false"
@click.stop="editParagraph(item)"
>
<div class="active-button">
<span class="mr-4">
<el-tooltip effect="dark" content="编辑" placement="top">
<el-button type="primary" text @click.stop="editParagraph(item)">
<el-icon><EditPen /></el-icon>
</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="取消关联" placement="top">
<el-button type="primary" text @click.stop="disassociation(item)">
<AppIcon iconName="app-quxiaoguanlian"></AppIcon>

View File

@ -11,6 +11,7 @@
<el-scrollbar height="500" wrap-class="paragraph-scrollbar">
<div class="bold title align-center p-24 pb-0">选择文档</div>
<div class="p-8" style="padding-bottom: 8px">
<el-input v-model="filterDoc" placeholder="按 文档名称 搜索" prefix-icon="Search" />
<common-list
:data="documentList"
class="mt-8"
@ -107,6 +108,7 @@ const dialogVisible = ref<boolean>(false)
const loading = ref(false)
const documentList = ref<any[]>([])
const cloneDocumentList = ref<any[]>([])
const paragraphList = ref<any[]>([])
const currentProblemId = ref<String>('')
@ -116,6 +118,7 @@ const associationParagraph = ref<any[]>([])
const currentDocument = ref<String>('')
const search = ref('')
const searchType = ref('title')
const filterDoc = ref('')
const paginationConfig = reactive({
current_page: 1,
@ -166,8 +169,9 @@ function clickDocumentHandle(item: any) {
function getDocument() {
document.asyncGetAllDocument(id, loading).then((res: any) => {
cloneDocumentList.value = res.data
documentList.value = res.data
currentDocument.value = documentList.value?.length > 0 ? documentList.value[0].id : ''
currentDocument.value = cloneDocumentList.value?.length > 0 ? cloneDocumentList.value[0].id : ''
getParagraphList(currentDocument.value)
})
}
@ -204,6 +208,7 @@ function isAssociation(paragraphId: String) {
watch(dialogVisible, (bool) => {
if (!bool) {
documentList.value = []
cloneDocumentList.value = []
paragraphList.value = []
associationParagraph.value = []
@ -214,6 +219,14 @@ watch(dialogVisible, (bool) => {
}
})
watch(filterDoc, (val) => {
paragraphList.value = []
documentList.value = val
? cloneDocumentList.value.filter((item) => item.name.includes(val))
: cloneDocumentList.value
currentDocument.value = documentList.value?.length > 0 ? documentList.value[0].id : ''
})
const open = (problemId: string) => {
currentProblemId.value = problemId
getDocument()