|
|
@@ -2,24 +2,14 @@
|
|
|
<div>
|
|
|
<div class="filters-container">
|
|
|
<el-input placeholder="用户名" size="small" v-model="filter1" clearable class="filter-item"></el-input>
|
|
|
- <el-select placeholder="性别" size="small" v-model="filter2" clearable class="filter-item">
|
|
|
- <el-option
|
|
|
- label="女"
|
|
|
- value="item1">
|
|
|
- </el-option>
|
|
|
- <el-option
|
|
|
- label="男"
|
|
|
- value="item2">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- <el-button @click="getData" type="primary" size="small" icon="el-icon-search" class="filter-item">搜索
|
|
|
+ <el-button @click="searchData" type="primary" size="small" icon="el-icon-search" class="filter-item">搜索
|
|
|
</el-button>
|
|
|
<el-button @click="$router.push('/user')" type="primary" size="small" icon="el-icon-edit"
|
|
|
class="filter-item">添加
|
|
|
</el-button>
|
|
|
<el-dropdown trigger="click" size="medium" class="table-column-filter">
|
|
|
<span>
|
|
|
- 筛选数据<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
+ 筛选数据<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
</span>
|
|
|
<el-dropdown-menu slot="dropdown" class="table-column-filter-wrapper">
|
|
|
<el-checkbox v-for="item in tableColumns" :key="item.value" v-model="item.show">{{item.label}}
|
|
|
@@ -28,58 +18,58 @@
|
|
|
</el-dropdown>
|
|
|
</div>
|
|
|
<el-table
|
|
|
- :data="tableData"
|
|
|
- :height="tableHeight"
|
|
|
- row-key="id"
|
|
|
- ref="table">
|
|
|
+ :data="tableData"
|
|
|
+ :height="tableHeight"
|
|
|
+ row-key="id"
|
|
|
+ ref="table">
|
|
|
<el-table-column
|
|
|
- v-if="multipleMode"
|
|
|
- align="center"
|
|
|
- type="selection"
|
|
|
- width="50">
|
|
|
+ v-if="multipleMode"
|
|
|
+ align="center"
|
|
|
+ type="selection"
|
|
|
+ width="50">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- type="index"
|
|
|
- min-width="50"
|
|
|
- align="center">
|
|
|
+ type="index"
|
|
|
+ min-width="50"
|
|
|
+ align="center">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-if="isColumnShow('username')"
|
|
|
- prop="username"
|
|
|
- label="用户名"
|
|
|
- min-width="300">
|
|
|
+ v-if="isColumnShow('username')"
|
|
|
+ prop="username"
|
|
|
+ label="用户名"
|
|
|
+ min-width="300">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-if="isColumnShow('nickname')"
|
|
|
- prop="nickname"
|
|
|
- label="昵称"
|
|
|
- min-width="300">
|
|
|
+ v-if="isColumnShow('nickname')"
|
|
|
+ prop="nickname"
|
|
|
+ label="昵称"
|
|
|
+ min-width="300">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-if="isColumnShow('icon')"
|
|
|
- label="头像"
|
|
|
- min-width="300">
|
|
|
+ v-if="isColumnShow('icon')"
|
|
|
+ label="头像"
|
|
|
+ min-width="300">
|
|
|
<template slot-scope="scope">
|
|
|
<img :src="scope.row.icon"
|
|
|
- style="width: 32px;height: 32px;border-radius: 50%;vertical-align: middle;"/>
|
|
|
+ style="width: 32px;height: 32px;border-radius: 50%;vertical-align: middle;" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-if="isColumnShow('sex')"
|
|
|
- prop="sex"
|
|
|
- label="性别"
|
|
|
- min-width="300">
|
|
|
+ v-if="isColumnShow('sex')"
|
|
|
+ prop="sex"
|
|
|
+ label="性别"
|
|
|
+ min-width="300">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-if="isColumnShow('openId')"
|
|
|
- prop="openId"
|
|
|
- label="openId"
|
|
|
- min-width="300">
|
|
|
+ v-if="isColumnShow('openId')"
|
|
|
+ prop="openId"
|
|
|
+ label="openId"
|
|
|
+ min-width="300">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- label="操作"
|
|
|
- align="center"
|
|
|
- fixed="right">
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ fixed="right">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button @click="editRow(scope.row)" type="primary" size="mini" plain>编辑</el-button>
|
|
|
</template>
|
|
|
@@ -95,117 +85,145 @@
|
|
|
</el-button-group>
|
|
|
</div>
|
|
|
<el-pagination
|
|
|
- background
|
|
|
- @size-change="pageSizeChange"
|
|
|
- @current-change="currentPageChange"
|
|
|
- :current-page="currentPage"
|
|
|
- :page-sizes="[10, 20, 30, 40, 50]"
|
|
|
- :page-size="pageSize"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total="totalNumber">
|
|
|
+ background
|
|
|
+ @size-change="pageSizeChange"
|
|
|
+ @current-change="currentPageChange"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-sizes="[10, 20, 30, 40, 50]"
|
|
|
+ :page-size="pageSize"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="totalNumber">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import {mapState} from 'vuex'
|
|
|
+import { mapState } from 'vuex';
|
|
|
|
|
|
- export default {
|
|
|
- created() {
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- totalNumber: 0,
|
|
|
- totalPage: 0,
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 20,
|
|
|
- tableData: [],
|
|
|
- filter1: '',
|
|
|
- filter2: '',
|
|
|
- tableColumns: [{
|
|
|
+export default {
|
|
|
+ created() {
|
|
|
+ this.$http
|
|
|
+ .get({
|
|
|
+ url: '/storeInfo/all',
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.storeInfos = res.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ totalNumber: 0,
|
|
|
+ totalPage: 0,
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ tableData: [],
|
|
|
+ filter1: '',
|
|
|
+ filter2: '',
|
|
|
+ tableColumns: [
|
|
|
+ {
|
|
|
label: '用户名',
|
|
|
value: 'username',
|
|
|
- show: true
|
|
|
- }, {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
label: '昵称',
|
|
|
value: 'nickname',
|
|
|
- show: true
|
|
|
- }, {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
label: '头像',
|
|
|
value: 'icon',
|
|
|
- show: true
|
|
|
- }, {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
label: '性别',
|
|
|
value: 'sex',
|
|
|
- show: true
|
|
|
- }, {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
label: 'openId',
|
|
|
value: 'openId',
|
|
|
- show: true
|
|
|
- }],
|
|
|
- multipleMode: false
|
|
|
- }
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ multipleMode: false,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['tableHeight', 'storeId']),
|
|
|
+ selection() {
|
|
|
+ return this.$refs.table.selection.map(i => i.id);
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState(['tableHeight']),
|
|
|
- selection() {
|
|
|
- return this.$refs.table.selection.map(i => i.id);
|
|
|
- }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ storeId() {
|
|
|
+ this.searchData();
|
|
|
},
|
|
|
- methods: {
|
|
|
- pageSizeChange(size) {
|
|
|
- this.pageSize = size;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- currentPageChange(page) {
|
|
|
- this.currentPage = page;
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- getData() {
|
|
|
- this.$http.get({
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ pageSizeChange(size) {
|
|
|
+ this.pageSize = size;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ currentPageChange(page) {
|
|
|
+ this.currentPage = page;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ getData() {
|
|
|
+ this.$http
|
|
|
+ .get({
|
|
|
url: '/userInfo/page',
|
|
|
data: {
|
|
|
currentPage: this.currentPage,
|
|
|
- pageNumber: this.pageSize
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
+ pageNumber: this.pageSize,
|
|
|
+ searchKey: this.filter1,
|
|
|
+ storeId: this.storeId || '',
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
if (res.success) {
|
|
|
this.totalNumber = res.data.page.totalNumber;
|
|
|
this.tableData = res.data.pp;
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
- isColumnShow(column) {
|
|
|
- var row = this.tableColumns.find(i => i.value === column);
|
|
|
- return row ? row.show : false;
|
|
|
- },
|
|
|
- toggleMultipleMode(multipleMode) {
|
|
|
- this.multipleMode = multipleMode;
|
|
|
- if (!multipleMode) {
|
|
|
- this.$refs.table.clearSelection();
|
|
|
- }
|
|
|
- },
|
|
|
- editRow(row) {
|
|
|
- this.$router.push({
|
|
|
- path: '/user',
|
|
|
- query: {
|
|
|
- id: row.id
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- operation1() {
|
|
|
- this.$notify({
|
|
|
- title: '提示',
|
|
|
- message: this.selection
|
|
|
});
|
|
|
- },
|
|
|
- operation2() {
|
|
|
- this.$message('操作2');
|
|
|
+ },
|
|
|
+ isColumnShow(column) {
|
|
|
+ var row = this.tableColumns.find(i => i.value === column);
|
|
|
+ return row ? row.show : false;
|
|
|
+ },
|
|
|
+ toggleMultipleMode(multipleMode) {
|
|
|
+ this.multipleMode = multipleMode;
|
|
|
+ if (!multipleMode) {
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ editRow(row) {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/user',
|
|
|
+ query: {
|
|
|
+ id: row.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ operation1() {
|
|
|
+ this.$notify({
|
|
|
+ title: '提示',
|
|
|
+ message: this.selection,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ operation2() {
|
|
|
+ this.$message('操作2');
|
|
|
+ },
|
|
|
+ searchData() {
|
|
|
+ this.currentPage = 1;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
-
|
|
|
</style>
|