Commit 58744c8c9a1d7b9750e3de5ecc67571bc1a6b87f

Authored by 梁保满
1 parent ce278878

即时测多班淡斑逻辑修改

public/static/试卷模板.docx
No preview for this file type
src/views/basic/test/index.vue
... ... @@ -8,30 +8,64 @@
8 8 <div class="select-box">
9 9 <div class="sel-item sel-item2">
10 10 <span class="sel-label">班级:</span>
11   - <div class="sel-d">
  11 + <div class="sel-d" v-if="role == 'ROLE_JIAOSHI'">
12 12 <p class="p-all">
13   - <el-checkbox :indeterminate="isIndeterminateClass" v-model="allClass"
14   - @change="handleCheckAllChangeClass">全选</el-checkbox>
  13 + <el-checkbox
  14 + :indeterminate="isIndeterminateClass"
  15 + v-model="allClass"
  16 + @change="handleCheckAllChangeClass"
  17 + >全选</el-checkbox
  18 + >
15 19 </p>
16 20 <p class="sel-p">
17 21 <el-checkbox-group v-model="query.classId" @change="changeclass">
18   - <el-checkbox v-for="item in classList" :label="item.value" :key="item.value">{{ item.label
19   - }}</el-checkbox>
  22 + <el-checkbox
  23 + v-for="item in classList"
  24 + :label="item.value"
  25 + :key="item.value"
  26 + >{{ item.label }}</el-checkbox
  27 + >
20 28 </el-checkbox-group>
21 29 </p>
22 30 </div>
  31 + <el-select
  32 + v-if="role == 'ROLE_BANZHUREN'"
  33 + class="sel"
  34 + v-model="query.classId"
  35 + placeholder="选择班级"
  36 + @change="changeclass"
  37 + >
  38 + <el-option
  39 + v-for="item in classList"
  40 + :key="item.value"
  41 + :label="item.label"
  42 + :value="item.value"
  43 + >
  44 + </el-option>
  45 + </el-select>
23 46 </div>
24 47 <div class="sel-item sel-item2">
25 48 <span class="sel-label">科目:</span>
26 49 <div class="sel-d">
27 50 <p class="p-all">
28   - <el-checkbox :indeterminate="isIndeterminateSub" v-model="allSubject"
29   - @change="handleCheckAllChangeSub">全选</el-checkbox>
  51 + <el-checkbox
  52 + :indeterminate="isIndeterminateSub"
  53 + v-model="allSubject"
  54 + @change="handleCheckAllChangeSub"
  55 + >全选</el-checkbox
  56 + >
30 57 </p>
31 58 <p class="sel-p">
32   - <el-checkbox-group v-model="query.subjectNames" @change="CheckedSub">
33   - <el-checkbox v-for="item in subjectList" :label="item" :key="item">{{ item
34   - }}</el-checkbox>
  59 + <el-checkbox-group
  60 + v-model="query.subjectNames"
  61 + @change="CheckedSub"
  62 + >
  63 + <el-checkbox
  64 + v-for="item in subjectList"
  65 + :label="item"
  66 + :key="item"
  67 + >{{ item }}</el-checkbox
  68 + >
35 69 </el-checkbox-group>
36 70 </p>
37 71 </div>
... ... @@ -39,18 +73,34 @@
39 73 <div class="sel-item">
40 74 <span class="sel-label">日期:</span>
41 75 <div class="d1">
42   - <el-date-picker v-model="query.startDay" type="date" @change="handleChangeTimeStart" placeholder="选择日期时间"
43   - value-format="yyyy-MM-dd">
  76 + <el-date-picker
  77 + v-model="query.startDay"
  78 + type="date"
  79 + @change="handleChangeTimeStart"
  80 + placeholder="选择日期时间"
  81 + value-format="yyyy-MM-dd"
  82 + >
44 83 </el-date-picker>
45 84 ~
46   - <el-date-picker v-model="query.endDay" type="date" placeholder="选择日期时间" @change="handleChangeTimeEnd"
47   - value-format="yyyy-MM-dd">
  85 + <el-date-picker
  86 + v-model="query.endDay"
  87 + type="date"
  88 + placeholder="选择日期时间"
  89 + @change="handleChangeTimeEnd"
  90 + value-format="yyyy-MM-dd"
  91 + >
48 92 </el-date-picker>
49 93 </div>
50 94 <p class="p1">
51   - <span @click="setDate(1)" :class="[date == 1 ? 'active' : '', 's1']">本周</span>
52   - <span @click="setDate(2)" :class="[date == 2 ? 'active' : '', 's1']">本月</span>
53   - <span @click="setDate(3)" :class="[date == 3 ? 'active' : '', 's1']">本季度</span>
  95 + <span @click="setDate(1)" :class="[date == 1 ? 'active' : '', 's1']"
  96 + >本周</span
  97 + >
  98 + <span @click="setDate(2)" :class="[date == 2 ? 'active' : '', 's1']"
  99 + >本月</span
  100 + >
  101 + <span @click="setDate(3)" :class="[date == 3 ? 'active' : '', 's1']"
  102 + >本季度</span
  103 + >
54 104 </p>
55 105 </div>
56 106 </div>
... ... @@ -80,10 +130,10 @@ export default {
80 130 classList: [], //班级
81 131 subjectList: [], //科目
82 132  
83   - isIndeterminateClass: true,//全选样式
84   - allClass: false,//全选状态
85   - isIndeterminateSub: true,//全选样式
86   - allSubject: false,//全选状态
  133 + isIndeterminateClass: true, //全选样式
  134 + allClass: false, //全选状态
  135 + isIndeterminateSub: true, //全选样式
  136 + allSubject: false, //全选状态
87 137 };
88 138 },
89 139 async created() {
... ... @@ -107,24 +157,30 @@ export default {
107 157  
108 158 methods: {
109 159 handleCheckAllChangeClass(val) {
110   - this.isIndeterminateClass = false
111   - this.query.classId = val ? this.classList.map(item => item.value) : [];
  160 + this.isIndeterminateClass = false;
  161 + this.query.classId = val ? this.classList.map((item) => item.value) : [];
112 162 },
113 163 changeclass(value) {
114   - console.log(value)
115   - let checkedCount = value.length;
116   - this.allClass = checkedCount === this.classList.length;
117   - this.isIndeterminateClass = checkedCount > 0 && checkedCount < this.classList.length;
  164 + console.log(value);
  165 + if (this.role == "ROLE_BANZHUREN") {
  166 + this._QuerySubjectList();
  167 + } else {
  168 + let checkedCount = value.length;
  169 + this.allClass = checkedCount === this.classList.length;
  170 + this.isIndeterminateClass =
  171 + checkedCount > 0 && checkedCount < this.classList.length;
  172 + }
118 173 },
119 174 handleCheckAllChangeSub(val) {
120   - this.isIndeterminate = false
  175 + this.isIndeterminate = false;
121 176 this.query.subjectNames = val ? this.subjectList : [];
122 177 },
123 178 CheckedSub(value) {
124   - console.log(value)
  179 + console.log(value);
125 180 let checkedCount = value.length;
126 181 this.allSubject = checkedCount === this.subjectList.length;
127   - this.isIndeterminate = checkedCount > 0 && checkedCount < this.subjectList.length;
  182 + this.isIndeterminate =
  183 + checkedCount > 0 && checkedCount < this.subjectList.length;
128 184 },
129 185 setDate(index) {
130 186 const that = this;
... ... @@ -189,10 +245,10 @@ export default {
189 245 async _QueryClassList() {
190 246 const fetchClassList =
191 247 this.role == "ROLE_BANZHUREN"
192   - ? this.$request.cTClassList :
193   - this.role == "ROLE_PERSONAL"
194   - ? this.$request.pClassList
195   - : this.$request.tClassList;
  248 + ? this.$request.cTClassList
  249 + : this.role == "ROLE_PERSONAL"
  250 + ? this.$request.pClassList
  251 + : this.$request.tClassList;
196 252 const { data, status, info } = await fetchClassList();
197 253 if (status === 0) {
198 254 this.classList = data.list.map((item) => {
... ... @@ -201,7 +257,15 @@ export default {
201 257 label: item.className,
202 258 };
203 259 });
204   - this.classList.length ? this.query.classId.push(this.classList[0].value) : "";
  260 + if (this.role == "ROLE_BANZHUREN") {
  261 + this.query.classId = this.classList.length
  262 + ? this.classList[0].value
  263 + : "";
  264 + } else {
  265 + this.classList.length
  266 + ? this.query.classId.push(this.classList[0].value)
  267 + : "";
  268 + }
205 269 } else {
206 270 this.$message.error(info);
207 271 }
... ... @@ -209,22 +273,20 @@ export default {
209 273 async _QuerySubjectList() {
210 274 const fetchSubjectList =
211 275 this.role == "ROLE_BANZHUREN"
212   - ? this.$request.cTSubjectList :
213   - this.role == "ROLE_PERSONAL"
214   - ? this.$request.pSubjectList
215   - : this.$request.tSubjectList;
  276 + ? this.$request.cTSubjectList
  277 + : this.role == "ROLE_PERSONAL"
  278 + ? this.$request.pSubjectList
  279 + : this.$request.tSubjectList;
216 280  
217   - const classIds = this.classList.map(item => item.value) || []
  281 + let classIds = this.query.classId;
218 282 const { data, status, info } = await fetchSubjectList({
219 283 classIds: classIds,
220 284 });
221 285 if (status === 0) {
222 286 this.subjectList = data.subjectNames || [];
223   - // if (this.role == "ROLE_BANZHUREN") {
224   - // this.query.subjectNames = this.subjectList
225   - // } else {
226   - this.subjectList.length ? this.query.subjectNames.push(this.subjectList[0]) : "";
227   - // }
  287 + this.subjectList.length
  288 + ? this.query.subjectNames.push(this.subjectList[0])
  289 + : "";
228 290 } else {
229 291 this.$message.error(info);
230 292 }
... ... @@ -233,26 +295,30 @@ export default {
233 295 //回主页
234 296 goHome() {
235 297 this.$router.push({
236   - path: '/index'
237   - })
  298 + path: "/index",
  299 + });
238 300 },
239 301 //去列表
240 302 goList() {
241   - if(this.query.classId.length == 0){
242   - this.$message.warning("请选择班级!")
243   - return
  303 + if (this.query.classId.length == 0) {
  304 + this.$message.warning("请选择班级!");
  305 + return;
244 306 }
245   - if(this.query.subjectNames.length == 0){
246   - this.$message.warning("请选择科目!")
247   - return
  307 + if (this.query.subjectNames.length == 0) {
  308 + this.$message.warning("请选择科目!");
  309 + return;
  310 + }
  311 + let query = { ...this.query };
  312 + if (this.role == "ROLE_BANZHUREN") {
  313 + query.classId = [query.classId];
248 314 }
249 315 this.$router.push({
250   - path: '/testList',
  316 + path: "/testList",
251 317 query: {
252   - params: JSON.stringify(this.query)
253   - }
254   - })
255   - }
  318 + params: JSON.stringify(query),
  319 + },
  320 + });
  321 + },
256 322 },
257 323 };
258 324 </script>
... ... @@ -270,7 +336,7 @@ div::-webkit-scrollbar-thumb {
270 336 <style lang="scss" scoped>
271 337 .main {
272 338 height: 100%;
273   - background: rgba($color: #000000, $alpha: .3);
  339 + background: rgba($color: #000000, $alpha: 0.3);
274 340 display: flex;
275 341 justify-content: center;
276 342 }
... ...
src/views/basic/test/list.vue
... ... @@ -5,83 +5,217 @@
5 5 <span>即时测-数据报表</span>
6 6 </template>
7 7 <template slot="btns">
8   - <el-tooltip v-if="!code && gdClass" effect="dark" content="已归档试卷" placement="bottom">
9   - <el-button type="primary" icon="fa fa-archive" size="mini" plain circle @click="toArchiving"></el-button>
  8 + <el-tooltip
  9 + v-if="!code && gdClass"
  10 + effect="dark"
  11 + content="已归档试卷"
  12 + placement="bottom"
  13 + >
  14 + <el-button
  15 + type="primary"
  16 + icon="fa fa-archive"
  17 + size="mini"
  18 + plain
  19 + circle
  20 + @click="toArchiving"
  21 + ></el-button>
10 22 </el-tooltip>
11 23 </template>
12 24 </back-box>
13 25 <div v-show="!isDetail" class="table-box" v-loading="loading">
14 26 <div v-if="!isMultipleClass">
15 27 <p class="btn-box">
16   - <el-button type="primary" round @click="linkToDetail2">查看汇总报表</el-button>
  28 + <el-button type="primary" round @click="linkToDetail2"
  29 + >查看汇总报表</el-button
  30 + >
17 31 </p>
18   - <el-table :data="tableData" :max-height="tableMaxHeight" border style="width: 100%"
19   - @selection-change="handleSelectionChange">
20   - <el-table-column type="selection" width="40"></el-table-column>
21   - <el-table-column prop="subjectName" label="科目" align="center"></el-table-column>
22   - <el-table-column prop="className" label="班级" align="center"></el-table-column>
23   - <el-table-column prop="title" label="试卷名称" align="center"></el-table-column>
24   - <el-table-column prop="examPaperScore" label="卷面分" align="center"></el-table-column>
  32 + <el-table
  33 + :data="tableData"
  34 + :max-height="tableMaxHeight"
  35 + border
  36 + style="width: 100%"
  37 + @selection-change="handleSelectionChange"
  38 + >
  39 + <el-table-column width="40" v-if="role == 'ROLE_BANZHUREN'">
  40 + <template slot-scope="scope">
  41 + <el-checkbox
  42 + v-model="multipleSelection"
  43 + :label="scope.row.id"
  44 + ></el-checkbox>
  45 + </template>
  46 + </el-table-column>
  47 + <el-table-column type="selection" width="40" v-else></el-table-column>
  48 + <el-table-column
  49 + prop="subjectName"
  50 + label="科目"
  51 + align="center"
  52 + ></el-table-column>
  53 + <el-table-column
  54 + prop="className"
  55 + label="班级"
  56 + align="center"
  57 + ></el-table-column>
  58 + <el-table-column
  59 + prop="title"
  60 + label="试卷名称"
  61 + align="center"
  62 + ></el-table-column>
  63 + <el-table-column
  64 + prop="examPaperScore"
  65 + label="卷面分"
  66 + align="center"
  67 + ></el-table-column>
25 68 <el-table-column label="测验人数/班级人数" align="center">
26   - <template slot-scope="scoped">{{ `${scoped.row.answeredNum}/${scoped.row.classPersonNum}` }}</template>
  69 + <template slot-scope="scoped">{{
  70 + `${scoped.row.answeredNum}/${scoped.row.classPersonNum}`
  71 + }}</template>
27 72 </el-table-column>
28   - <el-table-column prop="examStartTime" label="测验开始时间" align="center"></el-table-column>
  73 + <el-table-column
  74 + prop="examStartTime"
  75 + label="测验开始时间"
  76 + align="center"
  77 + ></el-table-column>
29 78 <el-table-column label="操作" align="center">
30 79 <template slot-scope="scoped">
31   - <el-tooltip v-if="scoped.row.answerNum != 0 || scoped.row.recordStatus != 0
32   - " effect="dark" content="详情" placement="top">
33   - <el-button type="primary" circle size="mini" icon="fa fa-arrow-right"
34   - @click="linkTo(scoped.row)"></el-button>
  80 + <el-tooltip
  81 + v-if="scoped.row.answerNum != 0 || scoped.row.recordStatus != 0"
  82 + effect="dark"
  83 + content="详情"
  84 + placement="top"
  85 + >
  86 + <el-button
  87 + type="primary"
  88 + circle
  89 + size="mini"
  90 + icon="fa fa-arrow-right"
  91 + @click="linkTo(scoped.row)"
  92 + ></el-button>
35 93 </el-tooltip>
36 94 <template v-if="scoped.row.answerNum == 0">
37   - <el-tooltip v-if="role != 'ROLE_BANZHUREN'" effect="dark" content="设置答案" placement="top">
38   - <el-button type="primary" circle size="mini" icon="fa fa-file-text"
39   - @click="edit(scoped.row)"></el-button>
  95 + <el-tooltip
  96 + v-if="role != 'ROLE_BANZHUREN'"
  97 + effect="dark"
  98 + content="设置答案"
  99 + placement="top"
  100 + >
  101 + <el-button
  102 + type="primary"
  103 + circle
  104 + size="mini"
  105 + icon="fa fa-file-text"
  106 + @click="edit(scoped.row)"
  107 + ></el-button>
40 108 </el-tooltip>
41 109 <template v-else>未设置答案</template>
42 110 </template>
43 111 <!-- <el-tooltip v-else effect="dark" content="答卷录分" placement="top">
44 112 <el-button type="primary" circle size="mini" @click="openScoreSet(scoped.row)">分</el-button>
45 113 </el-tooltip> -->
46   - <el-tooltip v-else effect="dark" content="答卷录分" placement="top">
47   - <el-button type="primary" circle size="mini" @click="openScoreSet(scoped.row)">分</el-button>
  114 + <el-tooltip
  115 + v-else
  116 + effect="dark"
  117 + content="答卷录分"
  118 + placement="top"
  119 + >
  120 + <el-button
  121 + type="primary"
  122 + circle
  123 + size="mini"
  124 + @click="openScoreSet(scoped.row)"
  125 + >分</el-button
  126 + >
48 127 </el-tooltip>
49   - <el-popconfirm v-if="role != 'ROLE_BANZHUREN'" title="确定删除吗?"
50   - @confirm="removeReport(scoped.row, scoped.$index)">
51   - <el-button class="remove-test" slot="reference" type="danger" circle size="mini" icon="el-icon-delete"
52   - :loading="scoped.row.loading"></el-button>
  128 + <el-popconfirm
  129 + v-if="role != 'ROLE_BANZHUREN'"
  130 + title="确定删除吗?"
  131 + @confirm="removeReport(scoped.row, scoped.$index)"
  132 + >
  133 + <el-button
  134 + class="remove-test"
  135 + slot="reference"
  136 + type="danger"
  137 + circle
  138 + size="mini"
  139 + icon="el-icon-delete"
  140 + :loading="scoped.row.loading"
  141 + ></el-button>
53 142 </el-popconfirm>
54 143 </template>
55 144 </el-table-column>
56 145 </el-table>
57 146 <div class="pagination-box">
58   - <el-pagination small="" layout="total,prev, pager, next" :hide-on-single-page="true" :total="total"
59   - @current-change="changePage" :current-page="page" :page-size="size">
  147 + <el-pagination
  148 + small=""
  149 + layout="total,prev, pager, next"
  150 + :hide-on-single-page="true"
  151 + :total="total"
  152 + @current-change="changePage"
  153 + :current-page="page"
  154 + :page-size="size"
  155 + >
60 156 </el-pagination>
61 157 </div>
62   - <ScoreSet v-show="diaScoreSet" :diaScoreSet="diaScoreSet" :role="role" :id="examId" :title="examTitlt"
63   - :examScore="examScore" @closeScoreSet="closeScoreSet" />
  158 + <ScoreSet
  159 + v-show="diaScoreSet"
  160 + :diaScoreSet="diaScoreSet"
  161 + :role="role"
  162 + :id="examId"
  163 + :title="examTitlt"
  164 + :examScore="examScore"
  165 + @closeScoreSet="closeScoreSet"
  166 + />
64 167 </div>
65 168 <div v-else>
66   - <el-table :data="tableData" :max-height="tableMaxHeight" border style="width: 100%">
67   - <el-table-column prop="subjectName" label="科目" align="center"></el-table-column>
  169 + <el-table
  170 + :data="tableData"
  171 + :max-height="tableMaxHeight"
  172 + border
  173 + style="width: 100%"
  174 + >
  175 + <el-table-column
  176 + prop="subjectName"
  177 + label="科目"
  178 + align="center"
  179 + ></el-table-column>
68 180 <el-table-column prop="classList" label="班级" align="center">
69 181 <template slot-scope="scoped">
70   - <span v-for="(item, index) in scoped.row.classNames">{{ `${index == 0 ? '' : '/'}` + item }}</span>
  182 + <span v-for="(item, index) in scoped.row.classNames">{{
  183 + `${index == 0 ? "" : "/"}` + item
  184 + }}</span>
71 185 </template>
72 186 </el-table-column>
73   - <el-table-column prop="title" label="试卷名称" align="center"></el-table-column>
74   - <el-table-column prop="examPaperScore" label="卷面分" align="center"></el-table-column>
  187 + <el-table-column
  188 + prop="title"
  189 + label="试卷名称"
  190 + align="center"
  191 + ></el-table-column>
  192 + <el-table-column
  193 + prop="examPaperScore"
  194 + label="卷面分"
  195 + align="center"
  196 + ></el-table-column>
75 197 <el-table-column label="操作" align="center">
76 198 <template slot-scope="scoped">
77   - <el-button type="primary" circle size="mini" icon="el-icon-arrow-right"
78   - @click="linkContrast(scoped.row)"></el-button>
  199 + <el-button
  200 + type="primary"
  201 + circle
  202 + size="mini"
  203 + icon="el-icon-arrow-right"
  204 + @click="linkContrast(scoped.row)"
  205 + ></el-button>
79 206 </template>
80 207 </el-table-column>
81 208 </el-table>
82 209 <div class="pagination-box">
83   - <el-pagination small="" layout="total,prev, pager, next" :hide-on-single-page="true" :total="total"
84   - @current-change="changePage" :current-page="page" :page-size="size">
  210 + <el-pagination
  211 + small=""
  212 + layout="total,prev, pager, next"
  213 + :hide-on-single-page="true"
  214 + :total="total"
  215 + @current-change="changePage"
  216 + :current-page="page"
  217 + :page-size="size"
  218 + >
85 219 </el-pagination>
86 220 </div>
87 221 </div>
... ... @@ -91,10 +225,10 @@
91 225 </template>
92 226  
93 227 <script>
94   -import ScoreSet from "./components/scoreSet.vue"
  228 +import ScoreSet from "./components/scoreSet.vue";
95 229 export default {
96 230 components: {
97   - ScoreSet
  231 + ScoreSet,
98 232 },
99 233 data() {
100 234 return {
... ... @@ -104,9 +238,9 @@ export default {
104 238 role: "",
105 239 loading: false,
106 240 diaScoreSet: false,
107   - examId: "",//当前操作试卷
108   - examTitlt: "",//当前操作试卷名称
109   - examScore: 0,//当前操作试卷卷面总分
  241 + examId: "", //当前操作试卷
  242 + examTitlt: "", //当前操作试卷名称
  243 + examScore: 0, //当前操作试卷卷面总分
110 244 query: {
111 245 //搜索条件
112 246 classId: [],
... ... @@ -124,13 +258,13 @@ export default {
124 258 },
125 259 computed: {
126 260 isDetail: function () {
127   - let bol = (this.$route.name == "即时测报表分析") ? true : false
128   - return bol
129   - }
  261 + let bol = this.$route.name == "即时测报表分析" ? true : false;
  262 + return bol;
  263 + },
130 264 },
131 265 async created() {
132 266 this.code = this.$store.getters.csCode;
133   - this.init()
  267 + this.init();
134 268 },
135 269 mounted() {
136 270 this.tableMaxHeight = this.$refs.main.offsetHeight;
... ... @@ -139,30 +273,30 @@ export default {
139 273 "$route.query.params": function (nVal) {
140 274 let isFromTestDetail = sessionStorage.getItem("isFromTestDetail");
141 275 if (!isFromTestDetail && nVal) {
142   - this.init()
  276 + this.init();
143 277 }
144   - }
  278 + },
145 279 },
146 280 methods: {
147 281 //初始化
148 282 init() {
149   - const queryData = this.$route.query.params
150   - queryData ? this.query = { ...this.query, ...JSON.parse(queryData) } : ''
151   - console.log(this.query)
152   - this.$store.commit('setClasses', this.query.classId.join(','))
153   - if (this.query.classId.length > 1) {
154   - this.isMultipleClass = true
155   - }
  283 + const queryData = this.$route.query.params;
  284 + queryData
  285 + ? (this.query = { ...this.query, ...JSON.parse(queryData) })
  286 + : "";
  287 + console.log(this.query);
  288 + this.$store.commit("setClasses", this.query.classId.join(","));
  289 + this.isMultipleClass = false;
156 290 this.role =
157 291 this.$store.getters.info.showRole ||
158 292 this.$store.getters.info.permissions[0].role;
159 293 if (this.role != "ROLE_PERSONAL") {
160   - this._QueryGdClass()
  294 + this._QueryGdClass();
161 295 }
162   - this.page = 1
163   - this.total = 0
164   - this.tableData = []
165   - this._QueryData()
  296 + this.page = 1;
  297 + this.total = 0;
  298 + this.tableData = [];
  299 + this._QueryData();
166 300 },
167 301 //归档列表
168 302 toArchiving() {
... ... @@ -182,23 +316,23 @@ export default {
182 316 type: 1,
183 317 subjectName: obj.subjectName,
184 318 classId: this.query.classId[0],
185   - params: this.$route.query.params
  319 + params: this.$route.query.params,
186 320 },
187 321 });
188 322 },
189 323 //汇总跳转-多卷
190 324 linkToDetail2() {
191 325 if (this.multipleSelection.length == 0) {
192   - this.$message.warning("请选择试卷!")
193   - return
194   - };
195   - let subjectArr = []
196   - const ids = this.multipleSelection.map(item => {
197   - subjectArr.push(item.subjectName)
198   - return item.id
199   - })
200   - subjectArr = [...new Set(subjectArr)]
201   - console.log(subjectArr)
  326 + this.$message.warning("请选择试卷!");
  327 + return;
  328 + }
  329 + let subjectArr = [];
  330 + const ids = this.multipleSelection.map((item) => {
  331 + subjectArr.push(item.subjectName);
  332 + return item.id;
  333 + });
  334 + subjectArr = [...new Set(subjectArr)];
  335 + console.log(subjectArr);
202 336 if (ids.length == 1) {
203 337 this.$router.push({
204 338 path: "/testAnalysis",
... ... @@ -209,7 +343,7 @@ export default {
209 343 type: 1,
210 344 subjectName: subjectArr.join(),
211 345 classId: this.query.classId[0],
212   - params: this.$route.query.params
  346 + params: this.$route.query.params,
213 347 },
214 348 });
215 349 } else {
... ... @@ -221,24 +355,24 @@ export default {
221 355 classId: this.query.classId[0],
222 356 type: subjectArr.length == 1 ? 2 : 3,
223 357 subjectName: subjectArr.join(),
224   - params: this.$route.query.params
  358 + params: this.$route.query.params,
225 359 },
226 360 });
227 361 }
228 362 },
229 363 // 多班对比
230 364 linkContrast(obj) {
231   - console.log(obj)
  365 + console.log(obj);
232 366 this.$router.push({
233 367 path: "/testAnalysis",
234 368 query: {
235   - ids: obj.ids.join(','),
236   - classId: obj.classIds.join(','),
  369 + ids: obj.ids.join(","),
  370 + classId: obj.classIds.join(","),
237 371 subjectName: obj.subjectName,
238 372 title: obj.title,
239 373 type: 4,
240 374 examPaperScore: obj.examPaperScore,
241   - params: this.$route.query.params
  375 + params: this.$route.query.params,
242 376 },
243 377 });
244 378 },
... ... @@ -247,7 +381,7 @@ export default {
247 381 },
248 382 //打开答卷录分
249 383 openScoreSet(obj) {
250   - console.log(obj)
  384 + console.log(obj);
251 385 this.examId = String(obj.id);
252 386 this.examTitlt = obj.title;
253 387 this.examScore = obj.examPaperScore;
... ... @@ -255,7 +389,7 @@ export default {
255 389 },
256 390 //关闭设置分数
257 391 closeScoreSet() {
258   - this.diaScoreSet = false
  392 + this.diaScoreSet = false;
259 393 },
260 394 //修改答案
261 395 edit(item) {
... ... @@ -303,19 +437,21 @@ export default {
303 437 let query = {};
304 438 for (let key in this.query) {
305 439 if (this.query[key] != "") {
306   - if (key == 'classId') {
  440 + if (key == "classId") {
307 441 if (this.query.classId?.length == 1) {
308   - query.classId = this.query[key][0]
  442 + query.classId = this.query[key][0];
309 443 } else {
310   - query.classIds = [...this.query[key]]
  444 + query.classIds = [...this.query[key]];
311 445 }
312 446 } else {
313 447 query[key] = this.query[key];
314 448 }
315 449 }
316 450 }
317   - const examReportList = this.role == "ROLE_PERSONAL" ?
318   - this.$request.pExamReportList : this.$request.examReportList
  451 + const examReportList =
  452 + this.role == "ROLE_PERSONAL"
  453 + ? this.$request.pExamReportList
  454 + : this.$request.examReportList;
319 455 const { data, status, info } = await examReportList({
320 456 ...query,
321 457 page: this.page,
... ... @@ -323,44 +459,60 @@ export default {
323 459 });
324 460 this.loading = false;
325 461 if (status === 0) {
326   - if (this.query.classId.length > 1) {
327   - //多班级
328   - let tableObj = {};
  462 + if (this.role == "ROLE_BANZHUREN") {
  463 + this.tableData = (data?.list && [...data?.list]) || [];
  464 + this.total = data?.count || 0;
  465 + } else {
  466 + this.isMultipleClass = true;
  467 + let classArr = [];
329 468 data?.list?.map((item) => {
330   - if (tableObj[item.examPaperId]) {
331   - // 没有班级考试的添加
332   - if (!tableObj[item.examPaperId].classIds.includes(item.classId)) {
333   - tableObj[item.examPaperId].ids.push(item.id)
334   - tableObj[item.examPaperId].classIds.push(item.classId)
335   - tableObj[item.examPaperId].classNames.push(item.className)
336   - } else {
337   - //已经考过班级的新的替换老的
338   - let idx = tableObj[item.examPaperId].classIds.indexOf(item.classId)
339   - if (tableObj[item.examPaperId].ids[idx] < item.id) {
340   - tableObj[item.examPaperId].ids[idx] = [item.id]
341   - tableObj[item.examPaperId].title = item.title
  469 + if (!classArr.includes(item.classId)) {
  470 + classArr.push(item.classId);
  471 + }
  472 + });
  473 + if (classArr.length > 1) {
  474 + //多班级
  475 + let tableObj = {};
  476 + data?.list?.map((item) => {
  477 + if (tableObj[item.examPaperId]) {
  478 + // 没有班级考试的添加
  479 + if (
  480 + !tableObj[item.examPaperId].classIds.includes(item.classId)
  481 + ) {
  482 + tableObj[item.examPaperId].ids.push(item.id);
  483 + tableObj[item.examPaperId].classIds.push(item.classId);
  484 + tableObj[item.examPaperId].classNames.push(item.className);
  485 + } else {
  486 + //已经考过班级的新的替换老的
  487 + let idx = tableObj[item.examPaperId].classIds.indexOf(
  488 + item.classId
  489 + );
  490 + if (tableObj[item.examPaperId].ids[idx] < item.id) {
  491 + tableObj[item.examPaperId].ids[idx] = [item.id];
  492 + tableObj[item.examPaperId].title = item.title;
  493 + }
342 494 }
  495 + } else {
  496 + tableObj[item.examPaperId] = {
  497 + ids: [item.id],
  498 + examPaperId: item.examPaperId,
  499 + classIds: [item.classId],
  500 + classNames: [item.className],
  501 + title: item.title,
  502 + examPaperScore: item.examPaperScore,
  503 + subjectName: item.subjectName,
  504 + };
343 505 }
344   - } else {
345   - tableObj[item.examPaperId] = {
346   - ids: [item.id],
347   - examPaperId: item.examPaperId,
348   - classIds: [item.classId],
349   - classNames: [item.className],
350   - title: item.title,
351   - examPaperScore: item.examPaperScore,
352   - subjectName: item.subjectName
  506 + });
  507 + Object.keys(tableObj).map((keys) => {
  508 + if (tableObj[keys].classIds.length > 1) {
  509 + this.tableData.push(tableObj[keys]);
353 510 }
354   - }
355   - });
356   - Object.keys(tableObj).map(keys => {
357   - if (tableObj[keys].classIds.length > 1) {
358   - this.tableData.push(tableObj[keys])
359   - }
360   - })
361   - } else {
362   - this.tableData = (data?.list && [...data?.list]) || [];
363   - this.total = data?.count || 0;
  511 + });
  512 + } else {
  513 + this.tableData = (data?.list && [...data?.list]) || [];
  514 + this.total = data?.count || 0;
  515 + }
364 516 }
365 517 } else {
366 518 this.$message.error(info);
... ...