| | |
| | | <el-form ref="form" inline="true" :model="searchData"> |
| | | <el-form-item> |
| | | <el-input |
| | | placeholder="请输入人员名称" |
| | | v-model="keyword" |
| | | placeholder="请输入人员名称" |
| | | > |
| | | <i slot="prefix" class="el-input__icon el-icon-search" /> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button @click="searchData()" type="primary">查询</el-button> |
| | | <el-button @click="resetData()" type="primary" plain>重置</el-button> |
| | | <el-button type="primary" @click="searchData()">查询</el-button> |
| | | <el-button type="primary" plain @click="resetData()">重置</el-button> |
| | | <!-- <el-button type="text">高级搜索<i class="el-icon-arrow-down el-icon--right" /></el-button> --> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="serve-btn"> |
| | | <el-button type="primary" @click="dialogFormVisible = true" icon="el-icon-plus">新增人员</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" @click="dialogFormVisible = true">新增人员</el-button> |
| | | |
| | | <el-dialog title="新增人员" :visible.sync="dialogFormVisible"> |
| | | <el-form :model="form" :rules="rules" ref="form"> |
| | | <el-form ref="form" :model="form" :rules="rules"> |
| | | <el-form-item label="账号" :label-width="formLabelWidth" prop="account"> |
| | | <el-input v-model="form.account" autocomplete="off"></el-input> |
| | | <el-input v-model="form.account" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="年龄" :label-width="formLabelWidth"> |
| | | <el-input v-model="form.age" autocomplete="off"></el-input> |
| | | <el-input v-model="form.age" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="邮箱" :label-width="formLabelWidth" prop="email"> |
| | | <el-input v-model="form.email" autocomplete="off"></el-input> |
| | | <el-input v-model="form.email" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="名字" :label-width="formLabelWidth" prop="name"> |
| | | <el-input v-model="form.name" autocomplete="off"></el-input> |
| | | <el-input v-model="form.name" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="电话" :label-width="formLabelWidth" prop="phone"> |
| | | <el-input v-model="form.phone" autocomplete="off"></el-input> |
| | | <el-input v-model="form.phone" autocomplete="off" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="权限" :label-width="formLabelWidth" prop="role_id"> |
| | | <el-input v-model="form.role_id" autocomplete="off"></el-input> |
| | | <el-input v-model="form.role_id" autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | min-width="120" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button> |
| | | <el-button type="text" size="small" @click="handleClick(scope.row)">编辑</el-button> |
| | | <!-- <el-button type="text" size="small">编辑</el-button> --> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <div> |
| | | <!-- 分页器 --> |
| | | <el-pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage" |
| | | :page-sizes="[100, 200, 300, 400]" |
| | | :page-size=pageSize |
| | | :page-size="pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total=this.personnerlTable.length> |
| | | </el-pagination> |
| | | :total="this.personnerlTable.length" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | currentPage: 1, |
| | | keyword: '', |
| | | personnerlTable: [ |
| | | |
| | |
| | | personData:[], //用来存放接口传过来的人员列表数据 |
| | | dialogFormVisible:false, |
| | | form: { |
| | | account: "", |
| | | account: '', |
| | | age: '', |
| | | email: "", |
| | | name: "", |
| | | phone: "", |
| | | email: '', |
| | | name: '', |
| | | phone: '', |
| | | role_id: '' |
| | | }, |
| | | formLabelWidth: '120px', |
| | |
| | | {required: true, message: '请输入权限(0或1)', trigger: 'blur'} |
| | | |
| | | ] |
| | | }, |
| | | } |
| | | } |
| | | }, |
| | | mounted(){ |
| | | this.getData(); |
| | | this.getData() |
| | | }, |
| | | methods: { |
| | | //每页条数改变时触发 选择一页显示多少行 |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`) |
| | | this.currentPage = 1; |
| | | this.pageSize = val; |
| | | this.currentPage = 1 |
| | | this.pageSize = val |
| | | }, |
| | | //当前页改变时触发 跳转其他页 |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`) |
| | | this.currentPage = val; |
| | | this.currentPage = val |
| | | }, |
| | | getData(){ |
| | | axios.get("/user/list_new_personnel",{ |
| | | axios.get('/user/list_new_personnel', { |
| | | params:{ |
| | | pageNo:0, |
| | | pageSize:20 |
| | |
| | | this.personData=res.data.data.row |
| | | this.personnerlTable=this.personData |
| | | }).catch(res=>{ |
| | | console.log("error") |
| | | console.log('error') |
| | | }) |
| | | }, |
| | | searchData() { |
| | | this.filteredpersonnerlTable = this.personnerlTable.filter((item) =>{ |
| | | return item.username==this.keyword |
| | | return item.username === this.keyword |
| | | } |
| | | ); |
| | | ) |
| | | this.personnerlTable=this.filteredpersonnerlTable |
| | | }, |
| | | resetData(){ |
| | |
| | | // POST请求 |
| | | this.$refs.form.validate((valid)=>{ |
| | | if(valid){ |
| | | this.dialogFormVisible = false; |
| | | this.dialogFormVisible = false |
| | | axios.post('/user/add_new_personnel', this.form) |
| | | .then(response => { |
| | | console.log(response); |
| | | console.log(response) |
| | | // this.dialogVisible = false; |
| | | }) |
| | | .catch(error => { |
| | | console.error(error); |
| | | }); |
| | | console.error(error) |
| | | }) |
| | | }else{ |
| | | console.log('error submit!!'); |
| | | return false; |
| | | console.log('error submit!!') |
| | | return false |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | } |
| | | |
| | | } |
| | | </script> |