Blame view

src/components/exportDia.vue 4.06 KB
e17ec739   梁保满   随堂问,即时测导出爆表修改
1
2
  <template>
    <div>
22095aba   梁保满   接口联调
3
4
      <el-dialog :close-on-click-modal="false" :visible.sync="diaShow" width="360px" :show-close="false">
        <i class="el-icon-close" @click="closeDia"></i>
e17ec739   梁保满   随堂问,即时测导出爆表修改
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
        <div v-show="exportType == 1">
          <div class="down-item">
            <p class="tit">是否将学生表现折线图一起导出</p>
            <el-radio-group v-model="downType" @change="changeDownType">
              <el-radio :label="1">不导出</el-radio>
              <el-radio :label="2">导出</el-radio>
            </el-radio-group>
          </div>
          <div class="down-item" v-show="downType == 2">
            <p class="tit">选择要导出的学生</p>
            <el-radio-group v-model="exportType">
              <el-radio :label="1">导出全部</el-radio>
              <el-radio :label="2">导出制定学生</el-radio>
            </el-radio-group>
          </div>
        </div>
        <ul v-show="exportType == 2">
          <p class="export-tit">选择学生</p>
          <el-table :data="exportStudent" @selection-change="handleSelectionChange" :max-height="300">
            <el-table-column type="selection"></el-table-column>
            <el-table-column prop="studentName" label="姓名" align="center"></el-table-column>
22095aba   梁保满   接口联调
26
            <el-table-column label="班名" align="center">
049db2b2   梁保满   接口联调
27
28
29
30
31
32
              <template slot-scope="scoped">
                <span v-if="scoped.row.classRank || scoped.row.rank">{{
                  scoped.row.classRank || scoped.row.rank }}</span>
                <span v-else>{{ scoped.row.examList && scoped.row.examList[0].classRank }}</span>
  
              </template>
22095aba   梁保满   接口联调
33
            </el-table-column>
7812e986   梁保满   班主任查看报表添加额外信息
34
35
36
            <el-table-column prop="correctRate" :label="this.lastLabel" align="center"><template slot-scope="scoped">
                <span v-if="scoped.row.correctRate || scoped.row.scoringRate">{{
                  scoped.row.correctRate || scoped.row.scoringRate }}%</span>
049db2b2   梁保满   接口联调
37
                <span v-else>{{ scoped.row.examList && scoped.row.examList[0].score }}</span>
7812e986   梁保满   班主任查看报表添加额外信息
38
              </template></el-table-column>
e17ec739   梁保满   随堂问,即时测导出爆表修改
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
          </el-table>
        </ul>
        <div class="dialog-footer" slot="footer">
          <el-button v-show="downType == 2" size="small" type="primary" round @click="exportData(10)">导出前十</el-button>
          <el-button size="small" type="primary" round @click="exportData(0)">确 定</el-button>
          <el-button size="small" type="danger" round @click="cancel">取 消</el-button>
        </div>
      </el-dialog>
    </div>
  </template>
  <script>
  export default {
    name: "exportDia",
    props: {
      diaShow: Boolean,
7812e986   梁保满   班主任查看报表添加额外信息
54
55
56
57
58
      exportStudent: Array,
      lastLabel: {
        type: String,
        default: '总正确率'
      }
e17ec739   梁保满   随堂问,即时测导出爆表修改
59
60
61
62
63
64
65
66
67
    },
    data() {
      return {
        downType: 1,
        exportType: 1,
        multipleSelection: [],
      }
    },
    watch: {
22095aba   梁保满   接口联调
68
69
70
71
72
73
74
      diaShow: {
        handler: function (nVal) {
          if (nVal) {
            this.downType = 1
          }
        },
        immediate: true
e17ec739   梁保满   随堂问,即时测导出爆表修改
75
      }
22095aba   梁保满   接口联调
76
  
e17ec739   梁保满   随堂问,即时测导出爆表修改
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
    },
    methods: {
      changeDownType() {
        this.exportType = 1
      },
      handleSelectionChange(val) {
        this.multipleSelection = val
      },
      exportData(length) {
        let studentIds = []
        if (length) {
          studentIds = this.exportStudent.slice(0, 10).map(item => {
            return item.studentId
          })
        } else {
          studentIds = this.multipleSelection.map(item => {
            return item.studentId
          })
        }
049db2b2   梁保满   接口联调
96
        this.$emit('exportData', studentIds)
e17ec739   梁保满   随堂问,即时测导出爆表修改
97
98
99
100
101
102
103
      },
      cancel() {
        if (this.exportType == 2) {
          this.exportType = 1
        } else {
          this.$emit('cancel')
        }
22095aba   梁保满   接口联调
104
105
106
107
      },
      closeDia() {
        this.$emit('cancel')
        this.exportType = 1
e17ec739   梁保满   随堂问,即时测导出爆表修改
108
109
110
      }
    }
  }
22095aba   梁保满   接口联调
111
112
113
114
115
116
117
118
119
120
121
122
  </script>
  <style lang="scss" scoped>
  .el-dialog__wrapper {
    :deep(.el-icon-close) {
      position: absolute;
      right: 2px;
      top: 5px;
      font-size: 18px;
      padding: 5px;
      cursor: pointer;
    }
  }
049db2b2   梁保满   接口联调
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
  
  :deep(.el-dialog) {
    .el-dialog__body {
      padding: 0 20px 10px;
    }
  
    .down-item {
      font-size: 15px;
      margin-bottom: 10px;
  
      .tit {
        line-height: 18px;
        padding: 10px 0;
      }
    }
  
    .export-tit {
      text-align: center;
      font-size: 16px;
      padding-bottom: 10px;
    }
  }
  
  .dialog-footer {
    text-align: center;
  }
22095aba   梁保满   接口联调
149
  </style>