diff --git a/src/api/wps/word/index.ts b/src/api/wps/word/index.ts index f622e72..8e83761 100644 --- a/src/api/wps/word/index.ts +++ b/src/api/wps/word/index.ts @@ -1,6 +1,6 @@ import request from '@/config/axios' -export interface DocxVO { +export interface WordVO { id?: number parentId: number status: number @@ -9,49 +9,53 @@ export interface DocxVO { } // 查询Docx节点(精简)列表 -export const getSimpleDocxList = async (): Promise => { +export const getSimpleWordList = async (): Promise => { return await request.get({ url: '/exam/docx/simple-list' }) } // 查询Docx节点列表 -export const getDocxPage = async (params: PageParam) => { +export const getWordPage = async (params: PageParam) => { return await request.get({ url: '/exam/docx/list', params }) } // 查询Docx节点详情 -export const getDocx = async (id: number) => { +export const getWord = async (id: number) => { return await request.get({ url: '/exam/docx/get?id=' + id }) } // 新增Docx节点 -export const createDocx = async (data: DocxVO) => { +export const createWord = async (data: WordVO) => { return await request.post({ url: '/exam/docx/create', data: data }) } // 修改Docx节点 -export const updateDocx = async (params: DocxVO) => { +export const updateWord = async (params: WordVO) => { return await request.put({ url: '/exam/docx/update', data: params }) } // 删除Docx节点 -export const deleteDocx = async (id: number) => { +export const deleteWord = async (id: number) => { return await request.delete({ url: '/exam/docx/delete?id=' + id }) } // 查询Word节点列表(小类) 根据title查询出来下面所有的数据 -export const getDocxInfos = async (title: string) => { +export const getDocxByNameList = async (title: string) => { console.log(title) return await request.get({ url: '/exam/docx/getByNameList?title=' + title }) } // 2025-07-04 word统一获取考点 -export const getDocxMaster = async (path: String) => { +export const getWordMaster = async (path: String) => { return await request.get({ url: '/auto/wps/docxMaster?path=' + path }) } // 上传文件 -export const getDocxDataInfo = (data: any) => { +export const getWordDataInfo = (data: any) => { return request.upload({ url: '/auto/wps/docxDataInfo', data }) } + +export const getdocxMaster = (data: any) => { + return request.upload({ url: '/auto/wps/docxMaster', data }) +} diff --git a/src/views/paper/question/WpsWordForm.vue b/src/views/paper/question/WpsWordForm.vue index bf1f0e8..2391d26 100644 --- a/src/views/paper/question/WpsWordForm.vue +++ b/src/views/paper/question/WpsWordForm.vue @@ -356,7 +356,6 @@ const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 const loading = ref(false) // 列表的加载中 const dialogVisible = ref(false) // 弹窗的是否展示 -const isLoading = ref(false) const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 @@ -404,21 +403,7 @@ const formData = ref({ } ] }) -const wordPointsFun = ref({ - chineseName: '', - function: '' -}) -const wordPoints = ref({ - name: '', - englishName: '', - filePath: '', - type: '', - belongTo: '', - isboo: '', - function: '', - unit: '', - isExam: '' -}) + let wordPointsInfosList: (typeof wordPoints)[] = [] const removePoint = (index: number) => { list.value.splice(index, 1) @@ -451,55 +436,36 @@ const documentList = ref([ ]) const dialogFormVisibleWordInfo = ref(false) const dialogFormVisibleWordInfos = ref(false) -const nodeFunction = ref('') const titles = ref('') -const englishName = ref('') const filePath = ref('') -const upFilePath = ref('') - -const functionList = ref([]) -const wordData = reactive({ - chineseName: '', - englishName: '', - filePath: '', - function: [] as string[] -}) const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean) => { - // if (checked || indeterminate) { - // wordPoints.value.belongTo = data.belongTo - // wordPoints.value.parameter = data.isboo - // wordPoints.value.type = data.type - // wordPointsFun.value = { - // chineseName: '', - // function: '' - // } - // wordPointsFun.value.chineseName = data.toChinese - // wordPointsFun.value.function = data.nodeFunction - // wordPoints.value.function.push(cloneDeep(wordPointsFun.value)) - // console.log(wordPoints) - // } - if (data.titleType == '2') { - wordPoints.value.name = chineseName.value + data.toChinese - wordPoints.value.filePath = filePath.value - wordPoints.value.function = englishNames.value + data.nodeFunction - wordPoints.value.englishName = englishNames.value - wordPoints.value.belongTo = data.belongTo - wordPoints.value.isboo = data.isboo - wordPoints.value.type = data.type - wordPoints.value.unit = data.unit - wordPoints.value.isExam = '0' - wordPointsInfosList.push(cloneDeep(wordPoints.value)) + console.log(data) + const wordPoints = { + firstName: '', + index: '', + function: '', + examName: '', + examCode: '', + filePath: '' + } + if (data.functions != null && data.functions != "") { + wordPoints.firstName = chineseName.value + wordPoints.index = textIndex.value + wordPoints.function = data.functions + wordPoints.examName = data.chineseName + wordPoints.examCode = '111' + wordPoints.method = data.parameter + wordPointsInfosList.push(cloneDeep(wordPoints)) } - console.log(data, checked, indeterminate) } - +const file = ref() // 获取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 }) + file.value = fileInput.files[0] + const res = await WordApi.getWordDataInfo({ file: file.value }) wordPointsList.value = [] wordPointsList.value.push(...handleTree(res.data)) } @@ -514,28 +480,18 @@ const queryParams = reactive({ nodeFunction: undefined }) const chineseName = ref('') -const nodeFunctions = ref('') -const englishNames = ref('') - +const textIndex = ref() // 打开 const handleNodelClick = async (row: any) => { - - - - - - - queryParams.nodeFunction = row.selectName + console.log(row) + // 获取名称 chineseName.value = '【' + row.name + '】' - filePath.value = row.filePath - nodeFunctions.value = row.selectName - englishNames.value = row.englishName - const res = await WordApi.getWordInfos(queryParams) + textIndex.value = row.index + const res = await WordApi.getDocxByNameList(row.type) wordPointsInfoList.value = [] wordPointsInfoList.value.push(...handleTree(res)) dialogFormVisibleWordInfos.value = true - } const handleDelete = (row) => { console.log(row) @@ -547,33 +503,52 @@ const handleDelete = (row) => { } const submitWordPoints = async () => { - const res = await WordApi.getWordListInfos(wordPointsInfosList) - wordPoints.value = { - name: '', - englishName: '', - filePath: '', - type: '', - belongTo: '', - isboo: '', - function: '', - unit: '', - isExam: '' - } + console.log(wordPointsInfosList) + const res = await WordApi.getdocxMaster({ + data: JSON.stringify(wordPointsInfosList), + file: file.value + }) wordPointsInfosList = [] - for (let i = 0; i < res.length; i++) { + console.log(res) + for (let i = 0; i < res.data.length; i++) { var indexFlag = false for (let x = 0; x < list.value.length; x++) { - if (res[i].content == list.value[x].content) { + if (res.data[i].content == list.value[x].content) { // 如果存在相同的数据话 不进入 indexFlag = true } } if (!indexFlag) { - res[i].sort = list.value.length + 1 - list.value.push(res[i]) + res.data[i].sort = list.value.length + 1 + list.value.push(res.data[i]) } } - // dialogFormVisibleWordInfo.value = false + // wordPoints.value = { + // name: '', + // englishName: '', + // filePath: '', + // type: '', + // belongTo: '', + // isboo: '', + // function: '', + // unit: '', + // isExam: '' + // } + // wordPointsInfosList = [] + // for (let i = 0; i < res.length; i++) { + // var indexFlag = false + // for (let x = 0; x < list.value.length; x++) { + // if (res[i].content == list.value[x].content) { + // // 如果存在相同的数据话 不进入 + // indexFlag = true + // } + // } + // if (!indexFlag) { + // res[i].sort = list.value.length + 1 + // list.value.push(res[i]) + // } + // } + // // dialogFormVisibleWordInfo.value = false dialogFormVisibleWordInfos.value = false // wordPointsList.value = [] } diff --git a/src/views/wps/word/WordForm.vue b/src/views/wps/word/WordForm.vue index e15fd5b..cf51c12 100644 --- a/src/views/wps/word/WordForm.vue +++ b/src/views/wps/word/WordForm.vue @@ -23,11 +23,17 @@ - - + + - - + + + + + + + + @@ -39,56 +45,6 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - -