From f2a9cb154099a59a97de312ea2bb45d37639868b Mon Sep 17 00:00:00 2001
From: lohir <3399054449@qq.com>
Date: 星期四, 17 十月 2024 19:46:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/class-management/ClassStaff.vue | 70 ++++++++++++++++++++++++-----------
1 files changed, 48 insertions(+), 22 deletions(-)
diff --git a/src/views/class-management/ClassStaff.vue b/src/views/class-management/ClassStaff.vue
index 2e20b1b..5007373 100644
--- a/src/views/class-management/ClassStaff.vue
+++ b/src/views/class-management/ClassStaff.vue
@@ -3,7 +3,7 @@
<div class="app-container">
<div style="display: flex; flex-direction: row">
<div style="padding-bottom:20px">
- <span class="item">{{ title }}</span>
+ <span class="item">{{ this.$route.query.className }}</span>
<el-button class="item" @click="handlerAddStudent" type="primary" size="small">鏂板瀛﹀憳</el-button>
<el-button class="item" @click="open = true" type="primary" size="small">瀛﹀憳璋冩暣</el-button>
</div>
@@ -14,7 +14,7 @@
placeholder="瀛﹀憳濮撳悕"></el-input>
</el-form-item>
<el-form-item>
- <el-button type="primary" @click="page">鏌ヨ</el-button>
+ <el-button type="primary" @click="page" size="small">鏌ヨ</el-button>
</el-form-item>
</el-form>
</div>
@@ -59,9 +59,14 @@
width="300px"
>
<template slot-scope="scope">
- <el-button @click="handlerEditStudent(scope.row)" type="warning">缂栬緫</el-button>
- <el-button @click="remove(scope.row.id)" type="danger">鍒犻櫎</el-button>
- <el-button type="primary">鍒嗛厤瑙掕壊</el-button>
+ <el-button @click="handlerEditStudent(scope.row)" type="warning" size="small">缂栬緫</el-button>
+ <el-popconfirm
+ style="margin: 0 5px"
+ title="纭畾瑕佸垹闄よ鎴愬憳鍚楋紵"
+ @confirm="remove(scope.row.id)"
+ >
+ <el-button slot="reference" type="danger" size="small">鍒犻櫎</el-button>
+ </el-popconfirm>
</template>
</el-table-column>
</el-table>
@@ -69,7 +74,7 @@
class="block"
style="display: flex; margin-top: 40px;"
>
- <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageNum"
+ <pagination v-show="total>0" :total="total" :page.sync="searchForm.currentPage"
:limit.sync="searchForm.pageSize"
@pagination="page"/>
</div>
@@ -77,15 +82,16 @@
:title="studentTitle"
:visible.sync="addOpen"
width="700px"
- :before-close="handleAddClose">
+ :before-close="handleAddClose"
+ :close-on-click-modal="false">
<el-form :model="studentForm" :rules="studentRules" ref="studentForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="濮撳悕" prop="realName">
<el-input v-model="studentForm.realName"></el-input>
</el-form-item>
<el-form-item label="鎬у埆" prop="sex">
<el-select v-model="studentForm.sex">
- <el-option label="鐢�" value="N"></el-option>
- <el-option label="濂�" value="V"></el-option>
+ <el-option label="鐢�" :value="1"></el-option>
+ <el-option label="濂�" :value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="鐢佃瘽" prop="phone">
@@ -133,16 +139,24 @@
<script>
// 寮曞叆褰堝嚭绐楀彛绲勪欢
import UserApi from '@/api/user'
-import { updateClassesUser, getClassesUsers, deleteClassesUserById, addClassesUser, edit } from '@/api/classesUser'
+import {
+ updateClassesUser,
+ getClassesUsers,
+ deleteClassesUserById,
+ addClassesUser,
+ editClassesUser
+} from '@/api/classesUser'
import Pagination from '@/components/Pagination'
+import {deleteExamById} from "@/api/exam";
export default {
components: { Pagination },
data () {
return {
studentForm: {
+ id: null,
realName: '',
- sex: '',
+ sex: 1,
phone: '',
age: null,
account: '',
@@ -169,7 +183,7 @@
searchForm: {
studentName: '',
pageSize: 10,
- pageNum: 1,
+ currentPage: 1,
classesId: null
},
classes: {
@@ -205,20 +219,24 @@
},
submitStudentForm () {
this.$refs['studentForm'].validate((valid) => {
+ console.log(this.studentForm)
if (valid) {
- this.studentForm.classes = this.classes.id
+ this.studentForm.classesId = this.classes.id
if (this.studentForm.id) {
- edit(this.studentForm).then(res => {
+ editClassesUser(this.studentForm).then(res => {
this.addOpen = false
this.$message.success(res.data.message)
this.page()
+ this.resetStudentForm()
+ })
+ }else {
+ addClassesUser(this.studentForm).then(res => {
+ this.addOpen = false
+ this.$message.success(res.data.message)
+ this.page()
+ this.resetStudentForm()
})
}
- addClassesUser(this.studentForm).then(res => {
- this.addOpen = false
- this.$message.success(res.data.message)
- this.page()
- })
}
})
},
@@ -235,9 +253,15 @@
this.resetStudentForm()
},
remove (id) {
- deleteClassesUserById(id).then(res => {
- this.$message.success(res.data.message)
- this.page()
+ this.$confirm('纭鏄惁鍒犻櫎?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ deleteClassesUserById(id).then(res => {
+ this.$message.success(res.data.message)
+ this.page()
+ })
})
},
sexFormatter (row) {
@@ -266,6 +290,8 @@
this.searchForm.classesId = this.classes.id
getClassesUsers(this.searchForm).then(res => {
this.tableData = res.data.data
+ this.total = res.data.total
+ this.loading = false
})
},
submitForm () {
--
Gitblit v1.8.0