cfort пре 2 година
родитељ
комит
f4b4545431

+ 14 - 9
src/views/platform/examine/question/edit.vue

@@ -6,7 +6,7 @@
         :close-on-press-escape="false"
         :close-on-press-escape="false"
         append-to-body
         append-to-body
         width="60%"
         width="60%"
-        class="dialog question-detail-dialog"
+        class="dialog question-dialog"
         top="6vh"
         top="6vh"
         @close="closeDialog"
         @close="closeDialog"
         @open="getQuestionData"
         @open="getQuestionData"
@@ -236,9 +236,14 @@ export default {
             type: Boolean,
             type: Boolean,
             default: false
             default: false
         },
         },
-        id: String,
-        parentId: String,
-        data: [Object, String]
+        paperId: {
+            type: String,
+            default: ''
+        },
+        id: {
+            type: String,
+            default: ''
+        }
     },
     },
     data () {
     data () {
         const { userList = [], deptList = [], userId } = this.$store.getters || {}
         const { userList = [], deptList = [], userId } = this.$store.getters || {}
@@ -255,7 +260,7 @@ export default {
             filePreviewVisible: false,
             filePreviewVisible: false,
             form: {
             form: {
                 // bu_men_: '',
                 // bu_men_: '',
-                parent_id_: this.parentId,
+                parent_id_: this.paperId,
                 chu_ti_ren_: userId,
                 chu_ti_ren_: userId,
                 chu_ti_shi_jian_: this.$common.getDateNow(19),
                 chu_ti_shi_jian_: this.$common.getDateNow(19),
                 ti_gan_: '',
                 ti_gan_: '',
@@ -460,7 +465,7 @@ export default {
                     this.form.xuan_xiang_lei_xi = ''
                     this.form.xuan_xiang_lei_xi = ''
                     this.form.da_an_ = ''
                     this.form.da_an_ = ''
                     break
                     break
-                case '答题':
+                case '答题':
                     this.form.xuan_xiang_lei_xi = ''
                     this.form.xuan_xiang_lei_xi = ''
                     this.form.da_an_ = ''
                     this.form.da_an_ = ''
                     break
                     break
@@ -493,7 +498,7 @@ export default {
             })
             })
         },
         },
         updatePaper () {
         updatePaper () {
-            const sql = `select fen_zhi_ from t_questions where parent_id_ = '${this.parentId}'`
+            const sql = `select fen_zhi_ from t_questions where parent_id_ = '${this.paperId}'`
             this.$common.request('sql', sql).then(res => {
             this.$common.request('sql', sql).then(res => {
                 const { data = [] } = res.variables || {}
                 const { data = [] } = res.variables || {}
                 const params = {
                 const params = {
@@ -501,7 +506,7 @@ export default {
                     updList: [
                     updList: [
                         {
                         {
                             where: {
                             where: {
-                                id_: this.parentId
+                                id_: this.paperId
                             },
                             },
                             param: {
                             param: {
                                 ti_shu_: data.length,
                                 ti_shu_: data.length,
@@ -523,7 +528,7 @@ export default {
 }
 }
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
-    .question-detail-dialog {
+    .question-dialog {
         ::v-deep {
         ::v-deep {
             .el-dialog__body {
             .el-dialog__body {
                 height: calc(88vh - 200px);
                 height: calc(88vh - 200px);

+ 515 - 0
src/views/platform/examine/question/judge.vue

@@ -0,0 +1,515 @@
+<template>
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        :show-close="false"
+        append-to-body
+        fullscreen
+        class="dialog paper-judge-dialog"
+        top="0"
+        @open="loadData"
+        @close="closeDialog"
+    >
+        <div class="container">
+            <div class="question">
+                <div
+                    v-for="(item, index) in questionList"
+                    v-show="showIndex === index + 1"
+                    :key="index"
+                    class="question-item"
+                >
+                    <div class="type">{{ item.questionType }}</div>
+                    <div class="stem">
+                        <span>{{ `【${index + 1}】${item.stem}` }}</span>
+                        <el-tag type="info" size="small">{{ `${item.score}分` }}</el-tag>
+                    </div>
+                    <div v-if="item.img && item.img.length" class="img">
+                        <ibps-image
+                            v-model="item.img"
+                            height="100"
+                            width="100"
+                            accept=".jpg,.jpeg,.png,.gif,.bmp,.webp"
+                            download
+                            disabled
+                        />
+                    </div>
+                    <div class="answer">
+                        <div class="mine">
+                            <div class="title">考生答案:</div>
+                            <div class="content">
+                                <el-input
+                                    v-for="(o, i) in item.answer"
+                                    :key="`${index}${i}`"
+                                    :value="o"
+                                    :type="item.questionType === '简答题' ? 'textarea' : 'text'"
+                                    :rows="item.questionType === '简答题' ? 12 : 1"
+                                    readonly
+                                />
+                            </div>
+                        </div>
+                        <div class="right">
+                            <div class="title">参考答案:</div>
+                            <div class="content">
+                                <el-input
+                                    v-for="(o, i) in item.rightKey"
+                                    :key="`${index}${i}`"
+                                    :value="o"
+                                    :type="item.questionType === '简答题' ? 'textarea' : 'text'"
+                                    :rows="item.questionType === '简答题' ? 12 : 1"
+                                    readonly
+                                />
+                            </div>
+                        </div>
+                    </div>
+                    <div class="result">
+                        <div class="title">试题得分
+                            <el-tooltip effect="dark" content="请输入根据考生答案与参考答案给出题目得分" placement="top">
+                                <i class="el-icon-question" />
+                            </el-tooltip>
+                        </div>
+                        <el-tooltip effect="dark" content="错误,该题计0分" placement="top">
+                            <el-button type="danger" icon="el-icon-close" circle @click="changeScore(index, 0)" />
+                        </el-tooltip>
+                        <el-input-number
+                            v-model="item.resultScore"
+                            :min="0"
+                            :max="item.score"
+                            :precision="1"
+                            class="score-input"
+                            placeholder=""
+                        />
+                        <el-tooltip effect="dark" content="正确,该题计满分" placement="top">
+                            <el-button type="success" icon="el-icon-check" circle @click="changeScore(index, item.score)" />
+                        </el-tooltip>
+                        <el-tooltip effect="dark" content="取消已有评分,未评分的题目不会被提交" placement="top">
+                            <el-button type="warning" icon="el-icon-delete" @click="changeScore(index, undefined)">取消评分</el-button>
+                        </el-tooltip>
+                    </div>
+                </div>
+            </div>
+            <div class="question-link">
+                <div
+                    v-for="(item, index) in questionList"
+                    :key="index"
+                    class="link-item"
+                    :class="setClassName(item, index)"
+                    @click="showIndex = index + 1"
+                >{{ index + 1 }}</div>
+            </div>
+        </div>
+        <div slot="footer" class="el-dialog--center">
+            <ibps-toolbar
+                :actions="toolbars"
+                @action-event="handleActionEvent"
+            />
+        </div>
+    </el-dialog>
+</template>
+
+<script>
+export default {
+    components: {
+        IbpsImage: () => import('@/business/platform/file/image')
+    },
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        paperId: {
+            type: String,
+            default: ''
+        },
+        id: {
+            type: String,
+            default: ''
+        }
+    },
+    data () {
+        const { userId } = this.$store.getters || {}
+        return {
+            title: '试题评阅',
+            dialogVisible: this.visible,
+            toolbars: [
+                {
+                    key: 'prev',
+                    icon: 'ibps-icon-chevron-left',
+                    label: '上一题',
+                    disabled: () => {
+                        return this.showIndex === 1
+                    }
+                },
+                {
+                    key: 'next',
+                    icon: 'ibps-icon-chevron-right',
+                    label: '下一题',
+                    disabled: () => {
+                        return this.showIndex === this.questionList.length
+                    }
+                },
+                {
+                    key: 'submit',
+                    icon: 'ibps-icon-send',
+                    label: '提交',
+                    hidden: () => {
+                        return this.readonly
+                    }
+                },
+                { key: 'cancel', label: '退出' }
+            ],
+            questionList: [],
+            showIndex: 1,
+            userId
+        }
+    },
+    computed: {
+        formData () {
+            return this.data
+        }
+    },
+    watch: {
+        visible: {
+            handler (val, oldVal) {
+                this.dialogVisible = this.visible
+            }
+            // immediate: true
+        },
+        showIndex: {
+            handler (val, oldVal) {
+                const temp = this.questionList[oldVal - 1]
+            }
+        }
+    },
+    mounted () {
+        this.loadData()
+        // 监听键盘事件
+        window.addEventListener('keyup', this.handleKeyPress)
+    },
+    beforeDestroy () {
+        window.removeEventListener('keyup', this.handleKeyPress)
+    },
+    methods: {
+        // 获取题库数据
+        async loadData () {
+            this.questionList = await this.getQuestionData()
+            console.log(this.questionList)
+        },
+        handleActionEvent ({ key }) {
+            switch (key) {
+                case 'prev':
+                    this.showIndex--
+                    break
+                case 'next':
+                    this.showIndex++
+                    break
+                case 'submit':
+                    this.handleSubmit()
+                    break
+                case 'cancel':
+                    this.closeDialog()
+                    break
+                default:
+                    break
+            }
+        },
+        getQuestionData () {
+            const param = this.id ? ` and find_in_set(id_, '${this.id}')` : ''
+            const sql = `select id_ as dataId, parent_id_ as paperId, ti_mu_id_ as questionId, ti_gan_ as stem, ti_xing_ as questionType, fu_tu_ as img, xuan_xiang_lei_xi as optionType, fen_zhi_ as score, ping_fen_fang_shi as rateType, ping_fen_ren_ as rater, hui_da_ as answer, can_kao_da_an_ as rightKey, shi_fou_yi_yue_ as isRate from t_examination_detail where ping_fen_ren_ = '${this.userId}' and shi_fou_yi_yue_ = '否' and parent_id_ in (select id_ from t_examination where zhuang_tai_ = '已交卷'${param}) order by field(ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题')`
+            return new Promise((resolve, reject) => {
+                this.$common.request('sql', sql).then(res => {
+                    const { data = [] } = res.variables || {}
+                    if (!data.length) {
+                        this.$message.error('获取题目信息失败!')
+                        return this.closeDialog()
+                    }
+                    data.map(item => {
+                        if (item.questionType === '填空题') {
+                            item.rightKey = item.rightKey ? JSON.parse(item.rightKey) : []
+                            item.answer = item.answer ? JSON.parse(item.answer) : Array(item.rightKey.length).fill('')
+                        } else {
+                            item.answer = [item.answer]
+                            item.rightKey = [item.rightKey]
+                        }
+                        item.score = parseInt(item.score)
+                        item.img = item.img ? JSON.parse(item.img) : ''
+                        item.resultScore = undefined
+                    })
+                    resolve(data)
+                }).catch(error => {
+                    reject(error)
+                })
+            })
+        },
+        setClassName (item, index) {
+            const result = []
+            if (item.resultScore !== undefined) {
+                result.push('finished')
+            }
+            if (this.showIndex === index + 1) {
+                result.push('active')
+            }
+            return result.join(' ')
+        },
+        handleKeyPress (event) {
+            if (event.keyCode === 37 || event.key === 'ArrowLeft') {
+                if (this.showIndex === 1) {
+                    this.$message.warning('已经是第一题了!')
+                    return
+                }
+                this.showIndex--
+            } else if (event.keyCode === 39 || event.key === 'ArrowRight') {
+                if (this.showIndex === this.questionList.length) {
+                    this.$message.warning('已经是最后一题了!')
+                    return
+                }
+                this.showIndex++
+            } else if (event.keyCode === 27 || event.key === 'Esc') {
+                this.closeDialog()
+            }
+        },
+        changeScore (index, score) {
+            this.questionList[index].resultScore = score
+            if (this.showIndex !== this.questionList.length) {
+                this.showIndex++
+            }
+        },
+        getScore ({ questionType, answer, rightKey, score }) {
+            if (questionType === '多选题') {
+                const temp = JSON.parse(rightKey)
+                return answer.length === temp.length && answer.every(i => temp.includes(i)) ? score : 0
+            } else {
+                return answer === rightKey ? score : 0
+            }
+        },
+        dealData (data) {
+            const paperIdList = []
+            const updList = []
+            const time = this.$common.getDateNow(19)
+            data.forEach(item => {
+                if (paperIdList.indexOf(item.paperId) === -1) {
+                    paperIdList.push(item.paperId)
+                }
+                updList.push({
+                    where: {
+                        id_: item.dataId
+                    },
+                    param: {
+                        shi_fou_yi_yue_: '是',
+                        ping_yue_shi_jian: time,
+                        de_fen_: item.resultScore
+                    }
+                })
+            })
+            return { updList, paperIdList }
+        },
+        handleSubmit () {
+            const completeList = this.questionList.filter(item => item.resultScore !== undefined && item.resultScore !== null && item.resultScore !== '')
+            console.log(completeList)
+            if (!completeList.length) {
+                return this.$message.warning('您还未评阅试题!')
+            }
+            this.$confirm('提交后已评阅试题将不再显示,是否确认提交?', '提示', {
+                type: 'info',
+                confirmButtonText: '确认',
+                cancelButtonText: '取消',
+                showClose: false,
+                closeOnClickModal: false
+            }).then(() => {
+                const submitData = this.dealData(completeList)
+                this.submitForm(submitData)
+            }).catch(() => {})
+        },
+        submitForm ({ updList, paperIdList }) {
+            const updateParams = {
+                tableName: 't_examination_detail',
+                updList
+            }
+            console.log(updateParams)
+            this.$common.request('update', updateParams).then(() => {
+                this.$message.success('提交成功!')
+                this.updatePaperInfo(paperIdList.join(','))
+                this.closeDialog()
+            })
+        },
+        updatePaperInfo (ids) {
+            const sql = `select parent_id_ as paperId, shi_fou_yi_yue_ as isRate, de_fen_ as score from t_examination_detail where find_in_set(parent_id_, '${ids}')`
+            this.$common.request('sql', sql).then(res => {
+                const { data = [] } = res.variables || {}
+                if (!data.length) {
+                    return
+                }
+                const temp = {}
+                data.forEach(item => {
+                    if (temp[item.paperId]) {
+                        temp[item.paperId].push(item)
+                    } else {
+                        temp[item.paperId] = [item]
+                    }
+                })
+                const updateObj = {}
+                Object.keys(temp).forEach(key => {
+                    const isAllRate = temp[key].every(item => item.isRate === '是')
+                    if (isAllRate) {
+                        updateObj[key] = [{
+                            where: { id_: key },
+                            param: {
+                                zhuang_tai_: '已完成',
+                                de_fen_: temp[key].reduce((sum, item) => sum + parseFloat(item.score), 0)
+                            }
+                        }]
+                    }
+                })
+                console.log(updateObj)
+                // return
+                Object.keys(updateObj).forEach(key => {
+                    const updateParams = {
+                        tableName: 't_examination',
+                        updList: updateObj[key]
+                    }
+                    this.$common.request('update', updateParams)
+                })
+            })
+        },
+        // 关闭当前窗口
+        closeDialog () {
+            this.$emit('close', false)
+        }
+    }
+}
+</script>
+<style lang="scss" scoped>
+    .paper-judge-dialog {
+        ::v-deep {
+            .el-dialog__body {
+                height: calc(100vh - 55px);
+                width: 1080px;
+                margin: 0 auto;
+                box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+                .el-radio {
+                    display: block;
+                    margin-bottom: 10px;
+                }
+                .el-radio__label, .el-checkbox__label {
+                    font-size: 16px;
+                }
+                .el-input {
+                    margin-bottom: 10px;
+                }
+                .el-tag {
+                    margin-right: 0;
+                }
+                .list-group {
+                    display: inline-block;
+                    width: 100%;
+                }
+            }
+            .el-dialog__header {
+                text-align: center;
+            }
+        }
+        .container {
+            position: relative;
+            height: calc(100vh - 160px);
+            padding: 20px;
+            .question {
+                font-size: 16px;
+                .question-item {
+                    margin-bottom: 10px;
+                    .type {
+                        font-size: 20px;
+                        font-weight: 600;
+                        margin-bottom: 20px;
+                    }
+                    .stem {
+                        display: flex;
+                        margin-bottom: 20px;
+                        align-items: flex-start;
+                        > span:first-child {
+                            line-height: 1.5;
+                            margin-right: 10px;
+                        }
+                    }
+                    .img {
+                        position: relative;
+                        width: 100%;
+                        margin-bottom: 10px;
+                    }
+                    .answer {
+                        border: 1px solid #ccc;
+                        display: flex;
+                        .mine, .right {
+                            flex: 1;
+                            padding: 10px;
+                            .title {
+                                font-size: 16px;
+                                color: #01a39e;
+                                margin-bottom: 10px;
+                            }
+                        }
+                        .mine {
+                            background-color: #f5f5f5;
+                            border-right: 1px solid #ccc;
+                        }
+                    }
+                    .result {
+                        margin-top: 20px;
+                        .title {
+                            display: inline-block;
+                            font-size: 16px;
+                            margin-right: 20px;
+                            margin-bottom: 0;
+                        }
+                        .score-input {
+                            margin: 0 10px;
+                            width: 150px;
+                        }
+                    }
+                }
+            }
+            .question-link {
+                display: flex;
+                flex-wrap: wrap;
+                justify-content: flex-start;
+                position: absolute;
+                width: calc(100% - 40px);
+                bottom: 20px;
+                .el-progress {
+                    width: 100%;
+                    margin-bottom: 10px;
+                }
+                .link-item {
+                    width: 32px;
+                    height: 32px;
+                    text-align: center;
+                    line-height: 32px;
+                    border: 1px solid #DCDFE6;
+                    margin: 3px;
+                    border-radius: 2px;
+                    cursor: pointer;
+                    &:hover {
+                        background-color: #F5F7FA;
+                    }
+                }
+                $button-themes: (
+                    active: (#409EFF, #fff, #409EFF),
+                    incomplete: (#E6A23C, #fff, #E6A23C),
+                    finished: (#67C23A, #fff, #67C23A)
+                );
+                @each $theme, $colors in $button-themes {
+                    .#{$theme} {
+                        background-color: nth($colors, 1);
+                        color: nth($colors, 2);
+                        border-color: nth($colors, 3);
+
+                        &:hover {
+                            background-color: lighten(nth($colors, 1), 10%);
+                            border-color: lighten(nth($colors, 1), 10%);
+                        }
+                    }
+                }
+            }
+        }
+    }
+</style>

+ 573 - 0
src/views/platform/examine/questionBank/detail.vue

@@ -0,0 +1,573 @@
+<template>
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        :show-close="false"
+        append-to-body
+        fullscreen
+        class="dialog paper-detail-dialog"
+        top="0"
+        @open="loadData"
+        @close="closeDialog"
+    >
+        <div class="container">
+            <div class="paper-info">
+                <div class="info-item">
+                    <span class="label">题库名称:</span>
+                    <span class="value">{{ paperData.paperName }}</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">题目数量:</span>
+                    <span class="value">{{ paperData.totalCount }}</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">总分</span>
+                    <span class="value">{{ paperData.totalScore }}分</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">达标分数占比:</span>
+                    <span class="value">{{ paperData.qualifiedRadio }}%</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">计分方式:</span>
+                    <span class="value">{{ paperData.scoringType }}</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">得分:</span>
+                    <span class="value">{{ paperData.status !== '已完成' ? '未评分' : `${paperData.resultScore}分` }}</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">报考时间:</span>
+                    <span class="value">{{ paperData.applyTime }}</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">开考时间:</span>
+                    <span class="value">{{ paperData.startTime }}</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">结束时间:</span>
+                    <span class="value">{{ paperData.endTime }}</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">考生姓名:</span>
+                    <span class="value">{{ transformUser(paperData.examinee) }}</span>
+                </div>
+                <div class="info-item">
+                    <span class="label">部门:</span>
+                    <span class="value">{{ paperData.dept }}</span>
+                </div>
+            </div>
+            <div class="question">
+                <div
+                    v-for="(item, index) in paperData.list"
+                    :key="index"
+                    class="question-item"
+                >
+                    <div class="type">{{ item.type }}<el-tag type="primary" size="small" class="score">{{ `共${item.totalScore}分` }}</el-tag></div>
+                    <div
+                        v-for="(q, qIndex) in item.questions"
+                        :key="`${index}${qIndex}`"
+                        class="card"
+                    >
+                        <div class="stem">
+                            <span>{{ `【${qIndex + 1}】${q.stem}` }}</span>
+                            <el-tag type="info" size="small">{{ `${q.questionScore}分` }}</el-tag>
+                        </div>
+                        <div v-if="q.img && q.img.length" class="img">
+                            <ibps-image
+                                v-model="q.img"
+                                height="100"
+                                width="100"
+                                accept=".jpg,.jpeg,.png,.gif,.bmp,.webp"
+                                download
+                                disabled
+                            />
+                        </div>
+                        <div class="answer">
+                            <div class="mine">
+                                <div class="title">考生答案:<el-tag type="success" size="small" class="score">{{ !q.score && q.score !== '0' ? '未评分' : `得${q.score}分` }}</el-tag></div>
+                                <div class="answer-content">
+                                    <el-radio-group v-if="q.questionType === '单选题'" :value="q.answer">
+                                        <el-radio
+                                            v-for="(o, i) in q.options"
+                                            :key="`${index}${qIndex}${i}`"
+                                            :label="o.label"
+                                        >{{ `${o.label}.${o.value}` }}</el-radio>
+                                    </el-radio-group>
+                                    <el-checkbox-group v-else-if="q.questionType === '多选题'" :value="q.answer">
+                                        <el-checkbox
+                                            v-for="(o, i) in q.options"
+                                            :key="`${index}${qIndex}${i}`"
+                                            :label="o.label"
+                                        >{{ `${o.label}.${o.value}` }}</el-checkbox>
+                                    </el-checkbox-group>
+                                    <el-radio-group v-else-if="q.questionType === '判断题'" :value="q.answer">
+                                        <el-radio-button label="√">√</el-radio-button>
+                                        <el-radio-button label="×">×</el-radio-button>
+                                    </el-radio-group>
+                                    <template v-else>
+                                        <el-input
+                                            v-for="(o, i) in q.answer"
+                                            :key="`${index}${qIndex}${i}`"
+                                            :value="o"
+                                            :type="q.questionType === '简答题' ? 'textarea' : 'text'"
+                                            :rows="q.questionType === '简答题' ? 12 : 1"
+                                            readonly
+                                        />
+                                    </template>
+                                </div>
+                            </div>
+                            <div class="right">
+                                <div class="title">参考答案:</div>
+                                <div class="answer-content">
+                                    <el-radio-group v-if="q.questionType === '单选题'" :value="q.rightKey">
+                                        <el-radio
+                                            v-for="(o, i) in q.options"
+                                            :key="`${index}${qIndex}${i}`"
+                                            :label="o.label"
+                                        >{{ `${o.label}.${o.value}` }}</el-radio>
+                                    </el-radio-group>
+                                    <el-checkbox-group v-else-if="q.questionType === '多选题'" :value="q.rightKey">
+                                        <el-checkbox
+                                            v-for="(o, i) in q.options"
+                                            :key="`${index}${qIndex}${i}`"
+                                            :label="o.label"
+                                        >{{ `${o.label}.${o.value}` }}</el-checkbox>
+                                    </el-checkbox-group>
+                                    <el-radio-group v-else-if="q.questionType === '判断题'" :value="q.rightKey">
+                                        <el-radio-button label="√">√</el-radio-button>
+                                        <el-radio-button label="×">×</el-radio-button>
+                                    </el-radio-group>
+                                    <template v-else>
+                                        <el-input
+                                            v-for="(o, i) in q.rightKey"
+                                            :key="`${index}${qIndex}${i}`"
+                                            :value="o"
+                                            :type="q.questionType === '简答题' ? 'textarea' : 'text'"
+                                            :rows="q.questionType === '简答题' ? 12 : 1"
+                                            readonly
+                                        />
+                                    </template>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="date-line">
+            <el-timeline>
+                <el-timeline-item
+                    v-for="(paper, index) in paperList"
+                    :key="index"
+                    :timestamp="paper.applyTime"
+                    :icon="paper.status === '已完成' ? 'el-icon-circle-check' : 'el-icon-view'"
+                    :type="paper.status === '已完成' ? 'success' : 'primary'"
+                    placement="top"
+                    size="large"
+                >
+                    <el-card class="timeline-card" :class="paper.dataId === showPaperId ? 'active-card' : ''" @click.native="changePaper(paper.dataId)">
+                        <div class="card-item">{{ `开始时间:${paper.startTime}` }}</div>
+                        <div class="card-item">{{ `结束时间:${paper.endTime}` }}</div>
+                        <div v-if="paper.status === '已完成'" class="card-item">
+                            <span>{{ `得分:${paper.resultScore}` }}</span>
+                            <el-tag :type="paper.isQualified ? 'success' : 'danger'" size="mini" class="score">{{ paper.isQualified ? `达标` : '未达标' }}</el-tag>
+                            <el-tag v-if="paper.resultScore === maxScore" type="success" size="mini" class="score">{{ `最高分` }}</el-tag>
+                            <el-tag v-if="paper.resultScore === minScore" type="warning" size="mini" class="score">{{ `最低分` }}</el-tag>
+                        </div>
+                    </el-card>
+                </el-timeline-item>
+            </el-timeline>
+        </div>
+        <div slot="footer" class="el-dialog--center">
+            <ibps-toolbar
+                :actions="toolbars"
+                @action-event="handleActionEvent"
+            />
+        </div>
+    </el-dialog>
+</template>
+
+<script>
+export default {
+    components: {
+        IbpsImage: () => import('@/business/platform/file/image')
+    },
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        paperId: {
+            type: String,
+            default: ''
+        },
+        id: {
+            type: String,
+            default: ''
+        }
+    },
+    data () {
+        const { userId } = this.$store.getters || {}
+        return {
+            title: '考试详情',
+            dialogVisible: this.visible,
+            toolbars: [
+                { key: 'cancel', label: '退出' }
+            ],
+            paperList: [],
+            paperData: [],
+            maxScore: '',
+            minScore: '',
+            showPaperId: '',
+            userId
+        }
+    },
+    computed: {
+        formData () {
+            return this.data
+        }
+    },
+    watch: {
+        visible: {
+            handler (val, oldVal) {
+                this.dialogVisible = this.visible
+            }
+        }
+    },
+    mounted () {
+        this.loadData()
+        // 监听键盘事件
+        window.addEventListener('keyup', this.handleKeyPress)
+    },
+    beforeDestroy () {
+        window.removeEventListener('keyup', this.handleKeyPress)
+    },
+    methods: {
+        // 获取题库数据
+        async loadData () {
+            if (!this.paperId) {
+                this.$message.error('获取题目信息失败,请重试!')
+                this.closeDialog()
+                return
+            }
+            this.paperList = await this.getQuestionData()
+            this.paperData = this.paperList.find(i => i.dataId === this.id)
+            this.showPaperId = this.id
+            console.log(this.paperData)
+        },
+        handleActionEvent ({ key }) {
+            switch (key) {
+                case 'cancel':
+                    this.closeDialog()
+                    break
+                default:
+                    break
+            }
+        },
+        handleKeyPress (event) {
+            if (event.keyCode === 27 || event.key === 'Esc') {
+                this.closeDialog()
+            }
+        },
+        transformUser (userId) {
+            const { userList = [] } = this.$store.getters
+            const user = userList.find(u => u.userId === userId) || {}
+            return user.userName || '-'
+        },
+        getQuestionData () {
+            const sql = `select e.id_ as dataId, e.kao_shi_ren_ as examinee, e.bu_men_ as dept, e.zhuang_tai_ as status, e.bao_ming_shi_jian as applyTime, e.kai_shi_shi_jian_ as startTime, e.jie_shu_shi_jian_ as endTime, e.ti_ku_zong_fen_ as totalScore, e.da_biao_zhan_bi_ as qualifiedRadio, e.de_fen_ as resultScore, ed.ti_mu_id_ as questionId, ed.ti_gan_ as stem, ed.ti_xing_ as questionType, ed.fen_zhi_ as questionScore, ed.fu_tu_ as img, ed.xuan_xiang_lei_xi as optionsType, ed.xuan_xiang_ as options, ed.can_kao_da_an_ as rightKey, ed.ping_fen_fang_shi as rateType, ed.ping_fen_ren_ as rater, ed.hui_da_ as answer, ed.ping_yue_shi_jian as rateTime, ed.de_fen_ as score, ed.jie_xi_ as analysis, q.ti_ku_ming_cheng_ as paperName, q.ji_fen_fang_shi_ as scoringType from t_examination e, t_examination_detail ed, t_question_bank q where e.id_ = ed.parent_id_ and e.ti_ku_id_ = q.id_ and e.ti_ku_id_ = '${this.paperId}' and (e.zhuang_tai_ = '已完成' or e.zhuang_tai_ = '已交卷') order by field(ed.ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题')`
+            return new Promise((resolve, reject) => {
+                this.$common.request('sql', sql).then(res => {
+                    const { data = [] } = res.variables || {}
+                    if (!data.length) {
+                        this.$message.error('获取题目信息失败!')
+                        this.closeDialog()
+                        return
+                    }
+                    const result = []
+                    data.map(item => {
+                        // 数据转换
+                        if (['单选题', '多选题'].includes(item.questionType)) {
+                            item.options = JSON.parse(item.options)
+                            item.rightKey = item.questionType === '多选题' ? item.rightKey.split(',') : item.rightKey
+                            item.answer = item.questionType === '多选题' ? JSON.parse(item.answer) : item.answer
+                        } else if (item.questionType === '填空题') {
+                            item.rightKey = item.rightKey ? JSON.parse(item.rightKey) : []
+                            item.answer = item.answer ? JSON.parse(item.answer) : Array(item.rightKey.length).fill('')
+                        } else if (item.questionType === '简答题') {
+                            item.rightKey = [item.rightKey]
+                            item.answer = [item.answer]
+                        }
+                        item.img = item.img ? JSON.parse(item.img) : ''
+
+                        // 数据分组
+                        const index = result.findIndex(i => i.dataId === item.dataId)
+                        if (index === -1) {
+                            const { dataId, examinee, dept, status, applyTime, startTime, endTime, qualifiedRadio, paperName, totalScore, resultScore, scoringType } = item || {}
+                            result.push({
+                                dataId,
+                                examinee,
+                                dept,
+                                status,
+                                applyTime,
+                                startTime,
+                                endTime,
+                                qualifiedRadio,
+                                isQualified: status === '已完成' ? parseFloat(resultScore) >= (parseFloat(qualifiedRadio) / 100 * parseFloat(totalScore)) : '',
+                                paperName,
+                                totalScore: parseFloat(resultScore),
+                                resultScore: parseFloat(resultScore),
+                                totalCount: data.length,
+                                scoringType,
+                                list: [{
+                                    type: item.questionType,
+                                    questions: [item]
+                                }]
+                            })
+                        } else {
+                            const qIndex = result[index].list.findIndex(i => i.type === item.questionType)
+                            if (qIndex === -1) {
+                                result[index].list.push({
+                                    type: item.questionType,
+                                    questions: [item]
+                                })
+                            } else {
+                                result[index].list[qIndex].questions.push(item)
+                            }
+                        }
+                    })
+                    result.forEach(item => {
+                        item.list.forEach(i => {
+                            i.totalScore = i.questions.reduce((a, b) => a + parseFloat(b.questionScore), 0)
+                        })
+                    })
+                    // 获取最高分最低分
+                    const { maxScore, minScore } = result.filter(i => i.status === '已完成').reduce((acc, curr) => {
+                        if (curr.resultScore > acc.maxScore) {
+                            acc.maxScore = curr.resultScore
+                        }
+                        if (curr.resultScore < acc.minScore) {
+                            acc.minScore = curr.resultScore
+                        }
+                        return acc
+                    }, { maxScore: -Infinity, minScore: Infinity })
+                    this.maxScore = maxScore
+                    this.minScore = minScore
+                    resolve(result)
+                }).catch(error => {
+                    reject(error)
+                })
+            })
+        },
+        changePaper (id) {
+            this.showPaperId = id
+            this.paperData = this.paperList.find(i => i.dataId === id)
+            console.log(id)
+        },
+        // 关闭当前窗口
+        closeDialog () {
+            this.$emit('close', false)
+        }
+    }
+}
+</script>
+<style lang="scss" scoped>
+    .paper-detail-dialog {
+        ::v-deep {
+            .el-dialog__body {
+                position: relative;
+                height: calc(100vh - 115px);
+                width: 1080px;
+                margin: 0 auto;
+                box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+                .el-radio, .el-checkbox {
+                    display: block;
+                    margin-bottom: 10px;
+                    pointer-events: none;
+                    &:last-child {
+                        margin-bottom: 0;
+                    }
+                }
+                .el-radio-button {
+                    pointer-events: none;
+                }
+                .el-radio__label, .el-checkbox__label {
+                    font-size: 16px;
+                }
+                .el-input {
+                    margin-bottom: 10px;
+                    pointer-events: none;
+                    &:last-child {
+                        margin-bottom: 0;
+                    }
+                }
+                .el-tag {
+                    margin-right: 0;
+                }
+                .ibps-p-0 {
+                    margin: 0;
+                    .list-group {
+                        display: inline-block;
+                        width: 100%;
+                    }
+                }
+            }
+            .el-dialog__header {
+                text-align: center;
+            }
+        }
+        .container {
+            position: relative;
+            height: calc(100vh - 160px);
+            padding: 20px;
+            .paper-info {
+                display: flex;
+                flex-wrap: wrap;
+                justify-content: flex-start;
+                margin-bottom: 20px;
+                background-color: #f5f5f5;
+                border: 1px solid #ddd;
+                padding: 10px;
+                border-radius: 5px;
+                font-size: 16px;
+            }
+
+            .info-item {
+                width: 33.3%;
+                margin-bottom: 10px;
+                display: flex;
+                align-items: center;
+                .label {
+                    width: 120px;
+                    font-weight: bold;
+                    color: #333;
+                }
+                .value {
+                    flex: 1;
+                    color: #666;
+                    white-space: nowrap;
+                    overflow: hidden;
+                    text-overflow: ellipsis;
+                }
+            }
+
+            .question {
+                font-size: 16px;
+                .question-item {
+                    padding-top: 20px;
+                    &:last-child {
+                        padding-bottom: 20px;
+                    }
+                    .card {
+                        padding-bottom: 10px;
+                        &:last-child {
+                            padding-bottom: 0;
+                        }
+                    }
+                    .type {
+                        font-size: 20px;
+                        font-weight: 600;
+                        margin-bottom: 20px;
+                        .score {
+                            margin-left: 10px;
+                            vertical-align: bottom;
+                        }
+                    }
+                    .stem {
+                        display: flex;
+                        margin-bottom: 10px;
+                        align-items: flex-start;
+                        > span:first-child {
+                            line-height: 1.5;
+                            margin-right: 10px;
+                        }
+                    }
+                    .img {
+                        position: relative;
+                        width: 100%;
+                        margin-bottom: 10px;
+                    }
+                    .answer {
+                        display: flex;
+                        border: 1px solid #ccc;
+                        border-radius: 5px;
+                        .mine, .right {
+                            flex: 1;
+                            padding: 10px;
+                            .title {
+                                font-size: 16px;
+                                color: #01a39e;
+                                margin-bottom: 10px;
+                                .score {
+                                    vertical-align: middle;
+                                }
+                            }
+                        }
+                        .mine {
+                            background-color: #f5f5f5;
+                            border-right: 1px solid #ccc;
+                        }
+                    }
+                }
+            }
+        }
+        .date-line {
+            position: fixed;
+            width: 280px;
+            height: calc(100vh - 120px);
+            overflow-y: auto;
+            top: 60px;
+            left: calc(50vw + 540px);
+            ::v-deep {
+                .el-timeline {
+                    padding-left: 10px;
+                }
+                .el-card__body {
+                    padding: 10px 10px;
+                }
+                .el-tag {
+                    margin-left: 5px;
+                }
+            }
+            .timeline-card {
+                cursor: pointer;
+                .card-item {
+                    margin-bottom: 10px;
+                    &:last-child {
+                        margin-bottom: 0;
+                    }
+                }
+            }
+            .active-card {
+                box-shadow: 0 2px 12px 0 rgba(64, 158, 255, 1);
+            }
+        }
+    }
+    @media screen and (max-width: 1600px) {
+        .paper-detail-dialog {
+            ::v-deep {
+                .el-dialog__body {
+                    width: 880px;
+                }
+            }
+            .date-line {
+                left: calc(50vw + 440px);
+            }
+        }
+    }
+    @media screen and (max-width: 1400px) {
+        .paper-detail-dialog {
+            ::v-deep {
+                .el-dialog__body {
+                    width: 800px;
+                }
+            }
+            .date-line {
+                left: calc(50vw + 400px);
+            }
+        }
+    }
+</style>

+ 11 - 9
src/views/platform/examine/questionBank/edit.vue

@@ -6,7 +6,7 @@
         :close-on-press-escape="false"
         :close-on-press-escape="false"
         append-to-body
         append-to-body
         width="60%"
         width="60%"
-        class="dialog question-detail-dialog"
+        class="dialog paper-dialog"
         top="6vh"
         top="6vh"
         @close="closeDialog"
         @close="closeDialog"
         @open="getQuestionData"
         @open="getQuestionData"
@@ -64,7 +64,7 @@
                 </el-select>
                 </el-select>
             </el-form-item>
             </el-form-item>
             <el-form-item label="限考次数:" prop="isLimit" class="inline-item">
             <el-form-item label="限考次数:" prop="isLimit" class="inline-item">
-                <el-radio-group v-model="form.isLimit">
+                <el-radio-group v-model="form.isLimit" @change="changeLimit">
                     <el-radio label="0">不限</el-radio>
                     <el-radio label="0">不限</el-radio>
                     <el-radio label="1">限制</el-radio>
                     <el-radio label="1">限制</el-radio>
                 </el-radio-group>
                 </el-radio-group>
@@ -78,7 +78,7 @@
                     <div class="unit">次</div>
                     <div class="unit">次</div>
                 </div>
                 </div>
             </el-form-item>
             </el-form-item>
-            <el-form-item label="考试时长:" prop="kao_shi_shi_chang" class="inline-item">
+            <el-form-item label="考试时长:" prop="limitTime" class="inline-item">
                 <el-radio-group v-model="form.limitTime">
                 <el-radio-group v-model="form.limitTime">
                     <el-radio label="0">不限</el-radio>
                     <el-radio label="0">不限</el-radio>
                     <el-radio label="1">限制</el-radio>
                     <el-radio label="1">限制</el-radio>
@@ -153,8 +153,10 @@ export default {
             type: Boolean,
             type: Boolean,
             default: false
             default: false
         },
         },
-        id: String,
-        data: [Object, String]
+        id: {
+            type: String,
+            default: ''
+        }
     },
     },
     data () {
     data () {
         const { userList = [], deptList = [], userId } = this.$store.getters || {}
         const { userList = [], deptList = [], userId } = this.$store.getters || {}
@@ -182,8 +184,8 @@ export default {
                 ti_shu_: 0,
                 ti_shu_: 0,
                 isLimit: '0',
                 isLimit: '0',
                 limitTime: '0',
                 limitTime: '0',
-                hours: null,
-                minutes: null
+                hours: 2,
+                minutes: 30
             },
             },
             toolbars: [
             toolbars: [
                 {
                 {
@@ -230,7 +232,7 @@ export default {
     },
     },
     methods: {
     methods: {
         changeLimit (e) {
         changeLimit (e) {
-            this.form.xian_kao_ci_shu_ = e ? 1 : '不限'
+            this.form.xian_kao_ci_shu_ = e === '1' ? 1 : '不限'
         },
         },
         getRaterOptions (list) {
         getRaterOptions (list) {
             const data = [
             const data = [
@@ -356,7 +358,7 @@ export default {
 }
 }
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
-    .question-detail-dialog {
+    .paper-dialog {
         ::v-deep {
         ::v-deep {
             .el-dialog__body {
             .el-dialog__body {
                 height: calc(88vh - 200px);
                 height: calc(88vh - 200px);

+ 49 - 59
src/views/platform/examine/questionBank/test.vue

@@ -4,6 +4,7 @@
         :visible.sync="dialogVisible"
         :visible.sync="dialogVisible"
         :close-on-click-modal="false"
         :close-on-click-modal="false"
         :close-on-press-escape="false"
         :close-on-press-escape="false"
+        :show-close="false"
         append-to-body
         append-to-body
         fullscreen
         fullscreen
         class="dialog test-dialog"
         class="dialog test-dialog"
@@ -35,21 +36,21 @@
                         />
                         />
                     </div>
                     </div>
                     <div class="answer">
                     <div class="answer">
-                        <el-radio-group v-if="item.questionType === '单选题'" v-model="item.answer">
+                        <el-radio-group v-if="item.questionType === '单选题'" v-model="item.answer" @change="goNext">
                             <el-radio
                             <el-radio
                                 v-for="(o, i) in item.options"
                                 v-for="(o, i) in item.options"
                                 :key="`${index}${i}`"
                                 :key="`${index}${i}`"
                                 :label="o.label"
                                 :label="o.label"
                             >{{ `${o.label}.${o.value}` }}</el-radio>
                             >{{ `${o.label}.${o.value}` }}</el-radio>
                         </el-radio-group>
                         </el-radio-group>
-                        <el-checkbox-group v-else-if="item.questionType === '多选题'" v-model="item.answer">
+                        <el-checkbox-group v-else-if="item.questionType === '多选题'" v-model="item.answer" @change="changeOptions">
                             <el-checkbox
                             <el-checkbox
                                 v-for="(o, i) in item.options"
                                 v-for="(o, i) in item.options"
                                 :key="`${index}${i}`"
                                 :key="`${index}${i}`"
                                 :label="o.label"
                                 :label="o.label"
-                            >{{ o.value }}</el-checkbox>
+                            >{{ `${o.label}.${o.value}` }}</el-checkbox>
                         </el-checkbox-group>
                         </el-checkbox-group>
-                        <el-radio-group v-else-if="item.questionType === '判断题'" v-model="item.answer">
+                        <el-radio-group v-else-if="item.questionType === '判断题'" v-model="item.answer" @change="goNext">
                             <el-radio-button label="√">√</el-radio-button>
                             <el-radio-button label="√">√</el-radio-button>
                             <el-radio-button label="×">×</el-radio-button>
                             <el-radio-button label="×">×</el-radio-button>
                         </el-radio-group>
                         </el-radio-group>
@@ -99,8 +100,6 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import ActionUtils from '@/utils/action'
-import { paperTypeOptions } from '../constants'
 export default {
 export default {
     components: {
     components: {
         IbpsImage: () => import('@/business/platform/file/image')
         IbpsImage: () => import('@/business/platform/file/image')
@@ -110,11 +109,11 @@ export default {
             type: Boolean,
             type: Boolean,
             default: false
             default: false
         },
         },
-        id: {
+        paperId: {
             type: String,
             type: String,
             default: ''
             default: ''
         },
         },
-        parentId: {
+        id: {
             type: String,
             type: String,
             default: ''
             default: ''
         }
         }
@@ -122,7 +121,6 @@ export default {
     data () {
     data () {
         const { userId } = this.$store.getters || {}
         const { userId } = this.$store.getters || {}
         return {
         return {
-            paperTypeOptions,
             title: '参加考试',
             title: '参加考试',
             dialogVisible: this.visible,
             dialogVisible: this.visible,
             toolbars: [
             toolbars: [
@@ -153,7 +151,8 @@ export default {
                 { key: 'cancel', label: '退出' }
                 { key: 'cancel', label: '退出' }
             ],
             ],
             questionList: [],
             questionList: [],
-            showIndex: 1
+            showIndex: 1,
+            userId
         }
         }
     },
     },
     computed: {
     computed: {
@@ -171,15 +170,12 @@ export default {
         showIndex: {
         showIndex: {
             handler (val, oldVal) {
             handler (val, oldVal) {
                 const temp = this.questionList[oldVal - 1]
                 const temp = this.questionList[oldVal - 1]
-                if (temp.questionType === '填空题') {
+                if (['填空题'].includes(temp.questionType)) {
                     temp.answer = temp.options.map(item => item.answer)
                     temp.answer = temp.options.map(item => item.answer)
                 }
                 }
             }
             }
         }
         }
     },
     },
-    created () {
-        // this.getQuestionData()
-    },
     mounted () {
     mounted () {
         this.loadData()
         this.loadData()
         // 监听键盘事件
         // 监听键盘事件
@@ -191,7 +187,7 @@ export default {
     methods: {
     methods: {
         // 获取题库数据
         // 获取题库数据
         async loadData () {
         async loadData () {
-            if (!this.parentId) {
+            if (!this.paperId) {
                 this.$message.error('获取题目信息失败,请重试!')
                 this.$message.error('获取题目信息失败,请重试!')
                 this.closeDialog()
                 this.closeDialog()
                 return
                 return
@@ -218,7 +214,7 @@ export default {
             }
             }
         },
         },
         getQuestionData () {
         getQuestionData () {
-            const sql = `select id_ as questionId, ti_gan_ as stem, ti_xing_ as questionType, fu_tu_ as img, xuan_xiang_lei_xi as optionType, da_an_ as options, xuan_xiang_shu_ as optionsLength, fen_zhi_ as score, ping_fen_fang_shi as rateType, ping_fen_ren_ as rater, zheng_que_da_an_ as rightKey from t_questions where parent_id_ = '${this.parentId}' and zhuang_tai_ = '启用' order by field(ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题')`
+            const sql = `select id_ as questionId, ti_gan_ as stem, ti_xing_ as questionType, fu_tu_ as img, xuan_xiang_lei_xi as optionType, da_an_ as options, xuan_xiang_shu_ as optionsLength, fen_zhi_ as score, ping_fen_fang_shi as rateType, ping_fen_ren_ as rater, zheng_que_da_an_ as rightKey from t_questions where parent_id_ = '${this.paperId}' and zhuang_tai_ = '启用' order by field(ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题')`
             return new Promise((resolve, reject) => {
             return new Promise((resolve, reject) => {
                 this.$common.request('sql', sql).then(res => {
                 this.$common.request('sql', sql).then(res => {
                     const { data = [] } = res.variables || {}
                     const { data = [] } = res.variables || {}
@@ -244,7 +240,7 @@ export default {
                             })
                             })
                         }
                         }
                         item.img = item.img ? JSON.parse(item.img) : ''
                         item.img = item.img ? JSON.parse(item.img) : ''
-                        item.answer = null
+                        item.answer = item.questionType === '多选题' ? [] : null
                     })
                     })
                     resolve(data)
                     resolve(data)
                 }).catch(error => {
                 }).catch(error => {
@@ -257,19 +253,27 @@ export default {
             this.questionList.forEach(item => {
             this.questionList.forEach(item => {
                 if (item.questionType === '填空题') {
                 if (item.questionType === '填空题') {
                     finished.push(item.answer && !item.answer.some(i => i === '' || i === null))
                     finished.push(item.answer && !item.answer.some(i => i === '' || i === null))
+                } else if (item.questionType === '多选题') {
+                    finished.push(item.answer.some(i => i) && true)
                 } else {
                 } else {
-                    finished.push(item.answer && 1)
+                    finished.push(item.answer && true)
                 }
                 }
             })
             })
             // const finished = this.questionList.filter(item => (item.questionType !== '填空题' && item.answer) || (item.questionType === '填空题' && item.answer && !item.answer.some(i => i === '' || i === null))).length
             // const finished = this.questionList.filter(item => (item.questionType !== '填空题' && item.answer) || (item.questionType === '填空题' && item.answer && !item.answer.some(i => i === '' || i === null))).length
             const finishedCount = finished.filter(i => i).length
             const finishedCount = finished.filter(i => i).length
-            return parseInt(finishedCount / this.questionList.length * 100)
+            const progress = parseFloat(finishedCount / this.questionList.length * 100)
+            return progress ? progress > 100 ? 100 : progress : 0
+        },
+        changeOptions (val) {
+            this.questionList[this.showIndex - 1].answer = val
         },
         },
         setClassName (item, index) {
         setClassName (item, index) {
             const result = []
             const result = []
             if (item.answer) {
             if (item.answer) {
                 // 填空题且未填写所有答案
                 // 填空题且未填写所有答案
-                if (item.questionType === '填空题' && (item.options.every(i => !i.answer))) {
+                if (['填空题'].includes(item.questionType) && (item.options.every(i => !i.answer))) {
+                    result.push('')
+                } else if (['多选题'].includes(item.questionType) && !item.answer.length) {
                     result.push('')
                     result.push('')
                 } else if (item.questionType === '填空题' && (item.options.some(i => !i.answer))) {
                 } else if (item.questionType === '填空题' && (item.options.some(i => !i.answer))) {
                     result.push('incomplete')
                     result.push('incomplete')
@@ -295,22 +299,32 @@ export default {
                     return
                     return
                 }
                 }
                 this.showIndex++
                 this.showIndex++
+            } else if (event.keyCode === 27 || event.key === 'Esc') {
+                this.closeDialog()
             }
             }
         },
         },
+        goNext () {
+            if (this.showIndex === this.questionList.length) {
+                return
+            }
+            this.showIndex++
+        },
         getScore ({ questionType, answer, rightKey, score }) {
         getScore ({ questionType, answer, rightKey, score }) {
             if (questionType === '多选题') {
             if (questionType === '多选题') {
-                const temp = JSON.parse(rightKey)
+                const temp = rightKey.split(',')
                 return answer.length === temp.length && answer.every(i => temp.includes(i)) ? score : 0
                 return answer.length === temp.length && answer.every(i => temp.includes(i)) ? score : 0
             } else {
             } else {
                 return answer === rightKey ? score : 0
                 return answer === rightKey ? score : 0
             }
             }
         },
         },
         handleSubmit () {
         handleSubmit () {
-            console.log(this.questionList)
             let incompleteList = []
             let incompleteList = []
             this.questionList.forEach((item, index) => {
             this.questionList.forEach((item, index) => {
                 if (item.questionType === '填空题') {
                 if (item.questionType === '填空题') {
-                    const t = item.answer && item.answer.some(i => i === '' || i === null)
+                    const t = item.answer && !item.answer.some(i => i === '' || i === null)
+                    incompleteList.push(!t ? index + 1 : '')
+                } else if (item.questionType === '多选题') {
+                    const t = item.answer && item.answer.length
                     incompleteList.push(!t ? index + 1 : '')
                     incompleteList.push(!t ? index + 1 : '')
                 } else {
                 } else {
                     incompleteList.push(!item.answer ? index + 1 : '')
                     incompleteList.push(!item.answer ? index + 1 : '')
@@ -326,27 +340,31 @@ export default {
                 closeOnClickModal: false
                 closeOnClickModal: false
             }).then(() => {
             }).then(() => {
                 const submitData = []
                 const submitData = []
+                const time = this.$common.getDateNow(19)
                 this.questionList.forEach((item, index) => {
                 this.questionList.forEach((item, index) => {
                     const autoType = ['单选题', '多选题', '判断题'].includes(item.questionType)
                     const autoType = ['单选题', '多选题', '判断题'].includes(item.questionType)
                     const multipleType = ['多选题', '填空题'].includes(item.questionType)
                     const multipleType = ['多选题', '填空题'].includes(item.questionType)
+                    const selectType = ['多选题', '单选题'].includes(item.questionType)
                     submitData.push({
                     submitData.push({
-                        parent_id_: this.parentId,
+                        parent_id_: this.id,
                         ti_mu_id_: item.questionId,
                         ti_mu_id_: item.questionId,
                         ti_gan_: item.stem,
                         ti_gan_: item.stem,
                         ti_xing_: item.questionType,
                         ti_xing_: item.questionType,
                         fen_zhi_: item.score,
                         fen_zhi_: item.score,
                         fu_tu_: item.img,
                         fu_tu_: item.img,
                         xuan_xiang_lei_xi: item.optionType,
                         xuan_xiang_lei_xi: item.optionType,
-                        xuan_xiang_: item.options,
+                        xuan_xiang_: selectType ? JSON.stringify(item.options) : '',
                         can_kao_da_an_: item.rightKey,
                         can_kao_da_an_: item.rightKey,
                         ping_fen_fang_shi: item.rateType,
                         ping_fen_fang_shi: item.rateType,
                         ping_fen_ren_: item.rater,
                         ping_fen_ren_: item.rater,
-                        hui_da_: multipleType ? JSON.stringify(item.answer) : item.answer,
+                        hui_da_: multipleType && item.answer && item.answer.length ? JSON.stringify(item.answer) : item.answer,
                         shi_fou_yi_yue_: autoType ? '是' : '否',
                         shi_fou_yi_yue_: autoType ? '是' : '否',
+                        ping_yue_shi_jian: autoType ? time : '',
                         de_fen_: autoType ? this.getScore(item) : '',
                         de_fen_: autoType ? this.getScore(item) : '',
                         jie_xi_: ''
                         jie_xi_: ''
                     })
                     })
                 })
                 })
+                // console.log(submitData)
                 this.submitForm(submitData)
                 this.submitForm(submitData)
             }).catch(() => {})
             }).catch(() => {})
         },
         },
@@ -355,6 +373,7 @@ export default {
                 tableName: 't_examination_detail',
                 tableName: 't_examination_detail',
                 paramWhere: data
                 paramWhere: data
             }
             }
+            const isAllReviewed = !data.some(i => i.shi_fou_yi_yue_ === '否')
             const updateParams = {
             const updateParams = {
                 tableName: 't_examination',
                 tableName: 't_examination',
                 updList: [
                 updList: [
@@ -364,8 +383,9 @@ export default {
                         },
                         },
                         param: {
                         param: {
                             jie_shu_shi_jian_: this.$common.getDateNow(19),
                             jie_shu_shi_jian_: this.$common.getDateNow(19),
-                            ti_ku_zong_fen_: data.reduce((sum, item) => sum + parseInt(item.fen_zhi_), 0),
-                            zhuang_tai_: '已完成',
+                            ti_ku_zong_fen_: data.reduce((sum, item) => sum + parseFloat(item.fen_zhi_), 0),
+                            zhuang_tai_: isAllReviewed ? '已完成' : '已交卷',
+                            de_fen_: isAllReviewed ? data.reduce((sum, item) => sum + parseFloat(item.de_fen_), 0) : '',
                             // sheng_yu_shi_chan: ''
                             // sheng_yu_shi_chan: ''
                         }
                         }
                     }
                     }
@@ -394,7 +414,7 @@ export default {
                 width: 1080px;
                 width: 1080px;
                 margin: 0 auto;
                 margin: 0 auto;
                 box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
                 box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-                .el-radio {
+                .el-radio, .el-checkbox {
                     display: block;
                     display: block;
                     margin-bottom: 10px;
                     margin-bottom: 10px;
                 }
                 }
@@ -489,36 +509,6 @@ export default {
                         }
                         }
                     }
                     }
                 }
                 }
-                // .active {
-                //     background-color: #409EFF;
-                //     color: #fff;
-                //     border-color: #409EFF;
-                //     &:hover {
-                //         background-color: #66b1ff;
-                //         color: #fff;
-                //         border-color: #66b1ff;
-                //     }
-                // }
-                // .incomplete {
-                //     background-color: #E6A23C;
-                //     color: #fff;
-                //     border-color: #E6A23C;
-                //     &:hover {
-                //         background-color: #E6A23C;
-                //         color: #fff;
-                //         border-color: #E6A23C;
-                //     }
-                // }
-                // .finished {
-                //     background-color: #67C23A;
-                //     color: #fff;
-                //     border-color: #67C23A;
-                //     &:hover {
-                //         background-color: #85ce61;
-                //         color: #fff;
-                //         border-color: #85ce61;
-                //     }
-                // }
             }
             }
         }
         }
     }
     }