fix:添加网络题出题界面事件绑定
This commit is contained in:
@@ -278,7 +278,7 @@
|
||||
</div>
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<FileForm ref="FileRef" @success="handleUploadSuccess" />
|
||||
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="1500px">
|
||||
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="1500px" style="overflow: scroll;">
|
||||
<Email />
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -909,4 +909,4 @@ const openPoints = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@@ -196,75 +196,6 @@
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane> -->
|
||||
<el-tab-pane name="annex">
|
||||
<template #label>
|
||||
<div class="custom-tabs-label">
|
||||
<p>试题附件</p>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 提示 -->
|
||||
<el-alert type="warning" show-icon :closable="false">
|
||||
<template #default>
|
||||
<span>提示:文件名称可默认不设置</span>
|
||||
</template>
|
||||
</el-alert>
|
||||
<div class="block">
|
||||
<el-table :data="documentList" style="width: 100%">
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column label="文件名称" width="250">
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.fileName"
|
||||
size="small"
|
||||
placeholder="请输入文件名称(未输入自动命名)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="fileType"
|
||||
label="类型"
|
||||
:formatter="fileTypeFormatter"
|
||||
/>
|
||||
<el-table-column prop="url" label="地址" width="200">
|
||||
<template #default="{ row }">
|
||||
<div
|
||||
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis"
|
||||
:title="row.url"
|
||||
>
|
||||
{{ row.url }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm(scope.row.fileType)"
|
||||
size="small"
|
||||
>
|
||||
<Icon icon="ep:upload" class="mr-5px" /> 上传
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="downloadFile(scope.row.url)"
|
||||
size="small"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 下载
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
@click="deleteUrl(scope.$index)"
|
||||
size="small"
|
||||
><Icon icon="ep:download" class="mr-5px" />删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
@@ -278,54 +209,37 @@
|
||||
</div>
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<FileForm ref="FileRef" @success="handleUploadSuccess" />
|
||||
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="1100px">
|
||||
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="1100px" @close="handleFrom">
|
||||
<Setting />
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { FormRules } from 'element-plus'
|
||||
import * as QuestionApi from '@/api/paper/question'
|
||||
import * as WordApi from '@/api/wps/word'
|
||||
import FileForm from './components/FileForm.vue'
|
||||
import Setting from '@/components/Setting/index.vue'
|
||||
import * as SpecialtyApi from '@/api/points'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { handleTree } from '@/utils/tree'
|
||||
import { useSettingStore } from '@/store/modules/settings'
|
||||
const settingStore = useSettingStore()
|
||||
// import { emitter } from '@/utils/eventBus'
|
||||
|
||||
defineOptions({ name: 'WpsWordFrom' })
|
||||
const wordPointsList = ref<Tree[]>([]) // 树形结构
|
||||
const wordPointsInfoList = ref<Tree[]>([]) // 树形结构
|
||||
|
||||
// onMounted(() => {
|
||||
// emitter.on('maskDisplay', handleFromC)
|
||||
// })
|
||||
|
||||
function handleFromC(data: any) {
|
||||
console.log(data.value)
|
||||
let index = 0
|
||||
for (let i = 0; i < data.value.length; i++) {
|
||||
var indexFlag = false
|
||||
for (let x = 0; x < list.value.length; x++) {
|
||||
if (data.value[i].content == list.value[x].content) {
|
||||
// 如果存在相同的数据话 不进入
|
||||
indexFlag = true
|
||||
}
|
||||
}
|
||||
if (!indexFlag) {
|
||||
index += 1
|
||||
data.value[i].sort = index
|
||||
data.value[i].scoreRate = "1"
|
||||
list.value.push(data.value[i])
|
||||
}
|
||||
}
|
||||
const list = ref<any>([]) // 列表的数
|
||||
const handleFrom = () => {
|
||||
list.value = [...settingStore.settingsFormList]
|
||||
// settingStore.clearSettingData()
|
||||
}
|
||||
const list = ref([]) // 列表的数
|
||||
|
||||
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 - 修改
|
||||
@@ -373,29 +287,8 @@ const formData = ref({
|
||||
}
|
||||
]
|
||||
})
|
||||
const wordPointsFun = ref({
|
||||
chineseName: '',
|
||||
function: ''
|
||||
})
|
||||
const wordPoints = ref({
|
||||
name: '',
|
||||
englishName: '',
|
||||
filePath: '',
|
||||
type: '',
|
||||
belongTo: '',
|
||||
isboo: '',
|
||||
function: '',
|
||||
unit: '',
|
||||
isExam: ''
|
||||
})
|
||||
let wordPointsInfosList: (typeof wordPoints)[] = []
|
||||
|
||||
function fileTypeFormatter(row, column, cellValue) {
|
||||
if (cellValue === '0') return '素材文件(上传ZIP)'
|
||||
if (cellValue === '1') return '考试文件'
|
||||
if (cellValue === '2') return '结果文件'
|
||||
return '未知类型'
|
||||
}
|
||||
|
||||
const documentList = ref([
|
||||
{
|
||||
quId: '',
|
||||
@@ -417,70 +310,11 @@ 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, checked, indeterminate)
|
||||
}
|
||||
|
||||
const addWordInfo = 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
|
||||
nodeFunctions.value = row.selectName
|
||||
englishNames.value = row.englishName
|
||||
const res = await WordApi.getWordInfos(queryParams)
|
||||
wordPointsInfoList.value = []
|
||||
wordPointsInfoList.value.push(...handleTree(res))
|
||||
dialogFormVisibleWordInfos.value = true
|
||||
}
|
||||
|
||||
const handleDelete = (row) => {
|
||||
for (let i = 0; i < list.value.length; i++) {
|
||||
if (row.content == list.value[i].content) {
|
||||
@@ -489,26 +323,6 @@ const handleDelete = (row) => {
|
||||
}
|
||||
}
|
||||
|
||||
const submitWordPoints = async () => {
|
||||
const res = await WordApi.getWordListInfos(wordPointsInfosList)
|
||||
wordPoints.value = {
|
||||
name: '',
|
||||
englishName: '',
|
||||
filePath: '',
|
||||
type: '',
|
||||
belongTo: '',
|
||||
isboo: '',
|
||||
function: '',
|
||||
unit: '',
|
||||
isExam: ''
|
||||
}
|
||||
|
||||
wordPointsInfosList = []
|
||||
|
||||
dialogFormVisibleWordInfo.value = false
|
||||
dialogFormVisibleWordInfos.value = false
|
||||
wordPointsList.value = []
|
||||
}
|
||||
const formRules = reactive<FormRules>({
|
||||
status: [{ required: true, message: '启用状态必填', trigger: 'blur' }]
|
||||
})
|
||||
@@ -593,6 +407,7 @@ const handleUploadSuccess = ({ url, fileType }) => {
|
||||
/** 打开弹窗 */
|
||||
const open = async (queryParams: any, type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
settingStore.settingsFormList = []
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
|
||||
@@ -604,6 +419,7 @@ const open = async (queryParams: any, type: string, id?: number) => {
|
||||
formData.value = res
|
||||
console.log(formData.value)
|
||||
list.value = formData.value.answerList
|
||||
settingStore.settingsFormList = [...list.value]
|
||||
documentList.value = res.fileUploads
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
@@ -620,16 +436,6 @@ const open = async (queryParams: any, type: string, id?: number) => {
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
// 转换函数:将大写字母 A-Z 映射为 0-25
|
||||
const mappedNumber = computed(() => {
|
||||
const char = radio.value.toUpperCase()
|
||||
const code = char.charCodeAt(0)
|
||||
if (code >= 65 && code <= 90) {
|
||||
return code - 65
|
||||
} else {
|
||||
return '请输入 A-Z 的字母'
|
||||
}
|
||||
})
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
@@ -662,48 +468,7 @@ const submitForm = async () => {
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
content: '',
|
||||
specialtyName: '',
|
||||
courseName: '',
|
||||
quBankName: '',
|
||||
required: '',
|
||||
chapteridDictText: '',
|
||||
analysis: '',
|
||||
quLevel: 0,
|
||||
pointNames: '',
|
||||
subjectName: '',
|
||||
status: '0',
|
||||
resourceValue: '',
|
||||
answerList: [
|
||||
{
|
||||
image: '',
|
||||
content: '',
|
||||
contentIn: '',
|
||||
scoreRate: ''
|
||||
}
|
||||
],
|
||||
fileUploads: [
|
||||
{
|
||||
quId: '',
|
||||
url: '',
|
||||
fileType: '0',
|
||||
fileName: ''
|
||||
},
|
||||
{
|
||||
quId: '',
|
||||
url: '',
|
||||
fileType: '1',
|
||||
fileName: ''
|
||||
},
|
||||
{
|
||||
quId: '',
|
||||
url: '',
|
||||
fileType: '2',
|
||||
fileName: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
documentList.value = [
|
||||
{
|
||||
quId: '',
|
||||
@@ -775,6 +540,7 @@ const openPoints = async () => {
|
||||
await getTree()
|
||||
dialogVisiblePoints.value = true
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.edit-dialog {
|
||||
@@ -918,4 +684,4 @@ const openPoints = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@@ -316,7 +316,7 @@
|
||||
<FdesignForm ref="fformRef" @success="getList" />
|
||||
<WpsWordForm ref="wformRef" @success="getList" />
|
||||
<WpsPptxForm ref="pformRef" @success="getList" />
|
||||
<SettingForm ref="setformRef" @success="getList" />
|
||||
<SettingForm ref="setformRef" @success="getList"/>
|
||||
<EmailForm ref="emailformRef" @success="getList" />
|
||||
<WpsExcelForm ref="xlsxformRef" @success="getList" />
|
||||
<PsForm ref="psformRef" @success="getList" />
|
||||
@@ -347,6 +347,8 @@ import DeptTree from './DeptTree.vue'
|
||||
import SpecialtyTree from './SpecialtyTree.vue'
|
||||
import { handleTree } from '@/utils/tree'
|
||||
import * as SpecialtyApi from '@/api/points'
|
||||
import { useSettingStore } from '@/store/modules/settings'
|
||||
const settingStore = useSettingStore()
|
||||
defineOptions({ name: 'SystemUser' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
@@ -403,6 +405,7 @@ const getList = async () => {
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
settingStore.clearSettingData() // 清除设置数据
|
||||
}
|
||||
/** 用户导入 */
|
||||
const handleImport = () => {
|
||||
|
Reference in New Issue
Block a user