<template>
  <div>
    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%">
      <el-form
        :model="dialogForm"
        ref="dialogForm"
        size="small"
        label-width="80px"
        :rules="rules"
        inline
        v-show="showSearch"
      >
        <!-- 试卷名称 -->
        <el-row>
          <el-form-item
            label="试卷名称"
            prop="examTemplateName"
            :rules="{ required: true, message: '请输入试卷名称', trigger: 'blur' }"
          >
            <el-input v-model="dialogForm.examTemplateName" v-no-whitespace />
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="抽取对象" required>
            <!-- 单选 -->
            <el-radio-group v-model="dialogForm.type" @input="changeRadio">
              <el-radio label="1">全部试题</el-radio>
              <el-radio label="2">自选试题</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="" prop="questionsLibraryIds" v-show="dialogForm.type === '2'">
            <!-- 下拉框 -->
            <el-select
              v-model="dialogForm.questionsLibraryIds"
              placeholder="请选择试题库"
              clearable
              filterable
              multiple
              class="mr-lt"
              @change="changeTestQuestions"
            >
              <el-option
                v-for="item in dialogForm.testQuestionsList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="" prop="testQuestionsNumber">
            <span class="mr-lt">共{{ dialogForm.testQuestionsNumber }}道试题</span>
          </el-form-item>
        </el-row>

        <el-row>
          <el-form-item label="抽取数量" required></el-form-item>
          <el-form-item label="单选题：" prop="singleNum">
            <el-input-number
              v-model="dialogForm.singleNum"
              :min="0"
              :max="99999"
              size="mini"
              :precision="0"
              @change="iptNumChange(1)"
            />
            <span>道</span>
          </el-form-item>
          <el-form-item label="多选题：" prop="multipleNum">
            <el-input-number
              v-model="dialogForm.multipleNum"
              :min="0"
              :max="99999"
              size="mini"
              :precision="0"
              @change="iptNumChange(2)"
            />
            <span>道</span>
          </el-form-item>
          <el-form-item label="判断题：" prop="judgeNum">
            <el-input-number
              v-model="dialogForm.judgeNum"
              :min="0"
              :max="99999"
              size="mini"
              :precision="0"
              @change="iptNumChange(3)"
            />
            <span>道</span>
          </el-form-item>
          <el-form-item label="简答题：" prop="shortNum">
            <el-input-number
              v-model="dialogForm.shortNum"
              :min="0"
              :max="99999"
              size="mini"
              :precision="0"
              @change="iptNumChange(4)"
            />
            <span>道</span>
          </el-form-item>
          <el-form-item label="自建题" prop="selfNum">
            <el-input-number
              v-model="dialogForm.selfNum"
              size="mini"
              :controls="false"
              :min="0"
              :max="999"
              disabled
              style="width: 60px; margin-left: 10px"
            />
            &nbsp;道
          </el-form-item>
          <!-- 创建试题 -->
          <el-form-item>
            <el-button type="primary" size="mini" @click="handleTopic">创建试题</el-button>
          </el-form-item>
        </el-row>

        <el-row>
          <el-form-item label="分值设置" required />
          <el-form-item label="单选题每题：" prop="singleScore" label-width="90">
            <el-input-number
              v-model="dialogForm.singleScore"
              :min="0"
              :max="999"
              size="mini"
              :precision="1"
              :controls="false"
              style="width: 60px"
              @change="iptNumChange(1)"
            />
            <span>分</span>
          </el-form-item>
          <el-form-item label="多选题每题：" prop="multipleScore" label-width="90">
            <el-input-number
              v-model="dialogForm.multipleScore"
              :min="0"
              :max="999"
              size="mini"
              :precision="1"
              :controls="false"
              style="width: 60px"
              @change="iptNumChange(2)"
            />
            <span>分</span>
          </el-form-item>
          <el-form-item label="判断题每题：" prop="judgeScore" label-width="90">
            <el-input-number
              v-model="dialogForm.judgeScore"
              :min="0"
              :max="999"
              size="mini"
              :precision="1"
              :controls="false"
              style="width: 60px"
              @change="iptNumChange(3)"
            />
            <span>分</span>
          </el-form-item>
          <el-form-item label="简答题每题：" prop="shortScore" label-width="90">
            <el-input-number
              v-model="dialogForm.shortScore"
              :min="0"
              :max="999"
              size="mini"
              :precision="1"
              :controls="false"
              style="width: 60px"
              @change="iptNumChange(4)"
            />
            <span>分</span>
          </el-form-item>
          <el-form-item label="合计分数：" prop="scoreSetting" label-width="90">
            <span>{{ dialogForm.scoreSetting }}分</span>
          </el-form-item>
          <el-form-item label="及格分数：" prop="passScore" label-width="90">
            <el-input-number
              v-model="dialogForm.passScore"
              :min="0"
              :max="999"
              size="mini"
              :precision="1"
              :controls="false"
              style="width: 60px"
              @change="iptNumChange(5)"
            />
            <span>分</span>
          </el-form-item>
        </el-row>

        <!-- 确认抽取 -->
        <el-row class="right-align">
          <el-form-item label=" " prop="confirm" label-width="90">
            <span style="color: #e47470; margin-right: 15px; font-size: 12px">*请先抽取试题后, 再保存</span>
            <el-button type="primary" size="mini" :loading="isLoading" @click="confirmExtract">确认抽取</el-button>
          </el-form-item>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button
          v-if="listType == 1 && showSave"
          size="mini"
          type="primary"
          :loading="saveLoading"
          @click="handleSave"
        >
          保 存
        </el-button>
      </span>

      <!-- <el-row :gutter="10" class="mb8">
        <el-col :span="1.5" v-if="isShow">
          <el-button type="primary" size="mini" @click="handlePreview" >试卷预览</el-button>
        </el-col>
        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
      </el-row> -->

      <!-- 列表 -->
      <el-table :data="tableData" fit highlight-current-row style="width: 100%" @selection-change="selectionChange">
        <!-- <el-table-column type="selection" width="55" align="center" /> -->
        <el-table-column
          type="index"
          width="55"
          label="序号"
          align="center"
          :index="indexContinuous(dialogForm.pageNum, dialogForm.pageSize)"
        />
        <el-table-column
          v-for="item in tableHeader"
          :key="item.prop"
          :prop="item.prop"
          :label="item.label"
          align="center"
        >
          <!-- 插槽 questionType: 1.单选题 2.多选题 3.判断题 4.简单题 -->
          <template v-slot="scope" v-if="item.prop == 'questionType'">
            <span v-if="scope.row.questionType == 1">单选题</span>
            <span v-else-if="scope.row.questionType == 2">多选题</span>
            <span v-else-if="scope.row.questionType == 3">判断题</span>
            <span v-else-if="scope.row.questionType == 4">简答题</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" v-if="listType == 1">
          <template slot-scope="scope">
            <el-button
              type="text"
              size="mini"
              @click="handleDelete(scope.row)"
              icon="el-icon-delete"
              style="color: #e47470"
            >
              删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页 -->
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="dialogForm.pageNum"
        :limit.sync="dialogForm.pageSize"
        @pagination="getList"
      />
    </el-dialog>

    <!-- 新建试题 -->
    <NewTestItem
      ref="NewTestItem"
      dialogTitle="新建试题"
      questionsLibraryId="0"
      :isNewExam="true"
      @getList="handleTopicIds"
    />
  </div>
</template>

<script>
import {
  getQuestionAndLibrary,
  extractTestQuestions,
  getTestQuestions,
  delTemplateExamQuestion,
  saveTemplateExamQuestion,
  getTestQuestionDetail,
  getQuestionAndLibraryByTask,
  extractTestQuestionsByTask,
  getTestQuestionsExam,
  delTemplateExamQuestionExam,
  saveTemplateExamQuestionExam,
  saveTemplateExamQuestionByTask,
  getTestQuestionDetailExam,
} from '@/api/educationalTraining/resourceAdministration'
import NewTestItem from './NewTestItem'
import { indexContinuous } from '@/utils/bonus'

export default {
  props: {
    isShow: {
      type: Boolean,
      default: true,
    },
  },
  components: {
    NewTestItem,
  },
  data() {
    return {
      isLoading: false,
      saveLoading: false,
      currentRow: {}, // 当前行数据
      showSearch: true,
      dialogTitle: '新建试卷',
      dialogVisible: false,
      total: 0,
      dialogForm: {
        pageNum: 1,
        pageSize: 10,
        // 抽取对象
        type: '1',
        // 试卷名称
        examTemplateName: '',
        // 试题
        questionsLibraryIds: [],
        selfBuildTopicIds: [], // 自建题ids
        // 题库下拉列表
        testQuestionsList: [],
        // 试题数
        testQuestionsNumber: 0,
        // 单选题
        singleNum: 0,
        // 多选题
        multipleNum: 0,
        // 判断题
        judgeNum: 0,
        // 简答题
        shortNum: 0,
        selfNum: 0, // 自建题
        // 自建单选
        selfSingleNum: 0,
        // 自建多选
        selfMultipleNum: 0,
        // 自建判断
        selfJudgeNum: 0,
        // 自建简答
        selfShortNum: 0,
        totalNum: 0, // 总题数
        // 单选题分值
        singleScore: 0,
        // 多选题分值
        multipleScore: 0,
        // 判断题分值
        judgeScore: 0,
        // 简答题分值
        shortScore: 0,
        // 合计分数
        scoreSetting: 0,
        // 及格分数
        passScore: 0,
      },
      questionNum: 0, // 试题数
      // 获取列表type
      listType: 1,
      saveType: 1,
      showSave: false, // 是否显示保存按钮
      rules: {
        questionsLibraryIds: [{ required: true, message: '请选择试题库', trigger: 'change' }],
      },
      tableHeader: [
        { prop: 'content', label: '题目' },
        { prop: 'questionType', label: '题型' },
        { prop: 'questionLabel', label: '标签' },
      ],
      tableData: [],
      // 自建题ids
      selfBuildTopicIds: [],
    }
  },
  // 监听: dialogForm的值有变化时, 设置 showSave 为false
  watch: {
    'dialogForm.singleNum': function () {
      this.showSave = false
    },
    'dialogForm.multipleNum': function () {
      this.showSave = false
    },
    'dialogForm.judgeNum': function () {
      this.showSave = false
    },
    'dialogForm.shortNum': function () {
      this.showSave = false
    },
    'dialogForm.selfNum': function () {
      this.showSave = false
    },
  },
  created() {},
  methods: {
    indexContinuous,
    // 展示弹框
    show(row) {
      console.log('🚀 ~ show ~ row:', row)
      console.log('🚀 ~ show ~ this.isShow:', this.isShow)
      this.dialogVisible = true
      this.saveType = 1

      setTimeout(() => {
        this.$refs.dialogForm.resetFields()
        this.selfBuildTopicIds = []
        this.listType = 1
        this.tableData = []
        this.total = 0
        this.dialogForm.type = '1'
        this.getQuestionAndLibrary()
      }, 200)
    },
    // 获取列表
    getList() {
      console.log('🚀 ~ getList ~ ', this.listType, this.isShow)
      const params = {
        pageNum: this.dialogForm.pageNum,
        pageSize: this.dialogForm.pageSize,
        examTemplateId: this.dialogForm.examTemplateId,
        type: this.listType,
      }
      if (this.isShow) {
        getTestQuestionsExam(params)
          .then(res => {
            console.log('🚀 ~ getList ~ res:', res)
            this.tableData = res.rows
            this.total = res.total
            this.isLoading = false
            this.questionNum = res.total
            this.totalScore()
            // this.getQuestionNum()
          })
          .catch(() => {
            this.isLoading = false
          })
      }
    },
    // 传递自建题 ids
    handleTopicIds(val) {
      console.log('🚀 ~ handleTopicIds ~ 自建题ids:', val)
      this.selfBuildTopicIds.push(val)
      this.selfBuildTopicIds = this.selfBuildTopicIds.filter(item => item)
      this.dialogForm.selfNum = this.selfBuildTopicIds.length
      this.dialogForm.selfBuildTopicIds = this.selfBuildTopicIds.map(item => item.questionId)
      if (val.questionType == '1') {
        this.dialogForm.selfSingleNum += 1
      } else if (val.questionType == '2') {
        this.dialogForm.selfMultipleNum += 1
      } else if (val.questionType == '3') {
        this.dialogForm.selfJudgeNum += 1
      } else if (val.questionType == '4') {
        this.dialogForm.selfShortNum += 1
      }
      this.totalScore()
    },
    // 获取下拉
    async getQuestionAndLibrary() {
      try {
        const params = {
          type: this.dialogForm.type,
        }
        let res = {}
        if (this.isShow) {
          res = await getQuestionAndLibraryByTask(params)
        }
        console.log('🚀 ~ getQuestionAndLibrary ~ res:', res.data.list[0].totalNum)
        if (this.dialogForm.type === '1') {
          this.dialogForm.testQuestionsNumber = res.data.list[0].totalNum
          console.log('🚀 ~ getQuestionAndLibrary ~ this.dialogForm:', this.dialogForm)
        } else {
          this.dialogForm.testQuestionsNumber = 0
          this.dialogForm.testQuestionsList = res.data.list
          this.dialogForm.testQuestionsList.forEach(item => {
            item.label = `${item.name} (${item.totalNum}题)`
            item.value = item.id
          })
          console.log('🚀 ~ getQuestionAndLibrary ~ this.dialogForm:', this.dialogForm)
        }
      } catch (error) {
        console.log('🚀 ~ getQuestionAndLibrary ~ error:', error)
      }
    },
    // 下拉框改变
    changeTestQuestions(val) {
      console.log('🚀 ~ changeTestQuestions ~ val:', val)
      this.dialogForm.questionsLibraryIds = val
      console.log(
        '🚀 ~ changeTestQuestions ~ this.dialogForm.questionsLibraryIds:',
        this.dialogForm.questionsLibraryIds
      )
      // 根据选中的id 从 testQuestionsList 中获取 totalNum 累加 赋值给 testQuestionsNumber
      let totalNum = 0
      this.dialogForm.questionsLibraryIds.forEach(item => {
        const obj = this.dialogForm.testQuestionsList.find(v => v.id === item)
        totalNum += obj.totalNum
      })
      this.dialogForm.testQuestionsNumber = totalNum
    },
    // 改变单选
    changeRadio(val) {
      console.log('🚀 ~ changeRadio ~ val:', val)
      this.dialogForm.type = val // 1:全部试题 2:自选试题
      // 清空ids
      this.dialogForm.questionsLibraryIds = []
      // 清除校验
      this.$refs.dialogForm.clearValidate('questionsLibraryIds')
      this.getQuestionAndLibrary()
    },
    // 确认抽取
    confirmExtract() {
      this.isLoading = true
      this.showSave = true
      // 单选,多选,判断,简答 加起来至少一道题
      this.totalNum =
        this.dialogForm.singleNum +
        this.dialogForm.multipleNum +
        this.dialogForm.judgeNum +
        this.dialogForm.shortNum +
        this.dialogForm.selfNum
      if (this.totalNum === 0) {
        this.$message.error('请至少选择一道题')
        this.isLoading = false
        return
      } else {
        console.log('🚀 ~ confirmExtract ~ ', this.currentRow)
        if (this.dialogForm.type === '2' && this.dialogForm.questionsLibraryIds.length === 0) {
          this.$message.error('请选择试题库')
          this.isLoading = false
          return
        }
        if (!this.dialogForm.examTemplateName) {
          this.$message.error('试卷名称不能为空')
          this.isLoading = false
          return
        }
        const params = {
          // examTemplateId: this.currentRow.examTemplateId,
          examTemplateName: this.dialogForm.examTemplateName,
          type: this.dialogForm.type,
          num: this.dialogForm.singleNum,
          num2: this.dialogForm.multipleNum,
          num3: this.dialogForm.judgeNum,
          num4: this.dialogForm.shortNum,
          num5: this.dialogForm.selfNum,
          questionsLibraryIds: this.dialogForm.questionsLibraryIds,
          templateType: this.isShow ? 1 : 2, // 1:试题库 2:练习库
          selfBuildTopicIds: this.dialogForm.selfBuildTopicIds,
        }
        console.log('🚀 ~ confirmExtract ~ params:', params)
        if (this.isShow) {
          extractTestQuestionsByTask(params)
            .then(res => {
              this.dialogForm.examTemplateId = res.data.examTemplateId
              this.listType = 1
              console.log('🚀 ~ confirmExtract ~ res:', res)
              this.getList()
            })
            .catch(() => {
              this.isLoading = false
            })
        }
      }
    },
    // 多选框
    selectionChange() {
      console.log('🚀 ~ selectionChange ~ ')
    },
    // 试卷预览
    handlePreview() {
      console.log('🚀 ~ handlePreview ~ ')
    },
    // 删除
    handleDelete(row) {
      console.log('🚀 ~ handleDelete ~ row:', row)
      // 弹框提示
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          // 删除
          console.log('删除', row)
          const params = {
            examPaperId: row.examPaperId,
            isSave: row.isSave,
          }
          if (this.isShow) {
            delTemplateExamQuestionExam(params).then(res => {
              console.log('🚀 ~ delTemplateExamQuestion ~ res:', res)
              // 根据删除的试卷的类型 减除对应的题数
              this.handleRow(row)
              // 刷新列表
              this.getList()
              this.$message.success('操作成功')
            })
          }
        })
        .catch(() => {
          // 取消
        })
    },
    handleRow(row) {
      console.log('🚀 ~ handleRow ~ row:', row)
      // 如果 row.questionId 在 selfBuildTopicIds 中, 从 selfBuildTopicIds 中删除
      if (this.dialogForm.selfBuildTopicIds.includes(row.questionId)) {
        this.dialogForm.selfNum -= 1
        this.dialogForm.selfBuildTopicIds = this.dialogForm.selfBuildTopicIds.filter(item => item !== row.questionId)
        this.selfBuildTopicIds = this.selfBuildTopicIds.filter(item => item.questionId !== row.questionId)
        if (row.questionType == 1) {
          this.dialogForm.selfSingleNum -= 1
        } else if (row.questionType == 2) {
          this.dialogForm.selfMultipleNum -= 1
        } else if (row.questionType == 3) {
          this.dialogForm.selfJudgeNum -= 1
        } else if (row.questionType == 4) {
          this.dialogForm.selfShortNum -= 1
        }
      } else {
        if (row.questionType == 1) {
          this.dialogForm.singleNum -= 1
        } else if (row.questionType == 2) {
          this.dialogForm.multipleNum -= 1
        } else if (row.questionType == 3) {
          this.dialogForm.judgeNum -= 1
        } else if (row.questionType == 4) {
          this.dialogForm.shortNum -= 1
        }
      }
      this.totalScore()
      setTimeout(() => {
        this.showSave = true
      }, 200)
      console.log('🚀 ~ handleRow ~ this.dialogForm:', this.dialogForm)
      console.log('🚀 ~ handleRow ~ this.selfBuildTopicIds:', this.selfBuildTopicIds)
    },
    // 保存
    handleSave() {
      this.totalScore()
      // 判断及格分数不能高于总分
      if (this.dialogForm.passScore > this.dialogForm.scoreSetting) {
        this.$message.error('及格分数不能高于总分')
        return
      }
      console.log('🚀 ~ handleSave ~ ', this.totalNum)
      this.saveLoading = true
      this.totalNum =
        this.dialogForm.singleNum +
        this.dialogForm.multipleNum +
        this.dialogForm.judgeNum +
        this.dialogForm.shortNum +
        this.dialogForm.selfNum
      if (this.totalNum === 0) {
        this.$message.error('请至少选择一道题')
        this.saveLoading = false
        return
      } else {
        console.log('🚀 ~ confirmExtract ~ ', this.currentRow)
        if (this.dialogForm.type === '2' && this.dialogForm.questionsLibraryIds.length === 0) {
          this.$message.error('请选择试题库')
          this.saveLoading = false
          return
        }
        let selfSingleNum = 0 // 自建单选
        let selfMultipleNum = 0 // 自建多选
        let selfJudgeNum = 0 // 自建判断
        let selfShortNum = 0 // 自建简答
        console.log('🚀 ~ 保存 ~ 自建ids:', this.selfBuildTopicIds)
        this.selfBuildTopicIds.forEach(item => {
          if (item.questionType == 1) {
            selfSingleNum += 1
          } else if (item.questionType == 2) {
            selfMultipleNum += 1
          } else if (item.questionType == 3) {
            selfJudgeNum += 1
          } else if (item.questionType == 4) {
            selfShortNum += 1
          }
        })
        const params = {
          examTemplateId: this.dialogForm.examTemplateId,
          type: 1,
          singleNum: this.dialogForm.singleNum + selfSingleNum,
          multipleNum: this.dialogForm.multipleNum + selfMultipleNum,
          judgeNum: this.dialogForm.judgeNum + selfJudgeNum,
          shortNum: this.dialogForm.shortNum + selfShortNum,
          templateType: 1, // 1:试题库 2:练习库
          singleScore: this.dialogForm.singleScore, // 单选分值
          multipleScore: this.dialogForm.multipleScore, // 多选分值
          judgeScore: this.dialogForm.judgeScore, // 判断分值
          shortScore: this.dialogForm.shortScore, // 简答分值
          passScore: this.dialogForm.passScore, // 及格分数
        }
        console.log('🚀 ~ handleSave ~ params:', params)
        if (this.isShow) {
          saveTemplateExamQuestionByTask(params)
            .then(res => {
              console.log('🚀 ~ handleSave ~ res:', res)
              this.saveLoading = false
              this.dialogVisible = false
              this.$message.success('操作成功')
              // this.$emit('getList')
              this.$emit('getDialogData', 1, [
                {
                  ...params,
                  examTemplateName: this.dialogForm.examTemplateName,
                  totalScore: this.dialogForm.scoreSetting,
                  questionNum: this.totalNum,
                },
              ])
            })
            .catch(() => {
              this.saveLoading = false
            })
        }
      }
    },
    // 输入框失焦 保留一位小数, 不足0.5向下取整, 大于0.5向上取整 0.5保留, 例如: 0.5 就是 0.5, 1.3 就是 1, 1.6 就是 2
    iptNumChange(type) {
      let val = ''
      if (type === 1) {
        val = this.dialogForm.singleScore || 0
      } else if (type === 2) {
        val = this.dialogForm.multipleScore || 0
      } else if (type === 3) {
        val = this.dialogForm.judgeScore || 0
      } else if (type === 4) {
        val = this.dialogForm.shortScore || 0
      } else if (type === 5) {
        val = this.dialogForm.passScore || 0
      }
      console.log('🚀 ~ iptNumChange ~ type:', type, val)

      val = parseFloat(val)
      if (val % 1 === 0) {
        // 整数
        val = val
      } else {
        if (val % 1 > 0 && val % 1 < 0.5) {
          console.log('ssss')
          // 四舍五入
          if (val < 1) {
            val = 0.5
          } else {
            val = Math.floor(val)
            val = val + '.0' // 保留一位小数
          }
        } else if (val % 1 == 0.5) {
          val = val
        } else if (val % 1 > 0.5) {
          val = Math.ceil(val)
        }
      }
      if (type === 1) {
        this.dialogForm.singleScore = val
      } else if (type === 2) {
        this.dialogForm.multipleScore = val
      } else if (type === 3) {
        this.dialogForm.judgeScore = val
      } else if (type === 4) {
        this.dialogForm.shortScore = val
      } else if (type === 5) {
        this.dialogForm.passScore = val
      }
      this.totalScore()
      // this.dialogForm.scoreSetting =
      //   this.dialogForm.singleNum * this.dialogForm.singleScore +
      //   this.dialogForm.multipleNum * this.dialogForm.multipleScore +
      //   this.dialogForm.judgeNum * this.dialogForm.judgeScore +
      //   this.dialogForm.shortNum * this.dialogForm.shortScore
    },
    // 创建试题
    handleTopic() {
      this.$refs.NewTestItem.openDialog()
    },
    // 计算总分
    totalScore() {
      this.dialogForm.scoreSetting =
        this.dialogForm.singleNum * this.dialogForm.singleScore +
        this.dialogForm.multipleNum * this.dialogForm.multipleScore +
        this.dialogForm.judgeNum * this.dialogForm.judgeScore +
        this.dialogForm.shortNum * this.dialogForm.shortScore +
        this.dialogForm.selfSingleNum * this.dialogForm.singleScore +
        this.dialogForm.selfMultipleNum * this.dialogForm.multipleScore +
        this.dialogForm.selfJudgeNum * this.dialogForm.judgeScore +
        this.dialogForm.selfShortNum * this.dialogForm.shortScore
    },
  },
}
</script>

<style lang="scss" scoped>
.right-align {
  display: flex;
  justify-content: flex-end;
}
</style>
