【修改】 前端页面报错
This commit is contained in:
@@ -351,7 +351,7 @@ defineOptions({ name: 'WpsPptxFrom' })
|
|||||||
const pptxPointsList = ref<Tree[]>([]) // 树形结构
|
const pptxPointsList = ref<Tree[]>([]) // 树形结构
|
||||||
const pptxPointsInfoList = ref<Tree[]>([]) // 树形结构
|
const pptxPointsInfoList = ref<Tree[]>([]) // 树形结构
|
||||||
|
|
||||||
const list = ref([]) // 列表的数
|
const list = ref<any[]>([]) // 列表的数
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const loading = ref(false) // 列表的加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
@@ -404,17 +404,26 @@ const formData = ref({
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
let pptxPointsInfosList: (typeof pptxPoints)[] = []
|
// 定义 pptxPoints 类型
|
||||||
|
interface PptxPoints {
|
||||||
|
firstName: string;
|
||||||
|
index: string;
|
||||||
|
function: string;
|
||||||
|
examName: string;
|
||||||
|
examCode: string;
|
||||||
|
method?: string;
|
||||||
|
}
|
||||||
|
let pptxPointsInfosList: PptxPoints[] = []
|
||||||
const removePoint = (index: number) => {
|
const removePoint = (index: number) => {
|
||||||
list.value.splice(index, 1)
|
list.value.splice(index, 1)
|
||||||
}
|
}
|
||||||
function fileTypeFormatter(row, column, cellValue) {
|
function fileTypeFormatter(_row: any, _column: any, cellValue: any) {
|
||||||
if (cellValue === '0') return '素材文件(上传ZIP)'
|
if (cellValue === '0') return '素材文件(上传ZIP)'
|
||||||
if (cellValue === '1') return '考试文件'
|
if (cellValue === '1') return '考试文件'
|
||||||
if (cellValue === '2') return '结果文件'
|
if (cellValue === '2') return '结果文件'
|
||||||
return '未知类型'
|
return '未知类型'
|
||||||
}
|
}
|
||||||
const documentList = ref([
|
const documentList = ref<any[]>([
|
||||||
{
|
{
|
||||||
quId: '',
|
quId: '',
|
||||||
url: '',
|
url: '',
|
||||||
@@ -437,16 +446,18 @@ const documentList = ref([
|
|||||||
const dialogFormVisiblePptxInfo = ref(false)
|
const dialogFormVisiblePptxInfo = ref(false)
|
||||||
const dialogFormVisiblePptxInfos = ref(false)
|
const dialogFormVisiblePptxInfos = ref(false)
|
||||||
const titles = ref('')
|
const titles = ref('')
|
||||||
const filePath = ref('')
|
// const filePath = ref('') // 未使用,注释
|
||||||
|
|
||||||
const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean) => {
|
// Tree 类型扩展,或用 any 替代
|
||||||
|
const handleCheckChange = (data: any, _checked: boolean, _indeterminate: boolean) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
const pptxPoints = {
|
const pptxPoints: PptxPoints = {
|
||||||
firstName: '',
|
firstName: '',
|
||||||
index: '',
|
index: '',
|
||||||
function: '',
|
function: '',
|
||||||
examName: '',
|
examName: '',
|
||||||
examCode: ''
|
examCode: '',
|
||||||
|
method: ''
|
||||||
}
|
}
|
||||||
if (data.functions != null && data.functions != '') {
|
if (data.functions != null && data.functions != '') {
|
||||||
pptxPoints.firstName = chineseName.value
|
pptxPoints.firstName = chineseName.value
|
||||||
@@ -463,7 +474,11 @@ const file = ref()
|
|||||||
const getSlideDataInfo = async () => {
|
const getSlideDataInfo = async () => {
|
||||||
const fileInput = document.getElementById('slideFile') as HTMLInputElement
|
const fileInput = document.getElementById('slideFile') as HTMLInputElement
|
||||||
if (fileInput != null) {
|
if (fileInput != null) {
|
||||||
file.value = fileInput.files[0]
|
if (fileInput.files && fileInput.files[0]) {
|
||||||
|
file.value = fileInput.files[0]
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
const res = await PptxApi.getSlideDataInfo({ file: file.value })
|
const res = await PptxApi.getSlideDataInfo({ file: file.value })
|
||||||
pptxPointsList.value = []
|
pptxPointsList.value = []
|
||||||
pptxPointsList.value.push(...handleTree(res.data))
|
pptxPointsList.value.push(...handleTree(res.data))
|
||||||
@@ -475,9 +490,7 @@ const addPptxForm = async () => {
|
|||||||
dialogFormVisiblePptxInfo.value = true
|
dialogFormVisiblePptxInfo.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryParams = reactive({
|
// 已移除未使用的 queryParams
|
||||||
nodeFunction: undefined
|
|
||||||
})
|
|
||||||
const chineseName = ref('')
|
const chineseName = ref('')
|
||||||
const textIndex = ref()
|
const textIndex = ref()
|
||||||
|
|
||||||
@@ -495,7 +508,7 @@ const handleNodelClick = async (row: any) => {
|
|||||||
const handleDelete = (row) => {
|
const handleDelete = (row) => {
|
||||||
console.log(row)
|
console.log(row)
|
||||||
for (let i = 0; i < list.value.length; i++) {
|
for (let i = 0; i < list.value.length; i++) {
|
||||||
if (row.content == list.value[i].content) {
|
if ((row as any).content == (list.value[i] as any).content) {
|
||||||
list.value.splice(i, 1)
|
list.value.splice(i, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -518,7 +531,7 @@ const submitPptxPoints = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!indexFlag) {
|
if (!indexFlag) {
|
||||||
res.data[i].sort = list.value.length + 1
|
(res.data[i] as any).sort = list.value.length + 1
|
||||||
list.value.push(res.data[i])
|
list.value.push(res.data[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -559,7 +572,7 @@ const formRef = ref() // 表单 Ref
|
|||||||
const leftActiveName = ref('desc')
|
const leftActiveName = ref('desc')
|
||||||
// 右侧tab
|
// 右侧tab
|
||||||
const rightActiveName = ref('annex')
|
const rightActiveName = ref('annex')
|
||||||
const rightHandleClick = (tab, e) => {
|
const rightHandleClick = (tab) => {
|
||||||
rightActiveName.value = tab.paneName.value
|
rightActiveName.value = tab.paneName.value
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,17 +623,7 @@ const deleteUrl = (index: number) => {
|
|||||||
formData.value.fileUploads[index].fileName = ''
|
formData.value.fileUploads[index].fileName = ''
|
||||||
}
|
}
|
||||||
// 媒体文件
|
// 媒体文件
|
||||||
const mediumList = ref([] as any)
|
// 已移除未使用的 mediumList、handleMediumSelectionChange、handleDocumentSelectionChange 相关声明
|
||||||
const multipleMediumSelection = ref([] as any)
|
|
||||||
const handleMediumSelectionChange = (val: any) => {
|
|
||||||
multipleMediumSelection.value = val
|
|
||||||
}
|
|
||||||
const fileList = []
|
|
||||||
|
|
||||||
const multipleDocumentSelection = ref([] as any)
|
|
||||||
const handleDocumentSelectionChange = (val: any) => {
|
|
||||||
multipleDocumentSelection.value = val
|
|
||||||
}
|
|
||||||
const handleUploadSuccess = ({ url, fileType }) => {
|
const handleUploadSuccess = ({ url, fileType }) => {
|
||||||
const index = documentList.value.findIndex((item) => item.fileType === fileType)
|
const index = documentList.value.findIndex((item) => item.fileType === fileType)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
@@ -640,8 +643,8 @@ const open = async (queryParams: any, type: string, id?: number) => {
|
|||||||
const res = await QuestionApi.getQuestion(id)
|
const res = await QuestionApi.getQuestion(id)
|
||||||
formData.value = res
|
formData.value = res
|
||||||
console.log(formData.value)
|
console.log(formData.value)
|
||||||
list.value = formData.value.answerList
|
list.value = formData.value.answerList as any[]
|
||||||
documentList.value = res.fileUploads
|
documentList.value = res.fileUploads as any[]
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
@@ -658,20 +661,13 @@ const open = async (queryParams: any, type: string, id?: number) => {
|
|||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
// 转换函数:将大写字母 A-Z 映射为 0-25
|
// 转换函数:将大写字母 A-Z 映射为 0-25
|
||||||
const mappedNumber = computed(() => {
|
// radio 未被模板或逻辑使用,已移除
|
||||||
const char = radio.value.toUpperCase()
|
// mappedNumber 未被模板或逻辑使用,已移除
|
||||||
const code = char.charCodeAt(0)
|
|
||||||
if (code >= 65 && code <= 90) {
|
|
||||||
return code - 65
|
|
||||||
} else {
|
|
||||||
return '请输入 A-Z 的字母'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
/** 提交表单 */
|
/** 提交表单 */
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
formData.value.answerList = list.value
|
formData.value.answerList = list.value as any[]
|
||||||
formData.value.fileUploads = documentList.value
|
formData.value.fileUploads = documentList.value as any[]
|
||||||
const values = Object.values(formData)
|
const values = Object.values(formData)
|
||||||
console.log(values)
|
console.log(values)
|
||||||
// 校验表单
|
// 校验表单
|
||||||
@@ -721,7 +717,7 @@ const resetForm = () => {
|
|||||||
contentIn: '',
|
contentIn: '',
|
||||||
scoreRate: ''
|
scoreRate: ''
|
||||||
}
|
}
|
||||||
],
|
] as any[],
|
||||||
fileUploads: [
|
fileUploads: [
|
||||||
{
|
{
|
||||||
quId: '',
|
quId: '',
|
||||||
@@ -782,7 +778,7 @@ const handleTreeWithLevel = (list, level = 1) => {
|
|||||||
|
|
||||||
// 只允许点击第三级节点
|
// 只允许点击第三级节点
|
||||||
const treeRef = ref() // 引用 el-tree
|
const treeRef = ref() // 引用 el-tree
|
||||||
const handleNodeClick = (data, node) => {
|
const handleNodeClick = (data) => {
|
||||||
if (data.level === 3) {
|
if (data.level === 3) {
|
||||||
formData.value.pointNames = data.id
|
formData.value.pointNames = data.id
|
||||||
formData.value.pointNamesVo = data.name
|
formData.value.pointNamesVo = data.name
|
||||||
|
Reference in New Issue
Block a user