| | |
| | | <!-- 班级名称 --> |
| | | <div style="padding-bottom:20px; border-bottom: 3px solid #409EFF;margin-bottom: 20px;"> |
| | | <span>{{title}}</span> |
| | | <el-button @click="open = true" type="primary" size="small">新增学员</el-button> |
| | | </div> |
| | | <!-- 表格 --> |
| | | <el-table |
| | |
| | | class="block" |
| | | style="display: flex; margin-top: 40px;" |
| | | > |
| | | <el-pagination |
| | | style="margin:auto" |
| | | background |
| | | :page-size="10" |
| | | layout="prev, pager, next, jumper" |
| | | :total="100" |
| | | > |
| | | </el-pagination> |
| | | <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageNum" :limit.sync="searchForm.pageSize" |
| | | @pagination="page"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | ref="popUp" |
| | | @children="parentGoods" |
| | | /> |
| | | |
| | | <el-dialog |
| | | title="学员管理" |
| | | :visible.sync="open" |
| | | width="900px" |
| | | :before-close="handleClose"> |
| | | <el-transfer |
| | | filterable |
| | | :filter-method="filterMethod" |
| | | filter-placeholder="学员姓名" |
| | | :titles="['学生列表', '当前学生']" |
| | | :button-texts="['退出班级', '加入班级']" |
| | | :props="{ |
| | | key: 'id', |
| | | label: 'realName' |
| | | }" |
| | | v-model="classes.studentList" |
| | | :data="studentList"> |
| | | </el-transfer> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="handleClose">取 消</el-button> |
| | | <el-button type="primary" @click="submitForm">保 存</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | </template> |
| | | <script> |
| | | // 引入彈出窗口組件 |
| | | import PopUp from "../../../components/PopUp/Question.vue"; |
| | | import UserApi from "@/api/user"; |
| | | import { updateClassesUser, getClassesUsers } from "@/api/classesUser"; |
| | | export default { |
| | | // 注册 |
| | | components: { |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | total: 0, |
| | | studentList: [], |
| | | searchForm: { |
| | | realName: "", |
| | | pageSize: 10, |
| | | pageNum: 1, |
| | | classesId: null |
| | | }, |
| | | classes: { |
| | | id: null, |
| | | studentList: [] |
| | | }, |
| | | open: false, |
| | | // 班级名称 |
| | | title: "19级软件四班", |
| | | formLabelAlign: { |
| | |
| | | region: "", |
| | | }, |
| | | tableData: [ |
| | | { |
| | | id: 1, |
| | | name: "张三", |
| | | sex: "男", |
| | | phone: "12345678977", |
| | | // 是否上线 |
| | | condition: "已上线", |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: "李四", |
| | | sex: "女", |
| | | phone: "12345678977", |
| | | // 是否上线 |
| | | condition: "已上线", |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: "王五", |
| | | sex: "男", |
| | | phone: "12345678977", |
| | | // 是否上线 |
| | | condition: "未上线", |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: "张三", |
| | | sex: "男", |
| | | phone: "12345678977", |
| | | // 是否上线 |
| | | condition: "已上线", |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: "李四", |
| | | sex: "女", |
| | | phone: "12345678977", |
| | | // 是否上线 |
| | | condition: "已上线", |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: "王五", |
| | | sex: "男", |
| | | phone: "12345678977", |
| | | // 是否上线 |
| | | condition: "未上线", |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: "张三", |
| | | sex: "男", |
| | | phone: "12345678977", |
| | | // 是否上线 |
| | | condition: "已上线", |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: "李四", |
| | | sex: "女", |
| | | phone: "12345678977", |
| | | // 是否上线 |
| | | condition: "已上线", |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: "王五", |
| | | sex: "男", |
| | | phone: "12345678977", |
| | | // 是否上线 |
| | | condition: "未上线", |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: "王五", |
| | |
| | | ], |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.classes.id = this.$route.query.classesId; |
| | | this.page() |
| | | this.getClassesCurrentUserList(this.classes.id) |
| | | this.getStudentList() |
| | | }, |
| | | methods: { |
| | | getClassesCurrentUserList(classesId) { |
| | | let param = { |
| | | classesId: classesId |
| | | } |
| | | UserApi.getClassesCurrentUserList(param).then(res => { |
| | | this.classes.studentList = res.data |
| | | }) |
| | | }, |
| | | getStudentList() { |
| | | UserApi.studentList().then(res => { |
| | | this.studentList = res.data; |
| | | }) |
| | | }, |
| | | // 获取当前班级学员分页 |
| | | page() { |
| | | this.searchForm.classesId = this.classes.id |
| | | getClassesUsers(this.searchForm).then(res => { |
| | | this.tableData = res.data.data |
| | | }) |
| | | }, |
| | | submitForm() { |
| | | updateClassesUser(this.classes).then(res => { |
| | | this.$message.success(res.data.message) |
| | | this.classesStudentPage(); |
| | | }) |
| | | }, |
| | | handleClose() { |
| | | |
| | | }, |
| | | filterMethod(query, item) { |
| | | return item.realName.indexOf(query) > -1; |
| | | }, |
| | | // 返回上一个页面 |
| | | goBack() { |
| | | this.$router.back(); |