| | |
| | | <el-form-item> |
| | | <el-input |
| | | placeholder="请输入人员名称" |
| | | v-model="searchData.keyword" |
| | | v-model="keyword" |
| | | > |
| | | <i slot="prefix" class="el-input__icon el-icon-search" /> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary">查询</el-button> |
| | | <el-button type="primary" plain>重置</el-button> |
| | | <el-button @click="searchData()" type="primary">查询</el-button> |
| | | <el-button @click="resetData()" type="primary" plain>重置</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" icon="el-icon-plus">新增人员</el-button> |
| | | <el-button type="primary" @click="dialogFormVisible = true" icon="el-icon-plus">新增人员</el-button> |
| | | |
| | | <el-dialog title="新增人员" :visible.sync="dialogFormVisible"> |
| | | <el-form :model="form" :rules="rules" ref="form"> |
| | | <el-form-item label="账号" :label-width="formLabelWidth" prop="account"> |
| | | <el-input v-model="form.account" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="年龄" :label-width="formLabelWidth"> |
| | | <el-input v-model="form.age" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="邮箱" :label-width="formLabelWidth" prop="email"> |
| | | <el-input v-model="form.email" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="名字" :label-width="formLabelWidth" prop="name"> |
| | | <el-input v-model="form.name" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="电话" :label-width="formLabelWidth" prop="phone"> |
| | | <el-input v-model="form.phone" autocomplete="off"></el-input> |
| | | </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-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="submitForm()">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | <div class="content-main"> |
| | |
| | | style="width: 100%" |
| | | > |
| | | <el-table-column |
| | | prop="roleName" |
| | | prop="username" |
| | | label="角色名称" |
| | | min-width="120" |
| | | /> |
| | | <el-table-column |
| | | prop="rolePermissions" |
| | | prop="roleName" |
| | | label="角色权限" |
| | | min-width="120" |
| | | /> |
| | |
| | | min-width="150" |
| | | /> |
| | | <el-table-column |
| | | prop="creatTime" |
| | | prop="createTime" |
| | | label="创建时间" |
| | | min-width="180" |
| | | /> |
| | |
| | | min-width="200" |
| | | /> |
| | | <el-table-column |
| | | prop="mailbox" |
| | | prop="email" |
| | | label="邮箱" |
| | | min-width="200" |
| | | /> |
| | | <el-table-column |
| | | prop="incumbentStatus" |
| | | prop="jobState" |
| | | label="在职状态" |
| | | min-width="120" |
| | | :filters="[{ text: 0, value: 0 }, { text: 1, value: 1 }]" |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | <div> |
| | | <!-- 分页器 --> |
| | | <el-pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage" |
| | | :page-sizes="[100, 200, 300, 400]" |
| | | :page-size="100" |
| | | :page-size=pageSize |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="400"> |
| | | :total=this.personnerlTable.length> |
| | | </el-pagination> |
| | | </div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import axios from 'axios' |
| | | axios.defaults.baseURL = 'http://192.168.110.167:1234' |
| | | export default { |
| | | data() { |
| | | return { |
| | | currentPage: 1, |
| | | searchData: { |
| | | keyword: '' |
| | | }, |
| | | keyword: '', |
| | | personnerlTable: [ |
| | | { |
| | | roleName: '张三', |
| | | rolePermissions: '管理员', |
| | | age: '18', |
| | | creatTime: '2023-07-07', |
| | | phone: '138888888', |
| | | mailbox: '138888888@qq.com', |
| | | incumbentStatus: '1' |
| | | } |
| | | ] |
| | | |
| | | ], |
| | | filteredpersonnerlTable:[], |
| | | currentindex:1, |
| | | currentPage: 1, // 当前页码 |
| | | total: 20, // 总条数 |
| | | pageSize: 100, // 每页的数据条数 |
| | | personData:[], //用来存放接口传过来的人员列表数据 |
| | | dialogFormVisible:false, |
| | | form: { |
| | | account: "", |
| | | age: '', |
| | | email: "", |
| | | name: "", |
| | | phone: "", |
| | | role_id: '' |
| | | }, |
| | | formLabelWidth: '120px', |
| | | rules: { |
| | | account:[ |
| | | { |
| | | required: true, message: '请输入账号', trigger: 'blur' |
| | | } |
| | | ], |
| | | name:[{ |
| | | required: true, message: '请输入名字', trigger: 'blur' |
| | | }], |
| | | phone: [ |
| | | // { required: true, message: '请输入11位电话号码', trigger: 'blur' }, |
| | | { pattern: /^1[34578]\d{9}$/, message: '非法手机号码', trigger: 'blur' } |
| | | ], |
| | | email: [ |
| | | // { required: true, message: '请输入邮箱地址', trigger: 'blur' }, |
| | | { type: 'email', message: '非法邮箱地址', trigger: ['blur', 'change'] } |
| | | ], |
| | | role_id:[ |
| | | {required: true, message: '请输入权限(0或1)', trigger: 'blur'} |
| | | |
| | | ] |
| | | }, |
| | | } |
| | | }, |
| | | mounted(){ |
| | | this.getData(); |
| | | }, |
| | | methods: { |
| | | //每页条数改变时触发 选择一页显示多少行 |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`) |
| | | this.currentPage = 1; |
| | | this.pageSize = val; |
| | | }, |
| | | //当前页改变时触发 跳转其他页 |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`) |
| | | this.currentPage = val; |
| | | }, |
| | | getData(){ |
| | | axios.get("/user/list_new_personnel",{ |
| | | params:{ |
| | | pageNo:0, |
| | | pageSize:20 |
| | | } |
| | | }).then(res=>{ |
| | | // console.log(res) |
| | | this.personData=res.data.data.row |
| | | this.personnerlTable=this.personData |
| | | }).catch(res=>{ |
| | | console.log("error") |
| | | }) |
| | | }, |
| | | searchData() { |
| | | this.filteredpersonnerlTable = this.personnerlTable.filter((item) =>{ |
| | | return item.username==this.keyword |
| | | } |
| | | ); |
| | | this.personnerlTable=this.filteredpersonnerlTable |
| | | }, |
| | | resetData(){ |
| | | // console.log("111111") |
| | | this.personnerlTable=this.personData |
| | | this.keyword='' |
| | | }, |
| | | // 提交新增人员表单 |
| | | submitForm() { |
| | | // Handle form submission here |
| | | // console.log(this.form); |
| | | // POST请求 |
| | | this.$refs.form.validate((valid)=>{ |
| | | if(valid){ |
| | | this.dialogFormVisible = false; |
| | | axios.post('/user/add_new_personnel', this.form) |
| | | .then(response => { |
| | | console.log(response); |
| | | // this.dialogVisible = false; |
| | | }) |
| | | .catch(error => { |
| | | console.error(error); |
| | | }); |
| | | }else{ |
| | | console.log('error submit!!'); |
| | | return false; |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | } |
| | | </script> |
| | | |