|
@@ -1,298 +0,0 @@
|
|
|
-<!DOCTYPE html>
|
|
|
-<html lang="en">
|
|
|
-<head>
|
|
|
- <meta charset="UTF-8">
|
|
|
-
|
|
|
- <!-- 引入样式 -->
|
|
|
- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
|
|
-
|
|
|
- <title>用户管理</title>
|
|
|
-</head>
|
|
|
-<body>
|
|
|
-<div id="project">
|
|
|
- <el-main>
|
|
|
- <el-form :inline="true" :model="searchFormData">
|
|
|
- <el-form-item label="用户名称">
|
|
|
- <el-input placeholder="用户名称" size="small" v-model="searchFormData.realname"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="账号">
|
|
|
- <el-input placeholder="账号" size="small" v-model="searchFormData.account"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="密码">
|
|
|
- <el-input placeholder="密码" size="small" v-model="searchFormData.password"></el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" size="small" @click="search(searchFormData)">搜索</el-button>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" size="small" @click="showAdd">新增</el-button>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" size="small" @click="showBindRole">绑定角色</el-button>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
-
|
|
|
- <el-dialog title="用户" :visible.sync="dialogFormVisible">
|
|
|
- <el-form label-position="left" :model="formData">
|
|
|
- <el-form-item label="用户名称">
|
|
|
- <el-input v-model="formData.realname"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="账号">
|
|
|
- <el-input v-model="formData.account"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="密码">
|
|
|
- <el-input v-model="formData.password"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="cancel()">取 消</el-button>
|
|
|
- <el-button type="primary" @click="addOrEditMehtond()">确 定</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- </el-form>
|
|
|
-
|
|
|
-
|
|
|
- <el-table :data="tableData">
|
|
|
-
|
|
|
- <el-table-column prop="realname" label="用户名称"></el-table-column>
|
|
|
- <el-table-column prop="account" label="账号"></el-table-column>
|
|
|
- <el-table-column prop="password" label="密码"></el-table-column>
|
|
|
-
|
|
|
-
|
|
|
- <el-table-column label="操作">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button type="primary" size="small" @click="showEdit(scope.row)">修改</el-button>
|
|
|
- <el-button type="danger" size="small" @click="del(scope.row)">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <el-pagination
|
|
|
- background
|
|
|
- layout="prev, pager, next"
|
|
|
- :page-size="pager.pageSize"
|
|
|
- :current-page="pager.pageIndex"
|
|
|
- :total="pager.itemCount"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- >
|
|
|
- </el-pagination>
|
|
|
-
|
|
|
- </el-main>
|
|
|
-</div>
|
|
|
-
|
|
|
-
|
|
|
-<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
|
|
|
-<!-- 引入组件库 -->
|
|
|
-<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
|
|
-<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
|
|
-
|
|
|
-<script>
|
|
|
- new Vue({
|
|
|
- el: '#project',
|
|
|
- data() {
|
|
|
- return {
|
|
|
-
|
|
|
- addOrEdit: 1,
|
|
|
-
|
|
|
- dialogFormVisible: false,
|
|
|
-
|
|
|
- pager: {
|
|
|
- pageSize: 2,
|
|
|
- pageIndex: 1,
|
|
|
- itemCount: 0,
|
|
|
- },
|
|
|
-
|
|
|
- tableData:
|
|
|
- [{
|
|
|
- realname: '',
|
|
|
- account: '',
|
|
|
- password: '',
|
|
|
- code: '',
|
|
|
- valid: '',
|
|
|
- }],
|
|
|
- formData: {
|
|
|
- realname: '',
|
|
|
- account: '',
|
|
|
- password: '',
|
|
|
- code: '',
|
|
|
- valid: '',
|
|
|
- },
|
|
|
- searchFormData:
|
|
|
- {
|
|
|
- realname: '',
|
|
|
- account: '',
|
|
|
- password: '',
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- created: function () {
|
|
|
- this.loadData();
|
|
|
- },
|
|
|
-
|
|
|
- methods: {
|
|
|
- //切换页码
|
|
|
- handleCurrentChange(index) {
|
|
|
- this.loadData(index)
|
|
|
- },
|
|
|
-
|
|
|
- loadData(index) {
|
|
|
- var vm = this;
|
|
|
- axios.get('http://localhost:8088/user/list', {
|
|
|
- params: {
|
|
|
- pageSize: 3,
|
|
|
- pageIndex: index ? index : 1,
|
|
|
- realname: this.searchFormData.realname,
|
|
|
- account: this.searchFormData.account,
|
|
|
- password: this.searchFormData.password,
|
|
|
- }
|
|
|
- })
|
|
|
- .then((response) => {
|
|
|
- // vm.paper = response.data.data.paper;
|
|
|
- //console.log(response.data.data);
|
|
|
-
|
|
|
- vm.pager = response.data.data.pager
|
|
|
-
|
|
|
- vm.tableData = response.data.data.users;
|
|
|
- })
|
|
|
- },
|
|
|
- search(searchFormData) {
|
|
|
- //console.log(this.searchFormData)
|
|
|
- this.loadData();
|
|
|
- },
|
|
|
- showAdd() {
|
|
|
- this.dialogFormVisible = true;
|
|
|
-
|
|
|
- this.formData.realname = '';
|
|
|
- this.formData.account = '';
|
|
|
- this.formData.password = '';
|
|
|
-
|
|
|
- this.addOrEdit = 1
|
|
|
- },
|
|
|
-
|
|
|
- showEdit(row) {
|
|
|
-
|
|
|
- console.log(row)
|
|
|
-
|
|
|
- this.dialogFormVisible = true;
|
|
|
-
|
|
|
- this.formData = row
|
|
|
-
|
|
|
- this.addOrEdit = 2
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- addOrEditMehtond() {
|
|
|
- if (this.addOrEdit == 2) {
|
|
|
- axios.get('http://localhost:8088/user/update', {
|
|
|
- params: {
|
|
|
- code: this.formData.code,
|
|
|
- realname: this.formData.realname,
|
|
|
- account: this.formData.account,
|
|
|
- password: this.formData.password
|
|
|
- }
|
|
|
- })
|
|
|
- .then((response) => {
|
|
|
- console.log(response)
|
|
|
-
|
|
|
- if (response.data.status == 200) {
|
|
|
-
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- showClose: true,
|
|
|
- message: response.data.desc
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- this.dialogFormVisible = false;
|
|
|
-
|
|
|
- this.loadData();
|
|
|
-
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if (this.addOrEdit == 1) {
|
|
|
- axios.get('http://localhost:8088/user/add', {
|
|
|
- params: {
|
|
|
- realname: this.formData.realname,
|
|
|
- account: this.formData.account,
|
|
|
- password: this.formData.password
|
|
|
- }
|
|
|
- })
|
|
|
- .then((response) => {
|
|
|
- if (response.data.status == 200) {
|
|
|
-
|
|
|
- this.dialogFormVisible = false;
|
|
|
-
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- showClose: true,
|
|
|
- message: response.data.desc
|
|
|
- })
|
|
|
-
|
|
|
- this.loadData();
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- del(row) {
|
|
|
- this.$confirm('确认删除', '提示', {
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- axios.get('http://localhost:8088/user/delete', {
|
|
|
- params: {
|
|
|
- code: row.code,
|
|
|
- }
|
|
|
- })
|
|
|
- .then((response) => {
|
|
|
- console.log(response)
|
|
|
- if (response.data.status == 200) {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- showClose: true,
|
|
|
- message: response.data.desc
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
- this.loadData();
|
|
|
- })
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- showClose: true,
|
|
|
- message: '取消删除'
|
|
|
- })
|
|
|
- });
|
|
|
- },
|
|
|
- cancel() {
|
|
|
- this.$message({
|
|
|
- message: '操作取消',
|
|
|
- showClose: true,
|
|
|
- type: 'info'
|
|
|
- });
|
|
|
-
|
|
|
- this.dialogFormVisible = false;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- showBindRole(){
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
-</script>
|
|
|
-</body>
|
|
|
-</html>
|