Commit 31fe9b9a97a702029e1add4b16c2d63ad1202ce6
1 parent
ea4f5fc9
班级修改删除即可偶调整
Showing
3 changed files
with
46 additions
and
32 deletions
src/api/apis/apis.js
src/api/urls/apis.js
src/views/standard/setUp/clazz.vue
... | ... | @@ -26,7 +26,12 @@ |
26 | 26 | ></el-button> |
27 | 27 | </el-tooltip> |
28 | 28 | <el-tooltip effect="dark" content="分班" placement="bottom"> |
29 | - <img @click="toArchived" src="../../../assets/images/fenban.png" class="fenban" alt="" /> | |
29 | + <img | |
30 | + @click="toArchived" | |
31 | + src="../../../assets/images/fenban.png" | |
32 | + class="fenban" | |
33 | + alt="" | |
34 | + /> | |
30 | 35 | </el-tooltip> |
31 | 36 | </template> |
32 | 37 | </back-box> |
... | ... | @@ -76,11 +81,7 @@ |
76 | 81 | </div> |
77 | 82 | </div> |
78 | 83 | <el-dialog title="导入班级名单" :visible.sync="diaUp" width="600"> |
79 | - <up-load | |
80 | - :url="url" | |
81 | - @upSuccess="upSuccess" | |
82 | - fileName="班级名单" | |
83 | - > | |
84 | + <up-load :url="url" @upSuccess="upSuccess" fileName="班级名单"> | |
84 | 85 | <p class="down-txt" slot="down"> |
85 | 86 | 通过Excel名单导入班级名单,点击 |
86 | 87 | <el-link type="danger" @click="downExcel">模板下载</el-link> 。 |
... | ... | @@ -124,7 +125,11 @@ |
124 | 125 | <div class="dialog-footer" slot="footer"> |
125 | 126 | <el-button @click="_SaveClass" type="primary">确 定</el-button> |
126 | 127 | <el-button @click="diaClass = false">取 消</el-button> |
127 | - <el-popconfirm title="确定删除该班级吗?" @confirm="_RemoveClass"> | |
128 | + <el-popconfirm | |
129 | + v-if="!formClass.teacherCount && !formClass.studentCount" | |
130 | + title="确定删除该班级吗?" | |
131 | + @confirm="_RemoveClass" | |
132 | + > | |
128 | 133 | <el-button class="el-button-del" slot="reference" type="danger" plain |
129 | 134 | >删 除</el-button |
130 | 135 | > |
... | ... | @@ -201,7 +206,7 @@ |
201 | 206 | </template> |
202 | 207 | |
203 | 208 | <script> |
204 | -import { downloadFile } from "@/utils"; | |
209 | +import { downloadFile, formatDate } from "@/utils"; | |
205 | 210 | import draggable from "vuedraggable"; |
206 | 211 | export default { |
207 | 212 | components: { |
... | ... | @@ -224,6 +229,8 @@ export default { |
224 | 229 | className: "", |
225 | 230 | classCode: "", |
226 | 231 | intoSchoolYear: "", |
232 | + studentCount: "", | |
233 | + teacherCount: "", | |
227 | 234 | }, |
228 | 235 | rulesClass: { |
229 | 236 | className: [ |
... | ... | @@ -243,10 +250,10 @@ export default { |
243 | 250 | this._QuerySubject(); |
244 | 251 | }, |
245 | 252 | methods: { |
246 | - toArchived(){ | |
253 | + toArchived() { | |
247 | 254 | this.$router.push({ |
248 | - path:'/archived' | |
249 | - }) | |
255 | + path: "/archived", | |
256 | + }); | |
250 | 257 | }, |
251 | 258 | openSubject(obj) { |
252 | 259 | this.formClass.gradeName = obj.gradeName; |
... | ... | @@ -275,6 +282,8 @@ export default { |
275 | 282 | this._QueryData(); |
276 | 283 | }, |
277 | 284 | setClass(obj, gradeName) { |
285 | + this.formClass.studentCount = obj.studentCount; | |
286 | + this.formClass.teacherCount = obj.teacherCount; | |
278 | 287 | this.formClass.gradeName = gradeName; |
279 | 288 | this.formClass.classId = obj.id; |
280 | 289 | this.formClass.className = obj.className; |
... | ... | @@ -284,24 +293,17 @@ export default { |
284 | 293 | : ""; |
285 | 294 | this.diaClass = true; |
286 | 295 | }, |
287 | - _RemoveClass() { | |
288 | - this.$refs.formClass.validate(async (valid) => { | |
289 | - if (valid) { | |
290 | - const { data, status, info } = await this.$request.removeClass({ | |
291 | - classId: this.formClass.classId, | |
292 | - }); | |
293 | - if (status === 0) { | |
294 | - this.$message.success("修改成功"); | |
295 | - this.diaClass = false; | |
296 | - this._QueryData(); | |
297 | - } else { | |
298 | - this.$message.error(info); | |
299 | - } | |
300 | - } else { | |
301 | - this.$message.warning("输入有误请检查!"); | |
302 | - return false; | |
303 | - } | |
296 | + async _RemoveClass() { | |
297 | + const { data, status, info } = await this.$request.removeClass({ | |
298 | + classId: this.formClass.classId, | |
304 | 299 | }); |
300 | + if (status === 0) { | |
301 | + this.$message.success("修改成功"); | |
302 | + this.diaClass = false; | |
303 | + this._QueryData(); | |
304 | + } else { | |
305 | + this.$message.error(info); | |
306 | + } | |
305 | 307 | }, |
306 | 308 | _SaveClass() { |
307 | 309 | this.$refs.formClass.validate(async (valid) => { |
... | ... | @@ -309,7 +311,8 @@ export default { |
309 | 311 | const { data, status, info } = await this.$request.updateClass({ |
310 | 312 | classId: this.formClass.classId, |
311 | 313 | className: this.formClass.className, |
312 | - intoSchoolYear: this.formClass.intoSchoolYear, | |
314 | + classCode: this.formClass.classCode, | |
315 | + intoSchoolYear: formatDate(this.formClass.intoSchoolYear, "yyyy"), | |
313 | 316 | }); |
314 | 317 | if (status === 0) { |
315 | 318 | this.$message.success("修改成功"); |
... | ... | @@ -468,9 +471,9 @@ export default { |
468 | 471 | </script> |
469 | 472 | |
470 | 473 | <style lang="scss" scoped> |
471 | -.fenban{ | |
472 | - width:28px; | |
473 | - margin-left:10px; | |
474 | +.fenban { | |
475 | + width: 28px; | |
476 | + margin-left: 10px; | |
474 | 477 | cursor: pointer; |
475 | 478 | } |
476 | 479 | .page-tit { | ... | ... |