hyc #1

Merged
hyc merged 2 commits from hyc into master 2025-09-09 23:13:43 +08:00
Showing only changes of commit 79a7921102 - Show all commits

View File

@@ -323,6 +323,19 @@
--> -->
</el-dialog> </el-dialog>
<el-dialog v-model="dialogFormVisibleWordInfos" :title="titles" width="300px"> <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 <el-tree
style="max-width: 600px" style="max-width: 600px"
:data="wordPointsInfoList" :data="wordPointsInfoList"
@@ -331,11 +344,13 @@
show-checkbox show-checkbox
@check-change="handleCheckChange" @check-change="handleCheckChange"
/> />
<template #footer> <template #footer>
<el-button type="primary" @click="submitWordPoints"> </el-button> <el-button type="primary" @click="submitWordPoints"> </el-button>
<el-button @click="dialogFormVisibleWordInfos = false"> </el-button> <el-button @click="dialogFormVisibleWordInfos = false"> </el-button>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as QuestionApi from '@/api/paper/question' import * as QuestionApi from '@/api/paper/question'
@@ -486,12 +501,23 @@ const queryParams = reactive({
const chineseName = ref('') const chineseName = ref('')
const textIndex = ref() const textIndex = ref()
const fileName = ref('')
const showFileInput = ref(false)
const fileNameError = ref(false)
// 打开 // 打开
const handleNodelClick = async (row: any) => { const handleNodelClick = async (row: any) => {
console.log(row) console.log(row)
// 获取名称 // 获取名称
chineseName.value = '【' + row.name + '】' chineseName.value = '【' + row.name + '】'
textIndex.value = row.index 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) const res = await WordApi.getDocxByNameList(row.type)
wordPointsInfoList.value = [] wordPointsInfoList.value = []
wordPointsInfoList.value.push(...handleTree(res)) wordPointsInfoList.value.push(...handleTree(res))
@@ -507,10 +533,18 @@ const handleDelete = (row) => {
} }
const submitWordPoints = async () => { const submitWordPoints = async () => {
if (showFileInput.value && !fileName.value.trim()) {
fileNameError.value = true
return
}
fileNameError.value = false
// TODO: 提交逻辑
console.log('提交的文件名:', fileName.value)
console.log(wordPointsInfosList) console.log(wordPointsInfosList)
const res = await WordApi.getdocxMaster({ const res = await WordApi.getdocxMaster({
data: JSON.stringify(wordPointsInfosList), data: JSON.stringify(wordPointsInfosList),
file: file.value file: file.value,
name:fileName.value
}) })
wordPointsInfosList = [] wordPointsInfosList = []
console.log(res) console.log(res)