【新增】试卷参数是否删除文件,docx4j验证word
This commit is contained in:
@@ -126,7 +126,7 @@
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item>
|
||||
<el-button @click="addWordInfo">添加</el-button>
|
||||
<el-button @click="addWordForm">添加</el-button>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
@@ -280,6 +280,8 @@
|
||||
<FileForm ref="FileRef" @success="handleUploadSuccess" />
|
||||
|
||||
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="70%">
|
||||
<input type="file" id="docxFile" accept=".docx" />
|
||||
<button @click="getDocxDataInfo">文件解析</button>
|
||||
<div style="height: 400px; overflow: hidden; display: flex; gap: 16px">
|
||||
<div style="flex: 0.5; overflow: auto; border: 1px solid #eee; padding: 8px">
|
||||
<h3>考点</h3>
|
||||
@@ -492,33 +494,38 @@ const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean)
|
||||
console.log(data, checked, indeterminate)
|
||||
}
|
||||
|
||||
const addWordInfo = async () => {
|
||||
var filePath = ''
|
||||
for (var i = 0; i < documentList.value.length; i++) {
|
||||
if (documentList.value[i].fileType == '2') {
|
||||
filePath = documentList.value[i].url
|
||||
}
|
||||
}
|
||||
// http://115.120.213.238:9000/exam/9f7d8f5d7c68cc2bfd03a23c19045efe7ba13a4bebeb833abece146908bcd0c6.docx documentList.value[1].url
|
||||
// if (filePath == '' || filePath == null) {
|
||||
// return
|
||||
// }
|
||||
dialogFormVisibleWordInfo.value = true
|
||||
isLoading.value = true
|
||||
if (wordPointsList.value.length <= 0) {
|
||||
const res = await WordApi.getWordInfo(filePath)
|
||||
isLoading.value = false
|
||||
// 获取docx文件,并使用文件流进行解析
|
||||
const getDocxDataInfo = async () => {
|
||||
const fileInput = document.getElementById('docxFile') as HTMLInputElement
|
||||
if (fileInput != null) {
|
||||
const file = fileInput.files[0]
|
||||
const res = await WordApi.getDocxDataInfo({ file: file })
|
||||
wordPointsList.value = []
|
||||
wordPointsList.value.push(...handleTree(res))
|
||||
wordPointsList.value.push(...handleTree(res.data))
|
||||
}
|
||||
}
|
||||
|
||||
// 打开考点窗口
|
||||
const addWordForm = async () => {
|
||||
dialogFormVisibleWordInfo.value = true
|
||||
}
|
||||
|
||||
const queryParams = reactive({
|
||||
nodeFunction: undefined
|
||||
})
|
||||
const chineseName = ref('')
|
||||
const nodeFunctions = ref('')
|
||||
const englishNames = ref('')
|
||||
|
||||
|
||||
// 打开
|
||||
const handleNodelClick = async (row: any) => {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
queryParams.nodeFunction = row.selectName
|
||||
chineseName.value = '【' + row.name + '】'
|
||||
filePath.value = row.filePath
|
||||
@@ -528,6 +535,7 @@ const handleNodelClick = async (row: any) => {
|
||||
wordPointsInfoList.value = []
|
||||
wordPointsInfoList.value.push(...handleTree(res))
|
||||
dialogFormVisibleWordInfos.value = true
|
||||
|
||||
}
|
||||
const handleDelete = (row) => {
|
||||
console.log(row)
|
||||
|
Reference in New Issue
Block a user