|
@@ -1,15 +1,38 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
- <admin-frame @search="search" :limit="limit" :total="total" topType="3" @back="back" :rightArrow="false" :useNav="false">
|
|
|
+ <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" :rightArrow="false" :useNav="false">
|
|
|
<template v-slot:info>
|
|
|
<van-col span="24" v-if="user.role == '1'" class="one">
|
|
|
+ <van-button type="info" size="small" @click="toSearch()">查询条件</van-button>
|
|
|
<van-button type="info" size="small" @click="toAdd()">添加用戶</van-button>
|
|
|
- <van-button type="info" size="small" @click="toImport()">批量注册用户</van-button>
|
|
|
- <van-button type="info" size="small" @click="tpExport()">批量导出用户</van-button>
|
|
|
+ <van-button type="info" size="small" @click="toImport()">批量注册</van-button>
|
|
|
+ <van-button type="info" size="small" @click="tpExport()">批量导出</van-button>
|
|
|
+ </van-col>
|
|
|
+ <van-col span="24" class="two">
|
|
|
+ <list-1 :list="list" @toEdit="toEdit" @toDel="toDel" @toPatent="toPatent" @toPsd="toPsd"></list-1>
|
|
|
</van-col>
|
|
|
- <van-col span="24" class="two"> <list-1 :list="list" @toEdit="toEdit" @toDel="toDel" @toPatent="toPatent" @toPsd="toPsd"></list-1> </van-col>
|
|
|
</template>
|
|
|
</admin-frame>
|
|
|
+ <van-dialog
|
|
|
+ class="dialog"
|
|
|
+ v-model="dialog.show"
|
|
|
+ :title="dialog.title"
|
|
|
+ @confirm="onSearch"
|
|
|
+ @cancel="unSearch"
|
|
|
+ show-cancel-button
|
|
|
+ cancelButtonText="重置查询"
|
|
|
+ confirmButtonText="确认查询"
|
|
|
+ >
|
|
|
+ <div v-if="dialog.type == '1'">
|
|
|
+ <van-form label-width="3em">
|
|
|
+ <van-field v-model="searchInfo.phone" name="账号" label="账号" placeholder="请输入账号" />
|
|
|
+ <van-field readonly clickable name="code" :value="searchInfo.code" label="邀请码" placeholder="点击选择邀请码" @click="oneShow = true" />
|
|
|
+ </van-form>
|
|
|
+ </div>
|
|
|
+ </van-dialog>
|
|
|
+ <van-popup v-model="oneShow" position="bottom">
|
|
|
+ <van-picker show-toolbar :columns="adminList" value-key="name" @confirm="oneFim" @cancel="oneShow = false" />
|
|
|
+ </van-popup>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -18,6 +41,7 @@ import list1 from './parts/list-1.vue';
|
|
|
import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: personal } = createNamespacedHelpers('personal');
|
|
|
+const { mapActions: adminLogin } = createNamespacedHelpers('adminLogin');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -27,22 +51,48 @@ export default {
|
|
|
list: [],
|
|
|
limit: 4,
|
|
|
total: 0,
|
|
|
+ searchInfo: {},
|
|
|
+ // 邀请码
|
|
|
+ adminList: [],
|
|
|
+ oneShow: false,
|
|
|
+ // 弹框
|
|
|
+ dialog: { title: '查询条件', show: false, type: '1' },
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- this.search();
|
|
|
+ async created() {
|
|
|
+ // 查询其他信息
|
|
|
+ await this.searchOther();
|
|
|
+ await this.search();
|
|
|
},
|
|
|
methods: {
|
|
|
...personal(['query', 'delete', 'export', 'updatePassword']),
|
|
|
- async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
|
|
|
- if (searchName) info.name = searchName;
|
|
|
+ ...adminLogin({ aQuery: 'query' }),
|
|
|
+ async search({ skip = 0, limit = this.limit, ...info } = {}) {
|
|
|
if (this.user.role == '1') info.role = this.user.role;
|
|
|
- let res = await this.query({ skip, limit, code: this.user.code, ...info });
|
|
|
+ let res = await this.query({ skip, limit, code: this.user.code, ...this.searchInfo, ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `list`, res.data);
|
|
|
this.$set(this, `total`, res.total);
|
|
|
}
|
|
|
},
|
|
|
+ // 添加查询条件
|
|
|
+ toSearch() {
|
|
|
+ this.dialog = { show: true, title: '查询条件', type: '1' };
|
|
|
+ },
|
|
|
+ // 确认选择
|
|
|
+ oneFim(data) {
|
|
|
+ this.$set(this.searchInfo, `code`, data.code);
|
|
|
+ this.oneShow = false;
|
|
|
+ },
|
|
|
+ // 确认查询
|
|
|
+ onSearch() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ // 重置查询
|
|
|
+ unSearch() {
|
|
|
+ this.$set(this, `searchInfo`, {});
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
// 添加用户
|
|
|
toAdd() {
|
|
|
this.$router.push({ path: `/account/users/detail` });
|
|
@@ -86,6 +136,20 @@ export default {
|
|
|
back() {
|
|
|
this.$router.push({ path: `/account/index` });
|
|
|
},
|
|
|
+ // 查询其他信息
|
|
|
+ async searchOther() {
|
|
|
+ let p1 = await this.aQuery({ role: '1' });
|
|
|
+ if (this.$checkRes(p1)) {
|
|
|
+ let data = [];
|
|
|
+ for (const val of p1.data) {
|
|
|
+ let p2 = await this.aQuery({ role: '2', pid: val.id });
|
|
|
+ if (this.$checkRes(p2)) {
|
|
|
+ data.push(...p2.data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$set(this, `adminList`, data);
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
@@ -110,7 +174,7 @@ export default {
|
|
|
padding: 10px 0;
|
|
|
margin: 0 0 10px 0;
|
|
|
.van-button {
|
|
|
- margin: 0 10px;
|
|
|
+ margin: 0 10px 5px 10px;
|
|
|
}
|
|
|
}
|
|
|
</style>
|