【修改】 word出题页面
This commit is contained in:
@@ -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<string[]>([])
|
||||
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 = []
|
||||
}
|
||||
|
Reference in New Issue
Block a user