Commit 38bdc42267894e6137a35c8a4abc949a509ae76d
1 parent
757a21e3
学生画像班主任和任课教师接口区分
Showing
2 changed files
with
42 additions
and
124 deletions
src/views/portrait/detail.vue
... | ... | @@ -309,6 +309,8 @@ export default { |
309 | 309 | let subjectList = |
310 | 310 | this.role == "ROLE_PERSONAL" |
311 | 311 | ? this.$request.pSubjectList |
312 | + : this.role == "ROLE_BANZHUREN" | |
313 | + ? this.$request.cTSubjectList | |
312 | 314 | : this.$request.tSubjectList; |
313 | 315 | const { data, status, info } = await subjectList({ |
314 | 316 | classId: this.classId, |
... | ... | @@ -390,7 +392,7 @@ export default { |
390 | 392 | this.loading = false; |
391 | 393 | if (status === 0) { |
392 | 394 | this.count = 0; |
393 | - this.tableData = data.list || []; | |
395 | + this.tableData = data?.list || []; | |
394 | 396 | if (this.type == 1) { |
395 | 397 | this.radarChartData.indicator = []; |
396 | 398 | this.radarChartData.num = [ | ... | ... |
src/views/portrait/index.vue
... | ... | @@ -21,40 +21,32 @@ |
21 | 21 | > |
22 | 22 | </el-option> |
23 | 23 | </el-select> |
24 | - <div class="d1"> | |
25 | - <el-date-picker | |
26 | - v-model="query.startDay" | |
27 | - type="date" | |
28 | - @change="handleChangeTimeStart" | |
29 | - placeholder="选择日期时间" | |
30 | - value-format="yyyy-MM-dd" | |
31 | - > | |
32 | - </el-date-picker> | |
33 | - ~ | |
34 | - <el-date-picker | |
35 | - v-model="query.endDay" | |
36 | - type="date" | |
37 | - placeholder="选择日期时间" | |
38 | - @change="handleChangeTimeEnd" | |
39 | - value-format="yyyy-MM-dd" | |
40 | - > | |
41 | - </el-date-picker> | |
42 | - </div> | |
43 | - <p class="p1"> | |
44 | - <span @click="setDate(1)" :class="[date == 1 ? 'active' : '', 's1']" | |
45 | - >今天</span | |
46 | - > | |
47 | - <span @click="setDate(2)" :class="[date == 2 ? 'active' : '', 's1']" | |
48 | - >本周</span | |
49 | - > | |
50 | - <span @click="setDate(3)" :class="[date == 3 ? 'active' : '', 's1']" | |
51 | - >本月</span | |
52 | - > | |
53 | - <span @click="setDate(4)" :class="[date == 4 ? 'active' : '', 's1']" | |
54 | - >本季度</span | |
55 | - > | |
56 | - </p> | |
57 | - <el-button type="primary" round @click="_QueryData()">筛选</el-button> | |
24 | + <el-input | |
25 | + placeholder="请输入学生姓名" | |
26 | + v-model="query.studentName" | |
27 | + class="input-with-select" | |
28 | + maxlength="30" | |
29 | + @keyup.enter.native="(query.studentCode = ''), _QueryData()" | |
30 | + > | |
31 | + <el-button | |
32 | + slot="append" | |
33 | + icon="el-icon-search" | |
34 | + @click="(query.studentCode = ''), _QueryData()" | |
35 | + ></el-button> | |
36 | + </el-input> | |
37 | + <el-input | |
38 | + placeholder="请输入学生学号" | |
39 | + v-model="query.studentCode" | |
40 | + class="input-with-select" | |
41 | + maxlength="30" | |
42 | + @keyup.enter.native="(query.studentName = ''), _QueryData()" | |
43 | + > | |
44 | + <el-button | |
45 | + slot="append" | |
46 | + icon="el-icon-search" | |
47 | + @click="(query.studentName = ''), _QueryData()" | |
48 | + ></el-button> | |
49 | + </el-input> | |
58 | 50 | </div> |
59 | 51 | </div> |
60 | 52 | <div class="page-content"> |
... | ... | @@ -66,8 +58,10 @@ |
66 | 58 | </div> |
67 | 59 | <div class="info"> |
68 | 60 | <p class="p1"> |
69 | - {{ item.studentName }} <i class="fa fa-calculator"></i> | |
70 | - {{ item.clickerSn }} | |
61 | + {{ item.studentName }} | |
62 | + <template v-if="item.clickerSn" | |
63 | + ><i class="fa fa-calculator"></i> {{ item.clickerSn }}</template | |
64 | + > | |
71 | 65 | </p> |
72 | 66 | <p class="p2">{{ gradeName(item.grade) }}</p> |
73 | 67 | <p class="p3">最近活跃:{{ item.modifiedTime }}</p> |
... | ... | @@ -96,15 +90,14 @@ export default { |
96 | 90 | query: { |
97 | 91 | //搜索条件 |
98 | 92 | classId: "", |
99 | - startDay: "", | |
100 | - endDay: "", | |
101 | - day: "", | |
93 | + studentName: "", | |
94 | + studentCode: "", | |
102 | 95 | }, |
103 | 96 | date: "", |
104 | 97 | classList: [], |
105 | 98 | tableData: [], |
106 | 99 | page: 1, |
107 | - size: 20, | |
100 | + size: 999, | |
108 | 101 | total: 0, |
109 | 102 | }; |
110 | 103 | }, |
... | ... | @@ -113,23 +106,13 @@ export default { |
113 | 106 | this.$store.getters.info.showRole || |
114 | 107 | this.$store.getters.info.permissions[0].role; |
115 | 108 | await this._QueryClassList(); |
116 | - await this.setDate(1); | |
117 | - let startDay = this.query?.startDay; | |
118 | - if (!startDay) { | |
119 | - this.query.startDay = new Date(); | |
120 | - this.query.endDay = new Date(); | |
121 | - } | |
109 | + await this._QueryData(); | |
122 | 110 | }, |
123 | 111 | activated() { |
124 | 112 | const that = this; |
125 | 113 | BusEvent.$on("keepAlive", async function () { |
126 | 114 | await that._QueryClassList(); |
127 | - await that.setDate(1); | |
128 | - let startDay = that.query?.startDay; | |
129 | - if (!startDay) { | |
130 | - that.query.startDay = new Date(); | |
131 | - that.query.endDay = new Date(); | |
132 | - } | |
115 | + await that._QueryData(); | |
133 | 116 | }); |
134 | 117 | }, |
135 | 118 | methods: { |
... | ... | @@ -149,82 +132,16 @@ export default { |
149 | 132 | }, |
150 | 133 | changeclass() { |
151 | 134 | this.page = 1; |
135 | + this.query.studentName = ""; | |
136 | + this.query.studentCode = ""; | |
152 | 137 | this._QueryData(); |
153 | 138 | }, |
154 | - setDate(index) { | |
155 | - const that = this; | |
156 | - this.date = index == this.date ? "" : index; | |
157 | - let aYear = new Date().getFullYear(); | |
158 | - let aMonth = new Date().getMonth() + 1; | |
159 | - that.query.day = ""; | |
160 | - that.query.startDay = ""; | |
161 | - that.query.endDay = ""; | |
162 | - switch (index) { | |
163 | - case 1: | |
164 | - that.query.day = formatDate(new Date(), "yyyy-MM-dd"); | |
165 | - that.query.startDay = that.query.day; | |
166 | - that.query.endDay = that.query.day; | |
167 | - that.tabIndex = 1; | |
168 | - break; | |
169 | - case 2: | |
170 | - let day = new Date().getDay(); | |
171 | - if (day == 0) { | |
172 | - //中国式星期天是一周的最后一天 | |
173 | - day = 7; | |
174 | - } | |
175 | - day--; | |
176 | - let aTime = new Date().getTime() - 24 * 60 * 60 * 1000 * day; | |
177 | - that.query.startDay = formatDate(new Date(aTime), "yyyy-MM-dd"); | |
178 | - that.query.endDay = formatDate(new Date(), "yyyy-MM-dd"); | |
179 | - break; | |
180 | - case 3: | |
181 | - aMonth = aMonth < 10 ? "0" + aMonth : aMonth; | |
182 | - that.query.startDay = `${aYear}-${aMonth}-01`; | |
183 | - that.query.endDay = formatDate(new Date(), "yyyy-MM-dd"); | |
184 | - break; | |
185 | - case 4: | |
186 | - if (aMonth > 0 && aMonth < 4) { | |
187 | - aMonth = "1"; | |
188 | - } else if (aMonth > 3 && aMonth < 7) { | |
189 | - aMonth = "4"; | |
190 | - } else if (aMonth > 6 && aMonth < 10) { | |
191 | - aMonth = "7"; | |
192 | - } else { | |
193 | - aMonth = "10"; | |
194 | - } | |
195 | - | |
196 | - aMonth = aMonth < 10 ? "0" + aMonth : aMonth; | |
197 | - that.query.startDay = `${aYear}-${aMonth}-01`; | |
198 | - that.query.endDay = formatDate(new Date(), "yyyy-MM-dd"); | |
199 | - break; | |
200 | - } | |
201 | - this.page = 1; | |
202 | - this._QueryData(); | |
203 | - }, | |
204 | - handleChangeTimeStart(val) { | |
205 | - this.query.day = ""; | |
206 | - this.date = ""; | |
207 | - if (this.query.endDay) { | |
208 | - if (new Date(val).getTime() > new Date(this.query.endDay).getTime()) { | |
209 | - this.$message.error("任务结束时间不能任务开始时间前面,请重新设置"); | |
210 | - this.query.startDay = ""; | |
211 | - } | |
212 | - } | |
213 | - }, | |
214 | - handleChangeTimeEnd(val) { | |
215 | - this.query.day = ""; | |
216 | - this.date = ""; | |
217 | - if (this.query.startDay) { | |
218 | - if (new Date(val).getTime() < new Date(this.query.startDay).getTime()) { | |
219 | - this.$message.error("任务结束时间不能任务开始时间前面,请重新设置"); | |
220 | - this.query.endDay = ""; | |
221 | - } | |
222 | - } | |
223 | - }, | |
224 | 139 | async _QueryClassList() { |
225 | 140 | let fetchClassList = |
226 | 141 | this.role == "ROLE_PERSONAL" |
227 | 142 | ? this.$request.pClassList |
143 | + : this.role == "ROLE_BANZHUREN" | |
144 | + ? this.$request.cTClassList | |
228 | 145 | : this.$request.fetchClassList; |
229 | 146 | |
230 | 147 | const { data, status, info } = await fetchClassList(); |
... | ... | @@ -254,7 +171,6 @@ export default { |
254 | 171 | : this.$request.tStudentList; |
255 | 172 | const { data, status, info } = await studentList({ |
256 | 173 | ...query, |
257 | - page: this.page, | |
258 | 174 | size: this.size, |
259 | 175 | }); |
260 | 176 | this.loading = false; | ... | ... |