1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <template>
- <div class="school-set-recognition part-box part-box-pad">
- <el-form ref="modalFormComp" :model="modalForm" label-width="160px">
- <el-form-item label="客观题检查扩展条件:">
- <el-checkbox v-model="modalForm.avoidSingleChoice">
- 单选题有且仅有一个识别答案不进客观题检查
- </el-checkbox>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" :loading="loading" @click="confirm"
- >保存</el-button
- >
- </el-form-item>
- </el-form>
- </div>
- </template>
- <script>
- import {
- schoolSetRecognitionInfo,
- schoolSetRecognitionUpdate,
- } from "../../api";
- export default {
- name: "SchoolSetRecognition",
- props: {
- school: {
- type: Object,
- default() {
- return {};
- },
- },
- },
- data() {
- return {
- modalForm: {
- avoidSingleChoice: false,
- },
- loading: false,
- };
- },
- mounted() {
- this.initData();
- },
- methods: {
- async initData() {
- const data = await schoolSetRecognitionInfo(this.school.id);
- this.modalForm.avoidSingleChoice = data?.value === "true";
- },
- async confirm() {
- const valid = await this.$refs.modalFormComp.validate().catch(() => {});
- if (!valid) return;
- if (this.loading) return;
- this.loading = true;
- const datas = {
- enable: this.modalForm.avoidSingleChoice,
- schoolId: this.school.id,
- };
- const res = await schoolSetRecognitionUpdate(datas).catch(() => {});
- this.loading = false;
- if (!res) return;
- this.$message.success("修改成功!");
- },
- },
- };
- </script>
|