| | |
| | | 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-button @click="remove(scope.row.id)" type="danger" size="small">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | 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> |
| | |
| | | :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"> |
| | |
| | | <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' |
| | | |
| | | export default { |
| | |
| | | data () { |
| | | return { |
| | | studentForm: { |
| | | id: null, |
| | | realName: '', |
| | | sex: '', |
| | | sex: 1, |
| | | phone: '', |
| | | age: null, |
| | | account: '', |
| | |
| | | searchForm: { |
| | | studentName: '', |
| | | pageSize: 10, |
| | | pageNum: 1, |
| | | currentPage: 1, |
| | | classesId: null |
| | | }, |
| | | classes: { |
| | |
| | | }, |
| | | 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() |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | 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 () { |