【修改】文字考点出题页面增加输入框

This commit is contained in:
huababa1
2025-09-09 23:11:36 +08:00
parent 241696b152
commit 79a7921102

View File

@@ -323,6 +323,19 @@
-->
</el-dialog>
<el-dialog v-model="dialogFormVisibleWordInfos" :title="titles" width="300px">
<!-- 如果 row.type === 'file'显示输入框 -->
<div v-if="showFileInput" style="margin-bottom: 10px">
<el-input
v-model="fileName"
placeholder="请输入文件名"
clearable
style="width: 100%"
/>
<div v-if="fileNameError" style="color: red; font-size: 12px; margin-top: 4px;">
文件名不能为空
</div>
</div>
<el-tree
style="max-width: 600px"
:data="wordPointsInfoList"
@@ -331,11 +344,13 @@
show-checkbox
@check-change="handleCheckChange"
/>
<template #footer>
<el-button type="primary" @click="submitWordPoints"> </el-button>
<el-button @click="dialogFormVisibleWordInfos = false"> </el-button>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import * as QuestionApi from '@/api/paper/question'
@@ -486,12 +501,23 @@ const queryParams = reactive({
const chineseName = ref('')
const textIndex = ref()
const fileName = ref('')
const showFileInput = ref(false)
const fileNameError = ref(false)
// 打开
const handleNodelClick = async (row: any) => {
console.log(row)
// 获取名称
chineseName.value = '【' + row.name + '】'
textIndex.value = row.index
// 如果 type 是 file显示输入框
if (row.type === 'file') {
showFileInput.value = true
fileName.value = ''
} else {
showFileInput.value = false
}
const res = await WordApi.getDocxByNameList(row.type)
wordPointsInfoList.value = []
wordPointsInfoList.value.push(...handleTree(res))
@@ -507,10 +533,18 @@ const handleDelete = (row) => {
}
const submitWordPoints = async () => {
if (showFileInput.value && !fileName.value.trim()) {
fileNameError.value = true
return
}
fileNameError.value = false
// TODO: 提交逻辑
console.log('提交的文件名:', fileName.value)
console.log(wordPointsInfosList)
const res = await WordApi.getdocxMaster({
data: JSON.stringify(wordPointsInfosList),
file: file.value
file: file.value,
name:fileName.value
})
wordPointsInfosList = []
console.log(res)