integrated_traffic_vue/src/views/archives_management/semester/components/paper.vue

181 lines
4.7 KiB
Vue
Raw Normal View History

2024-03-15 10:01:08 +08:00
<template>
<el-dialog
:title="title"
:model-value="type === 103"
width="1100px"
@close="fnClose"
>
<div class="tr mb">
<el-button type="primary" @click="fnExport"></el-button>
</div>
<div
class="title"
style="text-align: center; font-size: 28px; color: #000000"
>
{{ data.info.EXAMNAME }}
</div>
<div class="tc mt">(满分:{{ data.info.EXAMSCORE || 0 }})</div>
<dl v-for="(item, index) in data.questionList" :key="item.QUESTION_ID">
<dt>
<el-tag v-if="item.QUESTIONTYPE === '1'" type="success">
(单选题)
</el-tag>
<el-tag v-if="item.QUESTIONTYPE === '2'"> () </el-tag>
<el-tag v-if="item.QUESTIONTYPE === '3'" type="warning">
(判断题)
</el-tag>
<el-tag v-if="item.QUESTIONTYPE === '4'" type="danger">
(填空题)
</el-tag>
{{ index + 1 }}.{{ item.QUESTIONDRY }}
<span class="ml">
(题目分值{{ item.SCORE }} 正确答案{{ item.ANSWER }})
</span>
</dt>
<el-radio-group
v-if="item.QUESTIONTYPE === '1'"
v-model="item.ANSWER"
:disabled="true"
>
2024-03-20 15:45:42 +08:00
<el-radio value="A">A.{{ item.OPTIONA }}</el-radio>
<el-radio value="B">B.{{ item.OPTIONB }}</el-radio>
<el-radio value="C">C.{{ item.OPTIONC }}</el-radio>
<el-radio value="D">D.{{ item.OPTIOND }}</el-radio>
2024-03-15 10:01:08 +08:00
</el-radio-group>
<el-checkbox-group
v-if="item.QUESTIONTYPE === '2'"
v-model="item.checkList"
:disabled="true"
>
2024-03-20 15:45:42 +08:00
<el-checkbox value="A">A.{{ item.OPTIONA }}</el-checkbox>
<el-checkbox value="B">B.{{ item.OPTIONB }}</el-checkbox>
<el-checkbox value="C">C.{{ item.OPTIONC }}</el-checkbox>
<el-checkbox value="D">D.{{ item.OPTIOND }}</el-checkbox>
2024-03-15 10:01:08 +08:00
</el-checkbox-group>
<el-radio-group
v-if="item.QUESTIONTYPE === '3'"
v-model="item.ANSWER"
:disabled="true"
class="panduan"
>
2024-03-20 15:45:42 +08:00
<el-radio value="A">A.{{ item.OPTIONA }}</el-radio>
2024-03-15 10:01:08 +08:00
<div class="el-radio"></div>
2024-03-20 15:45:42 +08:00
<el-radio value="B">B.{{ item.OPTIONB }}</el-radio>
2024-03-15 10:01:08 +08:00
<div class="el-radio"></div>
</el-radio-group>
</dl>
<template #footer>
<el-button @click="fnClose"></el-button>
</template>
</el-dialog>
</template>
<script setup>
import { reactive, watchEffect } from "vue";
import { ElMessageBox } from "element-plus";
import {
getClassPaper,
downloadExaminationpaper,
} from "@/request/training_archive_management.js";
const props = defineProps({
type: {
type: Number,
required: true,
},
title: {
type: String,
required: true,
},
clazzId: {
type: String,
required: true,
},
stageexampaperinputId: {
type: String,
required: true,
},
});
const data = reactive({
questionList: [],
info: {},
});
const emits = defineEmits(["update:type"]);
const fnGetData = async () => {
const resData = await getClassPaper({
STAGEEXAMPAPERINPUT_ID: props.stageexampaperinputId,
});
data.info = resData.paper;
data.questionList = resData.questionList;
for (let i = 0; i < data.questionList.length; i++) {
if (
data.questionList[i].QUESTIONTYPE === "2" &&
data.questionList[i].ANSWER
) {
data.questionList[i].checkList = data.questionList[i].ANSWER.split("");
}
}
};
watchEffect(() => {
if (props.type === 103) fnGetData();
});
const fnExport = async () => {
await ElMessageBox.confirm("确定要导出吗?", { type: "warning" });
await downloadExaminationpaper({
CLASS_ID: props.clazzId,
STAGEEXAMPAPERINPUT_ID: props.stageexampaperinputId,
});
await ElMessageBox.confirm("导出后请前往档案下载中下载该档案!", "温馨提示", {
type: "info",
});
};
const fnClose = () => {
emits("update:type", 0);
};
</script>
<style scoped lang="scss">
dl {
width: 100%;
}
:deep {
.el-radio__input.is-disabled + span.el-radio__label {
white-space: break-spaces;
word-break: break-all;
line-height: 20px;
}
.el-checkbox__input.is-disabled + span.el-checkbox__label {
white-space: break-spaces;
word-break: break-all;
line-height: 20px;
}
.el-radio-group {
width: 90%;
margin: 0 5%;
justify-content: space-between;
flex-wrap: wrap;
.el-radio {
width: 25%;
margin-right: 0;
height: auto;
min-height: 30px;
}
}
.el-checkbox-group {
width: 90%;
margin: 0 5%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.el-checkbox {
flex-basis: 25%;
margin-right: 0;
height: auto;
min-height: 30px;
line-height: 10px;
}
}
}
</style>